Java 类com.google.gwt.user.client.ui.ListBox 实例源码

项目:unitimes    文件:CourseNumbersSuggestBox.java   
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;
}
项目:LAS    文件:ComparisonAxisSelector.java   
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);
    }
项目:LAS    文件:DateTimeWidget.java   
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));
    }
}
项目:LAS    文件:DateTimeWidget.java   
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);

}
项目:LAS    文件:DateTimeWidget.java   
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);
    }
}
项目:LAS    文件:DateTimeWidget.java   
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);
    }

}
项目:LAS    文件:OptionsWidget.java   
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;
}
项目:cuba    文件:CubaTwinColSelectWidget.java   
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;
}
项目:dhcalc    文件:PassivesPanel.java   
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;
}
项目:x-cure-chat    文件:FontSelectorPanelUI.java   
/**
 * 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();
        }
    });
}
项目:ephesoft    文件:EditBoxExporterView.java   
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;
        }
    }
}
项目:ephesoft    文件:EditBoxExporterView.java   
/**
 * 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;
}
项目:ephesoft    文件:AdvancedKVExtractionView.java   
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);
            }
        }
    });
}
项目:ephesoft    文件:EditScannerView.java   
/**
 * 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;
}
项目:ephesoft    文件:EditPluginPresenter.java   
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);
                }
            }
        }
    }

}
项目:ephesoft    文件:EditPluginPresenter.java   
private void enableTabbedPdfOptimizationProps(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.TABBED_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.TABBED_PDF_OPTIMIZATION_PARAMETERS)) {
                    editableWidgetStorage.widget.getWidget().setEnabled(false);
                }
            }
        }
    }

}
项目:ephesoft    文件:ConfigureModulePluginsPresenter.java   
private void addSelectedPlugin() {
    int selectedIndex = view.getMultipleSelectTwoSidedListBox().getLeftHandSideListBox().getSelectedIndex();
    if (selectedIndex != -1) {
        String selectedValue = view.getMultipleSelectTwoSidedListBox().getLeftHandSideListBox().getItemText(selectedIndex);
        String selectedValueKey = BatchClassManagementConstants.EMPTY_STRING;
        ListBox toList = view.getMultipleSelectTwoSidedListBox().getRightHandSideListBox();
        Map<String, String> pluginIdentifierToNameMap = view.getMultipleSelectTwoSidedListBox().getAllValuesMapFromList(toList);
        do {

            selectedValueKey = BatchClassManagementConstants.NEW + newIdentifier++;
        } while (pluginIdentifierToNameMap.keySet().contains(selectedValueKey));
        toList.addItem(selectedValue, selectedValueKey);
        int newIndex = toList.getItemCount() - 1;
        toList.getElement().getElementsByTagName("option").getItem(newIndex).setTitle(selectedValue);
    }
}
项目:djvu-html5    文件:Toolbar.java   
protected void zoomSelectionChanged() {
    if (pageLayout == null)
        return;
    ListBox zoomSelection = zoomPanel.selection;
    int index = zoomSelection.getSelectedIndex();
    if (index < zoomOptions.size()) {
        pageLayout.setZoom(zoomOptions.get(index));
    } else {
        switch (index - zoomOptions.size()) {
        case 0:
            pageLayout.zoomToFitWidth();
            break;
        case 1:
            pageLayout.zoomToFitPage();
            break;
        default:
            throw new RuntimeException();
        }
    }
    zoomPanel.textBox.setText(zoomSelection.getSelectedItemText());
    zoomSelection.setFocus(false);
}
项目:ephesoft    文件:ConfigureModulePresenter.java   
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);
        }
    }
}
项目:dhcalc    文件:ItemPanel.java   
private void setItem(Slot slot, SpecialItemType type) {

    ListBox list = listBoxes.get(slot);

    if (list != null) {
        if (type == null) {
            list.setSelectedIndex(0);

            anchors.get(slot).setHref("javascript:void(0)");
        } else {
            int n = list.getItemCount();
            anchors.get(slot).setHref(type.getUrl());

            for (int i = 0; i < n; i++) {
                if (list.getValue(i).equals(type.name())) {
                    list.setSelectedIndex(i);
                    return;
                }
            }
        }
    }
}
项目:dhcalc    文件:BasePanel.java   
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);
    }
}
项目:ephesoft    文件:ValidatePanel.java   
public DocFieldWidget(String parentDocumentIdentifier, Label fieldLabel, Field field, ValidatableWidget<SuggestionBox> widget,
        ValidatableWidget<ListBox> lWidget, ValidatableWidget<TextArea> textAreaWidget, boolean isReadOnly) {
    this.parentDocumentIdentifier = parentDocumentIdentifier;
    this.fieldLabel = fieldLabel;
    this.field = field;
    this.textAreaWidget = textAreaWidget;
    this.widget = widget;
    this.lWidget = lWidget;
    this.isReadOnly = isReadOnly;
    // enabling or disabling the widgets based on 'readonly' flag
    if (lWidget != null) {
        this.lWidget.getWidget().setEnabled(!isReadOnly);
    }
    if (widget != null) {
        this.widget.getWidget().getTextBox().setEnabled(!isReadOnly);
    }
    if (textAreaWidget != null) {
        this.textAreaWidget.getWidget().setReadOnly(isReadOnly);
    }

    setForceReviewOfValidatableWidget();
}
项目:dhcalc    文件:StatsPanel.java   
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);
    }
项目:gerrit    文件:DownloadBox.java   
DownloadBox(ChangeInfo change, String revision, PatchSet.Id psId) {
  this.change = change;
  this.revision = revision;
  this.psId = psId;
  this.commandTable = new FlexTable();
  this.scheme = new ListBox();
  this.scheme.addChangeHandler(
      new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
          renderCommands();
          if (Gerrit.isSignedIn()) {
            saveScheme();
          }
        }
      });

  setStyleName(Gerrit.RESOURCES.css().downloadBox());
  commandTable.setStyleName(Gerrit.RESOURCES.css().downloadBoxTable());
  scheme.setStyleName(Gerrit.RESOURCES.css().downloadBoxScheme());
  add(commandTable);
}
项目:jolie    文件:Echoes.java   
private void addVolumeMenuItems( ListBox volumeMenu )
{
    volumeMenu.addItem( "0%", "0" );
    volumeMenu.addItem( "5%", "5" );
    volumeMenu.addItem( "10%", "10" );
    volumeMenu.addItem( "15%", "15" );
    volumeMenu.addItem( "20%", "20" );
    volumeMenu.addItem( "25%", "25" );
    volumeMenu.addItem( "30%", "30" );
    volumeMenu.addItem( "35%", "35" );
    volumeMenu.addItem( "40%", "40" );
    volumeMenu.addItem( "45%", "45" );
    volumeMenu.addItem( "50%", "50" );
    volumeMenu.addItem( "55%", "55" );
    volumeMenu.addItem( "60%", "60" );
    volumeMenu.addItem( "65%", "65" );
    volumeMenu.addItem( "70%", "70" );
    volumeMenu.addItem( "75%", "75" );
    volumeMenu.addItem( "80%", "80" );
    volumeMenu.addItem( "85%", "85" );
    volumeMenu.addItem( "90%", "90" );
    volumeMenu.addItem( "95%", "95" );
    volumeMenu.addItem( "100%", "100" );
}
项目:dhcalc    文件:SkillsPanel.java   
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);
}
项目:firefly    文件:CatddPanel.java   
private ListBox createListBox() {
    List<EnumFieldDef.Item> listItems = new ArrayList<EnumFieldDef.Item>();
    listItems.add(new EnumFieldDef.Item("short", "Short Form"));
    listItems.add(new EnumFieldDef.Item("long", "Long Form"));
    EnumFieldDef list = new EnumFieldDef("Lists");
    list.addItems(listItems);
    list.setNullAllow(false);
    list.setErrMsg("This field is required. Select one from list");
    lists = GwtUtil.createComboBox(list);
    lists.addChangeHandler((new ChangeHandler() {
        public void onChange(ChangeEvent event) {
            formToSelect = lists.getValue(lists.getSelectedIndex());
            changePanel(formToSelect);
        }
    }));


    return lists;
}
项目:unitimes    文件:UniTimeWidget.java   
@Deprecated
public void clear() {
    if (getWidget() instanceof ListBox)
        ((ListBox)getWidget()).clear();
    if (getWidget() instanceof Panel)
        ((Panel)getWidget()).clear();
}
项目:unitimes    文件:EventAdd.java   
@Override
public List<RelatedObjectInterface> getValue() {
    List<RelatedObjectInterface> objects = new ArrayList<RelatedObjectInterface>();
    for (int row = 1; row < getRowCount(); row ++) {
        CourseRelatedObjectLine line = getData(row);
        ListBox subject = (ListBox)getWidget(row, 0);
        RelatedObjectLookupRpcResponse rSubject = (subject.getSelectedIndex() < 0 ? null : line.getSubject(subject.getValue(subject.getSelectedIndex())));
        ListBox course = (ListBox)getWidget(row, 1);
        RelatedObjectLookupRpcResponse rCourse = (course.getSelectedIndex() < 0 ? null : line.getCourse(course.getValue(course.getSelectedIndex())));
        ListBox subpart = (ListBox)getWidget(row, 2);
        RelatedObjectLookupRpcResponse rSubpart = (subpart.getSelectedIndex() < 0 ? null : line.getSubpart(subpart.getValue(subpart.getSelectedIndex())));
        ListBox clazz = (ListBox)getWidget(row, 3);
        RelatedObjectLookupRpcResponse rClazz = (clazz.getSelectedIndex() < 0 ? null : line.getClass(clazz.getValue(clazz.getSelectedIndex())));
        if (rClazz != null && rClazz.getRelatedObject() != null) {
            objects.add(rClazz.getRelatedObject()); continue;
        }
        if (rSubpart != null && rSubpart.getRelatedObject() != null) {
            objects.add(rSubpart.getRelatedObject()); continue;
        }
        if (rCourse != null && rCourse.getRelatedObject() != null) {
            objects.add(rCourse.getRelatedObject()); continue;
        }
        if (rSubject != null && rSubject.getRelatedObject() != null) {
            objects.add(rSubject.getRelatedObject()); continue;
        }
    }
    return objects;
}
项目:unitimes    文件:ReservationEdit.java   
private void select(ListBox l, String value) {
    for (int i = 0; i < l.getItemCount(); i++) {
        if (l.getValue(i).equals(value)) {
            l.setSelectedIndex(i);
            return;
        }
    }
}
项目:appinventor-extensions    文件:TemplateUploadWizard.java   
/**
 * Creates a drop down menu for selecting Template repositories.
 * @return the drop down menu of repository Urls.
 */
