Esempio n. 1
0
        private static string ResolveControlName(UIComponentMetadata metadata, FindAttribute findAttribute)
        {
            NameAttribute nameAttribute = metadata.Get <NameAttribute>(x => x.At(AttributeLevels.Declared));

            if (!string.IsNullOrWhiteSpace(nameAttribute?.Value))
            {
                return(nameAttribute.Value);
            }

            if (findAttribute is FindByLabelAttribute findByLabelAttribute && findByLabelAttribute.Match == TermMatch.Equals)
            {
                if (findByLabelAttribute.Values?.Any() ?? false)
                {
                    return(string.Join("/", findByLabelAttribute.Values));
                }
                else
                {
                    TermAttribute termAttribute = metadata.Get <TermAttribute>(x => x.At(AttributeLevels.Declared));
                    if (termAttribute?.Values?.Any() ?? false)
                    {
                        return(string.Join("/", termAttribute.Values));
                    }
                }
            }

            return(metadata.ComponentDefinitionAttribute.
                   NormalizeNameIgnoringEnding(metadata.Name).
                   ToString(TermCase.Title));
        }
Esempio n. 2
0
        private static string ResolveControlName(UIComponentMetadata metadata, FindAttribute findAttribute)
        {
            NameAttribute nameAttribute = metadata.Get <NameAttribute>(AttributeLevels.Declared);

            if (nameAttribute != null && !string.IsNullOrWhiteSpace(nameAttribute.Value))
            {
                return(nameAttribute.Value);
            }

            FindByLabelAttribute findByLabelAttribute = findAttribute as FindByLabelAttribute;

            if (findByLabelAttribute != null)
            {
                if (findByLabelAttribute.Values != null && findByLabelAttribute.Values.Any())
                {
                    return(string.Join("/", findByLabelAttribute.Values));
                }
                else
                {
                    TermAttribute termAttribute = metadata.Get <TermAttribute>(AttributeLevels.Declared);
                    if (termAttribute != null && termAttribute.Values != null && termAttribute.Values.Any())
                    {
                        return(string.Join("/", termAttribute.Values));
                    }
                }
            }

            return(metadata.ComponentDefinitonAttribute.
                   NormalizeNameIgnoringEnding(metadata.Name).
                   ToString(TermCase.Title));
        }
Esempio n. 3
0
        private static string ResolvePageObjectNameFromMetadata(Type type)
        {
            NameAttribute nameAttribute = GetClassAttributes(type).OfType <NameAttribute>().FirstOrDefault();

            return(nameAttribute != null && !string.IsNullOrWhiteSpace(nameAttribute.Value)
                ? nameAttribute.Value
                : ResolvePageObjectNameFromType(type));
        }
Esempio n. 4
0
        private static string GetControlNameFromNameAttribute(UIComponentMetadata metadata)
        {
            NameAttribute nameAttribute = metadata.Get <NameAttribute>(x => x.At(AttributeLevels.Declared));

            return(!string.IsNullOrWhiteSpace(nameAttribute?.Value)
                ? nameAttribute.Value
                : null);
        }