Exemplo n.º 1
0
            protected override IModelTabbedGroup?CreateViewLayoutElement(IModelNode parentNode, LayoutTabbedGroupItem tabbedGroupItemNode)
            {
                var modelTabbedGroup = parentNode.AddNode <IModelTabbedGroup>(tabbedGroupItemNode.Id);

                if (modelTabbedGroup is IModelNode genericModelNode)
                {
                    MapModelNode(genericModelNode, tabbedGroupItemNode);
                }

                if (modelTabbedGroup is IModelViewLayoutElement modelViewLayoutElement)
                {
                    MapModelViewLayoutElement(modelViewLayoutElement, tabbedGroupItemNode);
                }

                if (modelTabbedGroup is IModelLayoutElementWithCaptionOptions modelLayoutElementWithCaptionOptions)
                {
                    MapLayoutElementWithCaptionOptions(modelLayoutElementWithCaptionOptions, tabbedGroupItemNode);
                }

                if (modelTabbedGroup is IModelLayoutElementWithCaption modelLayoutElementWithCaption)
                {
                    MapCaption(modelLayoutElementWithCaption, tabbedGroupItemNode);
                }

                MapTabbedLayoutGroup(modelTabbedGroup, tabbedGroupItemNode);

                if (tabbedGroupItemNode.TabbedGroupOptions is not null)
                {
                    tabbedGroupItemNode.TabbedGroupOptions(modelTabbedGroup);
                }

                return(modelTabbedGroup);
            }
Exemplo n.º 2
0
            protected override IModelLayoutViewItem?CreateViewLayoutElement(IModelNode parentNode, LayoutEmptySpaceItem emptySpaceItemNode)
            {
                var modelLayoutViewItem = parentNode.AddNode <IModelLayoutViewItem>(emptySpaceItemNode.Id);

                if (modelLayoutViewItem is IModelNode genericModelNode)
                {
                    MapModelNode(genericModelNode, emptySpaceItemNode);
                }

                if (modelLayoutViewItem is IModelLayoutItem modelLayoutItem)
                {
                    MapModelLayoutItem(modelLayoutItem, emptySpaceItemNode);
                }

                if (modelLayoutViewItem is IModelViewLayoutElement modelViewLayoutElement)
                {
                    MapModelViewLayoutElement(modelViewLayoutElement, emptySpaceItemNode);
                }

                if (modelLayoutViewItem is ISupportControlAlignment modelSupportControlAlignment)
                {
                    MapSupportControlAlignment(modelSupportControlAlignment, emptySpaceItemNode);
                }

                return(modelLayoutViewItem);
            }
Exemplo n.º 3
0
 public static ModelNode AddNode <T>(this IModelNode node, string id, bool checkForDuplicates) where T : IModelNode
 {
     if (!checkForDuplicates || (((ModelNode)node)[id] == null))
     {
         return((ModelNode)(IModelNode)node.AddNode <T>(id));
     }
     throw new DuplicateNameValidationException($"{node}");
 }
Exemplo n.º 4
0
        internal static IModelTabbedGroup AddTab(this IModelNode view, string id, int?index = null)
        {
            var rst = view.AddNode <IModelTabbedGroup>(id);

            if (index.HasValue)
            {
                rst.Index = index.Value;
            }
            return(rst);
        }
