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


Java ListBox.setVisibleItemCount方法代碼示例

本文整理匯總了Java中com.google.gwt.user.client.ui.ListBox.setVisibleItemCount方法的典型用法代碼示例。如果您正苦於以下問題:Java ListBox.setVisibleItemCount方法的具體用法?Java ListBox.setVisibleItemCount怎麽用?Java ListBox.setVisibleItemCount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.gwt.user.client.ui.ListBox的用法示例。


在下文中一共展示了ListBox.setVisibleItemCount方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initializeListBox

import com.google.gwt.user.client.ui.ListBox; //導入方法依賴的package包/類
/**
 * Initializes the list box that allows to select styles
 * @param listBox the list box to initialize
 * @param dataToName the mapping from the style ID to the human readable name of the style
 * @param dataToStyleName the mapping from the style ID to the CSS style name
 * @param defaultValue the default style ID that should be set as selected
 */
public void initializeListBox( final ListBox listBox, final Map<Integer, String> dataToName,
							   final Map<Integer, String> dataToStyleName, final int defaultValue) {
	//Initialize the list box with data
	Iterator< Entry<Integer,String> > entrySetIter = dataToName.entrySet().iterator();
	while( entrySetIter.hasNext() ) {
		Entry<Integer, String> entry = entrySetIter.next();
		listBox.addItem( entry.getValue(), dataToStyleName.get( entry.getKey() ) );
	}
	listBox.setVisibleItemCount( 1 );
	
	//Set the default value as being selected
	setListBoxStyleID( listBox, defaultValue, dataToStyleName );
	
	//Add the change listener
	listBox.addChangeHandler(new ChangeHandler() {
		public void onChange(ChangeEvent e) {
			//Update the sample view
			updateSampleViewStyles();
		}
	});
}
 
開發者ID:ivan-zapreev,項目名稱:x-cure-chat,代碼行數:29,代碼來源:FontSelectorPanelUI.java

示例2: addDropDown

import com.google.gwt.user.client.ui.ListBox; //導入方法依賴的package包/類
/**
 * To add Drop Down.
 * 
 * @param row int
 * @param sampleValueList List<String>
 * @param selectedValue String
 * @param htmlID String
 * @param elementMap Map<String, Widget>
 * @return ListBox
 */
public ListBox addDropDown(int row, List<String> sampleValueList, String selectedValue, String htmlID,
		Map<String, Widget> elementMap) {
	ListBox fieldValue = new ListBox();
	elementMap.put(htmlID, fieldValue);
	fieldValue.getElement().setId(htmlID);
	fieldValue.setVisibleItemCount(1);
	for (String item : sampleValueList) {
		fieldValue.addItem(item);
	}
	if (selectedValue == null) {
		fieldValue.setItemSelected(0, true);
	} else {
		fieldValue.setItemSelected(sampleValueList.indexOf(selectedValue), true);
	}

	return fieldValue;
}
 
開發者ID:kuzavas,項目名稱:ephesoft,代碼行數:28,代碼來源:EditScannerView.java

示例3: makeTemplatesMenu

import com.google.gwt.user.client.ui.ListBox; //導入方法依賴的package包/類
/**
 * Creates a drop down menu for selecting Template repositories.
 * @return the drop down menu of repository Urls.
 */
private ListBox makeTemplatesMenu() {
  final ListBox templatesMenu = new ListBox();
  templatesMenu.addItem(MESSAGES.templateUploadNewUrlCaption());
  templatesMenu.addItem(MIT_TEMPLATES);

  for (int k = 0; k < dynamicTemplateUrls.size(); k++) { // Dynamically added Urls
    templatesMenu.addItem(dynamicTemplateUrls.get(k));
  }
  templatesMenu.setSelectedIndex(MIT_TEMPLATES_INDEX);
  templatesMenu.addChangeHandler(new ChangeHandler() {
      public void onChange(ChangeEvent event) {
        int selectedIndex = templatesMenu.getSelectedIndex();

        if (selectedIndex == 0) {
          templatesMenu.setSelectedIndex(lastSelectedIndex);
          usingExternalTemplate = true; // MIT templates at index 1
          removeButton.setVisible(false);
          new InputTemplateUrlWizard(instance).center();     // This will do a callback
        } else if (selectedIndex == 1) {
          removeButton.setVisible(false);          lastSelectedIndex = selectedIndex;
          usingExternalTemplate = false; // MIT templates at index 1
          templateHostUrl = "";
          retrieveSelectedTemplates(templatesMenu.getValue(selectedIndex));  // may do callback
        } else {
          removeButton.setVisible(true);         lastSelectedIndex = selectedIndex;
          usingExternalTemplate = true; // MIT templates at index 1
          templateHostUrl = templatesMenu.getValue(selectedIndex);
          retrieveSelectedTemplates(templatesMenu.getValue(selectedIndex));  // may do callback
        }
      }
    });
  templatesMenu.setVisibleItemCount(1);  // Turns menu into a drop-down list).
  return templatesMenu;
}
 
