Java Code Examples for com.google.gwt.dom.client.InputElement
The following examples show how to use
com.google.gwt.dom.client.InputElement. These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: gwt-material Source File: BaseCheckBox.java License: Apache License 2.0 | 6 votes |
protected BaseCheckBox(Element elem) { super(elem, CssName.GWT_CHECKBOX); inputElem = InputElement.as(DOM.createInputCheck()); labelElem = Document.get().createLabelElement(); getElement().appendChild(inputElem); getElement().appendChild(labelElem); String uid = DOM.createUniqueId(); inputElem.setPropertyString("id", uid); labelElem.setHtmlFor(uid); directionalTextHelper = new DirectionalTextHelper(labelElem, true); // Accessibility: setting tab index to be 0 by default, ensuring element // appears in tab sequence. FocusWidget's setElement method already // calls setTabIndex, which is overridden below. However, at the time // that this call is made, inputElem has not been created. So, we have // to call setTabIndex again, once inputElem has been created. setTabIndex(0); }
Example 2
Source Project: gwtmockito Source File: ReturnsCustomMocks.java License: Apache License 2.0 | 6 votes |
@Override public Object answer(InvocationOnMock invocation) throws Throwable { // Make JavaScriptObject.cast work in most cases by forcing it to return the underlying mock // instead of a new mock of type JavaScriptObject. This allows cast to be used in situations // that don't violate the Java type system, but not in situations that do (even though // javascript would allow them). String methodName = invocation.getMethod().getName(); if (invocation.getMock() instanceof JavaScriptObject && methodName.equals("cast")) { return invocation.getMock(); } else if (invocation.getMock() instanceof Element && methodName.equals("getTagName")) { String className = invocation.getMock().getClass().getSimpleName(); return className.substring(0, className.indexOf("Element")).toLowerCase(); } else if (invocation.getMock() instanceof InputElement && methodName.equals("getType")) { return "text"; } else { return super.answer(invocation); } }
Example 3
Source Project: cuba Source File: CubaOptionGroupWidget.java License: Apache License 2.0 | 5 votes |
protected void updateItemsSelection() { for (Widget w : panel) { if (w instanceof RadioButton) { Element input = w.getElement().getFirstChildElement(); if (input instanceof InputElement) { boolean checked = ((InputElement) input).isDefaultChecked(); ((InputElement) input).setChecked(checked); } } } }
Example 4
Source Project: gwt-material Source File: FocusableMixin.java License: Apache License 2.0 | 5 votes |
@Override public void setAccessKey(final char key) { final Element element = uiObject.getElement(); final String accessKey = Character.toString(key); if (AnchorElement.is(element)) { AnchorElement.as(element).setAccessKey(accessKey); } else if (ButtonElement.is(element)) { ButtonElement.as(element).setAccessKey(accessKey); } else if (InputElement.is(element)) { InputElement.as(element).setAccessKey(accessKey); } }
Example 5
Source Project: swellrt Source File: CheckBox.java License: Apache License 2.0 | 5 votes |
@Override public Element createDomImpl(Renderable element) { InputElement inputElem = Document.get().createCheckInputElement(); inputElem.setClassName(CheckConstants.css.check()); // Wrap in non-editable span- Firefox does not fire events for checkboxes // inside contentEditable region. SpanElement nonEditableSpan = Document.get().createSpanElement(); DomHelper.setContentEditable(nonEditableSpan, false, false); nonEditableSpan.appendChild(inputElem); return nonEditableSpan; }
Example 6
Source Project: swellrt Source File: RadioButton.java License: Apache License 2.0 | 5 votes |
@Override public Element createDomImpl(Renderable element) { // Note(user): IE insists that the input element's name attribute is // set at creation to correctly group radio buttons InputElement radioInputElement = Document.get().createRadioInputElement("xx"); radioInputElement.setClassName(CheckConstants.css.radio()); radioInputElement.setTabIndex(0); return radioInputElement; }
Example 7
Source Project: swellrt Source File: RadioButton.java License: Apache License 2.0 | 5 votes |
@Override public void onAttributeModified(ContentElement element, String name, String oldValue, String newValue) { if (GROUP.equalsIgnoreCase(name)) { InputElement inputElement = InputElement.as(element.getImplNodelet()); inputElement.setName(element.getEditorUniqueString() + newValue); } else if (ContentElement.NAME.equalsIgnoreCase(name)) { EditorStaticDeps.logger.trace().log("myname: " + element.getName()); element.getImplNodelet().setId(element.getEditorUniqueString() + newValue); } String groupName = element.getAttribute(GROUP); String elementName = element.getName(); if (groupName != null && elementName != null) { EditorStaticDeps.logger.trace().log("myname: " + element.getName()); ContentElement group = getGroup(element); if (group != null) { EditorStaticDeps.logger.trace().log( "selected: " + group.getAttribute(CheckConstants.VALUE)); if (elementName != null && elementName.equals(group.getAttribute(CheckConstants.VALUE))) { setImplChecked(element, true); } } else { EditorStaticDeps.logger.trace().log("Cannot find associated group"); } } }
Example 8
Source Project: swellrt Source File: Password.java License: Apache License 2.0 | 5 votes |
/** * TODO(danilatos): Have this be called by the central event routing, not the hack * dom listeners below? * * @param p */ public void handleTyping(ContentElement p) { isMutatingLocallyToMatchUserInput = true; try { p.getMutableDoc().setElementAttribute(p, "value", p.getImplNodelet().<InputElement>cast().getValue()); } finally { isMutatingLocallyToMatchUserInput = false; } }
Example 9
Source Project: swellrt Source File: Password.java License: Apache License 2.0 | 5 votes |
@Override public void onAttributeModified(ContentElement element, String name, String oldValue, String newValue) { if (VALUE.equals(name) && !eventHandler.isMutatingLocallyToMatchUserInput) { element.getImplNodelet().<InputElement>cast().setValue(newValue); } }
Example 10
Source Project: putnami-web-toolkit Source File: TableSelecter.java License: GNU Lesser General Public License v3.0 | 5 votes |
TDSelecter() { super(TableCellElement.TAG_TD); if (TableSelecter.this.singleSelection) { this.inputElem = InputElement.as(DOM.createInputRadio(TableSelecter.this.groupId)); } else { this.inputElem = InputElement.as(DOM.createInputCheck()); } this.getElement().appendChild(this.inputElem); }
Example 11
Source Project: incubator-retired-wave Source File: CheckBox.java License: Apache License 2.0 | 5 votes |
@Override public Element createDomImpl(Renderable element) { InputElement inputElem = Document.get().createCheckInputElement(); inputElem.setClassName(CheckConstants.css.check()); // Wrap in non-editable span- Firefox does not fire events for checkboxes // inside contentEditable region. SpanElement nonEditableSpan = Document.get().createSpanElement(); DomHelper.setContentEditable(nonEditableSpan, false, false); nonEditableSpan.appendChild(inputElem); return nonEditableSpan; }
Example 12
Source Project: incubator-retired-wave Source File: RadioButton.java License: Apache License 2.0 | 5 votes |
@Override public Element createDomImpl(Renderable element) { // Note(user): IE insists that the input element's name attribute is // set at creation to correctly group radio buttons InputElement radioInputElement = Document.get().createRadioInputElement("xx"); radioInputElement.setClassName(CheckConstants.css.radio()); radioInputElement.setTabIndex(0); return radioInputElement; }
Example 13
Source Project: incubator-retired-wave Source File: RadioButton.java License: Apache License 2.0 | 5 votes |
@Override public void onAttributeModified(ContentElement element, String name, String oldValue, String newValue) { if (GROUP.equalsIgnoreCase(name)) { InputElement inputElement = InputElement.as(element.getImplNodelet()); inputElement.setName(element.getEditorUniqueString() + newValue); } else if (ContentElement.NAME.equalsIgnoreCase(name)) { EditorStaticDeps.logger.trace().log("myname: " + element.getName()); element.getImplNodelet().setId(element.getEditorUniqueString() + newValue); } String groupName = element.getAttribute(GROUP); String elementName = element.getName(); if (groupName != null && elementName != null) { EditorStaticDeps.logger.trace().log("myname: " + element.getName()); ContentElement group = getGroup(element); if (group != null) { EditorStaticDeps.logger.trace().log( "selected: " + group.getAttribute(CheckConstants.VALUE)); if (elementName != null && elementName.equals(group.getAttribute(CheckConstants.VALUE))) { setImplChecked(element, true); } } else { EditorStaticDeps.logger.trace().log("Cannot find associated group"); } } }
Example 14
Source Project: incubator-retired-wave Source File: Password.java License: Apache License 2.0 | 5 votes |
/** * TODO(danilatos): Have this be called by the central event routing, not the hack * dom listeners below? * * @param p */ public void handleTyping(ContentElement p) { isMutatingLocallyToMatchUserInput = true; try { p.getMutableDoc().setElementAttribute(p, "value", p.getImplNodelet().<InputElement>cast().getValue()); } finally { isMutatingLocallyToMatchUserInput = false; } }
Example 15
Source Project: incubator-retired-wave Source File: Password.java License: Apache License 2.0 | 5 votes |
@Override public void onAttributeModified(ContentElement element, String name, String oldValue, String newValue) { if (VALUE.equals(name) && !eventHandler.isMutatingLocallyToMatchUserInput) { element.getImplNodelet().<InputElement>cast().setValue(newValue); } }
Example 16
Source Project: gwtbootstrap3-extras Source File: SingleValueTagsInput.java License: Apache License 2.0 | 5 votes |
public SingleValueTagsInput(final Collection<? extends Dataset<T>> datasets) { InputElement tagsInput = Document.get().createTextInputElement(); tagsInput.setAttribute("data-role", "tagsinput"); setElement(tagsInput); setDatasets(datasets); }
Example 17
Source Project: cuba Source File: AggregationInputFieldInfo.java License: Apache License 2.0 | 4 votes |
public AggregationInputFieldInfo(String oldValue, String columnKey, InputElement inputElement, TableCellElement td) { this(oldValue, columnKey, inputElement); this.td = td; }
Example 18
Source Project: cuba Source File: AggregationInputFieldInfo.java License: Apache License 2.0 | 4 votes |
public AggregationInputFieldInfo(String oldValue, String columnKey, InputElement inputElement) { this.oldValue = oldValue; this.inputElement = inputElement; this.columnKey = columnKey; }
Example 19
Source Project: cuba Source File: AggregationInputFieldInfo.java License: Apache License 2.0 | 4 votes |
public InputElement getInputElement() { return inputElement; }
Example 20
Source Project: cuba Source File: AggregationInputFieldInfo.java License: Apache License 2.0 | 4 votes |
public void setInputElement(InputElement inputElement) { this.inputElement = inputElement; }
Example 21
Source Project: gwt-material Source File: DateInput.java License: Apache License 2.0 | 4 votes |
public DateInput() { super(InputElement.as(Document.get().createTextInputElement())); getElement().setAttribute("type", "date"); }
Example 22
Source Project: swellrt Source File: CheckBox.java License: Apache License 2.0 | 4 votes |
private void updateCheckboxDom(ContentElement checkbox, boolean isChecked) { Element implNodelet = checkbox.getImplNodelet(); InputElement checkboxElem = (InputElement) implNodelet.getFirstChild(); checkboxElem.setChecked(isChecked); }
Example 23
Source Project: swellrt Source File: RadioButton.java License: Apache License 2.0 | 4 votes |
/** * Returns the implNodelet as an InputElement or null. */ public static InputElement getImplAsInputElement(ContentElement element) { return InputElement.as(element.getImplNodelet()); }
Example 24
Source Project: dashbuilder Source File: CharacterBox.java License: Apache License 2.0 | 4 votes |
private InputElement getInputElement() { return getElement().cast(); }
Example 25
Source Project: putnami-web-toolkit Source File: AbstractInputBox.java License: GNU Lesser General Public License v3.0 | 4 votes |
public void setMaxLength(int maxLength) { InputElement.as(this.input.getElement()).setMaxLength(maxLength); }
Example 26
Source Project: putnami-web-toolkit Source File: AbstractInputBox.java License: GNU Lesser General Public License v3.0 | 4 votes |
public int getMaxLength() { return InputElement.as(this.input.getElement()).getMaxLength(); }
Example 27
Source Project: putnami-web-toolkit Source File: InputFile.java License: GNU Lesser General Public License v3.0 | 4 votes |
public UploadForm destroy() { InputElement.as(this.fileUpload.getElement()).setValue(null); this.handlerRegistrations.removeHandler(); this.formPanel.removeFromParent(); return null; }
Example 28
Source Project: requestor Source File: BinaryData.java License: Apache License 2.0 | 4 votes |
private static native JavaScriptObject getFile(InputElement input, int index) /*-{ return input.files[index]; }-*/;
Example 29
Source Project: incubator-retired-wave Source File: CheckBox.java License: Apache License 2.0 | 4 votes |
private void updateCheckboxDom(ContentElement checkbox, boolean isChecked) { Element implNodelet = checkbox.getImplNodelet(); InputElement checkboxElem = (InputElement) implNodelet.getFirstChild(); checkboxElem.setChecked(isChecked); }
Example 30
Source Project: incubator-retired-wave Source File: RadioButton.java License: Apache License 2.0 | 4 votes |
/** * Returns the implNodelet as an InputElement or null. */ public static InputElement getImplAsInputElement(ContentElement element) { return InputElement.as(element.getImplNodelet()); }