Class HtmlImageInput

    • Method Detail

      • getSubmitNameValuePairs

        public NameValuePair[] getSubmitNameValuePairs()

        Returns an array of NameValuePairs that are the values that will be sent back to the server whenever this element's containing form is submitted.

        THIS METHOD IS INTENDED FOR THE USE OF THE FRAMEWORK ONLY AND SHOULD NOT BE USED BY CONSUMERS OF HTMLUNIT. USE AT YOUR OWN RISK.

        Specified by:
        getSubmitNameValuePairs in interface SubmittableElement
        Overrides:
        getSubmitNameValuePairs in class HtmlInput
        Returns:
        the values that will be sent back to the server whenever this element's containing form is submitted
      • click

        public Page click()
                   throws java.io.IOException
        Submit the form that contains this input. Only a couple of the inputs support this method so it is made protected here. Those subclasses that wish to expose it will override and make it public.
        Overrides:
        click in class DomElement
        Returns:
        the Page that is the result of submitting this page to the server
        Throws:
        java.io.IOException - If an IO error occurs
      • 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 occurred
      • click

        public <P extends Page> P click​(int x,
                                        int y)
                                 throws java.io.IOException,
                                        ElementNotFoundException
        Simulate clicking this input with a pointing device. The x and y coordinates of the pointing device will be sent to the server.
        Type Parameters:
        P - the page type
        Parameters:
        x - the x coordinate of the pointing device at the time of clicking
        y - the y coordinate of the pointing device at the time of clicking
        Returns:
        the page that is loaded after the click has taken place
        Throws:
        java.io.IOException - If an IO error occurs
        ElementNotFoundException - If a particular XML element could not be found in the DOM model
      • click

        public <P extends Page> P click​(org.htmlunit.javascript.host.event.Event event,
                                        boolean shiftKey,
                                        boolean ctrlKey,
                                        boolean altKey,
                                        boolean ignoreVisibility)
                                 throws java.io.IOException
        INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
        Simulates clicking on this element, returning the page in the window that has the focus after the element has been clicked. Note that the returned page may or may not be the same as the original page, depending on the type of element being clicked, the presence of JavaScript action listeners, etc.
        Overrides:
        click in class DomElement
        Type Parameters:
        P - the page type
        Parameters:
        event - the click event used
        shiftKey - true if SHIFT is pressed during the click
        ctrlKey - true if CTRL is pressed during the click
        altKey - true if ALT is pressed during the click
        ignoreVisibility - whether to ignore visibility or not
        Returns:
        the page contained in the current window as returned by WebClient.getCurrentWindow()
        Throws:
        java.io.IOException - if an IO error occurs
      • setValue

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

        protected boolean isRequiredSupported()
        Returns whether this element supports the required constraint.
        Overrides:
        isRequiredSupported in class HtmlInput
        Returns:
        whether this element supports the required constraint
      • setSrcAttribute

        public void setSrcAttribute​(java.lang.String src)
        Sets the src attribute.
        Overrides:
        setSrcAttribute in class HtmlInput
        Parameters:
        src - the src attribute
      • saveAs

        public void saveAs​(java.io.File file)
                    throws java.io.IOException
        Saves this image as the specified file.
        Parameters:
        file - the file to save to
        Throws:
        java.io.IOException - if an IO error occurs