Exemple #1
0
 /// <inheritdoc/>
 public override void RemoveOptionItem(IOptionItem item)
 {
     if (item is OptionGroup)
     {
         _groups.Remove((OptionGroup)item);
     }
     base.RemoveOptionItem(item);
 }
 public void SetUndefinedValue(IOptionItem item)
 {
     if ((bool)item.Attributes[OptionItem.SupportUndefinedValueAttribute])
     {
         //this should not be reached
         item.Value = OptionItem.ValueUndefined;
     }
 }
 public OptionItemPresenter()
 {
     weakEventListener        = new MyListener(this);
     ChildItems               = new IOptionItem[0];
     this.Loaded             += OnLoaded;
     this.LocalizingConverter = new XamlLocalizingConverter();
     CommandManager.RegisterClassCommandBinding(typeof(OptionItemPresenter), new CommandBinding(ResetValueCommand, OnResetValueExecuted, OnCanExecuteResetValue));
 }
Exemple #4
0
 public void SetUndefinedValue(IOptionItem item)
 {
     if ((bool)item.GetAttribute(OptionItem.SUPPORT_UNDEFINED_VALUE_ATTRIBUTE))
     {
         //this should not be reached
         item.Value = OptionItem.VALUE_UNDEFINED;
     }
 }
Exemple #5
0
 /// <inheritdoc/>
 public override IOptionItem AddOptionItem(IOptionItem item)
 {
     if (item is OptionGroup)
     {
         _groups.Add((OptionGroup)item);
         groupMap[item.Name] = (IOptionGroup)item;
     }
     return(base.AddOptionItem(item));
 }
 public CopiedOptionItem(IOptionItem delegateItem, IOptionGroup group)
 {
     this.delegateItem  = delegateItem;
     dictionaryOverride = new Dictionary <string, object>();
     lookup             = delegateItem;
     this.enabled       = this.initialEnabled = delegateItem.Enabled;
     this.value         = this.initialValue = delegateItem.Value;
     this.group         = group;
     listener           = new WeakListener(this, delegateItem);
 }
        /// <summary>
        /// This method is needed to find the correct item in <paramref name="view"/> that corresponds
        /// to the original input source <paramref name="item"/>. It is called by
        /// <see cref="InstallInView"/> to correctly determine the new event inputs for the copied
        /// condition.
        /// </summary>
        /// <remarks>This implementation just queries <see cref="IModelView.GetViewItem"/> for
        /// <paramref name="item"/>, and returns the result from this call, or <see langword="null"/>
        /// if <paramref name="item"/> does not implement <see cref="IOptionItem"/>.</remarks>
        /// <param name="view">The view where the condition is currently installed</param>
        /// <param name="item"></param>
        /// <returns>A <see cref="INotifyPropertyChanged"/> instance that corresponds
        /// to <paramref name="item"/> in <paramref name="view"/>.</returns>
        protected virtual INotifyPropertyChanged GetItemCopy(IModelView view, INotifyPropertyChanged item)
        {
            IOptionItem viewItem = item as IOptionItem;

            if (viewItem != null)
            {
                return(view.GetViewItem(viewItem));
            }
            return(null);
        }
        public void AdoptValue()
        {
            IOptionItem item = delegateItem;

            if (item != null)
            {
                this.Value   = delegateItem.Value;
                this.Enabled = delegateItem.Enabled;
            }
        }
        public void CommitValue()
        {
            IOptionItem item = delegateItem;

            if (item != null)
            {
                item.Value   = value;
                item.Enabled = enabled;
            }
        }
