/// <inheritdoc/>
        public AnchorControlObject SelectSingle(ControlSelectionContext context)
        {
            ArgumentUtility.CheckNotNull("context", context);

            var scope = context.Scope.FindCss(c_htmlAnchorTag, Options.Single);

            return(CreateControlObject(context, scope));
        }
Example #2
0
        /// <inheritdoc/>
        public TextBoxControlObject SelectFirst(ControlSelectionContext context)
        {
            ArgumentUtility.CheckNotNull("context", context);

            var scope = context.Scope.FindTagWithAttribute(c_htmlTextBoxTag, "type", "text");

            return(CreateControlObject(context, scope));
        }
        /// <inheritdoc/>
        public ImageButtonControlObject SelectFirst(ControlSelectionContext context)
        {
            ArgumentUtility.CheckNotNull("context", context);

            var scope = context.Scope.FindTagWithAttribute(c_inputTag, "type", "image");

            return(CreateControlObject(context, scope));
        }
        /// <inheritdoc/>
        public AnchorControlObject SelectPerIndex(ControlSelectionContext context, int index)
        {
            ArgumentUtility.CheckNotNull("context", context);

            var scope = context.Scope.FindXPath(string.Format("(.//{0})[{1}]", c_htmlAnchorTag, index));

            return(CreateControlObject(context, scope));
        }
        /// <inheritdoc/>
        public ImageControlObject SelectFirst(ControlSelectionContext context)
        {
            ArgumentUtility.CheckNotNull("context", context);

            var scope = context.Scope.FindCss(c_imgTag);

            return(CreateControlObject(context, scope));
        }
        /// <inheritdoc/>
        public TControlObject SelectFirst(ControlSelectionContext context)
        {
            ArgumentUtility.CheckNotNull("context", context);

            var scope = context.Scope.FindTagWithAttribute("*", DiagnosticMetadataAttributes.ControlType, _controlType);

            return(CreateControlObject(context, scope));
        }
        /// <inheritdoc/>
        public TControlObject SelectPerIndex(ControlSelectionContext context, int index)
        {
            ArgumentUtility.CheckNotNull("context", context);

            var hasAttributeCheck = XPathUtils.CreateHasAttributeCheck(DiagnosticMetadataAttributes.ControlType, _controlType);
            var scope             = context.Scope.FindXPath(string.Format("(.//*{0})[{1}]", hasAttributeCheck, index));

            return(CreateControlObject(context, scope));
        }
        /// <inheritdoc/>
        public AnchorControlObject SelectPerTextContent(ControlSelectionContext context, string textContent)
        {
            ArgumentUtility.CheckNotNull("context", context);
            ArgumentUtility.CheckNotNullOrEmpty("textContent", textContent);

            var scope = context.Scope.FindXPath(string.Format("(.//{0})[.='{1}']", c_htmlAnchorTag, textContent));

            return(CreateControlObject(context, scope));
        }
        /// <inheritdoc/>
        public TControlObject SelectPerHtmlID(ControlSelectionContext context, string htmlID)
        {
            ArgumentUtility.CheckNotNull("context", context);
            ArgumentUtility.CheckNotNull("htmlID", htmlID);

            var scope = context.Scope.FindId(htmlID);

            return(CreateControlObject(context, scope));
        }
Example #10
0
        /// <inheritdoc/>
        protected override BocAutoCompleteReferenceValueControlObject CreateControlObject(
            ControlObjectContext newControlObjectContext,
            ControlSelectionContext controlSelectionContext)
        {
            ArgumentUtility.CheckNotNull("controlSelectionContext", controlSelectionContext);
            ArgumentUtility.CheckNotNull("newControlObjectContext", newControlObjectContext);

            return(new BocAutoCompleteReferenceValueControlObject(newControlObjectContext));
        }
        /// <inheritdoc/>
        public ImageControlObject SelectPerIndex(ControlSelectionContext context, int index)
        {
            ArgumentUtility.CheckNotNull("context", context);

            var xPathSelector = string.Format("(.//{0})[{1}]", c_imgTag, index);
            var scope         = context.Scope.FindXPath(xPathSelector);

            return(CreateControlObject(context, scope));
        }
        /// <inheritdoc/>
        protected override BocListControlObject CreateControlObject(
            ControlObjectContext newControlObjectContext,
            ControlSelectionContext controlSelectionContext)
        {
            ArgumentUtility.CheckNotNull("controlSelectionContext", controlSelectionContext);
            ArgumentUtility.CheckNotNull("newControlObjectContext", newControlObjectContext);

            return(new BocListControlObject(newControlObjectContext));
        }
Example #13
0
        /// <inheritdoc/>
        public TextBoxControlObject SelectPerIndex(ControlSelectionContext context, int index)
        {
            ArgumentUtility.CheckNotNull("context", context);

            var hasAttributeCheck = XPathUtils.CreateHasAttributeCheck("type", "text");
            var xPathSelector     = string.Format("(.//{0}{1})[{2}]", c_htmlTextBoxTag, hasAttributeCheck, index);
            var scope             = context.Scope.FindXPath(xPathSelector);

            return(CreateControlObject(context, scope));
        }
        /// <inheritdoc/>
        public TControlObject SelectPerLocalID(ControlSelectionContext context, string localID)
        {
            ArgumentUtility.CheckNotNull("context", context);
            ArgumentUtility.CheckNotNull("localID", localID);

            var scope = context.Scope.FindIdEndingWith("_" + localID);

            if (!scope.Exists())
            {
                scope = context.Scope.FindId(localID);
            }

            return(CreateControlObject(context, scope));
        }
