/** * Returns the value of the checked property. Although this property is * defined in Input it doesn't make any sense for input's other than * checkbox and radio. This implementation does nothing. The * implementations in Checkbox and Radio actually do the work. * *@return the checked property */ public boolean jsxGet_checked() { return ((HtmlInput) getDomNodeOrDie()).isChecked(); }
/** * Returns the value of the checked property. Although this property is * defined in Input it doesn't make any sense for input's other than * checkbox and radio. This implementation does nothing. The * implementations in Checkbox and Radio actually do the work. * *@return the checked property */ public boolean jsxGet_checked() { return ((HtmlInput) getDomNodeOrDie()).isChecked(); }
/** * Returns the value of the checked property. Although this property is * defined in Input it doesn't make any sense for input's other than * checkbox and radio. This implementation does nothing. The * implementations in Checkbox and Radio actually do the work. * *@return the checked property */ public boolean jsxGet_checked() { return ((HtmlInput) getDomNodeOrDie()).isChecked(); }
/** * Returns the value of the checked property. Although this property is * defined in Input it doesn't make any sense for input's other than * checkbox and radio. This implementation does nothing. The * implementations in Checkbox and Radio actually do the work. * *@return the checked property */ @JsxGetter public boolean isChecked() { return getDomNodeOrDie().isChecked(); }
/** * Returns the value of the checked property. Although this property is * defined in Input it doesn't make any sense for input's other than * checkbox and radio. This implementation does nothing. The * implementations in Checkbox and Radio actually do the work. * *@return the checked property */ @JsxGetter public boolean isChecked() { return getDomNodeOrDie().isChecked(); }
public boolean isSelected() { assertElementNotStale(); if (element instanceof HtmlInput) return ((HtmlInput) element).isChecked(); else if (element instanceof HtmlOption) return ((HtmlOption) element).isSelected(); throw new UnsupportedOperationException("Unable to determine if element is selected. Tag name is: " + element.getTagName()); }
@Override public boolean isSelected() { assertElementNotStale(); if (element instanceof HtmlInput) { return ((HtmlInput) element).isChecked(); } else if (element instanceof HtmlOption) { return ((HtmlOption) element).isSelected(); } throw new UnsupportedOperationException( "Unable to determine if element is selected. Tag name is: " + element.getTagName()); }
private static boolean isValidForSubmission(final HtmlElement element, final SubmittableElement submitElement) { final String tagName = element.getTagName(); if (!SUBMITTABLE_ELEMENT_NAMES.contains(tagName)) { return false; } if (element.hasAttribute("disabled")) { return false; } // clicked input type="image" is submitted even if it hasn't a name if (element == submitElement && element instanceof HtmlImageInput) { return true; } if (!HtmlIsIndex.TAG_NAME.equals(tagName) && !element.hasAttribute("name")) { return false; } if (!HtmlIsIndex.TAG_NAME.equals(tagName) && "".equals(element.getAttributeDirect("name"))) { return false; } if (element instanceof HtmlInput) { final String type = element.getAttributeDirect("type").toLowerCase(Locale.ROOT); if ("radio".equals(type) || "checkbox".equals(type)) { return ((HtmlInput) element).isChecked(); } } if (HtmlSelect.TAG_NAME.equals(tagName)) { return ((HtmlSelect) element).isValidForSubmission(); } return true; }
private static boolean isValidForSubmission(final HtmlElement element, final SubmittableElement submitElement) { final String tagName = element.getTagName(); if (!SUBMITTABLE_ELEMENT_NAMES.contains(tagName)) { return false; } if (element.hasAttribute("disabled")) { return false; } // clicked input type="image" is submitted even if it hasn't a name if (element == submitElement && element instanceof HtmlImageInput) { return true; } if (!HtmlIsIndex.TAG_NAME.equals(tagName) && !element.hasAttribute("name")) { return false; } if (!HtmlIsIndex.TAG_NAME.equals(tagName) && "".equals(element.getAttributeDirect("name"))) { return false; } if (element instanceof HtmlInput) { final String type = element.getAttributeDirect("type").toLowerCase(Locale.ROOT); if ("radio".equals(type) || "checkbox".equals(type)) { return ((HtmlInput) element).isChecked(); } } if (HtmlSelect.TAG_NAME.equals(tagName)) { return ((HtmlSelect) element).isValidForSubmission(); } return true; }
/** * {@inheritDoc} */ @Override public void click() throws IOException { final HtmlInput domNode = getDomNodeOrDie(); final boolean originalState = domNode.isChecked(); final Event event; if (getBrowserVersion().hasFeature(EVENT_ONCLICK_USES_POINTEREVENT)) { event = new PointerEvent(domNode, MouseEvent.TYPE_CLICK, false, false, false, MouseEvent.BUTTON_LEFT); } else { event = new MouseEvent(domNode, MouseEvent.TYPE_CLICK, false, false, false, MouseEvent.BUTTON_LEFT); } domNode.click(event, true); final boolean newState = domNode.isChecked(); if (originalState != newState && (domNode instanceof HtmlRadioButtonInput || domNode instanceof HtmlCheckBoxInput)) { domNode.fireEvent(Event.TYPE_CHANGE); } }
/** * {@inheritDoc} */ @Override public void click() throws IOException { final HtmlInput domNode = getDomNodeOrDie(); final boolean originalState = domNode.isChecked(); final Event event; if (getBrowserVersion().hasFeature(EVENT_ONCLICK_USES_POINTEREVENT)) { event = new PointerEvent(domNode, MouseEvent.TYPE_CLICK, false, false, false, MouseEvent.BUTTON_LEFT); } else { event = new MouseEvent(domNode, MouseEvent.TYPE_CLICK, false, false, false, MouseEvent.BUTTON_LEFT); } domNode.click(event, true); final boolean newState = domNode.isChecked(); if (originalState != newState && (domNode instanceof HtmlRadioButtonInput || domNode instanceof HtmlCheckBoxInput)) { domNode.fireEvent(Event.TYPE_CHANGE); } }
return trueOrNull(((HtmlInput) element).isChecked());