Search in sources :

Example 1 with LabelElement

use of com.google.gwt.dom.client.LabelElement in project che by eclipse.

the class CustomComboBox method setItemText.

/**
     * Sets the text associated with the item at a given index.
     *
     * @param index
     *         the index of the item to be set
     * @param text
     *         the item's new text
     * @throws IndexOutOfBoundsException
     *         if the index is out of range
     */
public void setItemText(int index, String text) {
    checkIndex(index);
    final Element optionElement = (Element) optionsPanel.getElement().getChild(index);
    final LabelElement labelElement = (LabelElement) optionElement.getElementsByTagName("label").getItem(0);
    labelElement.setInnerText(text);
    if (selectedIndex == index) {
        currentInputElement.setValue(text);
    }
}
Also used : LabelElement(com.google.gwt.dom.client.LabelElement) InputElement(com.google.gwt.dom.client.InputElement) LabelElement(com.google.gwt.dom.client.LabelElement) Element(com.google.gwt.dom.client.Element)

Example 2 with LabelElement

use of com.google.gwt.dom.client.LabelElement in project che by eclipse.

the class CustomComboBox method getItemText.

/**
     * Gets the text associated with the item at the specified index.
     *
     * @param index
     *         the index of the item whose text is to be retrieved
     * @return the text associated with the item
     * @throws IndexOutOfBoundsException
     *         if the index is out of range
     */
public String getItemText(int index) {
    checkIndex(index);
    final Element optionElement = (Element) optionsPanel.getElement().getChild(index);
    final InputElement labelElement = (InputElement) optionElement.getElementsByTagName("input").getItem(0);
    return labelElement.getValue();
}
Also used : InputElement(com.google.gwt.dom.client.InputElement) LabelElement(com.google.gwt.dom.client.LabelElement) Element(com.google.gwt.dom.client.Element) InputElement(com.google.gwt.dom.client.InputElement)

Example 3 with LabelElement

use of com.google.gwt.dom.client.LabelElement in project che by eclipse.

the class CustomListBox method getItemText.

/**
     * Gets the text associated with the item at the specified index.
     *
     * @param index
     *         the index of the item whose text is to be retrieved
     * @return the text associated with the item
     * @throws IndexOutOfBoundsException
     *         if the index is out of range
     */
public String getItemText(int index) {
    checkIndex(index);
    final Element optionElement = (Element) optionsPanel.getElement().getChild(index);
    final LabelElement labelElement = (LabelElement) optionElement.getElementsByTagName("label").getItem(0);
    return labelElement.getInnerText();
}
Also used : LabelElement(com.google.gwt.dom.client.LabelElement) InputElement(com.google.gwt.dom.client.InputElement) LabelElement(com.google.gwt.dom.client.LabelElement) Element(com.google.gwt.dom.client.Element)

Example 4 with LabelElement

use of com.google.gwt.dom.client.LabelElement in project che by eclipse.

the class CustomListBox method setItemText.

/**
     * Sets the text associated with the item at a given index.
     *
     * @param index
     *         the index of the item to be set
     * @param text
     *         the item's new text
     * @throws IndexOutOfBoundsException
     *         if the index is out of range
     */
public void setItemText(int index, String text) {
    checkIndex(index);
    final Element optionElement = (Element) optionsPanel.getElement().getChild(index);
    final LabelElement labelElement = (LabelElement) optionElement.getElementsByTagName("label").getItem(0);
    labelElement.setInnerText(text);
    if (selectedIndex == index) {
        currentItemLabel.setInnerText(text);
    }
}
Also used : LabelElement(com.google.gwt.dom.client.LabelElement) InputElement(com.google.gwt.dom.client.InputElement) LabelElement(com.google.gwt.dom.client.LabelElement) Element(com.google.gwt.dom.client.Element)

Aggregations

Element (com.google.gwt.dom.client.Element)4 InputElement (com.google.gwt.dom.client.InputElement)4 LabelElement (com.google.gwt.dom.client.LabelElement)4