本文整理匯總了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);
}