Exemple #10
0
        /// <summary>
        /// Initializes the option handler for the export
        /// </summary>
        private void SetupHandler()
        {
            handler = new OptionHandler(IMAGE_EXPORT);
            handler.PropertyChanged += handler_PropertyChanged;
            OptionGroup currentGroup = handler.AddGroup(OUTPUT);
            OptionItem  formatItem   = currentGroup.AddList(FORMAT, Formats.Keys, FORMAT_JPG);

            currentGroup.AddBool(HIDE_DECORATIONS, true);
            currentGroup.AddBool(EXPORT_RECTANGLE, true);
            currentGroup = handler.AddGroup(BOUNDS);


            OptionItem  sizeItem   = currentGroup.AddList(SIZE, SizeModes, USE_ORIGINAL_SIZE);
            IOptionItem widthItem  = currentGroup.AddInt(WIDTH, DefaultWidth, 1, int.MaxValue);
            IOptionItem heightItem = currentGroup.AddInt(HEIGHT, DefaultHeight, 1, Int32.MaxValue);

            currentGroup.AddDouble(SCALE, DefaultScale);

            currentGroup = handler.AddGroup(MARGINS);

            currentGroup.AddInt(LEFT_MARGIN, DefaultMargins);
            currentGroup.AddInt(RIGHT_MARGIN, DefaultMargins);
            currentGroup.AddInt(TOP_MARGIN, DefaultMargins);
            currentGroup.AddInt(BOTTOM_MARGIN, DefaultMargins);

            currentGroup = handler.AddGroup(JPG);
            IOptionItem qualityItem = currentGroup.AddDouble(QUALITY, DefaultQuality);

            currentGroup = handler.AddGroup(TIFF);
            OptionItem compressionItem = currentGroup.AddList(COMPRESSION,
                                                              Compressions.Keys, DefaultCompression);


            currentGroup = handler.AddGroup(PNG);
            var transparentItem = currentGroup.AddBool(TRANSPARENT, false);

            var cm = new ConstraintManager(Handler);

            cm.SetEnabledOnValueEquals(sizeItem, SPECIFY_WIDTH, widthItem);
            cm.SetEnabledOnValueEquals(sizeItem, SPECIFY_HEIGHT, heightItem);

            cm.SetEnabledOnValueEquals(formatItem, FORMAT_PNG, transparentItem);

            cm.SetEnabledOnValueEquals(formatItem, FORMAT_JPG, qualityItem);
            cm.SetEnabledOnValueEquals(formatItem, FORMAT_TIFF, compressionItem);

            // localization
            var rm =
                new ResourceManager("Demo.yFiles.ImageExport.ImageExport",
                                    Assembly.GetExecutingAssembly());
            var rmf = new ResourceManagerI18NFactory();

            rmf.AddResourceManager(Handler.Name, rm);
            Handler.I18nFactory = rmf;
        }
            public IAction InstallInView(IModelView view)
            {
                IAction     retval   = null;
                IOptionItem viewItem = view.GetViewItem(target);

                if (viewItem != null)
                {
                    retval = new SetEnabledAction(viewItem, invert);
                }
                return(retval);
            }
Exemple #12
0
        private PartitionLayout.IPartitionPlacer ConfigurePartitionPlacer()
        {
            OptionGroup topLevelGroup = Handler.GetGroupByName(TOP_LEVEL);
            IOptionItem placementItem = topLevelGroup.GetItemByName(PLACEMENT_STRATEGY);

            return
                (PartitionLayout.CreateComponentPartitionPlacer(new ComponentLayout
            {
                Style = componentStyles[(string)placementItem.Value]
            }));
        }
 public bool BindItem(IOptionItem item, bool fullyQualifiedId, string id, bool addToOptionHandler)
 {
     if (fullyQualifiedId)
     {
         return(BindItemHelper(item, id, parentGroup, selectionProvider, string.Empty, addToOptionHandler));
     }
     else
     {
         return(BindItemHelper(item, id, parentGroup, selectionProvider, propertyPrefix, addToOptionHandler));
     }
 }
Exemple #14
0
        private void ApplyOptions(CompactOrthogonalLayout layout)
        {
            OptionGroup topLevelGroup = Handler.GetGroupByName(TOP_LEVEL);
            IOptionItem gridItem      = topLevelGroup.GetItemByName(GRID);

            layout.GridSpacing = (int)gridItem.Value;

            double ar = (double)topLevelGroup.GetItemByName(ASPECT_RATIO).Value;

            // this needs to be done as a final step since it will reconfigure
            // layout stages which support aspect ratio accordingly
            layout.AspectRatio = ar;
        }
