Class HtmlCheckBoxInput

    • Method Detail

      • isChecked

        public boolean isChecked()
        Returns true if this element is currently selected.
        Overrides:
        isChecked in class HtmlInput
        Returns:
        true if this element is currently selected
      • reset

        public void reset()
        Returns the value of this element to the default value or checked state (usually what it was at the time the page was loaded, unless it has been modified via JavaScript).
        Specified by:
        reset in interface SubmittableElement
        Overrides:
        reset in class HtmlInput
        See Also:
        SubmittableElement.reset()
      • setChecked

        public Page setChecked​(boolean isChecked)
        Sets the checked attribute, returning the page that occupies this input's window after setting the attribute. Note that the returned page may or may not be the original page, depending on the presence of JavaScript event handlers, etc.
        Overrides:
        setChecked in class HtmlInput
        Parameters:
        isChecked - true if this element is to be selected
        Returns:
        the page that occupies this input's window after setting the attribute
      • doClickStateUpdate

        protected boolean doClickStateUpdate​(boolean shiftKey,
                                             boolean ctrlKey)
                                      throws java.io.IOException
        This method implements the control state update part of the click action.

        The default implementation only calls doClickStateUpdate on parent's DomElement (if any). Subclasses requiring different behavior (like HtmlSubmitInput) will override this method.

        Overrides:
        doClickStateUpdate in class DomElement
        Parameters:
        shiftKey - true if SHIFT is pressed
        ctrlKey - true if CTRL is pressed
        Returns:
        true if doClickFireEvent method has to be called later on (to signal, that the value was changed)
        Throws:
        java.io.IOException - if an IO error occurs
      • doClickFireClickEvent

        protected ScriptResult doClickFireClickEvent​(org.htmlunit.javascript.host.event.Event event)
        This method implements the control onclick handler call during the click action.
        Overrides:
        doClickFireClickEvent in class DomElement
        Parameters:
        event - the click event used
        Returns:
        the script result
      • doClickFireChangeEvent

        protected void doClickFireChangeEvent()
        This method implements the control onchange handler call during the click action.
        Overrides:
        doClickFireChangeEvent in class DomElement
      • isStateUpdateFirst

        protected boolean isStateUpdateFirst()
        First update the internal state of checkbox and then handle "onclick" event. Returns true if state updates should be done before onclick event handling. This method returns false by default, and is expected to be overridden to return true by derived classes like HtmlCheckBoxInput.
        Overrides:
        isStateUpdateFirst in class DomElement
        Returns:
        true if state updates should be done before onclick event handling
      • preventDefault

        protected void preventDefault()
        This method is called if the current fired event is canceled by preventDefault() in FireFox, or by returning false in Internet Explorer.

        The default implementation does nothing.

        Overrides:
        preventDefault in class DomElement
      • setValue

        public void setValue​(java.lang.String newValue)
        Sets the value. Also sets the default value.
        Overrides:
        setValue in class HtmlInput
        Parameters:
        newValue - the new value
      • setDefaultChecked

        public void setDefaultChecked​(boolean defaultChecked)
        Sets the default checked state to use when this element gets reset, if applicable. The default implementation is empty; only checkboxes and radio buttons really care what the default checked value is.
        Specified by:
        setDefaultChecked in interface SubmittableElement
        Parameters:
        defaultChecked - the default checked state to use when this element gets reset, if applicable
        See Also:
        SubmittableElement.setDefaultChecked(boolean)
      • isDefaultChecked

        public boolean isDefaultChecked()
        Returns the default checked state to use when this element gets reset, if applicable. The default implementation returns false; only checkboxes and radio buttons really care what the default checked value is.
        Specified by:
        isDefaultChecked in interface SubmittableElement
        Overrides:
        isDefaultChecked in class HtmlInput
        Returns:
        the default checked state to use when this element gets reset, if applicable
        See Also:
        SubmittableElement.isDefaultChecked()
      • setAttributeNS

        protected void setAttributeNS​(java.lang.String namespaceURI,
                                      java.lang.String qualifiedName,
                                      java.lang.String attributeValue,
                                      boolean notifyAttributeChangeListeners,
                                      boolean notifyMutationObservers)
        Sets the value of the attribute specified by namespace and qualified name.
        Overrides:
        setAttributeNS in class HtmlInput
        Parameters:
        namespaceURI - the URI that identifies an XML namespace
        qualifiedName - the qualified name (prefix:local) of the attribute
        attributeValue - the value of the attribute
        notifyAttributeChangeListeners - to notify the associated HtmlAttributeChangeListeners
        notifyMutationObservers - to notify MutationObservers or not