Example #15
0
        /// <inheritdoc/>
        public TControlObject SelectPerDisplayName(ControlSelectionContext context, string displayName)
        {
            ArgumentUtility.CheckNotNull("context", context);
            ArgumentUtility.CheckNotNull("displayName", displayName);

            var scope = context.Scope.FindTagWithAttributes(
                "*",
                new Dictionary <string, string>
            {
                { DiagnosticMetadataAttributes.ControlType, ControlType },
                { DiagnosticMetadataAttributesForObjectBinding.DisplayName, displayName }
            });

            return(CreateControlObject(context, scope));
        }
Example #16
0
        /// <inheritdoc/>
        public DropDownMenuControlObject SelectPerTextContent(ControlSelectionContext context, string textContent)
        {
            ArgumentUtility.CheckNotNull("context", context);
            ArgumentUtility.CheckNotNull("textContent", textContent);

            var scope = context.Scope.FindTagWithAttributes(
                "*",
                new Dictionary <string, string>
            {
                { DiagnosticMetadataAttributes.ControlType, ControlType },
                { DiagnosticMetadataAttributes.Content, textContent }
            });

            return(CreateControlObject(context, scope));
        }
Example #17
0
        /// <inheritdoc/>
        public WebButtonControlObject SelectPerItemID(ControlSelectionContext context, string itemID)
        {
            ArgumentUtility.CheckNotNull("context", context);
            ArgumentUtility.CheckNotNull("itemID", itemID);

            var scope = context.Scope.FindTagWithAttributes(
                "*",
                new Dictionary <string, string>
            {
                { DiagnosticMetadataAttributes.ControlType, ControlType },
                { DiagnosticMetadataAttributes.ItemID, itemID }
            });

            return(CreateControlObject(context, scope));
        }
        /// <inheritdoc/>
        public FormGridControlObject SelectPerTitle(ControlSelectionContext context, string title)
        {
            ArgumentUtility.CheckNotNull("context", context);
            ArgumentUtility.CheckNotNull("title", title);

            // Todo RM-6337: Replace with CSS-based search as soon as FormGridManager is able to render the data-title attribute.
            // Note: it is not that easy, as we do not know the content of the title row on the server...FormGrid is just a design transformator...
            //var scope = context.Scope.FindCss (string.Format ("table[{0}='{1}']", DiagnosticMetadataAttributes.FormGridTitle, title));

            // Note: this implementation assumes that the title cell has the CSS class formGridTitleCell.
            var hasClassCheck = XPathUtils.CreateHasClassCheck("formGridTitleCell");
            var scope         = context.Scope.FindXPath(string.Format(".//table[tbody/tr/td{0}='{1}']", hasClassCheck, title));

            // This alterantive implementation assumes that the title cell is the very first row and column.
            // var scope = context.Scope.FindXPath (string.Format (".//table[tbody/tr[1]/td[1]='{0}']", title));

            return(CreateControlObject(context, scope));
        }
Example #19
0
        /// <inheritdoc/>
        public TControlObject SelectPerDomainProperty(ControlSelectionContext context, string domainProperty, string domainClass)
        {
            ArgumentUtility.CheckNotNull("context", context);
            ArgumentUtility.CheckNotNull("domainProperty", domainProperty);

            var diagnosticMetadata = new Dictionary <string, string>
            {
                { DiagnosticMetadataAttributes.ControlType, ControlType },
                { DiagnosticMetadataAttributesForObjectBinding.BoundProperty, domainProperty }
            };

            if (domainClass != null)
            {
                diagnosticMetadata.Add(DiagnosticMetadataAttributesForObjectBinding.BoundType, domainClass);
            }

            var scope = context.Scope.FindTagWithAttributes("*", diagnosticMetadata);

            return(CreateControlObject(context, scope));
        }
Example #20
0
 /// <inheritdoc/>
 public TControlObject Select(ControlSelectionContext context)
 {
     return(_controlSelector.SelectPerDomainProperty(context, _domainProperty, _domainClass));
 }
        /// <summary>
        /// Creates a control object of type <typeparamref name="TControlObject"/> using the given <paramref name="context"/> and <paramref name="scope"/>,
        /// making help of the template method <see cref="CreateControlObject(ControlObjectContext,ControlSelectionContext)"/>.
        /// </summary>
        protected TControlObject CreateControlObject([NotNull] ControlSelectionContext context, [NotNull] ElementScope scope)
        {
            var newControlObjectContext = context.CloneForControl(context.PageObject, scope);

            return(CreateControlObject(newControlObjectContext, context));
        }
 /// <summary>
 /// Template method for derived control selectors to instantiate the control object.
 /// </summary>
 protected abstract TControlObject CreateControlObject(
     [NotNull] ControlObjectContext newControlObjectContext,
     [NotNull] ControlSelectionContext controlSelectionContext);
 /// <inheritdoc/>
 public TControlObject Select(ControlSelectionContext context)
 {
     return(_controlSelector.SelectPerDisplayName(context, _displayName));
 }