コード例 #1
0
 public Widget Remove(LayoutItem child)
 {
     throw new NotImplementedException();
 }
コード例 #2
0
 public void AddAfter(LayoutItem child, LayoutItem after, object options = null)
 {
     throw new NotImplementedException();
 }
コード例 #3
0
 public void AddBefore(LayoutItem child, LayoutItem before, object options = null)
 {
     throw new NotImplementedException();
 }
コード例 #4
0
        public Hierarchy <LayoutItem> GetInstanceExtensions(Table table)
        {
            if (table.ID.Contains("07"))
            {
            }
            if (ExtDictionary.Count == 0)
            {
                return(table.Extensions);
            }
            else
            {
                if (this.Extensions == null)
                {
                    var hlroot = new Hierarchy <LayoutItem>(table.Extensions.Item);
                    var ix     = 1;
                    foreach (var typedext in ExtDictionary)
                    {
                        var factstring = typedext.Key;
                        var typedfact  = new FactBase();
                        typedfact.SetFromString(factstring);
                        typedfact.SetTyped();

                        foreach (var ext in table.Extensions.Children)
                        {
                            var li_original = ext.Item;
                            var li_new      = LayoutItem.Copy(li_original);
                            foreach (var dim in li_new.Dimensions)
                            {
                                var instancedim = typedfact.Dimensions.FirstOrDefault(i => i.DimensionItem == dim.DimensionItem && i.Domain == dim.Domain);
                                if (instancedim != null)
                                {
                                    dim.DomainMember = instancedim.DomainMember;
                                }
                            }
                            var fact = new FactBase();
                            fact.Dimensions = li_new.Dimensions;
                            fact.Concept    = li_new.Concept;
                            fact.SetFactString();
                            li_new.FactString = fact.FactString;

                            Label extensionlabel = new Label();
                            var   code           = String.Format(Table.LabelCodeFormat, typedext.Value);
                            var   content        = String.Format(Table.ExtensionLableContentFormat, code);

                            extensionlabel.LabelID = code;
                            extensionlabel.Code    = code;
                            extensionlabel.Content = content;
                            if (fact.Dimensions.Count == 1)
                            {
                                extensionlabel      = table.Taxonomy.GetLabelForDimensionDomainMember(fact.Dimensions.FirstOrDefault());
                                extensionlabel.Code = code;
                            }

                            if (fact.Dimensions.Count > 1)
                            {
                                extensionlabel.Content = "";
                                extensionlabel.Code    = "";
                                foreach (var dim in fact.Dimensions)
                                {
                                    extensionlabel.Code    += dim.DomainMemberFullName + ",";
                                    extensionlabel.Content += table.Taxonomy.GetLabelForDimensionDomainMember(dim) + ",";
                                }
                            }
                            li_new.ID           = extensionlabel.LabelID;
                            li_new.LabelCode    = extensionlabel.Code;
                            li_new.LabelContent = extensionlabel.Content;

                            var hli = new Hierarchy <LayoutItem>(li_new);
                            hlroot.Children.Add(hli);
                            hli.Parent = hlroot;

                            ix++;
                        }
                    }
                    Extensions = hlroot;
                }
                return(Extensions);
            }
        }
コード例 #5
0
        private Color GetPresudoRandomColorFromPalette(LayoutItem layoutItem)
        {
            Color color = Palette[layoutItem.Term.Occurrences * layoutItem.Term.Text.Length % Palette.Length];

            return(color);
        }
コード例 #6
0
        /// <summary>
        ///     Checks to see if the passed in item has presentation settings for the provided device and layout.
        /// </summary>
        /// <param name = "theItem">The item.</param>
        /// <param name = "device">The device.</param>
        /// <param name = "layoutItem">The layout item.</param>
        /// <returns>True if the item contains the device and layout in it's presentation settings, false otherwise.</returns>
        public static bool ItemHasPresentationSettingsForLayout(Item theItem, DeviceItem device, LayoutItem layoutItem)
        {
            if (theItem == null || device == null || layoutItem == null)
            {
                return(false);
            }

            //If the item does not contain settings for the passed in device do not bother with the
            // rest of the check.
            if (!ItemHasPresentationSettingsForDevice(theItem, device))
            {
                return(false);
            }

            //Try and get the device definition from the layout definition
            DeviceDefinition deviceDef = GetDeviceDefinition(theItem, device);

            if (deviceDef == null)
            {
                return(false);
            }
            if (deviceDef.Layout == null || deviceDef.Renderings == null)
            {
                return(false);
            }

            return(deviceDef.Layout == layoutItem.ID.ToString());
        }
