Package com.google.gwt.user.client.ui

Examples of com.google.gwt.user.client.ui.ListBox$Impl


    }
    return tb;
  }

    public static ListBox createListBox(List<Option> options, ChangeListener cl) {
    final ListBox lb = new ListBox();
    for ( Option option : options ) {
      String lab = option.getLabel();
      if ( lab != null && lab.length() > 0 ) {
        lb.addItem(option.getLabel(), option.getName());
      }
      else {
        lb.addItem(option.getName());
      }
    }
    if ( cl != null ) {
      lb.addChangeListener(cl);
    }
    return lb;
  }
View Full Code Here


          boolean allowUserOption = attr.isAllowUserDefinedOption();
          if ( allowUserOption ) {
            widget = new FieldWithChoose(attr, cl);
          }
          else {
            ListBox listBox = OrrUtil.createListBox(options, cl);
            widget = listBox;
          }
        }
      }
      else if ( !editing ) {
View Full Code Here

      }
      else if ( elem.widget instanceof ViewOnlyCell ) {
        value = ((ViewOnlyCell) elem.widget).getText();
      }
      else if ( elem.widget instanceof ListBox ) {
        ListBox lb = (ListBox) elem.widget;
        value = lb.getValue(lb.getSelectedIndex());
      }
      else if ( elem.widget instanceof FieldWithChoose ) {
        value = ((FieldWithChoose) elem.widget).getTextBox().getText();
      }
     
View Full Code Here

    for ( Elem elem : widgets.values() ) {
      if ( elem.widget instanceof TextBoxBase ) {
        ((TextBoxBase) elem.widget).setReadOnly(!enabled);
      }
      else if ( elem.widget instanceof ListBox ) {
        ListBox lb = (ListBox) elem.widget;
        lb.setEnabled(enabled);
      }
      else if ( elem.widget instanceof FieldWithChoose ) {
        ((FieldWithChoose) elem.widget).enable(enabled);
      }
    }
View Full Code Here

    for ( Elem elem : widgets.values() ) {
      if ( elem.widget instanceof TextBoxBase ) {
        ((TextBoxBase) elem.widget).setText(value);
      }
      else if ( elem.widget instanceof ListBox ) {
        ListBox lb = (ListBox) elem.widget;
        int idx = 0;
        lb.setSelectedIndex(idx);
      }
      else if ( elem.widget instanceof FieldWithChoose ) {
        ((FieldWithChoose) elem.widget).setValue(value);
      }
    }
