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


Java ListBox.removeItem方法代碼示例

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


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

示例1: 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

示例2: 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.removeItem方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。