private static ViewItem FindViewItem(ViewItemsCollection viewItems, IModelLayoutViewItem layoutItemModel) { IModelViewItem viewItem = layoutItemModel.ViewItem; string viewItemId = viewItem != null ? viewItem.Id : layoutItemModel.Id; return(viewItems[viewItemId]); }
public WinCustomUserControlViewItem(IModelViewItem model, Type objectType) : base(model, objectType) { this.model = model as IModelWinCustomUserControlViewItem; if (this.model == null) { throw new ArgumentNullException("IModelWinCustomUserControlViewItem must extend IModelCustomUserControlViewItem in the ExtendModelInterfaces method of your Win ModuleBase descendant."); } }
protected override ViewItem CreateItem(IModelViewItem info) { if (Application == null) return null; if (!IsMemberLelvelSecurityInstalled()) return base.CreateItem(info); Type objType = ObjectTypeInfo != null ? ObjectTypeInfo.Type : null; return Application.EditorFactory.CreateDetailViewEditor(false, info, objType, Application, ObjectSpace); }
protected override ViewItem CreateItem(IModelViewItem info) { if (Application == null) { return(null); } if (!IsMemberLelvelSecurityInstalled()) { return(base.CreateItem(info)); } Type objType = ObjectTypeInfo != null ? ObjectTypeInfo.Type : null; return(Application.EditorFactory.CreateDetailViewEditor(false, info, objType, Application, ObjectSpace)); }
public static string Get_Caption(IModelLayoutGroup layoutGroup) { var count = layoutGroup.Count(_ => !(_ is IModelModelMap)); if (count == 1 && layoutGroup[0] is IModelLayoutViewItem) { IModelViewItem layoutItemModel = ((IModelLayoutViewItem)layoutGroup[0]).ViewItem; if (layoutItemModel != null) { return(layoutItemModel.Caption); } } return(layoutGroup.Id); }
private void AddLayoutItemNode(IModelLayoutGroup layoutGroup, IModelPropertyEditor editor) { ModelDefaultAttribute modelDefaultAttribute = FindModelDefaultAttribute(editor.ModelMember.MemberInfo, CustomDetailViewItemsGenarator.ActionsContainerAttribute); if (modelDefaultAttribute != null) { IModelViewItem container = editor.Parent.GetNode(modelDefaultAttribute.PropertyValue) as IModelViewItem; if ((container != null)) { IModelLayoutViewItem item = layoutGroup.AddNode <IModelLayoutViewItem>(container.Id); item.ViewItem = container; item.Index = editor.Index; } } else { IModelLayoutViewItem item = layoutGroup.AddNode <IModelLayoutViewItem>(editor.PropertyName); item.ViewItem = editor; item.Index = editor.Index; } }
public MyViewItem(IModelViewItem modelNode, Type objectType) : base(objectType, modelNode.Id) { }
public CustomUserControlViewItem(IModelViewItem model, Type objectType) : base(objectType, model != null ? model.Id : string.Empty) { }
protected ActionButtonDetailItem(IModelViewItem model, Type objectType) : base(objectType, model != null ? model.Id : string.Empty) { _model = (IModelActionButton) model; }
public ActionButtonDetailItem( IModelViewItem model, Type objectType) : base(model, objectType) { }
public PivotGridViewItem(IModelViewItem model, Type objectType) : base(model, objectType) { }
public ButtonDetailViewItemMobile(IModelViewItem model, Type objectType) : base(objectType, model.Id) { }
public MyFileManagerViewItem(IModelViewItem modelNode, Type objectType) : base(objectType, modelNode.Id) { }
public static bool IsLayout(this IModelViewItem modelViewItem) => modelViewItem.GetParent <IModelDetailView>().Layout.GetItems <IModelLayoutGroup>(item => item) .SelectMany().OfType <IModelLayoutViewItem>().Any(element => element.ViewItem.Id == modelViewItem.Id);
protected ActionButtonDetailItem(IModelViewItem model, Type objectType) : base(objectType, model != null ? model.Id : string.Empty) { _model = (IModelActionButton)model; }
protected override void OnInit(EventArgs e) { base.OnInit(e); if (ViewItem != null) { String ModelID = ""; IModelViewItem Model = null; if (ViewItem is PropertyEditor) { ModelID = (ViewItem as PropertyEditor).Model.Id; Model = (ViewItem as PropertyEditor).Model as IModelViewItem; } else { if (ViewItem.GetType().GetProperty("Model") != null) { Model = (IModelViewItem)ViewItem.GetType().GetProperty("Model").GetValue(ViewItem); ModelID = Model.Id; } } ViewItemResponsive responsive = ViewItemResponsive.Default; if (Model != null && (Model is IModelBootstrapViewItemResponsive)) { responsive = (Model as IModelBootstrapViewItemResponsive).ContainerResponsive; } Func <String> controlsCreatedFunc = () => { var innerView = (ViewItem as DashboardViewItem).InnerView; if (innerView != null && innerView is DetailView && ViewItem.View is DetailView) { (innerView as DetailView).ViewEditMode = (ViewItem.View as DetailView).ViewEditMode; if (innerView.CurrentObject == null) { innerView.CurrentObject = innerView.ObjectSpace.FindObject((innerView as DetailView).Model.ModelClass.TypeInfo.Type, CriteriaOperator.Parse((ViewItem as DashboardViewItem).Model.Criteria), true); } ViewItem.View.ObjectSpace.Committed += new EventHandler(delegate { innerView.ObjectSpace.CommitChanges(); }); ViewItem.View.ObjectSpace.RollingBack += new EventHandler <System.ComponentModel.CancelEventArgs>(delegate { innerView.ObjectSpace.Rollback(); }); ViewItem.View.ObjectSpace.Refreshing += new EventHandler <System.ComponentModel.CancelEventArgs>(delegate { innerView.ObjectSpace.Refresh(); }); } return(""); }; if (ViewItem is WebPropertyEditor) { (ViewItem as WebPropertyEditor).AllowEdit["XafBootstrapAllowEdit"] = !(ModelID != "" && BootstrapView != null && BootstrapView.DisabledItems.IndexOf(ModelID) > -1); if ((ViewItem as WebPropertyEditor).CurrentObject == null && ViewItem.View is DetailView) { ViewItem.CurrentObject = (ViewItem.View as DetailView).CurrentObject; } } else if (ViewItem is DashboardViewItem) { (ViewItem as DashboardViewItem).ControlCreated += new EventHandler <EventArgs>(delegate { controlsCreatedFunc(); }); } if (ViewItem.Control == null) { ViewItem.CreateControl(); } else if (ViewItem is DashboardViewItem) { controlsCreatedFunc(); } if (ViewItem.Control != null && ViewItem.Control is Control) { Controls.Clear(); var Control = ViewItem.Control as Control; int i = 0; var ID = Control.ID; while (BootstrapView.ControlUniqueIDList.IndexOf(Control.ID) > -1) { Control.ID = ID + i.ToString(); i++; } BootstrapView.ControlUniqueIDList.Add(Control.ID); if (ViewItem is IXafBootstrapEditor || (ViewItem is ListPropertyEditor && (ViewItem as ListPropertyEditor).ListView != null && (ViewItem as ListPropertyEditor).ListView.Editor is IXafBootstrapListEditor) ) { Controls.Add(Control); } else if (ViewItem is DashboardViewItem && (ViewItem as DashboardViewItem).View is DetailView || responsive == ViewItemResponsive.AsIs) { Controls.Add(Control); } else { Controls.Add(new HTMLText() { Text = "<div class='table-responsive'>" }); Controls.Add(Control); Controls.Add(new HTMLText() { Text = "</div>" }); } } } }