開發者ID:mit-cml,項目名稱:appinventor-extensions,代碼行數:39,代碼來源:TemplateUploadWizard.java

示例4: addMultipleSelectListBox

import com.google.gwt.user.client.ui.ListBox; //導入方法依賴的package包/類
/**
 * To add Multiple Select List Box.
 * 
 * @param row int
 * @param sampleValueList List<String>
 * @param MAX_VISIBLE_ITEM_COUNT int
 * @param value String
 * @return ListBox
 */
public ListBox addMultipleSelectListBox(int row, List<String> sampleValueList, int MAX_VISIBLE_ITEM_COUNT, String value) {
	ListBox fieldValue = new ListBox(true);
	fieldValue.setVisibleItemCount(MAX_VISIBLE_ITEM_COUNT);
	for (String item : sampleValueList) {
		fieldValue.addItem(item);
	}
	String[] selectedValue = value.split(";");
	for (String string : selectedValue) {
		fieldValue.setItemSelected(sampleValueList.indexOf(string), true);
	}
	return fieldValue;
}
 
開發者ID:kuzavas,項目名稱:ephesoft,代碼行數:22,代碼來源:EditPluginView.java

示例5: addDropDown

import com.google.gwt.user.client.ui.ListBox; //導入方法依賴的package包/類
/**
 * To add drop down.
 * 
 * @param row int
 * @param sampleValueList List<String>
 * @param selectedValue String
 * @return ListBox
 */
public ListBox addDropDown(int row, List<String> sampleValueList, String selectedValue) {
	ListBox fieldValue = new ListBox();
	fieldValue.setVisibleItemCount(1);
	for (String item : sampleValueList) {
		fieldValue.addItem(item);
	}
	fieldValue.setItemSelected(sampleValueList.indexOf(selectedValue), true);
	return fieldValue;
}
 
開發者ID:kuzavas,項目名稱:ephesoft,代碼行數:18,代碼來源:EditPluginView.java

示例6: MultipleSelectTwoSidedListBox

import com.google.gwt.user.client.ui.ListBox; //導入方法依賴的package包/類
public MultipleSelectTwoSidedListBox(HandlerManager eventBus) {
	super();
	initWidget(BINDER.createAndBindUi(this));

	leftHandSideListBox = new ListBox(true);
	rightHandSideListBox = new ListBox(true);

	availableLabel = new Label();
	selectedLabel = new Label();

	/* Add handlers to buttons */

	addUpButtonPressHandler(moveUpButton, rightHandSideListBox);
	addDownButtonPressHandler(moveDownButton, rightHandSideListBox);

	/* Add list to their panels */
	leftHandSideListBoxPanel.add(availableLabel);
	rightHandSideListBoxPanel.add(selectedLabel);

	leftHandSideListBoxPanel.add(leftHandSideListBox);
	rightHandSideListBoxPanel.add(rightHandSideListBox);

	addCSSStyles();
	moveLeftButton.setText(REMOVE);
	moveRightButton.setText(ADD);
	
	moveUpButton.setText(UP_BUTTON);
	moveDownButton.setText(DOWN_BUTTON);

	leftHandSideListBox.setVisibleItemCount(VISIBLE_COUNT_13);
	rightHandSideListBox.setVisibleItemCount(VISIBLE_COUNT_13);
	this.setEventBus(eventBus);

}
 
開發者ID:kuzavas,項目名稱:ephesoft,代碼行數:35,代碼來源:MultipleSelectTwoSidedListBox.java

示例7: addDropDown

import com.google.gwt.user.client.ui.ListBox; //導入方法依賴的package包/類
public ListBox addDropDown(String fieldOptionValueList, String value) {
	ListBox fieldValue = new ListBox();
	fieldValue.setVisibleItemCount(1);
	String[] selectedValue = fieldOptionValueList.split(";");
	List<String> selectedValueList = Arrays.asList(selectedValue);
	for (String item : selectedValueList) {
		if (!item.trim().isEmpty()) {
			fieldValue.addItem(item);
		}
	}
	if (value != null && !value.isEmpty()) {
		fieldValue.setItemSelected(selectedValueList.indexOf(value), true);
	}
	return fieldValue;
}
 
開發者ID:kuzavas,項目名稱:ephesoft,代碼行數:16,代碼來源:AssociateBCFView.java

示例8: createColorList

