public View GetView(OutputFieldMetadata outputField, object value, MyFormHandler myFormHandler, FormMetadata formMetadata, List <FormInputManager> inputsManager) { this.OutputList = new LinearLayout(Application.Context) { Orientation = Orientation.Vertical }; if (!string.IsNullOrEmpty(outputField.Label)) { var label = new TextView(Application.Context) { Text = outputField.Label + ": " }; label.LayoutParameters = label.WrapContent(); myFormHandler.ManagersCollection.StyleRegister.ApplyStyle("TextView", label); this.OutputList.AddView(label); } var list = value.CastTObject <IList <object> >(); var listView = list.IntializeListView(outputField, myFormHandler); listView.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, listView.GetListHeigth()); myFormHandler.ManagersCollection.StyleRegister.ApplyStyle("ListView", listView); this.OutputList.AddView(listView); return(this.OutputList); }
public View GetView(OutputFieldMetadata outputField, object value, MyFormHandler myFormHandler, FormMetadata formMetadata, List <FormInputManager> inputsManager) { this.Layout = new FlexboxLayout(Application.Context); var tabstrip = value.CastTObject <Tabstrip>(); var currentTab = tabstrip.Tabs.SingleOrDefault(a => a.Form == tabstrip.CurrentTab); foreach (var tab in tabstrip.Tabs) { if (tab != null) { var tv = new TextView(Application.Context) { Text = tab.Label }; tv.Click += async(sender, args) => { var metadata = myFormHandler.GetFormMetadata(tab.Form); myFormHandler.FormWrapper.UpdateView(myFormHandler, new FormParameter(metadata, tab.InputFieldValues)); }; myFormHandler.ManagersCollection.StyleRegister.ApplyStyle(tab == currentTab ? "Tab CurrentTab" : "Tab", tv); this.Layout.AddView(tv); this.Layout.FlexDirection = FlexboxLayout.FlexDirectionRow; this.Layout.FlexWrap = FlexboxLayout.FlexWrapWrap; } } return(this.Layout); }
public UIView GetView(OutputFieldMetadata outputField, object value, MyFormHandler myFormHandler, FormMetadata formMetadata, List <FormInputManager> inputsManager, int yAxis) { var list = ((IEnumerable <object>)value).ToList(); var properties = list[0].GetType().GetProperties(); var height = properties.Length * 25 * list.Count; this.OutputList = new UIView(); var size = new CGSize(UIScreen.MainScreen.Bounds.Width - 40, height + 30); this.OutputList.Frame = new CGRect(new CGPoint(20, yAxis), size); var label = new UITextView { Text = outputField.Label }; var labelSize = new CGSize(UIScreen.MainScreen.Bounds.Width - 40, 30); label.Frame = new CGRect(new CGPoint(0, 0), labelSize); this.OutputList.AddSubview(label); var listViewSize = new CGSize(UIScreen.MainScreen.Bounds.Width - 40, height); var listView = new UITableView(new CGRect(new CGPoint(10, 30), listViewSize)) { //Source = new CustomTableViewController(list) }; this.OutputList.AddSubview(listView); return(this.OutputList); }
public View GetView(OutputFieldMetadata outputField, object value, MyFormHandler myFormHandler, FormMetadata formMetadata, List <FormInputManager> inputsManager) { this.OutputList = new LinearLayout(Application.Context) { Orientation = Orientation.Vertical }; var label = new TextView(Application.Context) { Text = outputField.Label }; label.LayoutParameters = label.WrapContent(); myFormHandler.ManagersCollection.StyleRegister.ApplyStyle("TextView", label); this.OutputList.AddView(label); var list = value.CastTObject <ObjectList <object> >(); var listView = new ListView(Application.Context); var adapter = new ListCustomAdapter <object>(list.Items.ToList(), list.Metadata, myFormHandler); listView.Adapter = adapter; listView.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, listView.GetListHeigth()); myFormHandler.ManagersCollection.StyleRegister.ApplyStyle("ListView", listView); this.OutputList.AddView(listView); return(this.OutputList); }
public void UpdateViewAsync(MyFormHandler myFormHandler, FormParameter formParameter, string submitAction = null) { var fragment = new MyFormFragment(formParameter, myFormHandler, this.Activity, submitAction); this.AppFragments?.Add(fragment); fragment.UpdateFragment(); }
public View GetView(OutputFieldMetadata outputField, object value, MyFormHandler myFormHandler, FormMetadata formMetadata, List <FormInputManager> inputsManager) { var formLink = value.CastTObject <FormLink>(); this.Layout = new LinearLayout(Application.Context) { Orientation = Orientation.Horizontal }; var link = new TextView(Application.Context) { Text = outputField.Label + ": " }; myFormHandler.ManagersCollection.StyleRegister.ApplyStyle("TextView", link); this.Layout.AddView(link); if (formLink != null) { var text = this.InitializeLink(formLink, myFormHandler); myFormHandler.ManagersCollection.StyleRegister.ApplyStyle("Link", text); this.Layout.AddView(text); } return(this.Layout); }
public View GetView(IDictionary <string, object> inputCustomProperties, MyFormHandler myFormHandler) { this.InputPaginator = new LinearLayout(Application.Context); this.Ascending = new EditText(Application.Context) { InputType = InputTypes.ClassText }; this.OrderBy = new EditText(Application.Context) { InputType = InputTypes.ClassText }; this.PageIndex = new EditText(Application.Context) { InputType = InputTypes.ClassText }; this.PageSize = new EditText(Application.Context) { InputType = InputTypes.ClassText }; this.InputPaginator.AddView(this.Ascending); this.InputPaginator.AddView(this.OrderBy); this.InputPaginator.AddView(this.PageIndex); this.InputPaginator.AddView(this.PageSize); return(this.InputPaginator); }
public UpdateViewTask(CustomFormWrapper wrapper, MyFormHandler myFormHandler, FormParameter formParameter, string submitAction) { this.Wrapper = wrapper; this.MyFormHandler = myFormHandler; this.FormParameter = formParameter; this.SubmitAction = submitAction; }
public UIView GetView(OutputFieldMetadata outputField, object value, MyFormHandler myFormHandler, FormMetadata formMetadata, List <FormInputManager> inputsManager, int yAxis) { var formLink = value.CastTObject <FormLink>(); var size = new CGSize(UIScreen.MainScreen.Bounds.Width - 40, 30); this.OutputView = new UITextView { Text = outputField.Label + ": " + formLink.Label, Frame = new CGRect(new CGPoint(20, yAxis), size), TextColor = UIColor.Blue }; var gesture = new UITapGestureRecognizer(); gesture.AddTarget(() => { var metadata = myFormHandler.GetFormMetadataAsync(formLink.Form); myFormHandler.FormWrapper.UpdateView(myFormHandler, new FormParameter(metadata, formLink.InputFieldValues)); }); this.OutputView.AddGestureRecognizer(gesture); return(this.OutputView); }
public UIView GetView(IDictionary <string, object> inputCustomProperties, MyFormHandler myFormHandler) { this.InputText = new AutoCompleteTextField(); this.InputText.SetTextBorders(); var paddingView = new UIView(new CGRect(0, 0, 10, 20)); this.InputText.LeftView = paddingView; this.InputText.LeftViewMode = UITextFieldViewMode.Always; this.Items = new List <TypeaheadItem <object> >(); this.CustomeSource = inputCustomProperties.GetCustomProperty <object>("source"); this.InputText.EditingChanged += (sender, args) => { var query = this.InputText.Text.ToString().Split(',').Last().Trim(); var source = this.CustomeSource.GetTypeaheadSource(myFormHandler, new TypeaheadRequest <object> { Query = "" }); foreach (var item in source) { this.Items.Add(item.CastTObject <TypeaheadItem <object> >()); } }; this.InputText.Setup(this.Items.Select(a => a.Label).ToList()); return(this.InputText); }
private Button CreateLoadMoreButton(MyFormHandler myFormHandler, FormMetadata formMetadata, OutputFieldMetadata outputField, ListView listView, List <FormInputManager> inputsManager, Dictionary <string, FormMetadata> allFormsMetadata) { var btnLoadMore = new Button(Application.Context) { Text = "Load More" }; btnLoadMore.Click += async(sender, args) => { this.PageIndex++; var paginator = inputsManager.Find(a => a.Input.Type == "paginator"); paginator.Manager.SetValue(new Paginator { PageSize = 10, PageIndex = this.PageIndex }); var response = await myFormHandler.HandleFormAsync(formMetadata, inputsManager); object responsevalue; if (response.Data.GetType() == typeof(JObject)) { var jsonObj = (JObject)response.Data; responsevalue = jsonObj.GetValue(outputField.Id, StringComparison.OrdinalIgnoreCase); } else { var propertyInfo = response.Data.GetType().GetProperty(outputField.Id); responsevalue = propertyInfo?.GetValue(response.Data, null); } var paginatedData = responsevalue.CastTObject <PaginatedData <object> >(); var newList = paginatedData.Results.ToList(); if (newList.Any()) { foreach (var item in newList) { this.ItemList.Add(item); } } //// Appending new data to menuItems ArrayList listView.Refresh(this.ItemList, outputField, myFormHandler, allFormsMetadata); // Setting new scroll position listView.SetSelectionFromTop(10 * (this.PageIndex - 1), 0); listView.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, listView.GetListHeigth()); if (this.ItemList.Count == this.TotalCount) { btnLoadMore.Visibility = ViewStates.Invisible; } }; return(btnLoadMore); }
public UIView GetView(OutputFieldMetadata outputField, object value, MyFormHandler myFormHandler, FormMetadata formMetadata, List <FormInputManager> inputsManager, int yAxis) { this.OutputView = new UIView(); var actions = value?.CastTObject <ActionList>(); if (actions != null) { int y = 0; foreach (var btn in actions.Actions) { var button = this.InitializeActionButton(btn, myFormHandler, y); y += 40; this.OutputView.AddSubview(button); } var size = new CGSize(UIScreen.MainScreen.Bounds.Width - 40, actions.Actions.Count * 40); this.OutputView.Frame = new CGRect(new CGPoint(20, yAxis), size); } return(this.OutputView); }
public View GetView(IDictionary <string, object> inputCustomProperties, MyFormHandler myFormHandler) { this.ItemsList = new List <TypeaheadItem <object> >(); this.MyFormHandler = myFormHandler; this.CustomeSource = inputCustomProperties.GetCustomProperty <object>("source"); var adapter = new ArrayAdapter <string>(Application.Context, Android.Resource.Layout.SimpleDropDownItem1Line, this.ItemsList.Select(a => a.Label).ToList()); this.InputText = new MultiAutoCompleteTextView(Application.Context) { Adapter = adapter, Threshold = 0 }; myFormHandler.ManagersCollection.StyleRegister.ApplyStyle("EditText", this.InputText); this.InputText.TextChanged += async(sender, args) => { adapter.Clear(); var query = args.Text.ToString().Split(',').Last().Trim(); this.ItemsList = this.CustomeSource.GetTypeaheadSource(myFormHandler, new TypeaheadRequest <object> { Query = query }) .Select(t => t.CastTObject <TypeaheadItem <object> >()).ToList(); var data = this.ItemsList.Select(t => t.Label).ToList(); adapter.AddAll(data); }; this.InputText.SetTokenizer(new MultiAutoCompleteTextView.CommaTokenizer()); return(this.InputText); }
public void ReloadView(MyFormHandler myFormHandler, ReloadResponse reloadResponse) { var allForms = this.Activity.Reload(); var metadata = allForms[reloadResponse.Form]; this.UpdateView(myFormHandler, new FormParameter(metadata, reloadResponse.InputFieldValues)); }
public View GetView(OutputFieldMetadata outputField, object value, MyFormHandler myFormHandler, FormMetadata formMetadata, List <FormInputManager> inputsManager) { this.OutputView = new LinearLayout(Application.Context) { Orientation = Orientation.Vertical }; var label = new TextView(Application.Context) { Text = outputField.Label }; label.LayoutParameters = label.WrapContent(); myFormHandler.ManagersCollection.StyleRegister.ApplyStyle("TextView", label); this.OutputView.AddView(label); var formInstance = value.CastTObject <FormInstanceModel>(); foreach (var formInstanceValue in formInstance.Values) { var textView = new TextView(Application.Context) { Text = formInstanceValue.Label + ": " + formInstanceValue.Value }; textView.LayoutParameters = textView.WrapContent(); myFormHandler.ManagersCollection.StyleRegister.ApplyStyle("TextView", textView); this.OutputView.AddView(textView); } return(this.OutputView); }
public UIView GetView(OutputFieldMetadata outputField, object value, MyFormHandler myFormHandler, FormMetadata formMetadata, List <FormInputManager> inputsManager, int yAxis) { var paginatedData = value.CastTObject <PaginatedData <object> >(); this.ItemList = paginatedData.Results.ToList(); this.TotalCount = paginatedData.TotalCount; var outputFieldProperty = outputField.CustomProperties.GetCustomProperty <IEnumerable <OutputFieldMetadata> >("columns"); this.OutputList = new UIView(); this.OutputList.UserInteractionEnabled = true; var label = new UITextView { Text = outputField.Label }; var labelSize = new CGSize(UIScreen.MainScreen.Bounds.Width - 40, 30); label.Frame = new CGRect(new CGPoint(0, 0), labelSize); this.OutputList.AddSubview(label); UITableView tableView = new UITableView(); tableView.Frame = UIScreen.MainScreen.Bounds; tableView.AllowsSelection = false; // tableView.IndexPathForCell() var listViewSize = new CGSize(tableView.Frame.Width, tableView.Frame.Height); tableView.Source = new CustomTableViewController <object>(this.ItemList, outputFieldProperty, myFormHandler, this.OutputList); var listView = new UITableView(new CGRect(new CGPoint(10, 30), listViewSize)) { Source = new CustomTableViewController <object>(this.ItemList, outputFieldProperty, myFormHandler, this.OutputList) }; if (this.TotalCount > 10) { if (formMetadata != null) { //var btnLoadMore = this.CreateLoadMoreButton(myFormHandler, formMetadata, outputField, listView, inputsManager, myFormHandler.AllFormsMetadata); //listView.TableFooterView = btnLoadMore; } } listView.ContentInset = UIEdgeInsets.Zero; listView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; //for resizing (switching from table to portait for example) listView.Bounces = false; listView.SetContentOffset(CGPoint.Empty, false); this.OutputList.AddSubview(tableView); this.OutputList.Frame = new CGRect(new CGPoint(20, yAxis), listViewSize); return(this.OutputList); }
public UIView GetView(OutputFieldMetadata outputField, object value, MyFormHandler myFormHandler, FormMetadata formMetadata, List <FormInputManager> inputsManager, int yAxis) { this.OutputView = new UIView(); var labelSize = new CGSize(UIScreen.MainScreen.Bounds.Width - 40, 30); this.OutputView.Frame = new CGRect(new CGPoint(20, yAxis), labelSize); var tabstrip = value.CastTObject <Tabstrip>(); var currentTab = tabstrip.Tabs.SingleOrDefault(a => a.Form == tabstrip.CurrentTab); var x = 0; var width = UIScreen.MainScreen.Bounds.Width - 60; foreach (var tab in tabstrip.Tabs) { var size = new CGSize(width / tabstrip.Tabs.Count, 30); if (tab != null) { var tv = new UITextView { Text = tab.Label, Frame = new CGRect(new CGPoint(x, 0), size), TextColor = UIColor.LightGray }; nfloat borderWidth = 2; var border = new CALayer { BorderColor = UIColor.LightGray.CGColor, Frame = new CGRect(0, tv.Frame.Size.Height - borderWidth, tv.Frame.Size.Width - 20, tv.Frame.Size.Height), BorderWidth = width }; x += (int)tv.Frame.Width; UITapGestureRecognizer gesture = new UITapGestureRecognizer(); gesture.AddTarget(() => { var metadata = myFormHandler.GetFormMetadataAsync(tab.Form); myFormHandler.FormWrapper.UpdateView(myFormHandler, new FormParameter(metadata, tab.InputFieldValues)); }); tv.AddGestureRecognizer(gesture); if (tab == currentTab) { tv.TextColor = UIColor.Black; border.BorderColor = UIColor.Black.CGColor; } tv.Layer.AddSublayer(border); tv.Layer.MasksToBounds = true; this.OutputView.AddSubview(tv); } } return(this.OutputView); }
public View GetView(OutputFieldMetadata outputField, object value, MyFormHandler myFormHandler, FormMetadata formMetadata, List <FormInputManager> inputsManager) { this.OutputText = new TextView(Application.Context) { Text = outputField.Label + ": " + value }; myFormHandler.ManagersCollection.StyleRegister.ApplyStyle("TextView", this.OutputText); return(this.OutputText); }
public View GetView(IDictionary <string, object> inputCustomProperties, MyFormHandler myFormHandler) { this.Layout = new LinearLayout(Application.Context) { Orientation = Orientation.Vertical }; this.FormHandler = myFormHandler; return(this.Layout); }
public View GetView(IDictionary <string, object> inputCustomProperties, MyFormHandler myFormHandler) { this.InputText = new EditText(Application.Context) { InputType = InputTypes.TextVariationPassword | InputTypes.ClassText }; myFormHandler.ManagersCollection.StyleRegister.ApplyStyle("EditText", this.InputText); return(this.InputText); }
public View GetView(IDictionary <string, object> inputCustomProperties, MyFormHandler myFormHandler) { this.DateInput = new DatePicker(Application.Context) { ScaleX = 0.5f, ScaleY = 0.5f }; myFormHandler.ManagersCollection.StyleRegister.ApplyStyle("DatePicker", this.DateInput); return(this.DateInput); }
public MyFormFragment(FormParameter formParameter, MyFormHandler myFormHandler, Activity ownerActivity, string submitAction = null) { this.MyFormHandler = myFormHandler; this.FormParameter = formParameter; this.OwnerActivity = ownerActivity; this.SubmitAction = submitAction; }
public void ReloadView(MyFormHandler myFormHandler, ReloadResponse reloadResponse) { var bar = this.ViewController as UINavigationController; bar?.PopToRootViewController(false); var allForms = this.SideMenuController.Reload(); var metadata = allForms[reloadResponse.Form]; this.UpdateView(myFormHandler, new FormParameter(metadata, reloadResponse.InputFieldValues)); }
public UIView GetView(IDictionary <string, object> inputCustomProperties, MyFormHandler myFormHandler) { this.Ascending = new UITextField(); this.OrderBy = new UITextField(); this.PageIndex = new UITextField(); this.PageSize = new UITextField(); this.InputPaginator = new UIView(); this.InputPaginator.AddSubviews(this.Ascending, this.OrderBy, this.PageIndex, this.PageSize); return(this.InputPaginator); }
public UIView GetView(IDictionary <string, object> inputCustomProperties, MyFormHandler myFormHandler) { this.PickerView = new UIPickerView(); this.Items = inputCustomProperties.GetCustomProperty <IList <DropdownItem> >("items"); this.Items.Insert(0, new DropdownItem { Label = "", Value = "" }); PickerModel model = new PickerModel(this.Items.Select(a => a.Label).ToArray()); model.PickerChanged += (sender, e) => { var selected = this.Items.SingleOrDefault(a => a.Label.Equals(e.SelectedValue)); var value = new DropdownValue <string>(selected?.Value); this.SelectedValue = value; }; this.PickerView.ShowSelectionIndicator = true; this.PickerView.Model = model; // Setup the toolbar UIToolbar toolbar = new UIToolbar { BarStyle = UIBarStyle.Black, Translucent = true }; toolbar.SizeToFit(); this.TextField = new UITextField(); this.TextField.Layer.CornerRadius = 8; this.TextField.Layer.BorderColor = UIColor.LightGray.CGColor; this.TextField.Layer.BorderWidth = 1; UIView paddingView = new UIView(new CGRect(0, 0, 10, 20)); this.TextField.LeftView = paddingView; this.TextField.LeftViewMode = UITextFieldViewMode.Always; // Create a 'done' button for the toolbar and add it to the toolbar UIBarButtonItem doneButton = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, (s, e) => { this.TextField.Text = this.SelectedValue.Value; this.TextField.ResignFirstResponder(); }); toolbar.SetItems(new [] { doneButton }, true); // Tell the textbox to use the picker for input this.TextField.InputView = this.PickerView; // Display the toolbar over the pickers this.TextField.InputAccessoryView = toolbar; return(this.TextField); }
public UIView GetView(IDictionary <string, object> inputCustomProperties, MyFormHandler myFormHandler) { this.InputText = new UITextField(); this.InputText.SetTextBorders(); this.InputText.ClearButtonMode = UITextFieldViewMode.WhileEditing; UIView paddingView = new UIView(new CGRect(0, 0, 10, 20)); this.InputText.LeftView = paddingView; this.InputText.LeftViewMode = UITextFieldViewMode.Always; return(this.InputText); }
public View GetView(OutputFieldMetadata outputField, object value, MyFormHandler myFormHandler, FormMetadata formMetadata, List <FormInputManager> inputsManager) { var inlineForm = value.CastTObject <InlineForm>(); this.LayouView = myFormHandler.GetIForm(inlineForm.Form, inlineForm.InputFieldValues); return(this.LayouView); }
public View GetView(OutputFieldMetadata outputField, object value, MyFormHandler myFormHandler, FormMetadata formMetadata, List <FormInputManager> inputsManager) { this.OutputList = new LinearLayout(Application.Context) { Orientation = Orientation.Vertical }; if (!string.IsNullOrEmpty(outputField.Label)) { var label = new TextView(Application.Context) { Text = outputField.Label + ": " }; this.OutputList.AddView(label, this.OutputList.MatchParentWrapContent()); myFormHandler.ManagersCollection.StyleRegister.ApplyStyle("TextView", label); } var paginatedData = value.CastTObject <PaginatedData <object> >(); this.ItemList = paginatedData.Results.ToList(); this.TotalCount = paginatedData.TotalCount; var listView = this.ItemList.IntializeListView(outputField, myFormHandler); if (this.TotalCount > 10) { if (formMetadata != null) { var btnLoadMore = this.CreateLoadMoreButton(myFormHandler, formMetadata, outputField, listView, inputsManager, myFormHandler.AllFormsMetadata); myFormHandler.ManagersCollection.StyleRegister.ApplyStyle("Button Link LoadMore", btnLoadMore); listView.AddFooterView(btnLoadMore); } } if (this.ItemList.Count == 0) { var noResult = new TextView(Application.Context) { Text = "no data." }; noResult.LayoutParameters = noResult.MatchParentWrapContent(); myFormHandler.ManagersCollection.StyleRegister.ApplyStyle("TextView NoResult", noResult); this.OutputList.AddView(noResult); } listView.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, listView.GetListHeigth()); myFormHandler.ManagersCollection.StyleRegister.ApplyStyle("ListView", listView); this.OutputList.AddView(listView); return(this.OutputList); }
public UIView GetView(IDictionary <string, object> inputCustomProperties, MyFormHandler myFormHandler) { this.InputText = new UITextField { KeyboardType = UIKeyboardType.NumberPad }; this.InputText.SetTextBorders(); var paddingView = new UIView(new CGRect(0, 0, 10, 20)); this.InputText.LeftView = paddingView; this.InputText.LeftViewMode = UITextFieldViewMode.Always; return(this.InputText); }
public TextView InitializeLink(FormLink btn, MyFormHandler myFormHandler) { var text = new TextView(Application.Context) { Text = btn.Label }; text.Click += async(sender, args) => { var formMetadata = myFormHandler.GetFormMetadata(btn.Form); myFormHandler.FormWrapper.UpdateView(myFormHandler, new FormParameter(formMetadata, btn.InputFieldValues)); }; return(text); }