Java Code Examples for com.google.gwt.dom.client.InputElement#as()

The following examples show how to use com.google.gwt.dom.client.InputElement#as() . 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 File: BaseCheckBox.java    From gwt-material with Apache License 2.0 6 votes vote down vote up
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 File: RadioButton.java    From swellrt with Apache License 2.0 5 votes vote down vote up
@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 3
Source File: TableSelecter.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
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 4
Source File: RadioButton.java    From incubator-retired-wave with Apache License 2.0 5 votes vote down vote up
@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 5
Source File: DateInput.java    From gwt-material with Apache License 2.0 4 votes vote down vote up
public DateInput() {
    super(InputElement.as(Document.get().createTextInputElement()));
    getElement().setAttribute("type", "date");
}
 
Example 6
Source File: RadioButton.java    From swellrt with Apache License 2.0 4 votes vote down vote up
/**
 * Returns the implNodelet as an InputElement or null.
 */
public static InputElement getImplAsInputElement(ContentElement element) {
  return InputElement.as(element.getImplNodelet());
}
 
Example 7
Source File: RadioButton.java    From incubator-retired-wave with Apache License 2.0 4 votes vote down vote up
/**
 * Returns the implNodelet as an InputElement or null.
 */
public static InputElement getImplAsInputElement(ContentElement element) {
  return InputElement.as(element.getImplNodelet());
}