本文整理匯總了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() + ")");
}
}
}
示例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