当前位置: 首页>>代码示例>>Java>>正文


Java ListBox.getSelectedIndex方法代码示例

本文整理汇总了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);
}
 
开发者ID:mateusz-matela,项目名称:djvu-html5,代码行数:23,代码来源:Toolbar.java

示例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;
}
 
开发者ID:dawg6,项目名称:dhcalc,代码行数:19,代码来源:SkillsPanel.java

示例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;
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:29,代码来源:EventAdd.java

示例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 );
	}
}
 
开发者ID:ivan-zapreev,项目名称:x-cure-chat,代码行数:16,代码来源:FontSelectorPanelUI.java

示例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");
	}
}
 
开发者ID:kuzavas,项目名称:ephesoft,代码行数:16,代码来源:LandingPresenter.java

示例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;

}
 
开发者ID:kuzavas,项目名称:ephesoft,代码行数:11,代码来源:DependencyManagementPresenter.java

示例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;
}
 
开发者ID:lsst,项目名称:firefly,代码行数:11,代码来源:DatasetPlotTypeUI.java

示例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() + ")");
    }
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:32,代码来源:ProjectInfoScreen.java

示例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;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:12,代码来源:ProjectInfoScreen.java

示例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);
}
 
开发者ID:dawg6,项目名称:dhcalc,代码行数:15,代码来源:StatsPanel.java

示例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;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:16,代码来源:MyPreferencesScreen.java

示例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();
}
 
开发者ID:mateusz-matela,项目名称:djvu-html5,代码行数:29,代码来源:Toolbar.java

示例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);
}
 
开发者ID:dawg6,项目名称:dhcalc,代码行数:9,代码来源:BasePanel.java

示例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));
}
 
开发者ID:dawg6,项目名称:dhcalc,代码行数:12,代码来源:ItemPanel.java

示例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);
}
 
开发者ID:dawg6,项目名称:dhcalc,代码行数:14,代码来源:MainPanel.java


注:本文中的com.google.gwt.user.client.ui.ListBox.getSelectedIndex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。