Exemple #15
0
        /// <inheritdoc/>
        protected internal override void ReadStateFromItem(IOptionItem savedItem)
        {
            base.ReadStateFromItem(savedItem);
            OptionGroup newGroup = savedItem as OptionGroup;

            foreach (OptionItem item in children)
            {
                if (newGroup.nameMap.ContainsKey(item.Name))
                {
                    IOptionItem backupValue = newGroup[item.Name];
                    item.ReadStateFromItem(backupValue);
                }
            }
        }
        ///<inheritdoc/>
        protected override void SetupHandler()
        {
            OptionGroup generalGroup = Handler.AddGroup(GENERAL);

            generalGroup.AddList(LAYOUT_STYLE, enumStyle, DIRECTED);
            IOptionItem       allowNonTreeItem = generalGroup.AddBool(ALLOW_NON_TREE_EDGES, true);
            IOptionItem       nonTreeStyleItem = generalGroup.AddList(ROUTING_STYLE_FOR_NON_TREE_EDGES, enumRoute, ROUTE_ORTHOGONAL);
            ConstraintManager cm = new ConstraintManager(Handler);

            cm.SetEnabledOnValueEquals(allowNonTreeItem, true, nonTreeStyleItem);

            generalGroup.AddBool(ACT_ON_SELECTION_ONLY, false);
            var bundlingStrength = generalGroup.AddDouble(EDGE_BUNDLING_STRENGTH, 0.99, 0, 1);

            cm.SetEnabledOnValueEquals(nonTreeStyleItem, ROUTE_BUNDLED, bundlingStrength);

            ClassicTreeLayout treeLayout    = new ClassicTreeLayout();
            OptionGroup       directedGroup = Handler.AddGroup(DIRECTED);

            directedGroup.AddInt(MINIMAL_NODE_DISTANCE, (int)treeLayout.MinimumNodeDistance, 1, int.MaxValue);
            directedGroup.AddInt(MINIMAL_LAYER_DISTANCE, (int)treeLayout.MinimumLayerDistance, 10, int.MaxValue);
            directedGroup.AddList(ORIENTATION, enumOrient.Keys, TOP_TO_BOTTOM);
            directedGroup.AddList(PORT_STYLE, enumPortStyle.Keys, NODE_CENTER_PORTS);

            directedGroup.AddBool(INTEGRATED_NODE_LABELING, false);
            directedGroup.AddBool(INTEGRATED_EDGE_LABELING, false);

            IOptionItem edgeRoutingOption  = directedGroup.AddBool(ORTHOGONAL_EDGE_ROUTING, false);
            IOptionItem busAlignmentOption = directedGroup.AddDouble(BUS_ALIGNMENT, 0.5, 0, 1);

            directedGroup.AddDouble(VERTICAL_ALIGNMENT, 0.5, 0, 1);
            var childPolicyItem    = directedGroup.AddList(CHILD_PLACEMENT_POLICY, childPlacementPolicies.Keys, SIBLINGS_ON_SAME_LAYER);
            var globalLayeringItem = directedGroup.AddBool(ENFORCE_GLOBAL_LAYERING, false);

            cm.SetEnabledOnCondition(ConstraintManager.LogicalCondition.And(cm.CreateValueEqualsCondition(edgeRoutingOption, true),
                                                                            ConstraintManager.LogicalCondition.Or(cm.CreateValueEqualsCondition(globalLayeringItem, true),
                                                                                                                  cm.CreateValueEqualsCondition(childPolicyItem, ALL_LEAVES_ON_SAME_LAYER))),
                                     busAlignmentOption);

            var         ar      = new AspectRatioTreeLayout();
            OptionGroup arGroup = Handler.AddGroup(AR);

            arGroup.AddInt(HORIZONTAL_SPACE, (int)ar.HorizontalDistance);
            arGroup.AddInt(VERTICAL_SPACE, (int)ar.VerticalDistance);
            arGroup.AddInt(BEND_DISTANCE, (int)ar.BendDistance);
            IOptionItem ratioItem   = arGroup.AddDouble(ASPECT_RATIO, ar.AspectRatio);
            IOptionItem useViewItem = arGroup.AddBool(USE_VIEW_ASPECT_RATIO, true);

            cm.SetEnabledOnValueEquals(useViewItem, false, ratioItem);
        }
