本文整理汇总了Java中com.google.gwt.user.client.ui.ListBox类的典型用法代码示例。如果您正苦于以下问题:Java ListBox类的具体用法?Java ListBox怎么用?Java ListBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ListBox类属于com.google.gwt.user.client.ui包,在下文中一共展示了ListBox类的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: ComparisonAxisSelector
import com.google.gwt.user.client.ui.ListBox; //导入依赖的package包/类
public ComparisonAxisSelector(String width) {
// The the other widgets have flextable layouts. Without it, this one doesn't line up.
layout = new FlexTable();
axes = new ListBox();
flex = new FlexTable();
// It looks funny without some sort of label on the same line.
HTML html = new HTML("Axis: ");
flex.setWidget(0, 0, html);
flex.setWidget(0, 1, axes);
disPanel = new DisclosurePanel("Compare");
disPanel.add(flex);
disPanel.setOpen(true);
// if ( width != null && !width.equals("") ) {
// disPanel.setWidth(width);
// }
layout.setWidget(0, 0, disPanel);
initWidget(layout);
}
示例3: days
import com.google.gwt.user.client.ui.ListBox; //导入依赖的package包/类
private void days(ListBox day, int year, int month) {
day.clear();
int lo_year = lo.getYear();
int hi_year = hi.getYear();
int lo_month = lo.getMonthOfYear();
int hi_month = hi.getMonthOfYear();
int start = 1;
int end = maxDays(year, month);
if ( lo_year == year && lo_month == month ) {
start = lo.getDayOfMonth();
end = maxDays(year, month);
}
// If it starts and ends in the same month replace with the day of the high month.
if ( hi_year == year && hi_month == month ) {
end = hi.getDayOfMonth();
}
for ( int i = start; i <= end; i++) {
day.addItem(GeoUtil.format_two(i), GeoUtil.format_two(i));
}
}
示例4: 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);
}
示例5: loadAndSetHour
import com.google.gwt.user.client.ui.ListBox; //导入依赖的package包/类
public void loadAndSetHour(HourListBox hour_list, ListBox minute_list, int year, int month, int day, int hour, int min) {
int start_year = lo.getYear();
int start_month = lo.getMonthOfYear();
int start_day = lo.getDayOfMonth();
int start_hour = lo.getHourOfDay();
int start_min = lo.getMinuteOfHour();
int end_year = hi.getYear();
int end_month = hi.getMonthOfYear();
int end_day = hi.getDayOfMonth();
int end_hour = hi.getHourOfDay();
int end_min = hi.getMinuteOfHour();
if ( start_year == year && start_month == month && start_day == day ) {
hours(hour_list, start_hour, start_min, 24, 0);
} else if ( end_year == year && end_month == month && end_day == day ) {
hours(hour_list, 0, 0, end_hour, end_min);
} else {
hours(hour_list, 0, 0, 24, 0);
}
if ( hasMinute ) {
loadAndSetMinute(minute_list, year, month, day, hour, min);
}
}
示例6: loadAndSetMinute
import com.google.gwt.user.client.ui.ListBox; //导入依赖的package包/类
public void loadAndSetMinute(ListBox minute_list, int year, int month, int day, int hour, int min) {
int start_year = lo.getYear();
int start_month = lo.getMonthOfYear();
int start_day = lo.getDayOfMonth();
int start_hour = lo.getHourOfDay();
int start_min = lo.getMinuteOfHour();
int end_year = hi.getYear();
int end_month = hi.getMonthOfYear();
int end_day = hi.getDayOfMonth();
int end_hour = hi.getHourOfDay();
int end_min = hi.getMinuteOfHour();
if ( start_year == year && start_month == month && start_day == day && start_hour == hour ) {
minutes(minute_list, start_min, 59);
} else if ( end_year == year && end_month == month && end_day == day && end_hour == hour ) {
minutes(minute_list, 0, end_hour);
} else {
minutes(minute_list, 0, 59);
}
}
示例7: getState
import com.google.gwt.user.client.ui.ListBox; //导入依赖的package包/类
public Map<String, String> getState() {
Map<String, String> state = new HashMap<String, String>();
for (Iterator widIt = widgets.iterator(); widIt.hasNext();) {
Widget w = (Widget) widIt.next();
if (w instanceof TextBox) {
TextBox t = (TextBox) w;
if (t.getText() != null && !t.getText().equals("")) {
state.put(t.getName(), t.getText());
}
} else if (w instanceof ListBox) {
ListBox l = (ListBox) w;
state.put(l.getName(), l.getValue(l.getSelectedIndex()));
}
}
return state;
}
示例8: 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;
}
示例9: checkDuplicate
import com.google.gwt.user.client.ui.ListBox; //导入依赖的package包/类
protected void checkDuplicate(ListBox lb) {
int selected = lb.getSelectedIndex();
boolean prev = disableListeners;
disableListeners = true;
for (int i = 0; i < NUM_PASSIVES; i++) {
ListBox l = listBoxes.get(i);
if ((l != lb) && (l.getSelectedIndex() == selected)) {
l.setSelectedIndex(0);
setTooltip(anchors.get(i), null);
}
}
disableListeners = prev;
}
示例10: initializeListBox
import com.google.gwt.user.client.ui.ListBox; //导入依赖的package包/类
/**
* Initializes the list box that allows to select styles
* @param listBox the list box to initialize
* @param dataToName the mapping from the style ID to the human readable name of the style
* @param dataToStyleName the mapping from the style ID to the CSS style name
* @param defaultValue the default style ID that should be set as selected
*/
public void initializeListBox( final ListBox listBox, final Map<Integer, String> dataToName,
final Map<Integer, String> dataToStyleName, final int defaultValue) {
//Initialize the list box with data
Iterator< Entry<Integer,String> > entrySetIter = dataToName.entrySet().iterator();
while( entrySetIter.hasNext() ) {
Entry<Integer, String> entry = entrySetIter.next();
listBox.addItem( entry.getValue(), dataToStyleName.get( entry.getKey() ) );
}
listBox.setVisibleItemCount( 1 );
//Set the default value as being selected
setListBoxStyleID( listBox, defaultValue, dataToStyleName );
//Add the change listener
listBox.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent e) {
//Update the sample view
updateSampleViewStyles();
}
});
}
示例11: 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;
}
}
}
示例12: 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;
}
示例13: setKeyPatternPanelView
import com.google.gwt.user.client.ui.ListBox; //导入依赖的package包/类
private void setKeyPatternPanelView() {
keyPatternText = new TextBox();
keyPatternText.addStyleName(AdminConstants.GWT_ADVANCED_KV_TEXT_BOX);
keyPatternField = new ListBox();
keyPatternField.setWidth("98%");
keyPatternPanel.add(keyPatternText);
useExistingKey.setValue(Boolean.FALSE);
useExistingKey.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
@Override
public void onValueChange(ValueChangeEvent<Boolean> arg0) {
if (arg0.getValue().equals(Boolean.TRUE)) {
keyPatternValidateButton.setEnabled(Boolean.FALSE);
keyPatternPanel.remove(keyPatternText);
keyPatternPanel.add(keyPatternField);
} else {
keyPatternValidateButton.setEnabled(Boolean.TRUE);
keyPatternPanel.remove(keyPatternField);
keyPatternPanel.add(keyPatternText);
}
}
});
}
示例14: addDropDown
import com.google.gwt.user.client.ui.ListBox; //导入依赖的package包/类
/**
* To add Drop Down.
*
* @param row int
* @param sampleValueList List<String>
* @param selectedValue String
* @param htmlID String
* @param elementMap Map<String, Widget>
* @return ListBox
*/
public ListBox addDropDown(int row, List<String> sampleValueList, String selectedValue, String htmlID,
Map<String, Widget> elementMap) {
ListBox fieldValue = new ListBox();
elementMap.put(htmlID, fieldValue);
fieldValue.getElement().setId(htmlID);
fieldValue.setVisibleItemCount(1);
for (String item : sampleValueList) {
fieldValue.addItem(item);
}
if (selectedValue == null) {
fieldValue.setItemSelected(0, true);
} else {
fieldValue.setItemSelected(sampleValueList.indexOf(selectedValue), true);
}
return fieldValue;
}
示例15: enableCreateMultipageOptimizationProps
import com.google.gwt.user.client.ui.ListBox; //导入依赖的package包/类
private void enableCreateMultipageOptimizationProps(final ListBox fieldValue) {
if (fieldValue != null) {
for (EditableWidgetStorage editableWidgetStorage : docFieldWidgets) {
if (fieldValue.getItemText(fieldValue.getSelectedIndex()).equalsIgnoreCase(PluginNameConstants.ON_STRING)) {
if (editableWidgetStorage != null
&& editableWidgetStorage.getTextBoxWidget() != null
&& editableWidgetStorage.getTextBoxWidget().getWidget() != null
&& editableWidgetStorage.getTextBoxWidget().getWidget().getName().equals(
PluginNameConstants.CREATE_MULTIPAGE_PDF_OPTIMIZATION_PARAMETERS)) {
editableWidgetStorage.widget.getWidget().setEnabled(true);
}
} else {
if (editableWidgetStorage != null
&& editableWidgetStorage.getTextBoxWidget() != null
&& editableWidgetStorage.getTextBoxWidget().getWidget() != null
&& editableWidgetStorage.getTextBoxWidget().getWidget().getName().equals(
PluginNameConstants.CREATE_MULTIPAGE_PDF_OPTIMIZATION_PARAMETERS)) {
editableWidgetStorage.widget.getWidget().setEnabled(false);
}
}
}
}
}