当前位置: 首页>>代码示例>>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;未经允许,请勿转载。