コード例 #7
0
        private void FillGroup(LayoutGroup group, DialogSourceViewModel vm)
        {
            //TODO: по хорошему нужно писать свой контрол на остнове DataLayout-а (научить правильно биндиться, понимать аттрибуты и т.д.)
            if (vm.Source != null)
            {
                group.DataContext = vm.Source;
            }
            group.Children.Clear();
            var setfocus = false;

            var layoutGroups = new Dictionary <string, LayoutGroup>();

            foreach (var field in vm.Fields.OrderBy(p => p.Order).ToArray())
            {
                var oldLayout = FindName(field.Name);
                if (oldLayout != null)
                {
                    continue;
                }
                if (field.SetFocus)
                {
                    setfocus = true;
                }

                UIElement child = null;
                if (field.FieldType == typeof(Button) || field.FieldType == typeof(CustomButton))
                {
                    var layoutItem = new LayoutItem
                    {
                        Name       = field.Name,
                        IsEnabled  = field.IsEnabled.HasValue && field.IsEnabled.Value,
                        Visibility = field.Visible ? Visibility.Visible : Visibility.Collapsed,
                        Content    = MenuHelper.CreateCustomButton(field, vm.MenuCommand, vm.FontSize, false)
                    };
                    RegisterName(field.Name, layoutItem);
                    child = layoutItem;
                }
                else if (field.FieldType == typeof(IFooterMenu) || field.FieldType == typeof(FooterMenu))
                {
                    MenuHelper.CreateFooterMenu(footerMenuControl, field, vm.MenuCommand, vm.FontSize, false);
                    continue;
                }
                else
                {
                    var layoutItem = new CustomDataLayoutItem(vm.IsWfDesignMode, field)
                    {
                        IsVisibilitySetOutside    = true,
                        IsDisplayFormatSetOutside = true,

                        FontSize = vm.FontSize,

                        IsReadOnlySetOutside = true,
                        TooltipDisable       = true,
                        CloseDialogCommand   = vm.MenuCommand
                    };
                    RegisterName(field.Name, layoutItem);

                    var layoutGroupName = LayoutGroupHelper.GetLayoutGroupNameFromField(field, vm.IsWfDesignMode);
                    if (string.IsNullOrEmpty(layoutGroupName))
                    {
                        child = layoutItem;
                    }
                    else
                    {
                        LayoutGroup layoutGroup;
                        if (!layoutGroups.ContainsKey(layoutGroupName))
                        {
                            layoutGroup = LayoutGroupHelper.CreateLayoutGroup(layoutGroupName);
                            layoutGroups[layoutGroupName] = layoutGroup;
                            RegisterName(layoutGroupName, layoutGroup);
                            group.Children.Add(layoutGroup);
                        }

                        layoutGroup = layoutGroups[layoutGroupName];
                        layoutGroup.Children.Add(layoutItem);
                    }
                }

                if (child != null)
                {
                    group.Children.Add(child);
                }
            }

            if (!setfocus)
            {
                KeyHelper.SetFocusElement(group.Children);
            }

            objectDataLayout.RestoreLayout(vm.LayoutValue);
        }
コード例 #8
0
 public void OnChildAddTest(LayoutItem child)
 {
     OnChildAdd(child);
 }
コード例 #9
0
 protected override void OnChildAdd(LayoutItem child)
 {
     flagOnChildAddOverride = true;
     base.OnChildAdd(child);
 }
コード例 #10
0
 protected override void MeasureChildWithMargins(LayoutItem child, MeasureSpecification parentWidthMeasureSpec, LayoutLength widthUsed, MeasureSpecification parentHeightMeasureSpec, LayoutLength heightUsed)
 {
     flagOnMeasureChild = true;
     base.MeasureChildWithMargins(child, parentWidthMeasureSpec, widthUsed, parentHeightMeasureSpec, heightUsed);
 }
コード例 #11
0
 public void MeasureChildWithoutPaddingTest(LayoutItem child, MeasureSpecification parentWidthMeasureSpec, MeasureSpecification parentHeightMeasureSpec)
 {
     MeasureChildWithoutPadding(child, parentWidthMeasureSpec, parentHeightMeasureSpec);
 }
コード例 #12
0
 public void MeasureChildWithMarginsTest(LayoutItem child, MeasureSpecification parentWidthMeasureSpec, LayoutLength widthUsed, MeasureSpecification parentHeightMeasureSpec, LayoutLength heightUsed)
 {
     MeasureChildWithMargins(child, parentWidthMeasureSpec, widthUsed, parentHeightMeasureSpec, heightUsed);
 }
