本文整理汇总了Java中com.google.gwt.user.client.ui.ListBox.getSelectedIndex方法的典型用法代码示例。如果您正苦于以下问题:Java ListBox.getSelectedIndex方法的具体用法?Java ListBox.getSelectedIndex怎么用?Java ListBox.getSelectedIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.ui.ListBox
的用法示例。
在下文中一共展示了ListBox.getSelectedIndex方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: zoomSelectionChanged
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
protected void zoomSelectionChanged() {
if (pageLayout == null)
return;
ListBox zoomSelection = zoomPanel.selection;
int index = zoomSelection.getSelectedIndex();
if (index < zoomOptions.size()) {
pageLayout.setZoom(zoomOptions.get(index));
} else {
switch (index - zoomOptions.size()) {
case 0:
pageLayout.zoomToFitWidth();
break;
case 1:
pageLayout.zoomToFitPage();
break;
default:
throw new RuntimeException();
}
}
zoomPanel.textBox.setText(zoomSelection.getSelectedItemText());
zoomSelection.setFocus(false);
}
示例2: checkDuplicate
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
private void checkDuplicate(ListBox lb) {
int selected = lb.getSelectedIndex();
boolean prev = disableListeners;
disableListeners = true;
for (int i = 0; i < NUM_SKILLS; i++) {
ListBox l = skillBoxes.get(i);
if ((l != lb) && (l.getSelectedIndex() == selected)) {
l.setSelectedIndex(0);
setRunes(runeAnchors.get(i), runeBoxes.get(i), null);
setSkillAnchor(skillAnchors.get(i), null);
}
}
disableListeners = prev;
}
示例3: getValue
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
@Override
public List<RelatedObjectInterface> getValue() {
List<RelatedObjectInterface> objects = new ArrayList<RelatedObjectInterface>();
for (int row = 1; row < getRowCount(); row ++) {
CourseRelatedObjectLine line = getData(row);
ListBox subject = (ListBox)getWidget(row, 0);
RelatedObjectLookupRpcResponse rSubject = (subject.getSelectedIndex() < 0 ? null : line.getSubject(subject.getValue(subject.getSelectedIndex())));
ListBox course = (ListBox)getWidget(row, 1);
RelatedObjectLookupRpcResponse rCourse = (course.getSelectedIndex() < 0 ? null : line.getCourse(course.getValue(course.getSelectedIndex())));
ListBox subpart = (ListBox)getWidget(row, 2);
RelatedObjectLookupRpcResponse rSubpart = (subpart.getSelectedIndex() < 0 ? null : line.getSubpart(subpart.getValue(subpart.getSelectedIndex())));
ListBox clazz = (ListBox)getWidget(row, 3);
RelatedObjectLookupRpcResponse rClazz = (clazz.getSelectedIndex() < 0 ? null : line.getClass(clazz.getValue(clazz.getSelectedIndex())));
if (rClazz != null && rClazz.getRelatedObject() != null) {
objects.add(rClazz.getRelatedObject()); continue;
}
if (rSubpart != null && rSubpart.getRelatedObject() != null) {
objects.add(rSubpart.getRelatedObject()); continue;
}
if (rCourse != null && rCourse.getRelatedObject() != null) {
objects.add(rCourse.getRelatedObject()); continue;
}
if (rSubject != null && rSubject.getRelatedObject() != null) {
objects.add(rSubject.getRelatedObject()); continue;
}
}
return objects;
}
示例4: getListBoxSelectedStyleName
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
/**
* Allows to retrieve the selected style name from the list box
* @param listBox the list box to get the selected style from
* @return the style selected by the user in this box
*/
public String getListBoxSelectedStyleName( final ListBox listBox ) {
final int selectedIndex = listBox.getSelectedIndex();
if( selectedIndex == -1 ) {
//Nothing is selected yet, return the fist element in the list
return listBox.getValue( 0 );
} else {
//An item is selected, get its value
return listBox.getValue( selectedIndex );
}
}
示例5: populateFilters
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
protected void populateFilters(final ReviewValidateTable table) {
ListBox listBox = table.getPriorityListBox();
int selectedIndex = listBox.getSelectedIndex();
if (selectedIndex != 0) {
String selectedValue = listBox.getValue(selectedIndex);
filters[0] = new DataFilter("priority", selectedValue);
} else {
filters[0] = new DataFilter("priority", "0");
}
if (table.isReview()) {
filters[1] = new DataFilter("status", "9");
} else {
filters[1] = new DataFilter("status", "10");
}
}
示例6: getSelectedValueFromList
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
private String getSelectedValueFromList(ListBox listBox) {
String value = CustomWorkflowConstants.EMPTY_STRING;
int selectedIndex = listBox.getSelectedIndex();
if (selectedIndex != -1) {
value = listBox.getItemText(selectedIndex);
}
return value;
}
示例7: getIDValue
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
private String getIDValue(ListBox box) {
PlotData pd= info.getPlotData();
String retval= null;
int i= box.getSelectedIndex();
if (i>-1) {
if (i==box.getItemCount()-1) retval= null;
else retval= pd.getIDFromTitle(box.getItemText(i));
}
return retval;
}
示例8: setBool
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
private void setBool(ListBox box, InheritedBooleanInfo inheritedBoolean) {
if (box == null) {
return;
}
int inheritedIndex = -1;
for (int i = 0; i < box.getItemCount(); i++) {
if (box.getValue(i).startsWith(InheritableBoolean.INHERIT.name())) {
inheritedIndex = i;
}
if (box.getValue(i).startsWith(inheritedBoolean.configuredValue().name())) {
box.setSelectedIndex(i);
}
}
if (inheritedIndex >= 0) {
if (Gerrit.info().gerrit().isAllProjects(getProjectKey())) {
if (box.getSelectedIndex() == inheritedIndex) {
for (int i = 0; i < box.getItemCount(); i++) {
if (box.getValue(i).equals(InheritableBoolean.FALSE.name())) {
box.setSelectedIndex(i);
break;
}
}
}
box.removeItem(inheritedIndex);
} else {
box.setItemText(
inheritedIndex,
InheritableBoolean.INHERIT.name() + " (" + inheritedBoolean.inheritedValue() + ")");
}
}
}
示例9: getBool
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
private static InheritableBoolean getBool(ListBox box) {
int i = box.getSelectedIndex();
if (i >= 0) {
final String selectedValue = box.getValue(i);
if (selectedValue.startsWith(InheritableBoolean.INHERIT.name())) {
return InheritableBoolean.INHERIT;
}
return InheritableBoolean.valueOf(selectedValue);
}
return InheritableBoolean.INHERIT;
}
示例10: getSelectedSkill
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
ActiveSkill getSelectedSkill(int i) {
ListBox list = skills[i];
int index = list.getSelectedIndex();
if (index < 0)
return null;
String value = list.getValue(index);
if ((value == null) || (value.trim().length() == 0))
return null;
return ActiveSkill.valueOf(value);
}
示例11: getListBox
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
private <T extends Enum<?>> T getListBox(ListBox f, T defaultValue, T[] all) {
final int idx = f.getSelectedIndex();
if (0 <= idx) {
String v = f.getValue(idx);
if ("".equals(v)) {
return defaultValue;
}
for (T t : all) {
if (t.name().equals(v)) {
return t;
}
}
}
return defaultValue;
}
示例12: setZoomOptions
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
public void setZoomOptions(List<Integer> newZoomOptions) {
ListBox zoomSelection = zoomPanel.selection;
int previousIndex = zoomSelection.getSelectedIndex();
zoomSelection.clear();
for (int i : newZoomOptions) {
zoomSelection.addItem(i + "%");
}
zoomSelection.addItem(DjvuContext.getString("label_fitWidth", "Fit width"));
zoomSelection.addItem(DjvuContext.getString("label_fitPage", "Fit page"));
if (previousIndex >= zoomOptions.size()) {
// either "fit with" or "fit page" was selected
zoomSelection.setSelectedIndex(newZoomOptions.size() + (zoomOptions.size() - previousIndex));
} else {
int zoom = pageLayout != null ? pageLayout.getZoom() : 100;
int newSelected = Arrays.binarySearch(newZoomOptions.toArray(), zoom, Collections.reverseOrder());
if (newSelected >= 0) {
zoomSelection.setSelectedIndex(Math.min(newSelected, newZoomOptions.size() - 1));
zoomOptions = newZoomOptions;
zoomSelectionChanged();
} else {
zoomSelection.setSelectedIndex(-1);
zoomOptions = newZoomOptions;
}
}
zoomPanel.updateButtons();
}
示例13: getFieldValue
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
protected String getFieldValue(ListBox field, String defaultValue) {
int i = field.getSelectedIndex();
if (i < 0)
return defaultValue;
return field.getValue(i);
}
示例14: getSelectedItem
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
private SpecialItemType getSelectedItem(Slot slot) {
ListBox list = listBoxes.get(slot);
int i = list.getSelectedIndex();
if (i <= 0)
return null;
else
return SpecialItemType.valueOf(list.getValue(i));
}
示例15: getSkill
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
private ActiveSkill getSkill(ListBox skills) {
int index = skills.getSelectedIndex();
if (index < 0)
return null;
String value = skills.getValue(index);
if (value.length() == 0)
return null;
else
return ActiveSkill.valueOf(value);
}