Exemple #17
0
                public HotkeyOptionList(string name)
                    : base(name)
                {
                    foreach (IPrimaryOption <GameObject> paramOption in CommonOptionList <IPrimaryOption <GameObject> > .AllOptions())
                    {
                        IOptionItem option = paramOption as IOptionItem;
                        if (option == null)
                        {
                            continue;
                        }

                        mOptions.Add(new HotkeyOption(option));
                    }
                }
Exemple #18
0
 /// <inheritdoc/>
 public override void RestoreState(XmlElement parent)
 {
     foreach (XmlNode n in parent.ChildNodes)
     {
         if (n.NodeType == XmlNodeType.Element)
         {
             string      name = n.Attributes["name"].Value;
             IOptionItem item = this[name];
             if (item != null)
             {
                 item.RestoreState((XmlElement)n);
             }
         }
     }
 }
        private void ConfigureGrouping()
        {
            IOptionItem groupingItem = Handler.GetItemByName("GROUPING.GROUP_LAYOUT_POLICY");

            switch ((string)groupingItem.Value)
            {
            case IGNORE_GROUPS:
                preStage = new HideGroupsStage();
                organic.PrependStage(preStage);
                break;

            case LAYOUT_GROUPS:
                //do nothing...
                break;

            case FIX_GROUP_BOUNDS:
                IDataProvider groupDP = CurrentLayoutGraph.GetDataProvider(GroupingKeys.GroupDpKey);
                if (groupDP != null)
                {
                    groupNodeContentDP = Maps.CreateHashedNodeMap();
                    foreach (Node node in CurrentLayoutGraph.Nodes)
                    {
                        if (groupDP.GetBool(node))
                        {
                            groupNodeContentDP.Set(node, GroupNodeMode.FixBounds);
                        }
                    }
                    CurrentLayoutGraph.AddDataProvider(OrganicLayout.GroupNodeModeDpKey, groupNodeContentDP);
                }
                break;

            case FIX_GROUP_CONTENTS:
                groupDP = CurrentLayoutGraph.GetDataProvider(GroupingKeys.GroupDpKey);
                if (groupDP != null)
                {
                    groupNodeContentDP = Maps.CreateHashedNodeMap();
                    foreach (Node node in CurrentLayoutGraph.Nodes)
                    {
                        if (groupDP.GetBool(node))
                        {
                            groupNodeContentDP.Set(node, GroupNodeMode.FixContents);
                        }
                    }
                    CurrentLayoutGraph.AddDataProvider(OrganicLayout.GroupNodeModeDpKey, groupNodeContentDP);
                }
                break;
            }
        }
Exemple #20
0
        /// <summary>
        /// Remove the specified child.
        /// </summary>
        /// <param name="item">The child to remove</param>
        public virtual void RemoveOptionItem(IOptionItem item)
        {
            children.Remove(item);
            nameMap.Remove(item.Name);
            if (item is IOwnerSettable)
            {
                ((IOwnerSettable)item).Owner = this;
            }

            if (item is OptionGroup)
            {
                //propagate structure changes
                ((IOptionGroup)item).StructureChanged -= item_StructureChanged;
            }
            OnStructureChanged();
        }
 public virtual void Dispose()
 {
     GetOptionHandler().Dispose(delegateItem, this);
     if (delegateItem != null)
     {
         if (listener != null)
         {
             listener.Disconnect(delegateItem);
             listener = null;
         }
         delegateItem       = null;
         lookup             = null;
         dictionaryOverride = null;
         group = null;
     }
 }
Exemple #22
0
 /// <summary>
 /// Callback method that can be used to copy the state and value from an existing option item
 /// to this instance.
 /// </summary>
 /// <param name="savedItem">The existing instance to be used as reference.</param>
 protected internal virtual void ReadStateFromItem(IOptionItem savedItem)
 {
     if (savedItem.GetType() != GetType() ||
         savedItem.Type != Type ||
         savedItem.Name != Name)
     {
         //don't read from incompatible items
         return;
     }
     foreach (string key in GetAttributeKeys())
     {
         SetAttribute(key, savedItem.GetAttribute(key));
     }
     Enabled = savedItem.Enabled;
     Value   = savedItem.Value;
 }
        internal CopiedOptionItem CreateCopy(CopiedOptionGroup newParent, IOptionItem itemToCopy)
        {
            CopiedOptionItem newItem;

            if (itemToCopy is IOptionGroup)
            {
                CopiedOptionGroup copiedGroup = new CopiedOptionGroup(itemToCopy as IOptionGroup, newParent);
                newItem = copiedGroup;
            }
            else
            {
                newItem = new CopiedOptionItem(itemToCopy, newParent);
            }
            newItem.AutoAdopt   = IsAutoAdopt;
            newItem.AutoCommit  = IsAutoCommit;
            mapping[itemToCopy] = newItem;
            return(newItem);
        }
