private Element showHideCheckbox(String label, String className, boolean initiallyHidden) { Element LI = document.createElement("LI"); HTMLInputElement checkbox = (HTMLInputElement) document.createElement("input"); LI.appendChild(checkbox); LI.appendChild(document.createTextNode(label)); checkbox.setAttribute("type", "checkbox"); String arglist = "('" + className + "')"; String show = "show_nodes_of_class" + arglist; String hide = "hide_nodes_of_class" + arglist; checkbox.setAttribute("onchange", "if (this.checked) {" + hide + "} else {" + show + "}"); checkbox.setChecked(initiallyHidden); return LI; }
@Override public Optional<String> getValue() { String value = null; if (element instanceof HTMLInputElement) { value = ((HTMLInputElement) element).getValue(); } else if (element instanceof HTMLOptionElement) { value = ((HTMLOptionElement) element).getValue(); } return value == null || value.isEmpty() ? Optional.empty() : Optional.of(value); }
@Override public Element setValue(String value) { if (element instanceof HTMLInputElement) { ((HTMLInputElement) element).setValue(value); } else if (element instanceof HTMLOptionElement) { ((HTMLOptionElement) element).setValue(value); } return this; }
public UserCredentials(HTMLInputElement username, HTMLInputElement password){ this.username = username; this.password = password; }