예제 #1
0
  @Override
  public void init() {
    LegacyWindow main = new LegacyWindow();
    setMainWindow(main);

    ComboBox combobox = new ComboBox("My ComboBox");

    // Enable null selection
    combobox.setNullSelectionAllowed(true);
    // Add the item that marks 'null' value
    String nullitem = "-- none --";
    combobox.addItem(nullitem);
    // Designate it was the 'null' value marker
    combobox.setNullSelectionItemId(nullitem);

    // Add some other items
    for (int i = 0; i < 10; i++) {
      combobox.addItem("Item " + i);
    }

    main.addComponent(combobox);
  }
예제 #2
0
  @Override
  public void init() {
    setMainWindow(main);
    setTheme("reindeer");

    themeToggle = new CheckBox("Runo theme");
    themeToggle.addListener(
        new ValueChangeListener() {

          @Override
          public void valueChange(ValueChangeEvent event) {
            if (getTheme() == "reindeer") {
              setTheme("runo");
            } else {
              setTheme("reindeer");
            }
          }
        });
    themeToggle.setStyleName("small");
    themeToggle.setImmediate(true);

    styleToggle = new CheckBox("Black style");
    styleToggle.addListener(
        new ValueChangeListener() {

          @Override
          public void valueChange(ValueChangeEvent event) {
            if (!main.getContent().getStyleName().contains("black")) {
              main.getContent().setStyleName("black");
            } else {
              main.getContent().setStyleName("");
            }
          }
        });
    styleToggle.setImmediate(true);
    styleToggle.setStyleName("small");

    iconToggle = new CheckBox("64x icons");
    iconToggle.addListener(
        new ValueChangeListener() {

          @Override
          public void valueChange(ValueChangeEvent event) {
            largeIcons = !largeIcons;
            recreateAll();
          }
        });
    iconToggle.setImmediate(true);
    iconToggle.setStyleName("small");

    nativeToggle = new CheckBox("Native buttons");
    nativeToggle.addListener(
        new ValueChangeListener() {

          @Override
          public void valueChange(ValueChangeEvent event) {
            nativeButtons = !nativeButtons;
            recreateAll();
          }
        });
    nativeToggle.setImmediate(true);
    nativeToggle.setStyleName("small");

    toggles.setSpacing(true);
    toggles.addComponent(themeToggle);
    toggles.addComponent(styleToggle);
    toggles.addComponent(iconToggle);
    toggles.addComponent(nativeToggle);
    main.addComponent(toggles);

    recreateAll();
  }
예제 #3
0
  private void recreateAll() {
    main.removeAllComponents();
    main.addComponent(toggles);

    main.addComponent(buildButtons(false, false, false, false));
    main.addComponent(buildButtons(false, false, true, false));
    main.addComponent(buildButtons(false, true, false, false));
    main.addComponent(buildButtons(false, true, true, false));
    main.addComponent(buildButtons(true, false, false, false));
    main.addComponent(buildButtons(true, false, true, false));
    main.addComponent(buildButtons(true, true, false, false));
    main.addComponent(buildButtons(true, true, true, false));

    main.addComponent(buildButtons(false, false, false, true));
    main.addComponent(buildButtons(false, false, true, true));
    main.addComponent(buildButtons(false, true, false, true));
    main.addComponent(buildButtons(false, true, true, true));
    main.addComponent(buildButtons(true, false, false, true));
    main.addComponent(buildButtons(true, false, true, true));
    main.addComponent(buildButtons(true, true, false, true));
    main.addComponent(buildButtons(true, true, true, true));

    final Button b = new Button("Tabindex");
    b.setTabIndex(1);
    main.addComponent(b);

    Button c =
        new Button(
            "toggle enabled",
            new Button.ClickListener() {
              @Override
              public void buttonClick(ClickEvent event) {
                b.setEnabled(!b.isEnabled());
              }
            });
    main.addComponent(c);
  }