Exemple #24
0
        /// <inheritdoc/>
        public virtual void AddItems(IOptionBuilderContext context, Type subjectType, object subject)
        {
            DefaultBrushOptionBuilder brushOptionBuilder = new DefaultBrushOptionBuilder();

            brushOptionBuilder.AllowNullValue = AllowNullValue;
            brushOptionBuilder.AddItems(context, typeof(Brush), null);

            FloatOptionItem widthItem      = new FloatOptionItem(DefaultPenPropertyMapBuilder.Width);
            bool            widthItemAdded = context.BindItem(widthItem, DefaultPenPropertyMapBuilder.Width);
            GenericOptionItem <DashStyle> dashStyleItem =
                new GenericOptionItem <DashStyle>(DefaultPenPropertyMapBuilder.DashStyle, OptionItem.VALUE_UNDEFINED);

            dashStyleItem.SetAttribute(OptionItem.SUPPORT_UNDEFINED_VALUE_ATTRIBUTE, true);
            dashStyleItem.SetAttribute(OptionItem.SUPPORT_NULL_VALUE_ATTRIBUTE, false);
//      dashStyleItem.SetAttribute(OptionItem.CUSTOM_TABLEITEM_EDITOR, typeof(PenDashStyleUITypeEditor));
            EnumUITypeEditor <DashStyle> editor = new EnumUITypeEditor <DashStyle>();

            editor.Renderer = new DashStyleItemRenderer();

            dashStyleItem.SetAttribute(OptionItem.CUSTOM_TABLEITEM_EDITOR, editor);
//      dashStyleItem.SetAttribute(OptionItem.CUSTOM_CELLRENDERER, typeof(DashStyleItemRenderer));
            bool dashStyleItemAdded = context.BindItem(dashStyleItem, DefaultPenPropertyMapBuilder.DashStyle);

            IOptionGroup parent = context.Lookup <IOptionGroup>();

            if (parent != null)
            {
                IOptionItem       fillTypeItem = parent[DefaultBrushPropertyMapBuilder.FillType];
                ConstraintManager cm           = parent.Lookup <ConstraintManager>();
                if (cm != null && fillTypeItem != null)
                {
                    ICondition cond = ConstraintManager.LogicalCondition.Not(cm.CreateValueEqualsCondition(fillTypeItem, null));
                    if (widthItemAdded)
                    {
                        cm.SetEnabledOnCondition(cond, widthItem);
                    }
                    if (dashStyleItemAdded)
                    {
                        cm.SetEnabledOnCondition(cond, dashStyleItem);
                    }
                }
            }
        }
        /// <inheritdoc/>
        public void AddItems(IOptionBuilderContext context, Type subjectType, object subject)
        {
            Type type1 = subject == null?subjectType:subject.GetType();

            PropertyInfo[] propertyInfos =
                SortProperties(FilterProperties(
                                   type1.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.FlattenHierarchy),
                                   context), context);

            foreach (PropertyInfo descriptor in propertyInfos)
            {
                DisplayNameAttribute displayNameAttribute = GetAttribute <DisplayNameAttribute>(descriptor);
                string propertyName;
                if (displayNameAttribute == null || displayNameAttribute.DisplayName.Length < 1)
                {
                    propertyName = descriptor.Name;
                }
                else
                {
                    propertyName = displayNameAttribute.DisplayName;
                }
                Type   type  = descriptor.PropertyType;
                object value = descriptor.GetGetMethod().Invoke(subject, null);

                IOptionBuilder builder = GetBuilder(descriptor, context, subject, type);

                if (builder != null)
                {
                    IOptionBuilderContext childContext = context.CreateChildContext(propertyName);
                    builder.AddItems(childContext, type, value);
                    ConfigureItem(childContext.Lookup <IOptionGroup>(), descriptor);
                }
                else
                {
                    IOptionItem item = CreateItem(context, descriptor, type, propertyName, value);
                    if (item != null)
                    {
                        context.BindItem(item, propertyName);
                        ConfigureItem(item, descriptor);
                    }
                }
            }
        }
        ///<inheritdoc/>
        protected override void SetupHandler()
        {
            CircularLayout layout     = new CircularLayout();
            BalloonLayout  treeLayout = layout.BalloonLayout;

            OptionGroup generalGroup = Handler.AddGroup(GENERAL);
            var         styleItem    = generalGroup.AddList(LAYOUT_STYLE, globalLayoutStyles.Keys, BCC_COMPACT);

            generalGroup.AddBool(ACT_ON_SELECTION_ONLY, false);
            generalGroup.AddBool(FROM_SKETCH, false);
            generalGroup.AddBool(HANDLE_NODE_LABELS, false);

            OptionGroup cycleGroup = Handler.AddGroup(CYCLE);

            cycleGroup.AddList(PARTITION_LAYOUT_STYLE, partitionLayoutStyles.Keys, PARTITION_LAYOUTSTYLE_CYCLIC);
            IOptionItem minDistItem     = cycleGroup.AddInt(MINIMAL_NODE_DISTANCE, 30, 0, int.MaxValue);
            IOptionItem autoRadiusItem  = cycleGroup.AddBool(CHOOSE_RADIUS_AUTOMATICALLY, true);
            IOptionItem fixedRadiusItem = cycleGroup.AddInt(FIXED_RADIUS, 200, 1, int.MaxValue);

            ConstraintManager cm = new ConstraintManager(Handler);

            cm.SetEnabledOnValueEquals(autoRadiusItem, true, minDistItem);
            cm.SetEnabledOnValueEquals(autoRadiusItem, false, fixedRadiusItem);

            OptionGroup bundlingGroup    = Handler.AddGroup(EDGE_BUNDLING);
            IOptionItem bundlingEnabled  = bundlingGroup.AddBool(EDGE_BUNDLING_ENABLED, false);
            IOptionItem bundlingStrength = bundlingGroup.AddDouble(EDGE_BUNDLING_STRENGTH, 0.95, 0, 1);

            cm.SetEnabledOnValueEquals(bundlingEnabled, true, bundlingStrength);

            OptionGroup treeGroup = Handler.AddGroup(TREE);

            treeGroup.AddInt(PREFERRED_CHILD_WEDGE, treeLayout.PreferredChildWedge, 1, 360);
            treeGroup.AddInt(MINIMAL_EDGE_LENGTH, treeLayout.MinimumEdgeLength, 1, int.MaxValue);
            treeGroup.AddInt(MAXIMAL_DEVIATION_ANGLE, layout.MaximumDeviationAngle, 1, 360);
            treeGroup.AddDouble(COMPACTNESS_FACTOR, treeLayout.CompactnessFactor, 0.1, 0.9);
            treeGroup.AddInt(MINIMAL_TREE_NODE_DISTANCE, treeLayout.MinimumNodeDistance, 0, int.MaxValue);
            treeGroup.AddBool(ALLOW_OVERLAPS, treeLayout.AllowOverlaps);
            treeGroup.AddBool(PLACE_CHILDREN_ON_COMMON_RADIUS, true);

            cm.SetEnabledOnCondition(ConstraintManager.LogicalCondition.Not(cm.CreateValueEqualsCondition(styleItem, SINGLE_CYCLE)), treeGroup);
        }