View Full Code Here

  private void dispatchOptions(final List<Option> options, final MyDialog waitPopup) {
    Orr.log("Dispatching options");
   
    final String width = "500px";
   
    final ListBox listBox = OrrUtil.createListBox(options, cl);
    listBox.setWidth(width);
   
    VerticalPanel vp = new VerticalPanel();
   
    final MyDialog popup = new MyDialog(vp);
   
    listBox.setVisibleItemCount(Math.min(options.size(), 12));
    // make sure no item is selected so we get a change event on the first item (needed for firefox at least):
    // (see issue #139: Can't select AGU as authority abbreviation)
    listBox.setSelectedIndex(-1);

    listBox.addChangeListener(new ChangeListener () {
      public void onChange(Widget sender) {
        String value = listBox.getValue(listBox.getSelectedIndex());
        textBox.setText(value);
       
        Option option = options.get(listBox.getSelectedIndex());
        optionSelected(option);

        _onChange();

        popup.hide();
View Full Code Here

      String value = elem.attr.getExample();
      if ( elem.widget instanceof TextBoxBase ) {
        ((TextBoxBase) elem.widget).setText(value);
      }
      else if ( elem.widget instanceof ListBox ) {
        ListBox lb = (ListBox) elem.widget;
        int idx = 0;
        for ( int i = 0; i < lb.getItemCount(); i++ ) {
          if ( value.equals(lb.getValue(i)) ) {
            idx = i;
            break;
          }
        }
        lb.setSelectedIndex(idx);
      }
      else if ( elem.widget instanceof FieldWithChoose ) {
        ((FieldWithChoose) elem.widget).setValue(value);
      }
    }
View Full Code Here

      }
      if ( elem.widget instanceof ViewOnlyCell ) {
        ((ViewOnlyCell) elem.widget).setText(value);
      }
      else if ( elem.widget instanceof ListBox ) {
        ListBox lb = (ListBox) elem.widget;
        int idx = 0;
        for ( int i = 0; i < lb.getItemCount(); i++ ) {
          if ( value.equals(lb.getValue(i)) ) {
            idx = i;
            break;
          }
        }
        lb.setSelectedIndex(idx);
      }
      else if ( elem.widget instanceof FieldWithChoose ) {
        ((FieldWithChoose) elem.widget).setValue(value);
      }
    }
View Full Code Here

        final Image imageI18n = new Image();
        horizontalPanel_1.add(imageI18n);
        imageI18n.setSize("16", "16");
        imageI18n.setUrl("images/locale.png");

        final ListBox listBoxLocale = new ListBox();
        horizontalPanel_1.add(listBoxLocale);
        // listBoxLocale.setTabIndex(1);
        listBoxLocale.setWidth("15em");
        // listBoxLocale.setEnabled(false);
        // // Map to location in list.
        HashMap<String, Integer> localeMap = new HashMap<String, Integer>();
        int i = 0;
        /**
         * Two letter codes are taken by ISO 639-1 specs at:
         * http://www.sil.org/iso639-3/codes.asp?order=639_1
         */
        localeMap.put("de", i++);
        localeMap.put("en", i++);
        localeMap.put("es", i++);
        localeMap.put("fr", i++);
        localeMap.put("it", i++);
        localeMap.put("ja", i++);
        localeMap.put("nl", i++);
        localeMap.put("pt", i++);
        localeMap.put("ru", i++);
        localeMap.put("zh", i++);

        listBoxLocale.addItem("Deutsch", "de");
        listBoxLocale.addItem("English", "en");
        listBoxLocale.addItem("Español", "es");
        listBoxLocale.addItem("Français", "fr");
        listBoxLocale.addItem("Italiano", "it");
        listBoxLocale.addItem("日本語", "ja");
        listBoxLocale.addItem("Nederlands", "nl");
        listBoxLocale.addItem("Português", "pt");
        listBoxLocale.addItem("Русский", "ru");
        listBoxLocale.addItem("中文", "zh");

        String currentLocale = LocaleInfo.getCurrentLocale().getLocaleName();
        if (currentLocale.equals("default")) {
            currentLocale = "en";
        }
        // GenClient.showDebug("localeMap: " + localeMap);
        // GenClient.showDebug("currentLocale: " + currentLocale);
        int idx = localeMap.get(currentLocale);
        if (idx < 0) {
            idx = 1; // en is default
        }
        listBoxLocale.setSelectedIndex(idx);

        listBoxLocale.addChangeListener(new ChangeListener() {
            public void onChange(Widget sender) {
                String localeName = listBoxLocale.getValue(listBoxLocale.getSelectedIndex());

                // original method.
                // Window.open(UtilsJS.getHostPageLocation() + "?locale="
                // + localeName, "_self", "");
                String windowLocationOrg = UtilsJS.getHostPageLocation() + "?locale=" + localeName;
View Full Code Here

   
    checkboxes = new ArrayList<CheckBox>();
   
    studyRegionList = new ArrayList<StudyRegion>();
   
    zoneTypes = new ListBox();
    zoneTypes.addItem("Residential", ZoneListing.ZONETYPE_RESIDENTIAL);
    zoneTypes.addItem("Commercial", ZoneListing.ZONETYPE_COMMERCIAL);
    zoneTypes.addItem("Industrial", ZoneListing.ZONETYPE_INDUSTRIAL);
    zoneTypes.setSelectedIndex(0);
    zoneTypes.addChangeHandler(new ChangeHandler() {
View Full Code Here

TOP

Related Classes of com.google.gwt.user.client.ui.ListBox$Impl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.