import com.google.gwt.user.client.ui.ListBox; //導入方法依賴的package包/類
private ListBox createColorList(String caption) {
  ListBox lb = new ListBox();
  lb.addChangeListener(listener);
  lb.setVisibleItemCount(1);

  lb.addItem(caption);
  lb.addItem(strings.white(), "white");
  lb.addItem(strings.black(), "black");
  lb.addItem(strings.red(), "red");
  lb.addItem(strings.green(), "green");
  lb.addItem(strings.yellow(), "yellow");
  lb.addItem(strings.blue(), "blue");
  return lb;
}
 
開發者ID:luox12,項目名稱:onecmdb,代碼行數:15,代碼來源:RichTextToolbar.java

示例9: createFontList

import com.google.gwt.user.client.ui.ListBox; //導入方法依賴的package包/類
private ListBox createFontList() {
  ListBox lb = new ListBox();
  lb.addChangeListener(listener);
  lb.setVisibleItemCount(1);

  lb.addItem(strings.font(), "");
  lb.addItem(strings.normal(), "");
  lb.addItem("Times New Roman", "Times New Roman");
  lb.addItem("Arial", "Arial");
  lb.addItem("Courier New", "Courier New");
  lb.addItem("Georgia", "Georgia");
  lb.addItem("Trebuchet", "Trebuchet");
  lb.addItem("Verdana", "Verdana");
  return lb;
}
 
開發者ID:luox12,項目名稱:onecmdb,代碼行數:16,代碼來源:RichTextToolbar.java

示例10: createFontSizes

import com.google.gwt.user.client.ui.ListBox; //導入方法依賴的package包/類
private ListBox createFontSizes() {
  ListBox lb = new ListBox();
  lb.addChangeListener(listener);
  lb.setVisibleItemCount(1);

  lb.addItem(strings.size());
  lb.addItem(strings.xxsmall());
  lb.addItem(strings.xsmall());
  lb.addItem(strings.small());
  lb.addItem(strings.medium());
  lb.addItem(strings.large());
  lb.addItem(strings.xlarge());
  lb.addItem(strings.xxlarge());
  return lb;
}
 
開發者ID:luox12,項目名稱:onecmdb,代碼行數:16,代碼來源:RichTextToolbar.java

示例11: createEnumInput

import com.google.gwt.user.client.ui.ListBox; //導入方法依賴的package包/類
private ListBox createEnumInput(boolean isMultiSelect) {
    ListBox lb = new ListBox(isMultiSelect);
    lb.setVisibleItemCount(isMultiSelect ? 5 : 1);
    if (isMultiSelect && BrowserUtil.isIE()) {
        lb.setHeight("70px");
    }
    lb.setWidth("130px");
    return lb;
}
 
開發者ID:lsst,項目名稱:firefly,代碼行數:10,代碼來源:FilterPanel.java

示例12: YoungAndroidComponentSelectorPropertyEditor

import com.google.gwt.user.client.ui.ListBox; //導入方法依賴的package包/類
/**
 * Creates a new property editor for selecting a component, where the
 * user chooses among components of one or more component types.
 *
 * @param editor the editor that this property editor belongs to
 * @param componentTypes types of component that can be selected, or null if
 *        all types of components can be selected.
 */
public YoungAndroidComponentSelectorPropertyEditor(final YaFormEditor editor,
    Set<String> componentTypes) {
  this.editor = editor;
  this.componentTypes = componentTypes;

  VerticalPanel selectorPanel = new VerticalPanel();
  componentsList = new ListBox();
  componentsList.setVisibleItemCount(10);
  componentsList.setWidth("100%");
  selectorPanel.add(componentsList);
  selectorPanel.setWidth("100%");

  choices = new ListWithNone(MESSAGES.noneCaption(), new ListWithNone.ListBoxWrapper() {
    @Override
    public void addItem(String item) {
      componentsList.addItem(item);
    }

    @Override
    public String getItem(int index) {
      return componentsList.getItemText(index);
    }

    @Override
    public void removeItem(int index) {
      componentsList.removeItem(index);
    }

    @Override
    public void setSelectedIndex(int index) {
      componentsList.setSelectedIndex(index);
    }
  });

  // At this point, the editor hasn't finished loading.
  // Use a DeferredCommand to finish the initialization after the editor has finished loading.
  DeferredCommand.addCommand(new Command() {
    @Override
    public void execute() {
      if (editor.isLoadComplete()) {
        finishInitialization();
      } else {
        // Editor still hasn't finished loading.
        DeferredCommand.addCommand(this);
      }
    }
  });

  initAdditionalChoicePanel(selectorPanel);
}
 
開發者ID:mit-cml,項目名稱:appinventor-extensions,代碼行數:59,代碼來源:YoungAndroidComponentSelectorPropertyEditor.java


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