private ListBox makeTemplatesMenu() {
  final ListBox templatesMenu = new ListBox();
  templatesMenu.addItem(MESSAGES.templateUploadNewUrlCaption());
  templatesMenu.addItem(MIT_TEMPLATES);

  for (int k = 0; k < dynamicTemplateUrls.size(); k++) { // Dynamically added Urls
    templatesMenu.addItem(dynamicTemplateUrls.get(k));
  }
  templatesMenu.setSelectedIndex(MIT_TEMPLATES_INDEX);
  templatesMenu.addChangeHandler(new ChangeHandler() {
      public void onChange(ChangeEvent event) {
        int selectedIndex = templatesMenu.getSelectedIndex();

        if (selectedIndex == 0) {
          templatesMenu.setSelectedIndex(lastSelectedIndex);
          usingExternalTemplate = true; // MIT templates at index 1
          removeButton.setVisible(false);
          new InputTemplateUrlWizard(instance).center();     // This will do a callback
        } else if (selectedIndex == 1) {
          removeButton.setVisible(false);          lastSelectedIndex = selectedIndex;
          usingExternalTemplate = false; // MIT templates at index 1
          templateHostUrl = "";
          retrieveSelectedTemplates(templatesMenu.getValue(selectedIndex));  // may do callback
        } else {
          removeButton.setVisible(true);         lastSelectedIndex = selectedIndex;
          usingExternalTemplate = true; // MIT templates at index 1
          templateHostUrl = templatesMenu.getValue(selectedIndex);
          retrieveSelectedTemplates(templatesMenu.getValue(selectedIndex));  // may do callback
        }
      }
    });
  templatesMenu.setVisibleItemCount(1);  // Turns menu into a drop-down list).
  return templatesMenu;
}
项目:appinventor-extensions    文件:MockSpinner.java   
/**
 * Creates a new MockSpinner component.
 *
 * @param editor editor of source file the component belongs to
 */
