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.");
     }
 }
예제 #3
0
        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);

        }
예제 #4
0
        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));
        }
예제 #5
0
        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)
 {
 }
예제 #8
0
 public CustomUserControlViewItem(IModelViewItem model, Type objectType)
     : base(objectType, model != null ? model.Id : string.Empty)
 {
 }
예제 #9
0
 protected ActionButtonDetailItem(IModelViewItem model, Type objectType)
     : base(objectType, model != null ? model.Id : string.Empty)
 {
     _model = (IModelActionButton) model;
 }
예제 #10
0
 public ActionButtonDetailItem(
     IModelViewItem model, Type objectType)
     : base(model, objectType) {
 }
예제 #11
0
 public PivotGridViewItem(IModelViewItem model, Type objectType)
     : base(model, objectType)
 {
 }
예제 #12
0
 public ActionButtonDetailItem(
     IModelViewItem model, Type objectType)
     : base(model, objectType)
 {
 }
예제 #13
0
 public ButtonDetailViewItemMobile(IModelViewItem model, Type objectType) : base(objectType, model.Id)
 {
 }
예제 #14
0
 public MyFileManagerViewItem(IModelViewItem modelNode, Type objectType) : base(objectType, modelNode.Id)
 {
 }
예제 #15
0
 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);
예제 #16
0
 protected ActionButtonDetailItem(IModelViewItem model, Type objectType)
     : base(objectType, model != null ? model.Id : string.Empty)
 {
     _model = (IModelActionButton)model;
 }
예제 #17
0
        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>"
                        });
                    }
                }
            }
        }