本文整理汇总了Java中com.google.gwt.user.client.ui.ListBox.getItemText方法的典型用法代码示例。如果您正苦于以下问题:Java ListBox.getItemText方法的具体用法?Java ListBox.getItemText怎么用?Java ListBox.getItemText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.ui.ListBox
的用法示例。
在下文中一共展示了ListBox.getItemText方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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);
}
}
}
示例3: moveValuesOnIndexFromOneListToAnother
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
public void moveValuesOnIndexFromOneListToAnother(Set<Integer> indexes, ListBox fromList, ListBox toList) {
for (Integer index : indexes) {
int fromListIndex = index;
String value = fromList.getItemText(fromListIndex);
toList.addItem(value);
// fromList.removeItem(fromListIndex);
int newIndex = toList.getItemCount() - 1;
toList.getElement().getElementsByTagName(OPTION).getItem(newIndex).setTitle(value);
}
}
示例4: getSelectedValueFromList
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
private String getSelectedValueFromList(ListBox listBox) {
String value = CustomWorkflowConstants.EMPTY_STRING;
int selectedIndex = listBox.getSelectedIndex();
if (selectedIndex != -1) {
value = listBox.getItemText(selectedIndex);
}
return value;
}
示例5: addValueForPluginNameForAdd
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
/**
* @param selectedDependencyDTO
*/
private void addValueForPluginNameForAdd() {
ListBox pluginNamesList = dependencyPresenter.getView().getPluginNames();
String pluginName = pluginNamesList.getItemText(pluginNamesList.getSelectedIndex());
controller.setSelectedPlugin(pluginName);
getEditDependencyPresenter().getView().getPluginNamesList().setText(pluginName);
}
示例6: 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
示例7: populateDialog
import com.google.gwt.user.client.ui.ListBox; //导入方法依赖的package包/类
@Override
protected void populateDialog() {
addNewGrid( 2, 3, false, "", false);
//Add the radio-html widget to the panel
this.addToGrid(this.getCurrentGridIndex(), FIRST_COLUMN_INDEX, 3, radioHTML, false, false);
//Construct and add the listbox
HorizontalPanel panel = new HorizontalPanel();
panel.setVerticalAlignment( HasVerticalAlignment.ALIGN_MIDDLE );
panel.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_LEFT );
panel.setSize("100%", "100%");
Label chooseLabel = new Label( titlesI18N.chooseRadioText() );
chooseLabel.setStyleName( CommonResourcesContainer.CONST_FIELD_VALUE_DEFAULT_IMP_STYLE_NAME );
final ListBox chooseRadioListBox = new ListBox();
for( String name : nameToUrl.keySet() ) {
chooseRadioListBox.addItem( name );
}
chooseRadioListBox.addChangeHandler( new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
setRadioStation( chooseRadioListBox.getItemText( chooseRadioListBox.getSelectedIndex() ) );
}
});
final String defaultRadioStation = chooseRadioListBox.getItemText(0);
panel.add( chooseLabel );
panel.add( new HTML(" "));
panel.add( chooseRadioListBox );
this.addToGrid(this.getCurrentGridIndex(), FIRST_COLUMN_INDEX, 2, panel, true, false);
//Set the default radio station
setRadioStation( defaultRadioStation );
//Create navigation button "Close"
Button closeButton = new Button();
closeButton.setText( titlesI18N.closeButtonTitle() );
closeButton.setStyleName( CommonResourcesContainer.USER_DIALOG_ACTION_BUTTON_STYLE );
closeButton.addClickHandler( new ClickHandler() {
public void onClick(ClickEvent e) {
//Close the dialog
hide();
}
} );
this.addToGrid( SECOND_COLUMN_INDEX, closeButton, false, true);
}