protected void FillInfoToLayoutMap(ViewItem detailViewItem, IModelViewLayoutElement itemModel, BaseLayoutItem layoutItem) {
            if (detailViewItem is AdditionalViewControlsItem) {
                var id = ((AdditionalViewControlsItem)detailViewItem).Model.Rule.Id;
                if (RuleToLayoutMap.ContainsKey(id))
                    RuleToLayoutMap[id] = layoutItem;
                else
                    RuleToLayoutMap.Add(id, layoutItem);
            }

        }
 protected void FillInfoToLayoutMap(ViewItem detailViewItem, IModelViewLayoutElement itemModel, object layoutItem) {
     var item = detailViewItem as AdditionalViewControlsItem;
     if (item != null) {
         var id = item.Model.Rule.Id;
         if (RuleToLayoutMap.ContainsKey(id))
             RuleToLayoutMap[id] = layoutItem;
         else
             RuleToLayoutMap.Add(id, layoutItem);
     }
 }
Exemplo n.º 3
0
 protected void FillInfoToLayoutMap(ViewItem detailViewItem, IModelViewLayoutElement itemModel, object layoutItem)
 {
     if (detailViewItem is AdditionalViewControlsItem)
     {
         var id = ((AdditionalViewControlsItem)detailViewItem).Model.Rule.Id;
         if (RuleToLayoutMap.ContainsKey(id))
         {
             RuleToLayoutMap[id] = layoutItem;
         }
         else
         {
             RuleToLayoutMap.Add(id, layoutItem);
         }
     }
 }
        internal static void MapModelViewLayoutElement(
            IModelViewLayoutElement modelModelViewLayoutElement,
            LayoutItemNode layoutViewItemNode
            )
        {
            if (layoutViewItemNode.Id is not null)
            {
                modelModelViewLayoutElement.Id =
                    layoutViewItemNode.Id ?? modelModelViewLayoutElement.Id;
            }

            if (layoutViewItemNode.RelativeSize is not null)
            {
                modelModelViewLayoutElement.RelativeSize =
                    layoutViewItemNode.RelativeSize ?? modelModelViewLayoutElement.RelativeSize;
            }
        }
Exemplo n.º 5
0
        string GetNullText(IModelViewLayoutElement modelViewLayoutElement)
        {
            string nullText            = null;
            var    modelLayoutViewItem = ((modelViewLayoutElement)) as IModelLayoutViewItem;

            if (modelLayoutViewItem != null && modelLayoutViewItem.ViewItem is IModelPropertyEditor)
            {
                var modelMember         = ((IModelPropertyEditor)modelLayoutViewItem.ViewItem).ModelMember;
                var modelMemberNullText = modelMember as IModelMemberNullText;
                if (modelMemberNullText != null)
                {
                    nullText = (modelMemberNullText).NullText;
                }
            }
            if (string.IsNullOrEmpty(nullText) && modelViewLayoutElement is IModelLayoutNullText)
            {
                nullText = ((IModelLayoutNullText)modelViewLayoutElement).NullText;
            }
            return(nullText);
        }
Exemplo n.º 6
0
        private void AddStateMachineActionsContainerToDetailViewLayout(DetailView detailView, string actionsContainerId, string caption)
        {
            if (detailView.Model.Items[actionsContainerId] != null)
            {
                return;
            }
            var    containerViewItem1   = detailView.Model.Items.AddNode <IModelActionContainerViewItem>(actionsContainerId);
            var    modelApplicationBase = ( ModelApplicationBase )detailView.Model.Application;
            string currentAspect        = modelApplicationBase.CurrentAspect;

            modelApplicationBase.SetCurrentAspect("");
            containerViewItem1.Caption = caption;
            modelApplicationBase.SetCurrentAspect(currentAspect);
            IModelViewLayoutElement viewLayoutElement   = detailView.Model.Layout.Count > 0 ? detailView.Model.Layout[0] : null;
            IModelLayoutViewItem    modelLayoutViewItem = !(viewLayoutElement is IModelLayoutGroup)
                                                   ? detailView.Model.Layout.AddNode <IModelLayoutViewItem>(containerViewItem1.Id)
                                                   : viewLayoutElement.AddNode <IModelLayoutViewItem>(containerViewItem1.Id);

            modelLayoutViewItem.ViewItem    = containerViewItem1;
            modelLayoutViewItem.ShowCaption = true;
            var containerViewItem2 = ( ActionContainerViewItem )detailView.AddItem(containerViewItem1);
        }
        private System.Web.UI.WebControls.Unit CalculateCaptionWidth(ViewItem viewItem, ViewItemsCollection viewItems, IModelLayoutViewItem layoutItemModel)
        {
            var item = layoutItemModel as IModelWebLayoutItem;

            if (item != null)
            {
                if (item.TextAlignMode == TextAlignModeItem.AutoSize)
                {
                    return(this.GetMaxStringWidth(new string[] { this.EnsureCaptionColon(viewItem.Caption) }));
                }
                else
                {
                    IModelViewLayoutElement current = layoutItemModel;
                    while (current != null)
                    {
                        var group = current.Parent as IModelWebLayoutGroup;
                        if (group != null)
                        {
                            if (group.TextAlignMode == TextAlignModeGroup.AutoSize)
                            {
                                return(this.GetMaxStringWidth(new string[] { this.EnsureCaptionColon(viewItem.Caption) }));
                            }
                            if (group.TextAlignMode == TextAlignModeGroup.AlignLocal)
                            {
                                return(CalculateLayoutItemCaptionWidthNew((IModelLayoutGroup)group, viewItems, false));
                            }
                            if (group.TextAlignMode == TextAlignModeGroup.AlignWithChildren)
                            {
                                return(CalculateLayoutItemCaptionWidthNew((IModelLayoutGroup)group, viewItems, true));
                            }
                        }
                        current = current.Parent as IModelViewLayoutElement;
                    }
                }
            }
            return(this.LayoutItemCaptionWidth);
        }
 private void OnLayoutItemCreatedNew(LayoutItemTemplateContainerBase templateContainer, IModelViewLayoutElement layoutItemModel, ViewItem viewItem)
 {
     if (!DelayedItemsInitialization)
     {
         templateContainer.Instantiate();
     }
     OnLayoutItemCreated(new ItemCreatedEventArgs(layoutItemModel, viewItem, templateContainer));
     OnCustomizeAppearance(new CustomizeAppearanceEventArgs(layoutItemModel.Id, new WebLayoutItemAppearanceAdapter(templateContainer), null));
 }