use of com.google.gwt.dom.client.InputElement in project che by eclipse.
the class CustomListBox method select.
/**
* Selects an item with given text.
*
* @param text
* text of an item to be selected
*/
public void select(String text) {
// uncheck previous value
if (selectedIndex >= 0) {
InputElement inputElement = getListItemElement(selectedIndex);
inputElement.setChecked(false);
}
// find and select a new one
if (text != null) {
for (int i = 0; i < getItemCount(); i++) {
if (text.equals(getItemText(i))) {
setSelectedIndex(i);
return;
}
}
}
// clear the selection
selectedIndex = -1;
currentItemLabel.setInnerText("");
}
use of com.google.gwt.dom.client.InputElement in project che by eclipse.
the class CustomListBox method setItemSelected.
/**
* Sets whether an individual list item is selected.
*
* @param index
* the index of the item to be selected or unselected
* @param selected
* <code>true</code> to select the item
*/
public void setItemSelected(int index, boolean selected) {
if (index < 0 || index >= getItemCount()) {
return;
}
if (selected) {
selectedIndex = index;
currentItemLabel.setInnerText(getItemText(index));
}
final InputElement inputElement = getListItemElement(index);
inputElement.setChecked(selected);
}
use of com.google.gwt.dom.client.InputElement in project che by eclipse.
the class CustomListBox method setSelectedIndex.
/**
* Sets the currently selected index.
*
* @param index
* the index of the item to be selected
*/
public void setSelectedIndex(int index) {
if (index < 0) {
return;
}
//set default index if not added options yet
if (index >= getItemCount()) {
defaultSelectedIndex = index;
return;
}
selectedIndex = index;
currentItemLabel.setInnerText(getItemText(index));
InputElement inputElement = getListItemElement(index);
inputElement.setChecked(true);
}
use of com.google.gwt.dom.client.InputElement in project che by eclipse.
the class CustomComboBox method setValue.
/**
* Sets the value associated with the item at a given index.
*
* @param index
* the index of the item to be set
* @param value
* the item's new value
* @throws IndexOutOfBoundsException
* if the index is out of range
*/
public void setValue(int index, String value) {
checkIndex(index);
final InputElement inputElement = getListItemElement(index);
inputElement.setValue(value);
}
use of com.google.gwt.dom.client.InputElement in project che by eclipse.
the class CustomComboBox method setSelectedIndex.
/**
* Sets the currently selected index.
*
* @param index
* the index of the item to be selected
*/
public void setSelectedIndex(int index) {
if (index < 0) {
return;
}
//set default index if not added options yet
if (index >= getItemCount()) {
defaultSelectedIndex = index;
return;
}
selectedIndex = index;
currentInputElement.setValue(getItemText(index));
final InputElement inputElement = getListItemElement(index);
inputElement.setChecked(true);
}
Aggregations