Example usage for com.google.gwt.dom.client InputElement setId

List of usage examples for com.google.gwt.dom.client InputElement setId

Introduction

In this page you can find the example usage for com.google.gwt.dom.client InputElement setId.

Prototype

@Override
    public void setId(String id) 

Source Link

Usage

From source file:org.eclipse.che.ide.ext.git.client.compare.selectablechangespanel.CheckBoxRender.java

License:Open Source License

private void setCheckBoxState(Path nodePath, InputElement checkBoxInputElement) {
    if (indeterminate.contains(nodePath)) {
        checkBoxInputElement.setId(checkBoxInputElement.getId() + "-indeterminate");
        setIndeterminate(checkBoxInputElement);
    } else if (!unselected.contains(nodePath)) {
        checkBoxInputElement.setChecked(true);
        checkBoxInputElement.setId(checkBoxInputElement.getId() + "-checked");
    } else {/*w w w  . ja  va 2  s. c o m*/
        checkBoxInputElement.setId(checkBoxInputElement.getId() + "-unchecked");
    }
}

From source file:rocket.widget.client.RadioButton.java

License:Apache License

/**
 * Replace the current input element with a new one.
 * // ww w .j  a  v  a2  s . c  o  m
 * @param newElement
 *            the new input element
 */
protected void replaceInputElement(final Element newElement) {
    // Collect information we need to set

    final InputElement oldInputElement = this.getElement().cast();

    int tabIndex = getTabIndex();
    boolean checked = isChecked();
    boolean enabled = isEnabled();
    String uid = oldInputElement.getId();
    String accessKey = oldInputElement.getAccessKey();

    // Clear out the old input element
    setChecked(false);
    oldInputElement.setId("");
    oldInputElement.setAccessKey("");

    // Quickly do the actual replace
    final Element parent = oldInputElement.getParentElement().cast();
    final int index = DOM.getChildIndex(parent, (Element) oldInputElement.cast());
    parent.removeChild(oldInputElement);
    DOM.insertChild(parent, (Element) newElement.cast(), index);
    this.invokeReplaceElement(newElement);

    // Setup the new element
    DOM.sinkEvents((Element) oldInputElement.cast(), DOM.getEventsSunk(this.getElement()));
    DOM.setEventListener((Element) oldInputElement.cast(), this);
    oldInputElement.setId(uid);
    if (accessKey != "") {
        oldInputElement.setAccessKey(accessKey);
    }
    setTabIndex(tabIndex);
    setChecked(checked);
    setEnabled(enabled);
}