private static ComponentScopeLocateOptions CreateScopeLocateOptions(UIComponentMetadata metadata, FindAttribute findAttribute) { ControlDefinitionAttribute definition = metadata.ComponentDefinitionAttribute as ControlDefinitionAttribute; int index = findAttribute.Index; ComponentScopeLocateOptions options = new ComponentScopeLocateOptions { Metadata = metadata, ElementXPath = definition?.ScopeXPath ?? ScopeDefinitionAttribute.DefaultScopeXPath, Index = index >= 0 ? (int?)index : null, Visibility = findAttribute.Visibility, OuterXPath = findAttribute.OuterXPath }; if (findAttribute is ITermFindAttribute termFindAttribute) { options.Terms = termFindAttribute.GetTerms(metadata); } if (findAttribute is ITermMatchFindAttribute termMatchFindAttribute) { options.Match = termMatchFindAttribute.GetTermMatch(metadata); } return(options); }
private static ComponentScopeLocateOptions CreateScopeLocateOptions(UIComponentMetadata metadata, FindAttribute findAttribute) { ControlDefinitionAttribute definition = metadata.ComponentDefinitonAttribute as ControlDefinitionAttribute; int index = findAttribute.Index; ComponentScopeLocateOptions options = new ComponentScopeLocateOptions { Metadata = metadata, ElementXPath = definition != null ? definition.ScopeXPath : "*", Index = index >= 0 ? (int?)index : null, Visibility = findAttribute.Visibility }; ITermFindAttribute termFindAttribute = findAttribute as ITermFindAttribute; ITermMatchFindAttribute termMatchFindAttribute = findAttribute as ITermMatchFindAttribute; if (termFindAttribute != null) { options.Terms = termFindAttribute.GetTerms(metadata); } if (termMatchFindAttribute != null) { options.Match = termMatchFindAttribute.GetTermMatch(metadata); } return(options); }
public static string ResolveControlTypeName(ControlDefinitionAttribute controlDefinitionAttribute, Type controlType) { return(controlDefinitionAttribute.ComponentTypeName ?? NormalizeTypeName(controlType).ToString(TermCase.MidSentence)); }
public static string ResolveControlTypeName(UIComponentMetadata metadata) { ControlDefinitionAttribute controlDefinitionAttribute = GetControlDefinition(metadata); return(ResolveControlTypeName(controlDefinitionAttribute, metadata.ComponentType)); }
public static string ResolveControlTypeName(Type type) { ControlDefinitionAttribute controlDefinitionAttribute = GetControlDefinition(type); return(ResolveControlTypeName(controlDefinitionAttribute, type)); }
private ControlDefinitionAttribute ResolveItemDefinition() { ControlDefinitionAttribute definition = DeclaredAttributes?.OfType <ControlDefinitionAttribute>().FirstOrDefault(); return(definition ?? UIComponentResolver.GetControlDefinition(typeof(TItem))); }