コード例 #1
0
  private ComboBox createLocaleSelect() {
    ComboBox s = new ComboBox("Locale");
    s.addContainerProperty("caption", String.class, "");
    s.setItemCaptionPropertyId("caption");
    s.setFilteringMode(FilteringMode.CONTAINS);

    for (Locale l : Locale.getAvailableLocales()) {
      if (!s.containsId(l)) {
        Item i = s.addItem(l);
        i.getItemProperty("caption").setValue(getLocaleItemCaption(l));
      }
    }

    s.select(getLocale());
    s.setImmediate(true);
    s.addValueChangeListener(
        new ValueChangeListener() {

          private static final long serialVersionUID = 1L;

          @Override
          public void valueChange(ValueChangeEvent event) {
            updateCalendarLocale((Locale) event.getProperty().getValue());
          }
        });

    return s;
  }
コード例 #2
0
  private ComboBox createCustomFirstDayOfWeekSelect() {
    ComboBox comboBox = new ComboBox("First day of week");

    comboBox.addContainerProperty("caption", String.class, "");
    comboBox.setItemCaptionPropertyId("caption");

    comboBox.setImmediate(true);

    Item defaultItem = comboBox.addItem(DEFAULT_ITEMID);
    defaultItem.getItemProperty("caption").setValue("Default by locale");

    Item sunday = comboBox.addItem(java.util.Calendar.SUNDAY);
    sunday.getItemProperty("caption").setValue("Sunday");

    Item monday = comboBox.addItem(java.util.Calendar.MONDAY);
    monday.getItemProperty("caption").setValue("Monday");

    comboBox.select(DEFAULT_ITEMID);
    comboBox.setNullSelectionAllowed(false);

    comboBox.addValueChangeListener(
        new ValueChangeListener() {

          private static final long serialVersionUID = 1L;

          @Override
          public void valueChange(ValueChangeEvent event) {
            updateCalendarFirstDayOfWeek(event.getProperty().getValue());
          }
        });

    return comboBox;
  }
コード例 #3
0
  private ComboBox createTimeZoneSelect() {
    ComboBox s = new ComboBox("Timezone");
    s.addContainerProperty("caption", String.class, "");
    s.setItemCaptionPropertyId("caption");
    s.setFilteringMode(FilteringMode.CONTAINS);

    Item i = s.addItem(DEFAULT_ITEMID);
    i.getItemProperty("caption").setValue("Default (" + TimeZone.getDefault().getID() + ")");
    for (String id : TimeZone.getAvailableIDs()) {
      if (!s.containsId(id)) {
        i = s.addItem(id);
        i.getItemProperty("caption").setValue(id);
      }
    }

    if (testBench) {
      s.select("America/New_York");
    } else {
      s.select(DEFAULT_ITEMID);
    }
    s.setImmediate(true);
    s.addValueChangeListener(
        new ValueChangeListener() {

          private static final long serialVersionUID = 1L;

          @Override
          public void valueChange(ValueChangeEvent event) {

            updateCalendarTimeZone(event.getProperty().getValue());
          }
        });

    return s;
  }
コード例 #4
0
  private ComboBox createCalendarFormatSelect() {
    ComboBox s = new ComboBox("Calendar format");
    s.addContainerProperty("caption", String.class, "");
    s.setItemCaptionPropertyId("caption");

    Item i = s.addItem(DEFAULT_ITEMID);
    i.getItemProperty("caption").setValue("Default by locale");
    i = s.addItem(TimeFormat.Format12H);
    i.getItemProperty("caption").setValue("12H");
    i = s.addItem(TimeFormat.Format24H);
    i.getItemProperty("caption").setValue("24H");

    s.select(DEFAULT_ITEMID);
    s.setImmediate(true);
    s.addValueChangeListener(
        new ValueChangeListener() {

          private static final long serialVersionUID = 1L;

          @Override
          public void valueChange(ValueChangeEvent event) {
            updateCalendarFormat(event.getProperty().getValue());
          }
        });

    return s;
  }
コード例 #5
0
 private ComboBox createStyleNameComboBox() {
   ComboBox s = new ComboBox("Color");
   s.addContainerProperty("c", String.class, "");
   s.setItemCaptionPropertyId("c");
   Item i = s.addItem("color1");
   i.getItemProperty("c").setValue("Green");
   i = s.addItem("color2");
   i.getItemProperty("c").setValue("Blue");
   i = s.addItem("color3");
   i.getItemProperty("c").setValue("Red");
   i = s.addItem("color4");
   i.getItemProperty("c").setValue("Orange");
   return s;
 }