Exemple #27
0
        /// <summary>
        /// Add a new <see cref="IOptionItem"/> to this group
        /// </summary>
        /// <param name="item"></param>
        public virtual IOptionItem AddOptionItem(IOptionItem item)
        {
            children.Add(item);
            if (item is IOwnerSettable)
            {
                ((IOwnerSettable)item).Owner = this;
            }

            nameMap.Add(item.Name, item);
            if (item is OptionGroup)
            {
                //propagate structure changes
                ((IOptionGroup)item).StructureChanged += item_StructureChanged;
            }
            //register for child notification events
            item.PropertyChanged += new PropertyChangedEventHandler(item_PropertyChanged);
            //fire structure change notification event
            OnStructureChanged();
            return(item);
        }
Exemple #28
0
        ///<inheritdoc/>
        protected override void SetupHandler()
        {
            createRouter();
            OptionGroup layoutGroup = Handler.AddGroup(TOP_LEVEL);

            layoutGroup.SetAttribute(TableEditorFactory.RENDERING_HINTS_ATTRIBUTE, TableEditorFactory.RenderingHints.Invisible);
            layoutGroup.SetAttribute(DefaultEditorFactory.RENDERING_HINTS_ATTRIBUTE, DefaultEditorFactory.RenderingHints.Invisible);

            ConstraintManager cm = new ConstraintManager(Handler);

            layoutGroup.AddList(SCOPE, scopes, SCOPE_ALL_EDGES);
            layoutGroup.AddBool(USE_SELECTED_EDGES_AS_MASTER, false);
            layoutGroup.AddBool(CONSIDER_EDGE_DIRECTION, router.DirectedMode);
            layoutGroup.AddBool(USE_ADAPTIVE_LINE_DISTANCE, router.AdaptiveLineDistances);
            layoutGroup.AddInt(LINE_DISTANCE, (int)router.LineDistance, 0, 50);
            IOptionItem joinEndsItem     = layoutGroup.AddBool(JOINS_ENDS, router.JoinEnds);
            IOptionItem joinDistanceItem = layoutGroup.AddInt(JOIN_DISTANCE, (int)router.AbsJoinEndDistance, 0, 50);

            cm.SetEnabledOnValueEquals(joinEndsItem, true, joinDistanceItem);
        }
