本文整理匯總了Java中com.google.gwt.user.client.ui.ListBox.getValue方法的典型用法代碼示例。如果您正苦於以下問題:Java ListBox.getValue方法的具體用法?Java ListBox.getValue怎麽用?Java ListBox.getValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.gwt.user.client.ui.ListBox
的用法示例。
在下文中一共展示了ListBox.getValue方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getConfiguration
import com.google.gwt.user.client.ui.ListBox; //導入方法依賴的package包/類
private String getConfiguration() {
String conf = iConfiguration;
for (MatchResult matcher = iRegExp.exec(conf); matcher != null; matcher = iRegExp.exec(conf)) {
Element element = DOM.getElementById(matcher.getGroup(1));
String value = "";
if ("select".equalsIgnoreCase(element.getTagName())) {
ListBox list = ListBox.wrap(element);
for (int i = 0; i < list.getItemCount(); i++) {
if (list.isItemSelected(i))
value += (value.isEmpty() ? "" : ",") + list.getValue(i);
}
} else if ("input".equalsIgnoreCase(element.getTagName())) {
TextBox text = TextBox.wrap(element);
value = text.getText();
} else {
Hidden hidden = Hidden.wrap(element);
value = hidden.getValue();
}
conf = conf.replace("${" + matcher.getGroup(1) + "}", value);
}
return conf;
}
示例2: loadAndSetDayHour
import com.google.gwt.user.client.ui.ListBox; //導入方法依賴的package包/類
public void loadAndSetDayHour(ListBox day_list, HourListBox hour_list, ListBox minute_list, int year, int month, int day, int hour, int min) {
// Load the valid days for this month (which as set above) and year.
days(day_list, year, month);
if ( day < Integer.valueOf(day_list.getValue(0)).intValue() ) {
day_list.setSelectedIndex(0);
} else if ( day > Integer.valueOf(day_list.getValue(day_list.getItemCount() - 1)).intValue() ) {
day_list.setSelectedIndex(day_list.getItemCount() - 1);
} else {
for (int i = 0; i < day_list.getItemCount(); i++) {
String v = day_list.getValue(i);
if ( v.equals(GeoUtil.format_two(day)) ) {
day_list.setSelectedIndex(i);
}
}
}
loadAndSetHour(hour_list, minute_list, year, month, Integer.valueOf(day_list.getValue(day_list.getSelectedIndex())).intValue(), hour, min);
}
示例3: 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;
}
示例4: setValueOfDocFieldWidget
import com.google.gwt.user.client.ui.ListBox; //導入方法依賴的package包/類
private void setValueOfDocFieldWidget(String name, String value) {
for (EditableWidgetStorage editableWidgetStorage : docFieldWidgets) {
if (editableWidgetStorage.getData().getName().equals(name)) {
if (editableWidgetStorage.isListBox) {
ListBox listBoxwidget = editableWidgetStorage.getListBoxwidget();
if (listBoxwidget != null) {
for (int i = 0; i < listBoxwidget.getItemCount(); i++) {
String listBoxValue = listBoxwidget.getValue(i);
if (listBoxValue.equals(value)) {
listBoxwidget.setSelectedIndex(i);
break;
}
}
}
} else {
ValidatableWidget<TextBox> textBoxWidget = editableWidgetStorage.getTextBoxWidget();
if (textBoxWidget != null) {
textBoxWidget.getWidget().setValue(value);
}
}
break;
}
}
}
示例5: getValueOfDocFieldWidget
import com.google.gwt.user.client.ui.ListBox; //導入方法依賴的package包/類
/**
* To get Value Of Document Field Widget.
*
* @param name String
* @return String
*/
public String getValueOfDocFieldWidget(String name) {
String value = null;
for (EditableWidgetStorage editableWidgetStorage : docFieldWidgets) {
String nameOfWidget = editableWidgetStorage.getData().getName();
if (nameOfWidget.equals(name)) {
if (editableWidgetStorage.isListBox) {
ListBox listBoxwidget = editableWidgetStorage.getListBoxwidget();
if (listBoxwidget != null) {
value = listBoxwidget.getValue(listBoxwidget.getSelectedIndex());
}
} else {
ValidatableWidget<TextBox> textBoxWidget = editableWidgetStorage.getTextBoxWidget();
if (textBoxWidget != null) {
value = textBoxWidget.getWidget().getValue();
}
}
break;
}
}
return value;
}
示例6: setFieldValue
import com.google.gwt.user.client.ui.ListBox; //導入方法依賴的package包/類
protected void setFieldValue(ListBox field, String value) {
try {
for (int i = 0; i < field.getItemCount(); i++) {
String v = field.getValue(i);
if (v.equals(value)) {
field.setSelectedIndex(i);
return;
}
}
field.setSelectedIndex(0);
} catch (Exception e) {
field.setSelectedIndex(0);
}
}
示例7: setPassive
import com.google.gwt.user.client.ui.ListBox; //導入方法依賴的package包/類
private void setPassive(ListBox lb, String name) {
int n = lb.getItemCount();
if ((name != null) && (name.length() > 0)) {
for (int i = 0; i < n; i++) {
String value = lb.getValue(i);
if (value.equals(name)) {
lb.setSelectedIndex(i);
return;
}
}
}
lb.setSelectedIndex(0);
}
示例8: selectSkill
import com.google.gwt.user.client.ui.ListBox; //導入方法依賴的package包/類
private void selectSkill(ListBox list, ActiveSkill skill) {
for (int i = 0; i < list.getItemCount(); i++) {
String value = list.getValue(i);
if (skill != null) {
if (value.equals(skill.name())) {
list.setSelectedIndex(i);
return;
}
} else {
if ((value == null) || (value.trim().length() == 0)) {
list.setSelectedIndex(i);
return;
}
}
}
list.setSelectedIndex(0);
}
示例9: selectRune
import com.google.gwt.user.client.ui.ListBox; //導入方法依賴的package包/類
private void selectRune(ActiveSkill skill, Anchor anchor2, ListBox list2,
Rune rune) {
if (rune == null) {
list2.setSelectedIndex(0);
} else {
int n = list2.getItemCount();
for (int i = 0; i < n; i++) {
String value = list2.getValue(i);
if (value.equals(rune.name())) {
list2.setSelectedIndex(i);
break;
}
}
}
this.setRuneAnchor(skill, anchor2, rune);
}
示例10: selectSkill
import com.google.gwt.user.client.ui.ListBox; //導入方法依賴的package包/類
private void selectSkill(Anchor anchor, ListBox list, ActiveSkill skill,
Anchor anchor2, ListBox list2) {
if (skill == null) {
list.setSelectedIndex(0);
} else {
int n = list.getItemCount();
for (int i = 0; i < n; i++) {
String value = list.getValue(i);
if (value.equals(skill.name())) {
list.setSelectedIndex(i);
break;
}
}
}
this.setSkillAnchor(anchor, skill);
this.setRunes(anchor2, list2, skill);
}
示例11: loadAndSetMonthDayHour
import com.google.gwt.user.client.ui.ListBox; //導入方法依賴的package包/類
private void loadAndSetMonthDayHour(ListBox month_list, ListBox day_list, HourListBox hour_list, ListBox minute_list, int year, int month, int day, int hour, int min) {
// Load the valid months for this year.
months(month_list, year);
int low_month_number = monthToInt(month_list.getValue(0));
int hi_month_number = monthToInt(month_list.getValue(month_list.getItemCount() - 1));
DateTime requested_instance = new DateTime(year, month, day, hour, min, chrono).withZone(DateTimeZone.UTC);
String month_name = monthFormat.print(requested_instance.getMillis());
if ( month < low_month_number ) {
// If the current month is before the first month in the list
// set to the first month.
month_list.setSelectedIndex(0);
} else if ( month > hi_month_number) {
// If the current month is after the last month in the list
// set to the last month.
month_list.setSelectedIndex(month_list.getItemCount() - 1);
} else {
// Else set to that month
for (int i = 0; i < month_list.getItemCount(); i++) {
String v = month_list.getValue(i);
if ( v.equals(month_name) ) {
month_list.setSelectedIndex(i);
}
}
}
int selected_month = monthToInt(month_list.getValue(month_list.getSelectedIndex()));
loadAndSetDayHour(day_list, hour_list, minute_list, year, selected_month, day, hour, min);
}
示例12: onChange
import com.google.gwt.user.client.ui.ListBox; //導入方法依賴的package包/類
@Override
public void onChange(ChangeEvent event) {
if (xAnalysisWidget.isActive()) {
eventBus.fireEventFromSource(new WidgetSelectionChangeEvent(false), event.getSource());
ListBox analysisAxis = (ListBox) event.getSource();
String v = analysisAxis.getValue(analysisAxis.getSelectedIndex());
setAnalysisAxes(v);
}
}
示例13: getListBoxSelectedStyleName
import com.google.gwt.user.client.ui.ListBox; //導入方法依賴的package包/類
/**
* Allows to retrieve the selected style name from the list box
* @param listBox the list box to get the selected style from
* @return the style selected by the user in this box
*/
public String getListBoxSelectedStyleName( final ListBox listBox ) {
final int selectedIndex = listBox.getSelectedIndex();
if( selectedIndex == -1 ) {
//Nothing is selected yet, return the fist element in the list
return listBox.getValue( 0 );
} else {
//An item is selected, get its value
return listBox.getValue( selectedIndex );
}
}
示例14: populateFilters
import com.google.gwt.user.client.ui.ListBox; //導入方法依賴的package包/類
protected void populateFilters(final ReviewValidateTable table) {
ListBox listBox = table.getPriorityListBox();
int selectedIndex = listBox.getSelectedIndex();
if (selectedIndex != 0) {
String selectedValue = listBox.getValue(selectedIndex);
filters[0] = new DataFilter("priority", selectedValue);
} else {
filters[0] = new DataFilter("priority", "0");
}
if (table.isReview()) {
filters[1] = new DataFilter("status", "9");
} else {
filters[1] = new DataFilter("status", "10");
}
}
示例15: getBool
import com.google.gwt.user.client.ui.ListBox; //導入方法依賴的package包/類
private static InheritableBoolean getBool(ListBox box) {
int i = box.getSelectedIndex();
if (i >= 0) {
final String selectedValue = box.getValue(i);
if (selectedValue.startsWith(InheritableBoolean.INHERIT.name())) {
return InheritableBoolean.INHERIT;
}
return InheritableBoolean.valueOf(selectedValue);
}
return InheritableBoolean.INHERIT;
}