コード例 #13
0
        //--------------------------------------------------------------------------------------
        //
        //--------------------------------------------------------------------------------------
        private static LayoutItem GetNextNode(XmlReader reader, string defaultName, string entityName)
        {
            var        nodeName = "";
            LayoutItem output   = null;

            do
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    if (output == null)
                    {
                        nodeName = reader.Name;
                        if (nodeName == "VarmintWidget")
                        {
                            throw new ApplicationException("You must specify a widget class derived from VarmintWidget");
                        }

                        output = new LayoutItem(nodeName);
                        var lineInfo = (IXmlLineInfo)reader;
                        output.LocationText = entityName + ", Line: " + lineInfo.LineNumber;

                        var hasAttribute = reader.MoveToFirstAttribute();
                        while (hasAttribute)
                        {
                            // Some properties are special, and need to be set now.  The rest we set
                            // at the last moment when we have all the styles to inform us.
                            switch (reader.Name)
                            {
                            case "Name": output.Name = reader.Value; break;

                            default:
                                output.Settings.Add(reader.Name, reader.Value);
                                break;
                            }

                            hasAttribute = reader.MoveToNextAttribute();
                        }
                        reader.MoveToElement();

                        if (reader.IsEmptyElement)
                        {
                            break;
                        }
                    }
                    else
                    {
                        output.Children.Add(GetNextNode(reader, null, entityName));
                    }
                }
                else if (reader.NodeType == XmlNodeType.EndElement)
                {
                    if (reader.Name != nodeName)
                    {
                        throw new ApplicationException("Expected end of '" + nodeName + "' but got end of '" + reader.Name + "'");
                    }
                    break;
                }

                if (output == null)
                {
                    continue;
                }
            } while (reader.Read());

            if (output != null && output.Name == null)
            {
                output.Name = defaultName;
            }
            return(output);
        }
コード例 #14
0
        //--------------------------------------------------------------------------------------
        /// <summary>
        /// HydrateLayout - Take a layout item and turn it into a VarmintWidget
        /// </summary>
        //--------------------------------------------------------------------------------------
        private VarmintWidget HydrateLayout(LayoutItem widgetLayout)
        {
            VarmintWidget newWidget = null;

            // Helper method to apply this layout to the widget we created.
            void ApplyLayout(LayoutItem layout)
            {
                // Get the settings explicitly specified in the layout
                foreach (var name in layout.Settings.Keys)
                {
                    switch (name)
                    {
                    case "Style":
                    case "ApplyTo":
                        newWidget.SetValue(name, layout.Settings[name], true);
                        break;

                    default:
                        newWidget.AddSetting(name, layout.Settings[name]);
                        break;
                    }
                }

                foreach (var childItem in layout.Children)
                {
                    if (childItem.VwmlTag.Contains("."))
                    {
                        var parts = childItem.VwmlTag.Split('.');
                        if (parts.Length > 2)
                        {
                            throw new ApplicationException("Property setter specification is too deep.  Only one dot allowed! (" + childItem.VwmlTag + ")");
                        }

                        var propertyType = newWidget.GetType().GetProperty(parts[1]);
                        if (childItem.Children.Count == 1) // Only add items with content
                        {
                            var hydratedLayout = HydrateLayout(childItem.Children[0]);
                            if (propertyType != null && !propertyType.PropertyType.IsInstanceOfType(hydratedLayout))
                            {
                                throw new ApplicationException("Property " + childItem.VwmlTag + " cannot be assigned Type " + hydratedLayout.GetType().Name);
                            }
                            propertyType?.SetValue(newWidget, hydratedLayout);
                        }
                        else if (childItem.Children.Count > 1)
                        {
                            throw new ApplicationException("Too many child nodes on a property setter.  You only get one! (" + childItem.VwmlTag + ")");
                        }
                    }
                    else
                    {
                        newWidget.AddChild(HydrateLayout(childItem));
                    }
                }
            }

            // If the vwmlTag is in the layouts, it must be a control
            if (_controlLibrary.ContainsKey(widgetLayout.VwmlTag))
            {
                var controlLayout = _controlLibrary[widgetLayout.VwmlTag];

                // If there is a class that is bound to this control then we bind events to that class
                if (controlLayout.Settings.ContainsKey("Class"))
                {
                    var controlType = VarmintWidget.GetWidgetType(controlLayout.Settings["Class"]);
                    if (!controlType.IsSubclassOf(typeof(VarmintWidgetControl)))
                    {
                        throw new ApplicationException("The Class attribute must point to a VarmintWidgetControl");
                    }
                    newWidget = (VarmintWidget)Activator.CreateInstance(controlType);
                    newWidget.ControlHandler = newWidget;
                }
                else
                {
                    newWidget = new VarmintWidgetControl();
                }

                // Controls will get properties from the control layout, but these can
                // be overridden later by the local instace of the control
                ApplyLayout(controlLayout);
            }
            else
            {
                var nodeType = VarmintWidget.GetWidgetType(widgetLayout.VwmlTag);
                newWidget = (VarmintWidget)Activator.CreateInstance(nodeType);
            }
            if (widgetLayout.Name != null)
            {
                newWidget.Name = widgetLayout.Name;
            }

            // Automatically inject property values if they are injectable
            foreach (var propertyType in newWidget.GetType().GetProperties())
            {
                var injectAttribute = (VarmintWidgetInjectAttribute)propertyType.GetCustomAttribute(typeof(VarmintWidgetInjectAttribute));
                if (injectAttribute != null)
                {
                    propertyType.SetValue(newWidget, _injector.GetInjectedValue(injectAttribute, propertyType));
                }
            }

            ApplyLayout(widgetLayout);
            return(newWidget);
        }
