當前位置: 首頁>>代碼示例>>Java>>正文


Java ListBox.getItemCount方法代碼示例

本文整理匯總了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;
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:23,代碼來源:CourseNumbersSuggestBox.java

示例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);
	
}
 
開發者ID:NOAA-PMEL,項目名稱:LAS,代碼行數:22,代碼來源:DateTimeWidget.java

示例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;
}
 
開發者ID:cuba-platform,項目名稱:cuba,代碼行數:18,代碼來源:CubaTwinColSelectWidget.java

示例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;
		}
	}
}
 
開發者ID:kuzavas,項目名稱:ephesoft,代碼行數:25,代碼來源:EditBoxExporterView.java

示例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);
	}
}
 
開發者ID:kuzavas,項目名稱:ephesoft,代碼行數:17,代碼來源:ConfigureModulePluginsPresenter.java

示例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);
		}
	}
}
 
開發者ID:kuzavas,項目名稱:ephesoft,代碼行數:21,代碼來源:ConfigureModulePresenter.java

示例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);
	}
}
 
開發者ID:dawg6,項目名稱:dhcalc,代碼行數:18,代碼來源:BasePanel.java

示例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);
}
 
開發者ID:dawg6,項目名稱:dhcalc,代碼行數:21,代碼來源:SkillsPanel.java

示例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);
}
 
開發者ID:dawg6,項目名稱:dhcalc,代碼行數:18,代碼來源:PassivesPanel.java

示例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;
				}
			}
		}
	}
}
 
開發者ID:dawg6,項目名稱:dhcalc,代碼行數:23,代碼來源:ItemPanel.java

示例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;
		}
	}
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:9,代碼來源:ReservationEdit.java

示例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);	
}
 
開發者ID:NOAA-PMEL,項目名稱:LAS,代碼行數:33,代碼來源:DateTimeWidget.java

示例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();
}
 
開發者ID:ivan-zapreev,項目名稱:x-cure-chat,代碼行數:17,代碼來源:FontSelectorPanelUI.java

示例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;
}
 
開發者ID:kuzavas,項目名稱:ephesoft,代碼行數:14,代碼來源:ConfigureModulePluginsPresenter.java

示例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;
}
 
開發者ID:kuzavas,項目名稱:ephesoft,代碼行數:14,代碼來源:MultipleSelectTwoSidedListBox.java


注:本文中的com.google.gwt.user.client.ui.ListBox.getItemCount方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。