本文整理了Java中com.google.gwt.user.client.ui.ListBox.getSelectElement()
方法的一些代码示例,展示了ListBox.getSelectElement()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ListBox.getSelectElement()
方法的具体详情如下:
包路径:com.google.gwt.user.client.ui.ListBox
类名称:ListBox
方法名:getSelectElement
暂无
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Gets whether this list allows multiple selection.
*
* @return <code>true</code> if multiple selection is allowed
*/
public boolean isMultipleSelect() {
return getSelectElement().isMultiple();
}
代码示例来源:origin: com.google.gwt/gwt-servlet
public void setName(String name) {
getSelectElement().setName(name);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Gets the currently-selected item. If multiple items are selected, this
* method will return the first selected item ({@link #isItemSelected(int)}
* can be used to query individual items).
*
* @return the selected index, or <code>-1</code> if none is selected
*/
public int getSelectedIndex() {
return getSelectElement().getSelectedIndex();
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Gets the number of items that are visible. If only one item is visible,
* then the box will be displayed as a drop-down list.
*
* @return the visible item count
*/
public int getVisibleItemCount() {
return getSelectElement().getSize();
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Sets the number of items that are visible. If only one item is visible,
* then the box will be displayed as a drop-down list.
*
* @param visibleItems the visible item count
*/
public void setVisibleItemCount(int visibleItems) {
getSelectElement().setSize(visibleItems);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Removes all items from the list box.
*/
public void clear() {
getSelectElement().clear();
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Sets whether this list allows multiple selections. <em>NOTE:
* Using this method can spuriously fail on Internet Explorer 6.0.</em>
*
* @param multiple <code>true</code> to allow multiple selections
*/
public void setMultipleSelect(boolean multiple) {
getSelectElement().setMultiple(multiple);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
public String getName() {
return getSelectElement().getName();
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Sets the currently selected index.
*
* After calling this method, only the specified item in the list will remain
* selected. For a ListBox with multiple selection enabled, see
* {@link #setItemSelected(int, boolean)} to select multiple items at a time.
*
* <p>
* Note that setting the selected index programmatically does <em>not</em>
* cause the {@link ChangeHandler#onChange(ChangeEvent)} event to be fired.
* </p>
*
* @param index the index of the item to be selected
*/
public void setSelectedIndex(int index) {
getSelectElement().setSelectedIndex(index);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Gets the number of items present in the list box.
*
* @return the number of items
*/
public int getItemCount() {
return getSelectElement().getOptions().getLength();
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Removes the item at the specified index.
*
* @param index the index of the item to be removed
* @throws IndexOutOfBoundsException if the index is out of range
*/
public void removeItem(int index) {
checkIndex(index);
getSelectElement().remove(index);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* 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
* @param dir the item's direction.
* @throws IndexOutOfBoundsException if the index is out of range
*/
public void setItemText(int index, String text, Direction dir) {
checkIndex(index);
if (text == null) {
throw new NullPointerException("Cannot set an option to have null text");
}
setOptionText(getSelectElement().getOptions().getItem(index), text, dir);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Sets the value associated with the item at a given index. This value can be
* used for any purpose, but is also what is passed to the server when the
* list box is submitted as part of a {@link FormPanel}.
*
* @param index the index of the item to be set
* @param value the item's new value; cannot be <code>null</code>
* @throws IndexOutOfBoundsException if the index is out of range
*/
public void setValue(int index, String value) {
checkIndex(index);
getSelectElement().getOptions().getItem(index).setValue(value);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Gets the value associated with the item at a given index.
*
* @param index the index of the item to be retrieved
* @return the item's associated value
* @throws IndexOutOfBoundsException if the index is out of range
*/
public String getValue(int index) {
checkIndex(index);
return getSelectElement().getOptions().getItem(index).getValue();
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Determines whether an individual list item is selected.
*
* @param index the index of the item to be tested
* @return <code>true</code> if the item is selected
* @throws IndexOutOfBoundsException if the index is out of range
*/
public boolean isItemSelected(int index) {
checkIndex(index);
return getSelectElement().getOptions().getItem(index).isSelected();
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* 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);
return getOptionText(getSelectElement().getOptions().getItem(index));
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Sets whether an individual list item is selected.
*
* <p>
* Note that setting the selection programmatically does <em>not</em> cause
* the {@link ChangeHandler#onChange(ChangeEvent)} event to be fired.
* </p>
*
* @param index the index of the item to be selected or unselected
* @param selected <code>true</code> to select the item
* @throws IndexOutOfBoundsException if the index is out of range
*/
public void setItemSelected(int index, boolean selected) {
checkIndex(index);
getSelectElement().getOptions().getItem(index).setSelected(selected);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* <b>Affected Elements:</b>
* <ul>
* <li>-item# = the option at the specified index.</li>
* </ul>
*
* @see UIObject#onEnsureDebugId(String)
*/
@Override
protected void onEnsureDebugId(String baseID) {
super.onEnsureDebugId(baseID);
// Set the id of each option
int numItems = getItemCount();
for (int i = 0; i < numItems; i++) {
ensureDebugId(getSelectElement().getOptions().getItem(i), baseID, "item"
+ i);
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Inserts an item into the list box, specifying its direction and an initial
* value for the item. If the index is less than zero, or greater than or
* equal to the length of the list, then the item will be appended to the end
* of the list.
*
* @param item the text of the item to be inserted
* @param dir the item's direction. If {@code null}, the item is displayed in
* the widget's overall direction, or, if a direction estimator has
* been set, in the item's estimated direction.
* @param value the item's value, to be submitted if it is part of a
* {@link FormPanel}.
* @param index the index at which to insert it
*/
public void insertItem(String item, Direction dir, String value, int index) {
SelectElement select = getSelectElement();
OptionElement option = Document.get().createOptionElement();
setOptionText(option, item, dir);
option.setValue(value);
int itemCount = select.getLength();
if (index < 0 || index > itemCount) {
index = itemCount;
}
if (index == itemCount) {
select.add(option, null);
} else {
OptionElement before = select.getOptions().getItem(index);
select.add(option, before);
}
}
代码示例来源:origin: net.wetheinter/gwt-user
/**
* Gets the value associated with the item at a given index.
*
* @param index the index of the item to be retrieved
* @return the item's associated value
* @throws IndexOutOfBoundsException if the index is out of range
*/
public String getValue(int index) {
checkIndex(index);
return getSelectElement().getOptions().getItem(index).getValue();
}
内容来源于网络,如有侵权,请联系作者删除!