internal static bool BindItemHelper(IOptionItem item, string virtualPropertyName, IOptionGroup group, ISelectionProvider <T> selectionProvider, string prefix, bool addToOptionHandler) { bool retval = false; IOptionItemFilter <T> filter = item.Lookup <IOptionItemFilter <T> >(); string finalName = DefaultOptionBuilderContext <object> .CreatePrefix(prefix, virtualPropertyName); OptionItemValidities validity; if (filter == null) { validity = CheckValidity(new DefaultOptionItemFilter <T>(finalName), selectionProvider); } else { validity = CheckValidity(new DefaultOptionItemFilter <T>(finalName), selectionProvider) & CheckValidity(filter, selectionProvider); } if (validity != OptionItemValidities.Invalid) { CompositeHandler <T> .Create(selectionProvider, finalName, item); if (addToOptionHandler) { group.AddOptionItem(item); } retval = true; if (validity != OptionItemValidities.ReadWrite) { item.Enabled = false; } } return(retval); }
internal ChildBuilderContext(IOptionBuilderContext parent, string prefix, string groupName, ISelectionProvider <T> selectionProvider) { IOptionGroup group = parent.Lookup <IOptionGroup>(); if (group != null && groupName != string.Empty) { group.AddOptionItem(this.parentGroup = new OptionGroup(groupName)); } else { this.parentGroup = group; } this.parent = parent; this.propertyPrefix = CreatePrefix(prefix, groupName); this.selectionProvider = selectionProvider; }