コード例 #15
0
        /// <summary>
        /// 	Checks to see if the passed in item has presentation settings for the provided device and layout.
        /// </summary>
        /// <param name = "theItem">The item.</param>
        /// <param name = "device">The device.</param>
        /// <param name = "layoutItem">The layout item.</param>
        /// <returns>True if the item contains the device and layout in it's presentation settings, false otherwise.</returns>
        public static bool ItemHasPresentationSettingsForLayout(Item theItem, DeviceItem device, LayoutItem layoutItem)
        {
            if (theItem == null || device == null || layoutItem == null) return false;

            //If the item does not contain settings for the passed in device do not bother with the
            // rest of the check.
            if (!ItemHasPresentationSettingsForDevice(theItem, device)) return false;

            //Try and get the device definition from the layout definition
            DeviceDefinition deviceDef = GetDeviceDefinition(theItem, device);
            if (deviceDef == null) return false;
            if (deviceDef.Layout == null || deviceDef.Renderings == null) return false;

            return (deviceDef.Layout == layoutItem.ID.ToString());
        }
コード例 #16
0
 public void OnChildRemoveTest(LayoutItem child)
 {
     OnChildRemove(child);
 }
コード例 #17
0
ファイル: FGMMain.aspx.cs プロジェクト: KijongNam/EDIS
        public void InstantiateIn(Control container)
        {
            Control control = new Control();
            control.ID = "GroupDetectorEditForm";
            container.Controls.Add(control);
            
            DataTable dt = datafield;
            string db_name = "";
            string desc_name = "";
            string auth = "";
            string cell_type = "";

            ASPxFormLayout editform_GroupDetector = new ASPxFormLayout();
            editform_GroupDetector.ID = "editform_GroupDetector";
            //editform_GroupDetector.Border.BorderWidth = Unit.Pixel(1);
            //editform_GroupDetector.SettingsItems.VerticalAlign = FormLayoutVerticalAlign.Middle;
            //editform_GroupDetector.SettingsItems.HorizontalAlign = FormLayoutHorizontalAlign.Center;
            editform_GroupDetector.Paddings.Padding = Unit.Pixel(8);
            
            
            foreach (DataRow dr in dt.Select("AUTH <> 'System'", "VIEW_SEQ"))
            {
                db_name = dr["DB_NAME"].ToString();
                desc_name = dr["DESC_NAME"].ToString();
                auth = dr["AUTH"].ToString();
                cell_type = dr["SEL_TYPE"].ToString();
                

                LayoutItem li = new LayoutItem(desc_name);
                li.FieldName = db_name;
                
                editform_GroupDetector.Items.Add(li);
                LayoutItemNestedControlContainer li_container = li.LayoutItemNestedControlContainer;
                if (auth == "Manager")
                {
                    li.CaptionStyle.Font.Bold = true;
                    li.CaptionStyle.ForeColor = Color.Red;
                }


                if (cell_type == "DropDown List")
                {
                    ASPxDropDownEdit dropdownEdit = new ASPxDropDownEdit();
                    dropdownEdit.ID = db_name;

                    ASPxComboBox comboBox = new ASPxComboBox();
                    comboBox.DataSource = Srch_DropDownItem(db_name);
                    comboBox.TextField = "LOOKUPDETDESC";
                    comboBox.DataBind();
                    comboBox.IncrementalFilteringMode = IncrementalFilteringMode.StartsWith;
                    comboBox.DropDownStyle = DropDownStyle.DropDown;
                    comboBox.EnableSynchronization = DevExpress.Utils.DefaultBoolean.False;
                    li_container.Controls.Add(comboBox);
                }
                else if (cell_type == "Note")
                {
                    ASPxMemo textMemo = new ASPxMemo();
                    textMemo.ID = db_name;
                    textMemo.Width = Unit.Percentage(91);
                    li_container.Controls.Add(textMemo);
                }
                else
                {
                    
                    ASPxTextBox textBox = new ASPxTextBox();
                    textBox.ID = db_name;
                    li_container.Controls.Add(textBox);


                    //Suffix 증가 유무 체크 (15.10.16)
                    if (db_name == "CNT")
                    {
                        li = new LayoutItem("Suffix");
                        li.FieldName = "DETECTOR_SUFFIX";

                        editform_GroupDetector.Items.Add(li);
                        li_container = li.LayoutItemNestedControlContainer;

                        ASPxCheckBox chkBox = new ASPxCheckBox();
                        chkBox.ID = "DETECTOR_SUFFIX";
                        li_container.Controls.Add(chkBox);
                    }

                }
                
            }
            

            container.Controls.Add(editform_GroupDetector);
            //container.Controls.Add(editform_GroupDetector);
            
            //Button
            ASPxFormLayout btn_lo = new ASPxFormLayout();
            btn_lo.ID = "button_GroupDetector";
            btn_lo.ColCount = 1;
            btn_lo.Width = Unit.Percentage(90);
            btn_lo.SettingsItems.HorizontalAlign = FormLayoutHorizontalAlign.Right;
            btn_lo.Paddings.Padding = Unit.Pixel(1);

            LayoutItem btn_li = new LayoutItem("btn_li");
            btn_li.ShowCaption = DevExpress.Utils.DefaultBoolean.False;
            btn_lo.Items.Add(btn_li);
            LayoutItemNestedControlContainer btn_li_container = btn_li.LayoutItemNestedControlContainer;

            ASPxGridViewTemplateReplacement btn_add = new ASPxGridViewTemplateReplacement();
            btn_add.ReplacementType = GridViewTemplateReplacementType.EditFormUpdateButton;
            btn_add.ID = "btn_add";
            btn_li_container.Controls.Add(btn_add);

            //LayoutItem btn_li2 = new LayoutItem("btn_li2");
            //btn_li2.ShowCaption = DevExpress.Utils.DefaultBoolean.False;
            //btn_lo.Items.Add(btn_li2);
            //LayoutItemNestedControlContainer btn_li_container2 = btn_li2.LayoutItemNestedControlContainer;

            ASPxGridViewTemplateReplacement btn_cancel = new ASPxGridViewTemplateReplacement();
            btn_cancel.ReplacementType = GridViewTemplateReplacementType.EditFormCancelButton;
            btn_cancel.ID = "btn_cancel";
            btn_li_container.Controls.Add(btn_cancel);
            //btn_li.HorizontalAlign = FormLayoutHorizontalAlign.Right;

            container.Controls.Add(btn_lo);
        }