Exemple #29
0
                public HotkeyOptionList(IInteractionOptionList <GameObject> options)
                    : base(options.ToString())
                {
                    foreach (IInteractionOptionItem <IActor, GameObject, GameHitParameters <GameObject> > paramOption in options.IOptions())
                    {
                        IOptionItem option = paramOption as IOptionItem;
                        if (option == null)
                        {
                            continue;
                        }

                        if (!(option is IOptionList))
                        {
                            if (string.IsNullOrEmpty(option.HotkeyID))
                            {
                                continue;
                            }
                        }

                        mOptions.Add(new HotkeyOption(option));
                    }
                }
Exemple #30
0
        /// <summary>
        /// Configures additional attributes for an option item or option group, such as collapsed state and group visibility.
        /// </summary>
        /// <param name="item">The item or group to configure.</param>
        /// <param name="propertyInfo">The associated property info.</param>
        protected virtual void ConfigureItem(IOptionItem item, PropertyInfo propertyInfo)
        {
            NullableAttribute nullableAttribute =
                (NullableAttribute)Attribute.GetCustomAttribute(propertyInfo, typeof(NullableAttribute));

            if (nullableAttribute != null)
            {
                item.Attributes[OptionItem.SupportNullValueAttribute] = nullableAttribute.IsNullable;
            }
            else
            {
                CanBeNullAttribute canBeNull =
                    (CanBeNullAttribute)Attribute.GetCustomAttribute(propertyInfo, typeof(CanBeNullAttribute));
                NotNullAttribute notNull =
                    (NotNullAttribute)Attribute.GetCustomAttribute(propertyInfo, typeof(NotNullAttribute));
                if (canBeNull != null)
                {
                    item.Attributes[OptionItem.SupportNullValueAttribute] = true;
                }
                else if (notNull != null)
                {
                    item.Attributes[OptionItem.SupportNullValueAttribute] = false;
                }
            }

            DescriptionAttribute attribute = GetAttribute <DescriptionAttribute>(propertyInfo);

            if (attribute != null && !attribute.IsDefaultAttribute())
            {
                item.Attributes[OptionItem.DescriptionAttribute] = attribute.Description;
            }

            var customAttributes = Attribute.GetCustomAttributes(propertyInfo);

            foreach (var attrib in customAttributes.OfType <OptionItemAttributeAttribute>())
            {
                item.Attributes[attrib.Name] = attrib.Value;
            }
        }