Exemplo n.º 1
0
        private static IModelObjectView NewModelView(IModelViews modelViews, CloneModelViewAttribute cloneViewAttribute, IModelClass modelClass)
        {
            if (cloneViewAttribute.ViewType == CloneViewType.ListView)
            {
                var listView = modelViews.AddNode <IModelListView>(cloneViewAttribute.ViewId);
                listView.ModelClass = modelClass;
                ModelListViewNodesGenerator.GenerateNodes(listView, modelClass);
                return(listView);
            }

            if (cloneViewAttribute.ViewType == CloneViewType.LookupListView)
            {
                var listViewModel = modelViews.AddNode <IModelListView>(cloneViewAttribute.ViewId);
                listViewModel.ModelClass = modelClass;
                listViewModel.SetValue("IsLookupView", true);
                if (!modelClass.TypeInfo.IsPersistent)
                {
                    listViewModel.DataAccessMode = CollectionSourceDataAccessMode.Client;
                }
                listViewModel.IsGroupPanelVisible = false;
                listViewModel.AutoExpandAllGroups = false;
                listViewModel.IsFooterVisible     = false;
                return(listViewModel);
            }

            if (cloneViewAttribute.ViewType == CloneViewType.DetailView)
            {
                var detailView = modelViews.AddNode <IModelDetailView>(cloneViewAttribute.ViewId);
                detailView.ModelClass = modelClass;
                return(detailView);
            }

            throw new NotImplementedException();
        }
Exemplo n.º 2
0
 static void AssignAsDefaultView(CloneModelViewAttribute cloneModelViewAttribute, IModelObjectView modelView)
 {
     if (cloneModelViewAttribute.IsDefault)
     {
         if (modelView is IModelListView view)
         {
             if (cloneModelViewAttribute.ViewType != CloneViewType.LookupListView)
             {
                 view.ModelClass.DefaultListView = view;
             }
             else
             {
                 view.ModelClass.DefaultLookupListView = view;
             }
         }
         else
         {
             modelView.ModelClass.DefaultDetailView = (IModelDetailView)modelView;
         }
     }
 }
Exemplo n.º 3
0
 void AssignAsDefaultView(CloneModelViewAttribute cloneModelViewAttribute, IModelObjectView modelView, bool isLookup)
 {
     if (cloneModelViewAttribute.IsDefault)
     {
         if (modelView is IModelListView view)
         {
             if (!isLookup)
             {
                 view.ModelClass.DefaultListView = view;
             }
             else
             {
                 view.ModelClass.DefaultLookupListView = view;
             }
         }
         else
         {
             modelView.ModelClass.DefaultDetailView = (IModelDetailView)modelView;
         }
     }
 }