コード例 #18
0
 protected override void OnChildRemove(LayoutItem child)
 {
     flagOnChildRemoveOverride = true;
     base.OnChildRemove(child);
 }
コード例 #19
0
ファイル: ViewInternal.cs プロジェクト: linuxias/TizenFX
 internal void SetLayout(LayoutItem layout)
 {
     _layout = layout;
     _layout?.AttachToOwner(this);
     _layout?.RequestLayout();
 }
コード例 #20
0
 public void MeasureChildTest(LayoutItem child, MeasureSpecification parentWidth, MeasureSpecification parentHeight)
 {
     MeasureChild(child, parentWidth, parentHeight);
 }
コード例 #21
0
            private TreeViewItem AddControlLayoutItem(InputControlLayout layout, TreeViewItem parent, ref int id)
            {
                var item = new LayoutItem
                {
                    parent      = parent,
                    depth       = parent.depth + 1,
                    id          = id++,
                    displayName = layout.displayName ?? layout.name,
                    layoutName  = layout.name,
                };

                item.icon = EditorInputControlLayoutCache.GetIconForLayout(layout.name);
                parent.AddChild(item);

                // Header.
                AddChild(item, "Type: " + layout.type.Name, ref id);
                if (!string.IsNullOrEmpty(layout.m_DisplayName))
                {
                    AddChild(item, "Display Name: " + layout.m_DisplayName, ref id);
                }
                if (!string.IsNullOrEmpty(layout.name))
                {
                    AddChild(item, "Name: " + layout.name, ref id);
                }
                var baseLayouts = StringHelpers.Join(layout.baseLayouts, ", ");

                if (!string.IsNullOrEmpty(baseLayouts))
                {
                    AddChild(item, "Extends: " + baseLayouts, ref id);
                }
                if (layout.stateFormat != 0)
                {
                    AddChild(item, "Format: " + layout.stateFormat, ref id);
                }
                if (layout.m_UpdateBeforeRender != null)
                {
                    var value = layout.m_UpdateBeforeRender.Value ? "Update" : "Disabled";
                    AddChild(item, "Before Render: " + value, ref id);
                }
                if (layout.commonUsages.Count > 0)
                {
                    AddChild(item,
                             "Common Usages: " +
                             string.Join(", ", layout.commonUsages.Select(x => x.ToString()).ToArray()),
                             ref id);
                }
                if (layout.appliedOverrides.Count() > 0)
                {
                    AddChild(item,
                             "Applied Overrides: " +
                             string.Join(", ", layout.appliedOverrides),
                             ref id);
                }

                ////TODO: find a more elegant solution than multiple "Matching Devices" parents when having multiple
                ////      matchers
                // Device matchers.
                foreach (var matcher in EditorInputControlLayoutCache.GetDeviceMatchers(layout.name))
                {
                    var node = AddChild(item, "Matching Devices", ref id);
                    foreach (var pattern in matcher.patterns)
                    {
                        AddChild(node, $"{pattern.Key} => \"{pattern.Value}\"", ref id);
                    }
                }

                // Controls.
                if (layout.controls.Count > 0)
                {
                    var controls = AddChild(item, "Controls", ref id);
                    foreach (var control in layout.controls)
                    {
                        AddControlItem(control, controls, ref id);
                    }

                    controls.children.Sort((a, b) => string.Compare(a.displayName, b.displayName));
                }

                return(item);
            }