Exemplo n.º 5
0
            protected override IModelLayoutGroup?CreateViewLayoutElement(IModelNode parentNode, LayoutGroupItem groupItemNode)
            {
                var modelLayoutGroup = parentNode.AddNode <IModelLayoutGroup>(groupItemNode.Id);

                if (modelLayoutGroup is IModelNode genericModelNode)
                {
                    MapModelNode(genericModelNode, groupItemNode);
                }

                if (modelLayoutGroup is IModelViewLayoutElement modelViewLayoutElement)
                {
                    MapModelViewLayoutElement(modelViewLayoutElement, groupItemNode);
                }

                if (modelLayoutGroup is IModelLayoutElementWithCaptionOptions modelLayoutElementWithCaptionOptions)
                {
                    MapLayoutElementWithCaptionOptions(modelLayoutElementWithCaptionOptions, groupItemNode);
                }

                if (modelLayoutGroup is IModelLayoutElementWithCaption modelLayoutElementWithCaption)
                {
                    MapCaption(modelLayoutElementWithCaption, groupItemNode);
                }

                if (modelLayoutGroup is ISupportControlAlignment modelSupportControlAlignment)
                {
                    MapSupportControlAlignment(modelSupportControlAlignment, groupItemNode);
                }

                if (modelLayoutGroup is IModelToolTip modelToolTip)
                {
                    MapModelToolTip(modelToolTip, groupItemNode);
                }

                if (modelLayoutGroup is IModelToolTipOptions modelToolTipOptions)
                {
                    MapModelToolTipOptions(modelToolTipOptions, groupItemNode);
                }

                MapLayoutGroup(modelLayoutGroup, groupItemNode);

                if (groupItemNode.LayoutGroupOptions is not null)
                {
                    groupItemNode.LayoutGroupOptions(modelLayoutGroup);
                }

                return(modelLayoutGroup);
            }
Exemplo n.º 6
0
            protected override IModelLayoutViewItem?CreateViewLayoutElement(IModelNode parentNode, LayoutViewItem layoutViewItemNode)
            {
                var modelLayoutViewItem = parentNode.AddNode <IModelLayoutViewItem>(layoutViewItemNode.Id);

                var viewItems = FindViewItems(parentNode);

                if (viewItems is not null)
                {
                    modelLayoutViewItem.ViewItem = viewItems.OfType <IModelViewItem>().FirstOrDefault(m => m.Id == layoutViewItemNode.ViewItemId);
                }

                if (modelLayoutViewItem is IModelNode genericModelNode)
                {
                    MapModelNode(genericModelNode, layoutViewItemNode);
                }

                if (modelLayoutViewItem is IModelLayoutItem modelLayoutItem)
                {
                    MapModelLayoutItem(modelLayoutItem, layoutViewItemNode);
                }

                if (modelLayoutViewItem is IModelViewLayoutElement modelViewLayoutElement)
                {
                    MapModelViewLayoutElement(modelViewLayoutElement, layoutViewItemNode);
                }

                if (modelLayoutViewItem is ISupportControlAlignment modelSupportControlAlignment)
                {
                    MapSupportControlAlignment(modelSupportControlAlignment, layoutViewItemNode);
                }

                if (modelLayoutViewItem is IModelToolTip modelToolTip)
                {
                    MapModelToolTip(modelToolTip, layoutViewItemNode);
                }

                if (modelLayoutViewItem is IModelToolTipOptions modelToolTipOptions)
                {
                    MapModelToolTipOptions(modelToolTipOptions, layoutViewItemNode);
                }

                if (modelLayoutViewItem is IModelLayoutElementWithCaptionOptions modelLayoutElementWithCaptionOptions)
                {
                    MapLayoutElementWithCaptionOptions(modelLayoutElementWithCaptionOptions, layoutViewItemNode);
                }
                else if (modelLayoutViewItem.ViewItem is IModelLayoutElementWithCaptionOptions modelLayoutElementWithCaptionOptions2)
                {
                    MapLayoutElementWithCaptionOptions(modelLayoutElementWithCaptionOptions2, layoutViewItemNode);
                }

                if (modelLayoutViewItem is IModelLayoutElementWithCaption modelLayoutElementWithCaption)
                {
                    MapCaption(modelLayoutElementWithCaption, layoutViewItemNode);
                }
                else if (modelLayoutViewItem.ViewItem is IModelLayoutElementWithCaption modelLayoutElementWithCaption2)
                {
                    MapCaption(modelLayoutElementWithCaption2, layoutViewItemNode);
                }
                else if (modelLayoutViewItem.ViewItem is not null)
                {
                    if (layoutViewItemNode.Caption is not null)
                    {
                        modelLayoutViewItem.ViewItem.Caption = layoutViewItemNode.Caption;
                    }
                }

                if (layoutViewItemNode.ViewItemOptions is not null)
                {
                    if (modelLayoutViewItem.ViewItem is not null)
                    {
                        layoutViewItemNode.ViewItemOptions(modelLayoutViewItem.ViewItem);
                    }
                }

                if (layoutViewItemNode is LayoutPropertyEditorItem layoutPropertyEditorItem &&
                    layoutPropertyEditorItem.PropertyEditorOptions is not null)
                {
                    if (modelLayoutViewItem.ViewItem is IModelPropertyEditor modelPropertyEditor)
                    {
                        layoutPropertyEditorItem.PropertyEditorOptions(modelPropertyEditor);
                    }
                }

                return(modelLayoutViewItem);
            }