public MockSpinner(SimpleEditor editor) {
  super(editor, TYPE, images.spinner());

  // Initialize mock label UI
  spinnerWidget = new ListBox();
  spinnerWidget.addItem(MESSAGES.MockSpinnerAddItems());
  spinnerWidget.setStylePrimaryName("ode-SimpleMockComponent");
  spinnerWidget.addStyleName("spinnerComponentStyle");
  initComponent(spinnerWidget);
  refreshForm();
}
项目:essence    文件:EndpointListBoxV3.java   
static public void copyListItemsToListBox(ListBox lb) {
    if (lb == null)
        return;
    for (int i=0; i<EndpointTypesListItems.length; i++) {
        lb.addItem(EndpointTypesListItems[i][1], EndpointTypesListItems[i][0]);
    }       
}
项目:essence    文件:EndpointListBoxV5.java   
static public void copyListItemsToListBox(ListBox lb) {
    if (lb == null)
        return;
    for (int i=0; i<EndpointTypesListItems.length; i++) {
        lb.addItem(EndpointTypesListItems[i][1], EndpointTypesListItems[i][0]);
    }       
}
项目:LAS    文件:DateTimeWidget.java   
private void minutes(ListBox mins, int start_minute, int end_minute) {
    mins.clear();
    for (int min = start_minute; min <= end_minute; min++) {
        mins.addItem(GeoUtil.format_two(min), GeoUtil.format_two(min));
    }

}
项目:LAS    文件:DateTimeWidget.java   
private void months(ListBox month, int year) {
        month.clear();
        int lo_year = lo.getYear();
        int hi_year = hi.getYear();

        int start = 1;
        int end = 12;

        if  ( lo_year == year ) {
            start = lo.getMonthOfYear();
        } 
        if ( hi_year == year ) {
            end = hi.getMonthOfYear();
        }

//      DateTime startDate = new DateTime(year, start, 1, 0, 0, DateTimeZone.UTC).withChronology(chrono);
//      DateTime endDate = new DateTime(year, end, 1, 0, 0, DateTimeZone.UTC).withChronology(chrono);

        DateTime startDate = lo.withYear(year).withMonthOfYear(start).withDayOfMonth(1).withHourOfDay(0).withMinuteOfHour(0);
        DateTime endDate = hi.withYear(year).withMonthOfYear(end).withDayOfMonth(1).withHourOfDay(0).withMinuteOfHour(0);


        while (startDate.isBefore(endDate.getMillis()) || startDate.equals(endDate)) {
            month.addItem(monthFormat.print(startDate.getMillis()));
            startDate = startDate.plusMonths(1);
        }
    }