コード例 #22
0
 protected override void MeasureChild(LayoutItem child, MeasureSpecification parentWidth, MeasureSpecification parentHeight)
 {
     flagOnMeasureChild = true;
     base.MeasureChild(child, parentWidth, parentHeight);
 }
コード例 #23
0
        private void FillGroup(LayoutGroup group, ICustomModelHandler vm)
        {
            //TODO: по хорошему нужно писать свой контрол на остнове DataLayout-а (научить правильно биндиться, понимать аттрибуты и т.д.)
            if (vm.Source != null)
            {
                group.DataContext = vm.Source;
            }

            //HACK: всегда берем последний элемент (с макс. order'ом) для SpinEdit'а
            var maxorder = vm.Fields.Max(p => p.Order);

            foreach (var field in vm.Fields.OrderBy(p => p.Order).ToArray())
            {
                var oldLayout = FindName(field.Name);
                if (oldLayout != null)
                {
                    continue;
                }

                var isChangeName = false;
                if (Regex.IsMatch(field.Name, @"^[0-9]"))
                {
                    field.Name   = "_" + field.Name;
                    isChangeName = true;
                }

                LayoutItem layoutItem;
                if (maxorder > 0 && field.Order == maxorder)
                {
                    layoutItem = new LayoutItem
                    {
                        Name          = field.Name,
                        LabelPosition = field.LabelPosition.To(LayoutItemLabelPosition.Left),
                        Label         = new Label {
                            Content = field.Caption
                        },
                        IsEnabled  = !field.IsEnabled.HasValue || field.IsEnabled.Value,
                        Visibility = field.Visible ? Visibility.Visible : Visibility.Hidden,
                        Content    = spinEdit
                    };
                }
                else
                {
                    layoutItem = new CustomDataLayoutItem(field)
                    {
                        IsVisibilitySetOutside    = true,
                        IsDisplayFormatSetOutside = true,
                        IsLabelFontWeightBold     = field.IsLabelFontWeightBold,
                        ParentViewModelSource     = vm.Source,
                        ToolTipIns = CreateCustomSuperToolTip(field),
                    };
                    ((CustomDataLayoutItem)layoutItem).SetLabelProperties(field);
                }

                //т.к. испоьзуем ExpandoObject - регистрируем здесь
                RegisterName(field.Name, layoutItem);
                if (isChangeName)
                {
                    field.Name = field.Name.Substring(1);
                }
                group.Children.Add(layoutItem);
            }

            objectDataLayout.RestoreLayout(vm.LayoutValue);
            if (vm.InsertFromAvailableItems && objectDataLayout.AvailableItems.Count > 0)
            {
                foreach (var p in objectDataLayout.AvailableItems.ToArray())
                {
                    objectDataLayout.AvailableItems.Remove(p);
                    objectDataLayout.Children.Add(p);
                }
            }
        }
コード例 #24
0
ファイル: FieldManager.cs プロジェクト: tranxuannam/bk_data
        public PrivateApiResponse <object> MakeFieldsActive(TestCoreFramework.Enums.ResourceType resource, Guid[] fieldGuids, LayoutItem fromSection, Guid toSection)
        {
            var unusedSection = GetUnusedFieldsSectionDetails(resource).Result.Values.First().Value;

            var request = new SetLayoutRequest
            {
                Values = new Dictionary <Guid, LayoutItem>
                {
                    [GetUiLayerId(resource)] = new LayoutItem
                    {
                        Id    = GetUiLayerId(resource),
                        Cells = new List <CellItem>
                        {
                            new CellItem
                            {
                                Content = new Dictionary <string, Guid> {
                                    ["layout"] = toSection
                                },
                                CoulmnsCount = 1,
                                RowsCount    = 1,
                                XLocation    = 1,
                                YLocation    = 10
                            }
                        }
                    },
                    [GetUnusedSectionId(resource)] = new LayoutItem
                    {
                        Id    = GetUnusedSectionId(resource),
                        Cells = unusedSection.Cells.Where(x => !fieldGuids.Any(item => item != x.Content["field"])).ToList()
                    },
                    [toSection] = new LayoutItem
                    {
                        Id    = toSection,
                        Cells = fieldGuids.Select(x => new CellItem
                        {
                            XLocation    = 1,
                            YLocation    = Array.IndexOf(fieldGuids, x),
                            CoulmnsCount = 1,
                            RowsCount    = 1,
                            Content      = new Dictionary <string, Guid>
                            {
                                ["field"] = x
                            }
                        }).ToList()
                    }
                }
            };

            var requestContent = ConvertToJsonString(request);


            using (LogHelper.LoggerForCurrentTest.EnterReproStep($"Making fields active by moving them to displayable section in UI"))
            {
                return(ProcessResponseWithContent <object>(Connection.SendAsync(FieldLayoutApiRelativeUrl, requestContent, HttpMethod.Put).Result));
            }
        }