Exemplo n.º 7
0
 public static ModelNode AddNode(this IModelNode node, string id = null)
 {
     return(node.AddNode(node.ModelListType(), id));
 }
Exemplo n.º 8
0
 public static ModelNode AddNode(this IModelNode node, Type type, string id = null)
 {
     return(node.AddNode(XafTypesInfo.Instance.FindTypeInfo(type), id));
 }
Exemplo n.º 9
0
 /// <summary>
 /// Adds the selector node.
 /// </summary>
 /// <param name="node">The node.</param>
 /// <returns></returns>
 protected override ISelectorNode AddSelectorNode(IModelNode node)
 {
     return(node.AddNode <ISnapshotSelectorNode>());
 }
Exemplo n.º 10
0
 /// <summary>
 /// Adds the selector node.
 /// </summary>
 /// <param name="node">The node.</param>
 /// <returns></returns>
 protected override ISelectorNode AddSelectorNode(IModelNode node)
 {
     return(node.AddNode <IRecipientSelectorNode>());
 }
Exemplo n.º 11
0
        private IModelViewLayoutElement FactorNode(LayoutItem item, IModelNode parentNode, IModelDetailView modelDetailView)
        {
            if (item is VerticalGroup)
            {
                var vGroupNode = parentNode.AddNode <IModelLayoutGroup>(item.Id);
                vGroupNode.Direction = FlowDirection.Vertical;
                return(vGroupNode);
            }

            if (item is HorizontalGroup)
            {
                var hGroupNode = parentNode.AddNode <IModelLayoutGroup>(item.Id);
                hGroupNode.Direction = FlowDirection.Horizontal;
                return(hGroupNode);
            }

            if (item is TabGroup)
            {
                var tabGroupNode = parentNode.AddNode <IModelTabbedGroup>(item.Id);
                tabGroupNode.Direction = FlowDirection.Horizontal;
                return(tabGroupNode);
            }

            if (item is Tab)
            {
                var tabGroupNode = parentNode.AddNode <IModelLayoutGroup>(item.Id);
                tabGroupNode.Direction = FlowDirection.Horizontal;
                return(tabGroupNode);
            }

            //if(item is Contracts.Layout.Splitter)
            //{
            //    var splitterNode = parentNode.AddNode<IModelSplitter>(item.Id);

            //    (item as Contracts.Layout.Splitter).Options(splitterNode);

            //    node = splitterNode;
            //}

            //if(item is Contracts.Layout.Seperator)
            //{
            //    var seperatorNode = parentNode.AddNode<IModelSeparator>(item.Id);

            //    (item as Contracts.Layout.Seperator).Options(seperatorNode);

            //    node = seperatorNode;
            //}

            //if(item is Contracts.Layout.LabelItem)
            //{
            //    var labelNode = parentNode.AddNode<IModelLabel>(item.Id);

            //    (item as Contracts.Layout.LabelItem).Options(labelNode);
            //    labelNode.Text = (item as Contracts.Layout.LabelItem).Text;

            //    node = labelNode;
            //}

            if (item is ViewItem)
            {
                var viewItemNode = parentNode.AddNode <IModelLayoutViewItem>(item.Id);
                var editor       = item as ViewItem;

                viewItemNode.ViewItem = modelDetailView.Items.FirstOrDefault(m => m.Id == editor.ViewItemId);

                return(viewItemNode);
            }

            if (item is EmptySpaceItem)
            {
                var emptySpaceNode = parentNode.AddNode <IModelLayoutViewItem>(item.Id);
                return(emptySpaceNode);
            }

            if (item is LayoutGroup)
            {
                var groupNode = parentNode.AddNode <IModelLayoutGroup>(item.Id);
                return(groupNode);
            }

            return(null);
        }