/// <summary> /// Adds the currently valid <see cref="IPortStyle"/> items to the context. /// </summary> /// <remarks> /// Uses <see cref="ValidPortStyles"/>. /// </remarks> /// <param name="context">The context to use.</param> protected virtual void AddValidStyleItems(IOptionBuilderContext context) { CollectionOptionItem <Type> portStyleItems = new CollectionOptionItem <Type>(DefaultPortPropertyMapBuilder.PortStyleProperty, validPortStyles); portStyleItems.SetAttribute(CollectionOptionItem <Type> .USE_ONLY_DOMAIN_ATTRIBUTE, false); context.BindItem(portStyleItems, DefaultPortPropertyMapBuilder.PortStyleProperty); }
/// <summary> /// Adds an <see cref="IOptionItem"/> that is bound to the label's <see cref="ILabel.Text"/> /// property to the builder. /// </summary> /// <param name="context">The context to use for building.</param> protected virtual void AddLabelTextItem(IOptionBuilderContext context) { context.BindItem(new OptionItem(DefaultLabelPropertyMapBuilder.TextProperty) { Value = string.Empty, Type = typeof(string) }, DefaultLabelPropertyMapBuilder.TextProperty); }
public void AddItems(IOptionBuilderContext context, Type subjectType, object subject) { GenericOptionItem <StringTrimming> trimmingItem = new GenericOptionItem <StringTrimming>(StringFormatPropertyMapBuilder.TrimmingProperty); trimmingItem.SetAttribute(OptionItem.SUPPORT_NULL_VALUE_ATTRIBUTE, false); context.BindItem(trimmingItem, StringFormatPropertyMapBuilder.TrimmingProperty); GenericOptionItem <StringAlignment> alignmentItem = new GenericOptionItem <StringAlignment>(StringFormatPropertyMapBuilder.AlignmentProperty); alignmentItem.SetAttribute(OptionItem.SUPPORT_NULL_VALUE_ATTRIBUTE, false); context.BindItem(alignmentItem, StringFormatPropertyMapBuilder.AlignmentProperty); GenericOptionItem <StringAlignment> lineAlignItem = new GenericOptionItem <StringAlignment>(StringFormatPropertyMapBuilder.LineAlignmentProperty); lineAlignItem.SetAttribute(OptionItem.SUPPORT_NULL_VALUE_ATTRIBUTE, false); context.BindItem(lineAlignItem, StringFormatPropertyMapBuilder.LineAlignmentProperty); IList <StringFormatFlags> directionValues = new List <StringFormatFlags>(2); directionValues.Add(StringFormatFlags.DirectionRightToLeft); directionValues.Add(StringFormatFlags.DirectionVertical); CollectionOptionItem <StringFormatFlags> directionItem = new CollectionOptionItem <StringFormatFlags>(StringFormatPropertyMapBuilder.DirectionProperty, directionValues); directionItem.SetAttribute(OptionItem.SUPPORT_NULL_VALUE_ATTRIBUTE, true); directionItem.SetAttribute(OptionItem.NULL_VALUE_STRING_ATTRIBUTE, "LeftToRight"); context.BindItem(directionItem, StringFormatPropertyMapBuilder.DirectionProperty); }
/// <summary> /// Adds the currently valid <see cref="ILabelStyle"/> items to the context. /// </summary> /// <remarks> /// Uses <see cref="ValidLabelStyles"/>. /// </remarks> /// <param name="context">The context to use.</param> protected virtual void AddValidStyleItems(IOptionBuilderContext context) { CollectionOptionItem <Type> labelStyleItems = new CollectionOptionItem <Type>(DefaultLabelPropertyMapBuilder.LabelStyleProperty, validLabelStyles); labelStyleItems.Attributes[CollectionOptionItem <Type> .USE_ONLY_DOMAIN_ATTRIBUTE] = false; labelStyleItems.Attributes[OptionItem.ItemTemplateAttribute] = Application.Current.FindResource("LabelStyleTypeTemplate") as DataTemplate; context.BindItem(labelStyleItems, DefaultLabelPropertyMapBuilder.LabelStyleProperty); }
/// <inheritdoc/> public virtual void AddItems(IOptionBuilderContext context, Type subjectType, object subject) { //layout group IEdge edge = (IEdge)subject; BuildLabelOptions(context, edge); BuildStyleOptions(context, edge); }
/// <summary> /// This method <see cref="IOptionBuilderContext.BindItem(IOptionItem,string)"/> binds the /// <see cref="INode.Layout"/> properties to corresponding option items. /// </summary> /// <param name="context">The context to use.</param> protected virtual void BuildLayoutOptions(IOptionBuilderContext context) { context = context.CreateChildContext(DefaultNodePropertyMapBuilder.LayoutPropertyName); context.BindItem(new DoubleOptionItem(DefaultNodePropertyMapBuilder.LayoutXName), DefaultNodePropertyMapBuilder.LayoutXName); context.BindItem(new DoubleOptionItem(DefaultNodePropertyMapBuilder.LayoutYName), DefaultNodePropertyMapBuilder.LayoutYName); context.BindItem(new DoubleOptionItem(DefaultNodePropertyMapBuilder.LayoutWidthName), DefaultNodePropertyMapBuilder.LayoutWidthName); context.BindItem(new DoubleOptionItem(DefaultNodePropertyMapBuilder.LayoutHeightName), DefaultNodePropertyMapBuilder.LayoutHeightName); }
/// <inheritdoc/> public virtual void AddItems(IOptionBuilderContext context, Type subjectType, object subject) { //layout group INode node = (INode)subject; BuildLabelOptions(context, node); BuildStyleOptions(context, node); BuildLayoutOptions(context); }
/// <summary> /// Adds <see cref="IOptionItem"/>s that are bound to the label's <see cref="ILabel.PreferredSize"/> /// property to the builder. /// </summary> /// <param name="context">The context to use for building.</param> protected virtual void AddPreferredSizeItems(IOptionBuilderContext context) { var preferredSizeItem = new OptionItem(DefaultLabelPropertyMapBuilder.PreferredSizeProperty) { Type = typeof(SizeD) }; context.BindItem(preferredSizeItem, DefaultLabelPropertyMapBuilder.PreferredSizeProperty); }
/// <summary> /// Adds <see cref="IOptionItem"/>s that are bound to the label's <see cref="ILabel.LayoutParameter"/> /// and the associated <see cref="ILabelModelParameter.Model"/>. /// property to the builder. /// </summary> /// <param name="context">The context to use for building.</param> /// <param name="label">The current label instance.</param> protected virtual void AddLabelLayoutParameterItems(IOptionBuilderContext context, ILabel label) { if (label.LayoutParameter != null) { IOptionBuilder modelBuilder = GetLabelModelOptionBuilder(context, label.LayoutParameter.Model); if (modelBuilder != null) { modelBuilder.AddItems(context.CreateChildContext("Model"), label.LayoutParameter.Model.GetType(), label.LayoutParameter.Model); } } }
/// <summary> /// Filters the list of properties so that only the desired ones are used. /// </summary> /// <remarks>By default, all properties that have a <see cref="DisplayNameAttribute"/> with a non empty value set are included.</remarks> /// <param name="properties"></param> /// <param name="context"></param> /// <returns></returns> private PropertyInfo[] FilterProperties(PropertyInfo[] properties, IOptionBuilderContext context) { List <PropertyInfo> filteredList = new List <PropertyInfo>(); foreach (var property in properties) { if (property.CanWrite) { filteredList.Add(property); } } return(filteredList.ToArray()); }
/// <inheritdoc/> public virtual void AddItems(IOptionBuilderContext context, Type subjectType, object subject) { IPort port = subject as IPort; if (port == null) { return; } BuildLabelOptions(context, port); // BuildStyleOptions(context, port); AddValidStyleItems(context); AddStyleItems(context, port); }
/// <inheritdoc/> public virtual void AddItems(IOptionBuilderContext context, Type subjectType, object subject) { AddLabelTextItem(context); AddPreferredSizeItems(context); AddValidModelsItems(context); ILabel label = subject as ILabel; if (label == null) { return; } AddLabelLayoutParameterItems(context, label); AddValidStyleItems(context); AddStyleItems(context, label); }
/// <summary> /// Adds a <see cref="IOptionItem"/>s that are bound to the port's <see cref="IPort.Style"/> /// to the builder. /// </summary> /// <param name="context">The context to use for building.</param> /// <param name="port"></param> protected virtual void AddStyleItems(IOptionBuilderContext context, IPort port) { //style group... //retrieve current style... IPortStyle style = port.Style; if (style != null) { //retrieve OptionBuilder from style IOptionBuilder styleBuilder = GetStyleOptionBuilder(context, style); if (styleBuilder != null) { styleBuilder.AddItems(context.CreateChildContext(DefaultPortPropertyMapBuilder.StyleProperty), style.GetType(), style); } } }
/// <summary> /// Builds the options for the first label of the node instance. /// </summary> /// <param name="context">The context to use for building.</param> /// <param name="subject">The current node instance.</param> protected virtual void BuildLabelOptions(IOptionBuilderContext context, ILabelOwner subject) { if (subject.Labels.Count > 0) { context = context.CreateChildContext(DefaultNodePropertyMapBuilder.LabelPropertyName); ILabel label = subject.Labels[0]; if (label != null) { IOptionBuilder builder = GetLabelOptionBuilder(context, label); if (builder != null) { builder.AddItems(context, typeof(ILabel), label); } } } }
internal ChildBuilderContext(IOptionBuilderContext context, string prefix, string groupName, ISelectionProvider <T> selectionProvider) { IOptionGroup group = context.Lookup <IOptionGroup>(); if (group != null && groupName != string.Empty) { group.Items.Add(this.parentGroup = new OptionGroup(groupName)); } else { this.parentGroup = group; } this.parent = context; this.propertyPrefix = CreatePrefix(prefix, groupName); this.selectionProvider = selectionProvider; }
/// <summary> /// Builds the options for the style of the edge instance. /// </summary> /// <param name="context">The context to use for building.</param> /// <param name="edge">The current edge instance.</param> protected virtual void BuildStyleOptions(IOptionBuilderContext context, IEdge edge) { context = context.CreateChildContext(StylePropertyName); //style group... //retrieve current style... IEdgeStyle style = edge.Style; if (style != null) { //retrieve OptionBuilder from style IOptionBuilder builder = GetStyleOptionBuilder(context, style); if (builder != null) { builder.AddItems(context, style.GetType(), style); } } }
private IOptionBuilder GetBuilder(PropertyInfo info, IOptionBuilderContext context, object subject, Type type) { IOptionBuilder builder = null; OptionBuilderAttribute builderAttribute = (OptionBuilderAttribute)Attribute.GetCustomAttribute(info, typeof(OptionBuilderAttribute)); if (builderAttribute != null) { builder = Activator.CreateInstance(builderAttribute.OptionBuilderType) as IOptionBuilder; } else { object value = info.GetGetMethod().Invoke(subject, null); builder = context.GetOptionBuilder(type, value); } return(builder); }
/// <summary> /// Builds the options for the style of the node instance. /// </summary> /// <param name="context">The context to use for building.</param> /// <param name="node">The current node instance.</param> protected virtual void BuildStyleOptions(IOptionBuilderContext context, INode node) { context = context.CreateChildContext(DefaultNodePropertyMapBuilder.StylePropertyName); context.BindItem(new BoolOptionItem("Shadow"), "Shadow"); //style group... //retrieve current style... INodeStyle style = node.Style; if (style != null) { //retrieve OptionBuilder from style IOptionBuilder builder = GetStyleOptionBuilder(context, style); if (builder != null) { builder.AddItems(context, style.GetType(), style); } } }
/// <summary> /// Adds the currently valid <see cref="ILabelModel"/> items to the context. /// </summary> /// <remarks> /// Uses <see cref="ValidEdgeLabelModels"/>, <see cref="ValidNodeLabelModels"/>, and <see cref="ValidPortLabelModels"/> /// respectively. /// </remarks> /// <param name="context">The context to use.</param> protected virtual void AddValidModelsItems(IOptionBuilderContext context) { CollectionOptionItem <Type> edgeLabelModelItem = new CollectionOptionItem <Type>(DefaultLabelPropertyMapBuilder.EdgeLabelModelProperty, validEdgeLabelModels); edgeLabelModelItem.SetAttribute(CollectionOptionItem <Type> .USE_ONLY_DOMAIN_ATTRIBUTE, false); context.BindItem(edgeLabelModelItem, DefaultLabelPropertyMapBuilder.EdgeLabelModelProperty); CollectionOptionItem <Type> nodeLabelModelItem = new CollectionOptionItem <Type>(DefaultLabelPropertyMapBuilder.NodeLabelModelProperty, validNodeLabelModels); nodeLabelModelItem.SetAttribute(CollectionOptionItem <Type> .USE_ONLY_DOMAIN_ATTRIBUTE, false); context.BindItem(nodeLabelModelItem, DefaultLabelPropertyMapBuilder.NodeLabelModelProperty); CollectionOptionItem <Type> portLabelModelItem = new CollectionOptionItem <Type>(DefaultLabelPropertyMapBuilder.PortLabelModelProperty, validPortLabelModels); portLabelModelItem.SetAttribute(CollectionOptionItem <Type> .USE_ONLY_DOMAIN_ATTRIBUTE, false); context.BindItem(portLabelModelItem, DefaultLabelPropertyMapBuilder.PortLabelModelProperty); }
/// <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/> 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); } } } }
/// <summary> /// This method <see cref="IOptionBuilderContext.BindItem(IOptionItem,string)"/> binds the /// <see cref="INode.Layout"/> properties to corresponding option items. /// </summary> /// <param name="context">The context to use.</param> protected virtual void BuildLayoutOptions(IOptionBuilderContext context) { context = context.CreateChildContext(DefaultNodePropertyMapBuilder.LayoutPropertyName); context.BindItem(new OptionItem(DefaultNodePropertyMapBuilder.LayoutXName) { Value = 0.0d, Type = typeof(double) }, DefaultNodePropertyMapBuilder.LayoutXName); context.BindItem(new OptionItem(DefaultNodePropertyMapBuilder.LayoutYName) { Value = 0.0d, Type = typeof(double) }, DefaultNodePropertyMapBuilder.LayoutYName); context.BindItem(new OptionItem(DefaultNodePropertyMapBuilder.LayoutWidthName) { Value = 0.0d, Type = typeof(double) }, DefaultNodePropertyMapBuilder.LayoutWidthName); context.BindItem(new OptionItem(DefaultNodePropertyMapBuilder.LayoutHeightName) { Value = 0.0d, Type = typeof(double) }, DefaultNodePropertyMapBuilder.LayoutHeightName); }
/// <summary> /// Filters the list of properties so that only the desired ones are used. /// </summary> /// <remarks>By default, all properties are included.</remarks> /// <param name="context"></param> /// <param name="properties"></param> /// <returns></returns> private PropertyInfo[] FilterProperties(IOptionBuilderContext context, PropertyInfo[] properties) { List <PropertyInfo> infos = new List <PropertyInfo>(); foreach (var i in properties) { if (i.CanRead && i.CanWrite) { var getter = i.GetGetMethod(false); var setter = i.GetSetMethod(false); if (getter != null && setter != null) { if (!setter.IsStatic && !getter.IsStatic) { infos.Add(i); } } } } return(infos.ToArray()); }
/// <summary> /// Adds the currently valid <see cref="ILabelModel"/> items to the context. /// </summary> /// <remarks> /// Uses <see cref="ValidEdgeLabelModels"/>, <see cref="ValidNodeLabelModels"/>, and <see cref="ValidPortLabelModels"/> /// respectively. /// </remarks> /// <param name="context">The context to use.</param> protected virtual void AddValidModelsItems(IOptionBuilderContext context) { CollectionOptionItem <Type> edgeLabelModelItem = new CollectionOptionItem <Type>(DefaultLabelPropertyMapBuilder.EdgeLabelModelProperty, validEdgeLabelModels); edgeLabelModelItem.Attributes[CollectionOptionItem <Type> .USE_ONLY_DOMAIN_ATTRIBUTE] = false; edgeLabelModelItem.Attributes[OptionItem.ItemTemplateAttribute] = Application.Current.FindResource("LabelModelTypeTemplate") as DataTemplate; context.BindItem(edgeLabelModelItem, DefaultLabelPropertyMapBuilder.EdgeLabelModelProperty); CollectionOptionItem <Type> nodeLabelModelItem = new CollectionOptionItem <Type>(DefaultLabelPropertyMapBuilder.NodeLabelModelProperty, validNodeLabelModels); nodeLabelModelItem.Attributes[CollectionOptionItem <Type> .USE_ONLY_DOMAIN_ATTRIBUTE] = false; nodeLabelModelItem.Attributes[OptionItem.ItemTemplateAttribute] = Application.Current.FindResource("LabelModelTypeTemplate") as DataTemplate; context.BindItem(nodeLabelModelItem, DefaultLabelPropertyMapBuilder.NodeLabelModelProperty); CollectionOptionItem <Type> portLabelModelItem = new CollectionOptionItem <Type>(DefaultLabelPropertyMapBuilder.PortLabelModelProperty, validPortLabelModels); portLabelModelItem.Attributes[CollectionOptionItem <Type> .USE_ONLY_DOMAIN_ATTRIBUTE] = false; portLabelModelItem.Attributes[OptionItem.ItemTemplateAttribute] = Application.Current.FindResource("LabelModelTypeTemplate") as DataTemplate; context.BindItem(portLabelModelItem, DefaultLabelPropertyMapBuilder.PortLabelModelProperty); }
/// <inheritdoc/> public void AddItems(IOptionBuilderContext context, Type subjectType, object subject) { PropertyInfo[] propertyInfos = SortProperties(context, FilterProperties(context, subjectType.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.FlattenHierarchy))); foreach (PropertyInfo info in propertyInfos) { DisplayAttribute descriptionAttribute = GetAttribute <DisplayAttribute>(info); #if UseDataAnnotations string description = descriptionAttribute == null ? info.Name : descriptionAttribute.GetName(); #else string description = descriptionAttribute == null ? info.Name : descriptionAttribute.DisplayName; #endif object value = subject == null ? null : info.GetValue(subject, null); Type type = value == null ? info.PropertyType : value.GetType(); IOptionBuilder builder = GetBuilder(context, info, subject, type); if (builder != null) { IOptionBuilderContext childContext = context.CreateChildContext(description); builder.AddItems(childContext, type, value); ConfigureItem((IOptionItem)childContext.Lookup(typeof(IOptionGroup)), info); } else { IOptionItem item = CreateItem(context, info, type, description, value); if (item != null) { context.BindItem(item, description); ConfigureItem(item, info); } } } }
public DefaultPropertyInfoComparer(IOptionBuilderContext context) { this.context = context; }
/// <summary> /// Factory method that creates the option item using the provided parameters. /// </summary> protected virtual IOptionItem CreateItem(IOptionBuilderContext context, PropertyInfo propertyInfo, Type type, string description, object value) { IOptionItem item = null; // if (type.IsEnum) { // Type genericType = typeof (GenericOptionItem<>); // Type newType = genericType.MakeGenericType(type); // item = newType.GetConstructor(new Type[] {typeof (string)}).Invoke(new object[] {description}) as IOptionItem; // } else if (type == typeof (Color)) { // item = new ColorOptionItem(description); // } else if (type.IsGenericType && type.GetGenericTypeDefinition().IsAssignableFrom((typeof(ICollection <>)))) { Type[] types = type.GetGenericArguments(); if (types.Length == 1) { Type collectionItemType = types[0]; Type collectionBaseType = typeof(ICollection <>); Type collectionType = collectionBaseType.MakeGenericType(collectionItemType); Type collectionOptionItemType = typeof(CollectionOptionItem <>); item = collectionOptionItemType.MakeGenericType(collectionItemType).GetConstructor( new Type[] { typeof(string), collectionType }).Invoke(new object[] { description, value }) as IOptionItem; } } if (item == null) { if (type.IsValueType) { if (IsNullable(type)) { item = new OptionItem() { Type = Nullable.GetUnderlyingType(type), Name = description }; item.Attributes[OptionItem.SupportNullValueAttribute] = true; } else if (IsNullable(propertyInfo.PropertyType)) { item = new OptionItem() { Type = type, Name = description }; item.Attributes[OptionItem.SupportNullValueAttribute] = true; } else { item = new OptionItem() { Type = type, Name = description }; item.Attributes[OptionItem.SupportNullValueAttribute] = false; } } else { item = new OptionItem() { Type = type, Name = description }; } } var customAttributes = Attribute.GetCustomAttributes(propertyInfo); foreach (var attribute in customAttributes.OfType <OptionItemAttributeAttribute>()) { item.Attributes[attribute.Name] = attribute.Value; } TypeConverterAttribute converter = GetAttribute <TypeConverterAttribute>(propertyInfo); if (converter != null && !converter.IsDefaultAttribute()) { try { Type typeConverter = Type.GetType(converter.ConverterTypeName); if (typeConverter != null) { item.Attributes[OptionItem.CustomTypeConverterAttribute] = typeConverter; } } catch (Exception e) { Trace.WriteLine("Could not load custom type converter " + e.Message); } } return(item); }
/// <summary> /// Sorts the list of displayed properties. /// </summary> /// <remarks>By default, properties are sorted alphabetically by display name.</remarks> /// <param name="context"></param> /// <param name="properties"></param> /// <returns></returns> protected virtual PropertyInfo[] SortProperties(IOptionBuilderContext context, PropertyInfo[] properties) { Array.Sort(properties, new DefaultPropertyInfoComparer(context)); return(properties); }
/// <summary> /// Method that retrieves an <see cref="IOptionBuilder"/> instance for the given style and context. /// </summary> /// <remarks> /// This implementation simply delegates to <see cref="IOptionBuilderContext.GetOptionBuilder(object)"/>. /// </remarks> /// <param name="context">The context to use.</param> /// <param name="style">The current style instance.</param> /// <returns>The builder to use or <see langword="null"/>.</returns> protected virtual IOptionBuilder GetStyleOptionBuilder(IOptionBuilderContext context, INodeStyle style) { return(context.GetOptionBuilder(style)); }
/// <summary> /// Method that retrieves an <see cref="IOptionBuilder"/> instance for the given label and context. /// </summary> /// <remarks> /// This implementation simply delegates to <see cref="IOptionBuilderContext.GetOptionBuilder(object)"/>. /// </remarks> /// <param name="context">The context to use.</param> /// <param name="label">The label instance.</param> /// <returns>The builder to use or <see langword="null"/>.</returns> protected virtual IOptionBuilder GetLabelOptionBuilder(IOptionBuilderContext context, ILabel label) { return(context.GetOptionBuilder(label)); }