コード例 #25
0
 public Widget Add(LayoutItem child, object options = null)
 {
     throw new NotImplementedException();
 }
コード例 #26
0
ファイル: MainActivity.cs プロジェクト: woehrl01/flex
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            var metrics = new DisplayMetrics();

            WindowManager.DefaultDisplay.GetMetrics(metrics);

            float spacing = 40;

            var root = new LayoutItem(this)
            {
                Width         = metrics.WidthPixels,
                Height        = metrics.HeightPixels,
                PaddingBottom = 80
            };

            var label = new Item <TextView>(this)
            {
                Margin = spacing
            };

            label.View.Text = "This is the list of items you have added. You can add new items and clear the list using the buttons at the bottom. This label has extra lines on purpose.";
            label.Height    = new StaticLayout(label.View.Text, label.View.Paint, (int)root.Width, Layout.Alignment.AlignNormal, 1, 0, true).Height;
            root.Add(label);

            var list = new Item <ListView>(this)
            {
                Grow        = 1,
                MarginLeft  = spacing,
                MarginRight = spacing
            };

            list.View.Adapter = new ArrayAdapter(this, Resource.Layout.TextViewItem);
            root.Add(list);

            var input = new Item <EditText>(this)
            {
                Margin = spacing
            };

            input.View.Hint = "Enter list item";
            input.Height    = 80;
            root.Add(input);

            var buttons_row = new LayoutItem(this)
            {
                Direction    = Xamarin.Flex.Direction.Row,
                Height       = 80,
                MarginLeft   = spacing,
                MarginRight  = spacing,
                MarginBottom = spacing
            };

            root.Add(buttons_row);

            var add_button = new Item <Button>(this)
            {
                Grow   = 1,
                Height = 80
            };

            add_button.View.Text   = "Add";
            add_button.View.Click += delegate
            {
                var adapter = (ArrayAdapter)list.View.Adapter;
                if (input.View.Text != "")
                {
                    adapter.Add(input.View.Text);
                    input.View.Text = "";
                }
            };
            buttons_row.Add(add_button);

            var clear_button = new Item <Button>(this)
            {
                Grow   = 1,
                Height = 80
            };

            clear_button.View.Text   = "Clear";
            clear_button.View.Click += delegate
            {
                var adapter = (ArrayAdapter)list.View.Adapter;
                adapter.Clear();
            };
            buttons_row.Add(clear_button);

            root.Layout();

            SetContentView(root.view);
        }
コード例 #27
0
 public void AddAt(LayoutItem child, double index, object options = null)
 {
     throw new NotImplementedException();
 }
コード例 #28
0
 private void AdjustTextRenderHint(LayoutItem layoutItem)
 {
     m_Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
 }
コード例 #29
0
 public double IndexOf(LayoutItem child)
 {
     throw new NotImplementedException();
 }
コード例 #30
0
 public void Add(LayoutItem layoutItem)
 {
     flagOnILayoutParentAdd = true;
 }
