本文整理汇总了Java中com.google.gwt.user.client.ui.ListBox.getItemCount方法的典型用法代码示例。如果您正苦于以下问题:Java ListBox.getItemCount方法的具体用法?Java ListBox.getItemCount怎么用?Java ListBox.getItemCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.ui.ListBox
的用法示例。
在下文中一共展示了ListBox.getItemCount方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getConfiguration
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
private String getConfiguration() {
String conf = iConfiguration;
for (MatchResult matcher = iRegExp.exec(conf); matcher != null; matcher = iRegExp.exec(conf)) {
Element element = DOM.getElementById(matcher.getGroup(1));
String value = "";
if ("select".equalsIgnoreCase(element.getTagName())) {
ListBox list = ListBox.wrap(element);
for (int i = 0; i < list.getItemCount(); i++) {
if (list.isItemSelected(i))
value += (value.isEmpty() ? "" : ",") + list.getValue(i);
}
} else if ("input".equalsIgnoreCase(element.getTagName())) {
TextBox text = TextBox.wrap(element);
value = text.getText();
} else {
Hidden hidden = Hidden.wrap(element);
value = hidden.getValue();
}
conf = conf.replace("${" + matcher.getGroup(1) + "}", value);
}
return conf;
}
示例2: loadAndSetDayHour
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
public void loadAndSetDayHour(ListBox day_list, HourListBox hour_list, ListBox minute_list, int year, int month, int day, int hour, int min) {
// Load the valid days for this month (which as set above) and year.
days(day_list, year, month);
if ( day < Integer.valueOf(day_list.getValue(0)).intValue() ) {
day_list.setSelectedIndex(0);
} else if ( day > Integer.valueOf(day_list.getValue(day_list.getItemCount() - 1)).intValue() ) {
day_list.setSelectedIndex(day_list.getItemCount() - 1);
} else {
for (int i = 0; i < day_list.getItemCount(); i++) {
String v = day_list.getValue(i);
if ( v.equals(GeoUtil.format_two(day)) ) {
day_list.setSelectedIndex(i);
}
}
}
loadAndSetHour(hour_list, minute_list, year, month, Integer.valueOf(day_list.getValue(day_list.getSelectedIndex())).intValue(), hour, min);
}
示例3: moveAllItems
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
private Set<String> moveAllItems(ListBox source, ListBox target) {
final Set<String> movedItems = new HashSet<String>();
int size = source.getItemCount();
for (int i = 0; i < size; i++) {
movedItems.add(source.getValue(i));
final String text = source.getItemText(i);
final String value = source.getValue(i);
target.addItem(text, value);
target.setItemSelected(target.getItemCount() - 1, true);
}
target.setFocus(true);
if (source.getItemCount() > 0) {
target.setSelectedIndex(0);
}
source.clear();
return movedItems;
}
示例4: setValueOfDocFieldWidget
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
private void setValueOfDocFieldWidget(String name, String value) {
for (EditableWidgetStorage editableWidgetStorage : docFieldWidgets) {
if (editableWidgetStorage.getData().getName().equals(name)) {
if (editableWidgetStorage.isListBox) {
ListBox listBoxwidget = editableWidgetStorage.getListBoxwidget();
if (listBoxwidget != null) {
for (int i = 0; i < listBoxwidget.getItemCount(); i++) {
String listBoxValue = listBoxwidget.getValue(i);
if (listBoxValue.equals(value)) {
listBoxwidget.setSelectedIndex(i);
break;
}
}
}
} else {
ValidatableWidget<TextBox> textBoxWidget = editableWidgetStorage.getTextBoxWidget();
if (textBoxWidget != null) {
textBoxWidget.getWidget().setValue(value);
}
}
break;
}
}
}
示例5: addSelectedPlugin
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
private void addSelectedPlugin() {
int selectedIndex = view.getMultipleSelectTwoSidedListBox().getLeftHandSideListBox().getSelectedIndex();
if (selectedIndex != -1) {
String selectedValue = view.getMultipleSelectTwoSidedListBox().getLeftHandSideListBox().getItemText(selectedIndex);
String selectedValueKey = BatchClassManagementConstants.EMPTY_STRING;
ListBox toList = view.getMultipleSelectTwoSidedListBox().getRightHandSideListBox();
Map<String, String> pluginIdentifierToNameMap = view.getMultipleSelectTwoSidedListBox().getAllValuesMapFromList(toList);
do {
selectedValueKey = BatchClassManagementConstants.NEW + newIdentifier++;
} while (pluginIdentifierToNameMap.keySet().contains(selectedValueKey));
toList.addItem(selectedValue, selectedValueKey);
int newIndex = toList.getItemCount() - 1;
toList.getElement().getElementsByTagName("option").getItem(newIndex).setTitle(selectedValue);
}
}
示例6: addSelectedModule
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
private void addSelectedModule() {
ListBox fromList = view.getMultipleSelectTwoSidedListBox().getLeftHandSideListBox();
List<Integer> selectedIndexes = view.getMultipleSelectTwoSidedListBox().getAllSelectedIndexes(fromList);
for (Integer selectedIndex : selectedIndexes) {
if (selectedIndex != -1) {
String selectedValue = fromList.getItemText(selectedIndex);
String selectedValueKey = BatchClassManagementConstants.EMPTY_STRING;
ListBox toList = view.getMultipleSelectTwoSidedListBox().getRightHandSideListBox();
Map<String, String> moduleIdentifierToNameMap = view.getMultipleSelectTwoSidedListBox()
.getAllValuesMapFromList(toList);
do {
selectedValueKey = BatchClassManagementConstants.NEW + newIdentifier++;
} while (moduleIdentifierToNameMap.containsKey(selectedValueKey));
toList.addItem(selectedValue, selectedValueKey);
int newIndex = toList.getItemCount() - 1;
toList.getElement().getElementsByTagName("option").getItem(newIndex).setTitle(selectedValue);
}
}
}
示例7: setFieldValue
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
protected void setFieldValue(ListBox field, String value) {
try {
for (int i = 0; i < field.getItemCount(); i++) {
String v = field.getValue(i);
if (v.equals(value)) {
field.setSelectedIndex(i);
return;
}
}
field.setSelectedIndex(0);
} catch (Exception e) {
field.setSelectedIndex(0);
}
}
示例8: selectRune
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
private void selectRune(ActiveSkill skill, Anchor anchor2, ListBox list2,
Rune rune) {
if (rune == null) {
list2.setSelectedIndex(0);
} else {
int n = list2.getItemCount();
for (int i = 0; i < n; i++) {
String value = list2.getValue(i);
if (value.equals(rune.name())) {
list2.setSelectedIndex(i);
break;
}
}
}
this.setRuneAnchor(skill, anchor2, rune);
}
示例9: setPassive
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
private void setPassive(ListBox lb, String name) {
int n = lb.getItemCount();
if ((name != null) && (name.length() > 0)) {
for (int i = 0; i < n; i++) {
String value = lb.getValue(i);
if (value.equals(name)) {
lb.setSelectedIndex(i);
return;
}
}
}
lb.setSelectedIndex(0);
}
示例10: setItem
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
private void setItem(Slot slot, SpecialItemType type) {
ListBox list = listBoxes.get(slot);
if (list != null) {
if (type == null) {
list.setSelectedIndex(0);
anchors.get(slot).setHref("javascript:void(0)");
} else {
int n = list.getItemCount();
anchors.get(slot).setHref(type.getUrl());
for (int i = 0; i < n; i++) {
if (list.getValue(i).equals(type.name())) {
list.setSelectedIndex(i);
return;
}
}
}
}
}
示例11: select
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
private void select(ListBox l, String value) {
for (int i = 0; i < l.getItemCount(); i++) {
if (l.getValue(i).equals(value)) {
l.setSelectedIndex(i);
return;
}
}
}
示例12: loadAndSetMonthDayHour
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
private void loadAndSetMonthDayHour(ListBox month_list, ListBox day_list, HourListBox hour_list, ListBox minute_list, int year, int month, int day, int hour, int min) {
// Load the valid months for this year.
months(month_list, year);
int low_month_number = monthToInt(month_list.getValue(0));
int hi_month_number = monthToInt(month_list.getValue(month_list.getItemCount() - 1));
DateTime requested_instance = new DateTime(year, month, day, hour, min, chrono).withZone(DateTimeZone.UTC);
String month_name = monthFormat.print(requested_instance.getMillis());
if ( month < low_month_number ) {
// If the current month is before the first month in the list
// set to the first month.
month_list.setSelectedIndex(0);
} else if ( month > hi_month_number) {
// If the current month is after the last month in the list
// set to the last month.
month_list.setSelectedIndex(month_list.getItemCount() - 1);
} else {
// Else set to that month
for (int i = 0; i < month_list.getItemCount(); i++) {
String v = month_list.getValue(i);
if ( v.equals(month_name) ) {
month_list.setSelectedIndex(i);
}
}
}
int selected_month = monthToInt(month_list.getValue(month_list.getSelectedIndex()));
loadAndSetDayHour(day_list, hour_list, minute_list, year, selected_month, day, hour, min);
}
示例13: setListBoxStyleName
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
/**
* Allows to set the style name as selected in the list box
* @param listBox the list box to set the value in
* @param styleName the style which we want to set as selected
*/
public void setListBoxStyleName( final ListBox listBox, final String styleName ) {
//First set the selected element
for( int index = 0; index < listBox.getItemCount(); index++ ) {
if( listBox.getValue( index ).equals( styleName ) ) {
listBox.setSelectedIndex( index );
break;
}
}
//Second, update the sample view
updateSampleViewStyles();
}
示例14: getIndexForValueFromList
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
private Integer getIndexForValueFromList(ListBox listBox, String dependencyName) {
int valueIndex = -1;
for (int index = 0; index < listBox.getItemCount(); index++) {
if (listBox.getItemText(index).equals(dependencyName)) {
valueIndex = index;
listBox.getElement().getElementsByTagName(BatchClassManagementConstants.OPTION).getItem(valueIndex).addClassName(
BatchClassManagementConstants.DEPENDENCY_COLOR);
break;
}
}
return valueIndex;
}
示例15: getAllSelectedIndexes
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
public List<Integer> getAllSelectedIndexes(ListBox fromList) {
List<Integer> selectedValuesList = new ArrayList<Integer>(0);
final int LIST_LENGTH = fromList.getItemCount();
if (LIST_LENGTH > 0) {
// populate all selected indexes from the list
for (int index = 0; index < LIST_LENGTH; index++) {
if (fromList.isItemSelected(index)) {
selectedValuesList.add(index);
}
}
}
return selectedValuesList;
}