/** * {@inheritDoc} * @see SubmittableElement#reset() */ @Override public void reset() { if (defaultCheckedState_) { setAttribute("checked", "checked"); } else { removeAttribute("checked"); } }
/** * {@inheritDoc} * @see SubmittableElement#reset() */ @Override public void reset() { if (defaultCheckedState_) { setAttribute("checked", "checked"); } else { removeAttribute("checked"); } }
/** * {@inheritDoc} * @see SubmittableElement#reset() */ @Override public void reset() { if (defaultCheckedState_) { setAttribute("checked", "checked"); } else { removeAttribute("checked"); } }
/** * Creates an instance. * If no value is specified, it is set to "on" as browsers do (eg IE6 and Mozilla 1.7) * even if spec says that it is not allowed * (<a href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-value-INPUT">W3C</a>). * @param namespaceURI the URI that identifies an XML namespace * @param qualifiedName the qualified name of the element type to instantiate * @param page the page that contains this element * @param attributes the initial attributes */ HtmlRadioButtonInput(final String namespaceURI, final String qualifiedName, final SgmlPage page, final Map<String, DomAttr> attributes) { super(namespaceURI, qualifiedName, page, attributes); // default value for both IE6 and Mozilla 1.7 even if spec says it is unspecified if (getAttribute("value") == ATTRIBUTE_NOT_DEFINED) { setAttribute("value", "on"); } defaultCheckedState_ = hasAttribute("checked"); }
/** * Creates an instance. * If no value is specified, it is set to "on" as browsers do (eg IE6 and Mozilla 1.7) * even if spec says that it is not allowed * (<a href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-value-INPUT">W3C</a>). * @param namespaceURI the URI that identifies an XML namespace * @param qualifiedName the qualified name of the element type to instantiate * @param page the page that contains this element * @param attributes the initial attributes */ HtmlRadioButtonInput(final String namespaceURI, final String qualifiedName, final SgmlPage page, final Map<String, DomAttr> attributes) { super(namespaceURI, qualifiedName, page, attributes); // default value for both IE6 and Mozilla 1.7 even if spec says it is unspecified if (getAttribute("value") == ATTRIBUTE_NOT_DEFINED) { setAttribute("value", "on"); } defaultCheckedState_ = hasAttribute("checked"); }
/** * Creates an instance. * If no value is specified, it is set to "on" as browsers do (eg IE6 and Mozilla 1.7) * even if spec says that it is not allowed * (<a href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-value-INPUT">W3C</a>). * @param namespaceURI the URI that identifies an XML namespace * @param qualifiedName the qualified name of the element type to instantiate * @param page the page that contains this element * @param attributes the initial attributes */ HtmlRadioButtonInput(final String namespaceURI, final String qualifiedName, final SgmlPage page, final Map<String, DomAttr> attributes) { super(namespaceURI, qualifiedName, page, attributes); // default value for both IE6 and Mozilla 1.7 even if spec says it is unspecified if (getAttribute("value") == ATTRIBUTE_NOT_DEFINED) { setAttribute("value", "on"); } defaultCheckedState_ = hasAttribute("checked"); }
/** * Selects the specified radio button in the form. Only a radio button that is actually contained * in the form can be selected. * * @param radioButtonInput the radio button to select */ void setCheckedRadioButton(final HtmlRadioButtonInput radioButtonInput) { if (!isAncestorOf(radioButtonInput) && !lostChildren_.contains(radioButtonInput)) { throw new IllegalArgumentException("HtmlRadioButtonInput is not child of this HtmlForm"); } final List<HtmlRadioButtonInput> radios = getRadioButtonsByName(radioButtonInput.getNameAttribute()); for (final HtmlRadioButtonInput input : radios) { if (input == radioButtonInput) { input.setAttribute("checked", "checked"); } else { input.removeAttribute("checked"); } } }
/** * Selects the specified radio button in the form. Only a radio button that is actually contained * in the form can be selected. * * @param radioButtonInput the radio button to select */ void setCheckedRadioButton(final HtmlRadioButtonInput radioButtonInput) { if (!isAncestorOf(radioButtonInput) && !lostChildren_.contains(radioButtonInput)) { throw new IllegalArgumentException("HtmlRadioButtonInput is not child of this HtmlForm"); } final List<HtmlRadioButtonInput> radios = getRadioButtonsByName(radioButtonInput.getNameAttribute()); for (final HtmlRadioButtonInput input : radios) { if (input == radioButtonInput) { input.setAttribute("checked", "checked"); } else { input.removeAttribute("checked"); } } }
/** * Selects the specified radio button in the form. Only a radio button that is actually contained * in the form can be selected. * * @param radioButtonInput the radio button to select */ void setCheckedRadioButton(final HtmlRadioButtonInput radioButtonInput) { if (!isAncestorOf(radioButtonInput) && !lostChildren_.contains(radioButtonInput)) { throw new IllegalArgumentException("HtmlRadioButtonInput is not child of this HtmlForm"); } final List<HtmlRadioButtonInput> radios = getRadioButtonsByName(radioButtonInput.getNameAttribute()); for (final HtmlRadioButtonInput input : radios) { if (input == radioButtonInput) { input.setAttribute("checked", "checked"); } else { input.removeAttribute("checked"); } } }
/** * Select the specified radio button in the page (outside any <form>). * * @param radioButtonInput the radio Button */ @SuppressWarnings("unchecked") void setCheckedRadioButton(final HtmlRadioButtonInput radioButtonInput) { // May be done in single XPath search? final List<HtmlRadioButtonInput> pageInputs = getByXPath("//input[lower-case(@type)='radio' " + "and @name='" + radioButtonInput.getNameAttribute() + "']"); final List<HtmlRadioButtonInput> formInputs = getByXPath("//form//input[lower-case(@type)='radio' " + "and @name='" + radioButtonInput.getNameAttribute() + "']"); pageInputs.removeAll(formInputs); for (final HtmlRadioButtonInput input : pageInputs) { if (input == radioButtonInput) { input.setAttribute("checked", "checked"); } else { input.removeAttribute("checked"); } } }
/** * Select the specified radio button in the page (outside any <form>). * * @param radioButtonInput the radio Button */ @SuppressWarnings("unchecked") void setCheckedRadioButton(final HtmlRadioButtonInput radioButtonInput) { // May be done in single XPath search? final List<HtmlRadioButtonInput> pageInputs = getByXPath("//input[lower-case(@type)='radio' " + "and @name='" + radioButtonInput.getNameAttribute() + "']"); final List<HtmlRadioButtonInput> formInputs = getByXPath("//form//input[lower-case(@type)='radio' " + "and @name='" + radioButtonInput.getNameAttribute() + "']"); pageInputs.removeAll(formInputs); for (final HtmlRadioButtonInput input : pageInputs) { if (input == radioButtonInput) { input.setAttribute("checked", "checked"); } else { input.removeAttribute("checked"); } } }
/** * Select the specified radio button in the page (outside any <form>). * * @param radioButtonInput the radio Button */ @SuppressWarnings("unchecked") void setCheckedRadioButton(final HtmlRadioButtonInput radioButtonInput) { // May be done in single XPath search? final List<HtmlRadioButtonInput> pageInputs = (List<HtmlRadioButtonInput>) getByXPath("//input[lower-case(@type)='radio' " + "and @name='" + radioButtonInput.getNameAttribute() + "']"); final List<HtmlRadioButtonInput> formInputs = (List<HtmlRadioButtonInput>) getByXPath("//form//input[lower-case(@type)='radio' " + "and @name='" + radioButtonInput.getNameAttribute() + "']"); pageInputs.removeAll(formInputs); for (final HtmlRadioButtonInput input : pageInputs) { if (input == radioButtonInput) { input.setAttribute("checked", "checked"); } else { input.removeAttribute("checked"); } } }