コード例 #31
0
        private void FillGroup(LayoutGroup group, ICustomModelHandler vm)
        {
            var inPropertyEditMode = false;
            var isOldLayout        = false;

            //TODO: по хорошему нужно писать свой контрол на остнове DataLayout-а (научить правильно биндиться, понимать аттрибуты и т.д.)
            if (vm.Source != null)
            {
                group.DataContext = vm.Source;
            }
            var pe = vm as IPropertyEditHandler;

            if (pe != null)
            {
                inPropertyEditMode = pe.InPropertyEditMode;
            }
            foreach (var field in vm.Fields.OrderBy(p => p.Order).ToArray())
            {
                bool?isMergedProperty = null;
                if (inPropertyEditMode)
                {
                    isMergedProperty = pe.IsMergedPropery(field.Name);
                }

                var oldLayout = FindName(field.Name);
                if ((isOldLayout = oldLayout != null) && !field.IsChangeLookupCode)
                {
                    var li = oldLayout as CustomDataLayoutItem;
                    if (li != null)
                    {
                        li.SetLabelProperties(field);
                        li.Visibility = field.Visible ? Visibility.Visible : Visibility.Hidden;
                        if (field.IsEnabled.HasValue)
                        {
                            li.IsReadOnly = !field.IsEnabled.Value;
                        }

                        if (field.SetFocus)
                        {
                            li.SetFocus = field.SetFocus;
                        }

                        li.Binding = new Binding(string.IsNullOrEmpty(field.FieldName) ? field.Name : field.FieldName)
                        {
                            Mode = BindingMode.TwoWay,
                            UpdateSourceTrigger   = UpdateSourceTrigger.PropertyChanged,
                            ValidatesOnDataErrors = true,
                        };
                    }
                    else
                    {
                        var layItem = oldLayout as LayoutItem;
                        if (layItem != null)
                        {
                            layItem.Visibility = field.Visible ? Visibility.Visible : Visibility.Hidden;
                            if (field.IsEnabled.HasValue)
                            {
                                layItem.IsEnabled         = field.IsEnabled.Value;
                                layItem.Content.IsEnabled = field.IsEnabled.Value;
                            }
                        }
                    }
                    continue;
                }

                var isChangeName = false;
                if (Regex.IsMatch(field.Name, @"^[0-9]"))
                {
                    field.Name   = "_" + field.Name;
                    isChangeName = true;
                }

                LayoutItem  layoutItem;
                LayoutGroup foundGroup = null;
                var         index      = 0;

                if (oldLayout != null)
                {
                    foundGroup = ObjectViewBase.SearchGroup(group, (UIElement)oldLayout);
                    if (foundGroup == null)
                    {
                        continue;
                    }
                    index = foundGroup.Children.IndexOf((UIElement)oldLayout);
                    if (index < 0)
                    {
                        continue;
                    }
                    foundGroup.Children.Remove((UIElement)oldLayout);
                    UnregisterName(((FrameworkElement)oldLayout).Name);
                }

                if (typeof(Button).IsAssignableFrom(field.FieldType))
                {
                    Key currKey;
                    layoutItem = new LayoutItem()
                    {
                        Name       = field.Name,
                        IsEnabled  = !field.IsEnabled.HasValue || field.IsEnabled.Value,
                        Visibility = field.Visible ? Visibility.Visible : Visibility.Collapsed,

                        Content = new CustomButton
                        {
                            Content = field.Caption,
                            Command = vm.MenuCommand,

                            HotKey           = Enum.TryParse(field.HotKey, out currKey) ? currKey : Key.None,
                            CommandParameter = new KeyValuePair <string, object>(field.Name, field.Value),
                            Visibility       = field.Visible ? Visibility.Visible : Visibility.Collapsed,
                            IsEnabled        = !field.IsEnabled.HasValue || field.IsEnabled.Value
                        }
                    };
                }
                else
                {
                    layoutItem = new CustomDataLayoutItem(field)
                    {
                        IsVisibilitySetOutside    = true,
                        IsDisplayFormatSetOutside = true,
                        IsLabelFontWeightBold     = field.IsLabelFontWeightBold,
                        ParentViewModelSource     = (vm is ICPV) ? vm.ParentViewModelSource : null,
                        LookupButtonEnabled       = field.LookupButtonEnabled,
                        ToolTipIns       = CreateCustomSuperToolTip(field),
                        IsMergedProperty = isMergedProperty
                    };
                }

                //т.к. испоьзуем ExpandoObject - регистрируем здесь
                RegisterName(field.Name, layoutItem);
                if (isChangeName)
                {
                    field.Name = field.Name.Substring(1);
                }

                if (oldLayout != null && index > -1)
                {
                    foundGroup.Children.Insert(index, layoutItem);
                }
                else
                {
                    group.Children.Add(layoutItem);
                }
            }

            if (!isOldLayout)
            {
                objectDataLayout.RestoreLayout(vm.LayoutValue);
            }
            if (vm.InsertFromAvailableItems && objectDataLayout.AvailableItems.Count > 0)
            {
                foreach (var p in objectDataLayout.AvailableItems.ToArray())
                {
                    objectDataLayout.AvailableItems.Remove(p);
                    objectDataLayout.Children.Add(p);
                }
            }
        }
コード例 #32
0
 public void Remove(LayoutItem layoutItem)
 {
     flagOnILayoutParentRemove = true;
 }
コード例 #33
0
 protected void SetupEditSelectedEmployeesFormLayout()
 {
     foreach (string fieldName in EmployeeUtilities.PropertiesAvailableForSelfUpdating())
     {
         LayoutItem layoutItem = new LayoutItem { FieldName = fieldName };
         layoutItem.Controls.Add(new ASPxTextBox());
         EditSelectedEmployeesFormLayout.Items.Add(layoutItem);
     }
 }
コード例 #34
0
        private static FieldList GetLayout(LayoutItem layoutItem)
        {
            var data = new FieldList();

            data.AddField("Display Name", layoutItem.DisplayName);
            data.AddField("File Path", layoutItem.FilePath);
            data.AddField("ID", layoutItem.ID.Guid.ToString());

            return data;
        }