项目:LAS    文件:DateTimeWidget.java   
private void years(DateTime lo, DateTime hi, ListBox year) {
       year.clear();
    int start = lo.getYear();
    int end = hi.getYear();
    for ( int y = start; y <= end; y++ ) {
        year.addItem(GeoUtil.format_four(y), GeoUtil.format_four(y));
    }
}
项目:LAS    文件:DateTimeWidget.java   
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);  
}
项目:LAS    文件:UI.java   
@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);
    }
}
项目:autorest-nominatim-example    文件:ExampleEntryPoint.java   
public void onModuleLoad() {
    PublishSubject<String> query = PublishSubject.create();

    TextBox text = new TextBox(); RootPanel.get().add(text);
    text.addValueChangeHandler(e -> query.onNext(e.getValue()));

    Button search = new Button("search"); RootPanel.get().add(search);
    search.addClickHandler(e -> query.onNext(text.getValue()));

    ListBox url = new ListBox(); RootPanel.get().add(url);
    url.addItem(NOMINATIM_OPENSTREETMAP);
    url.addItem("http://localhost:8080/");
    url.addChangeHandler(e -> query.onNext(text.getValue()));

    FlowPanel results = new FlowPanel(); RootPanel.get().add(results);

    // remember last selected server
    Storage storage = Storage.getLocalStorageIfSupported();
    if (storage != null) {
        try {
            url.setSelectedIndex(Integer.valueOf(storage.getItem("nominatim.url")));
        } catch (Exception ignore) {}
        url.addChangeHandler(c -> storage.setItem("nominatim.url", Integer.toString(url.getSelectedIndex())));
    }

    // on each tick, re-configure root resource and fire new request
    query.switchMap(q -> {
        results.clear();
        if (q == null || q.isEmpty()) return Observable.empty();
        Nominatim nominatim = new Nominatim_RestServiceModel(() -> osm(url.getSelectedItemText()));
        return nominatim.search(q, "json").doOnNext(n -> results.add(new Label(
                "[" + (int) (n.importance * 10.) + "] " + n.display_name + " (" + n.lon + "," + n.lat + ")")));
    }).retry((cnt, err) -> {
        GWT.log("request error: " + err, err); return true;
    }).subscribe();

     // fires initial search
    text.setValue("Málaga,España", true);
}