Exemplo n.º 1
0
 private void configureComponents() {
   save.setStyleName(ValoTheme.BUTTON_PRIMARY);
   save.setClickShortcut(ShortcutAction.KeyCode.ENTER);
   cancel.setClickShortcut(ShortcutAction.KeyCode.ESCAPE);
   variantField.setNullSelectionAllowed(false);
   variantField.setInvalidAllowed(false);
   variantField.addItems(Variant.values());
   nominal.setNullSelectionAllowed(true);
   nominal.setInvalidAllowed(false);
   nominal.addItems(NominalValue.values());
 }
Exemplo n.º 2
0
    void displayVersions(String path) {
      List<PageVersion> pageVersions = pageService.getPageVersions(path);
      if (pageVersions.size() > 0) {
        final ComboBox pageSelection = new ComboBox();
        content.addComponent(pageSelection);
        pageSelection.setNullSelectionAllowed(false);
        pageSelection.setStyleName("version-selection-box");
        pageSelection.setTextInputAllowed(false);

        pageSelection.addValueChangeListener(
            new ValueChangeListener() {
              private static final long serialVersionUID = 1L;

              @Override
              public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) {
                selectedVersion = (PageVersion) pageSelection.getValue();
                if (selectedVersion != null) {
                  Page page =
                      pageService.getPageByVersion(beanItem.getPath(), selectedVersion.getName());
                  page.setPath(beanItem.getPath());
                  previewForm.setBean(page);
                  previewLayout.setTitle(page.getSubject());
                  ((PagePreviewFormLayout) previewLayout).displayPageInfo(page);
                }
              }
            });

        pageSelection.setItemCaptionMode(ItemCaptionMode.EXPLICIT);
        pageSelection.setNullSelectionAllowed(false);

        for (int i = 0; i < pageVersions.size(); i++) {
          PageVersion version = pageVersions.get(i);
          pageSelection.addItem(version);
          pageSelection.setItemCaption(version, getVersionDisplay(version, i));
        }

        if (pageVersions.size() > 0) {
          pageSelection.setValue(pageVersions.get(pageVersions.size() - 1));
        }
      }
    }
Exemplo n.º 3
0
  private void initLayout() {

    layout.setMargin(true);
    setContent(layout);

    form.setCaption("Employee Details ");
    PropertysetItem item = new PropertysetItem();
    item.addItemProperty("Name", new ObjectProperty<String>(""));
    item.addItemProperty("Address", new ObjectProperty<String>(""));

    ComboBox combobox = new ComboBox("Sex");
    combobox.setInvalidAllowed(true);
    combobox.setNullSelectionAllowed(false);
    combobox.addItem("Male");
    combobox.addItem("Female");
    item.addItemProperty("Age", new ObjectProperty<String>(""));
    item.addItemProperty("Email", new ObjectProperty<String>(""));
    item.addItemProperty("Mobile No", new ObjectProperty<String>(""));

    Form form = new Form();
    final Form reader = new Form();
    form.setCaption("Fill Your Details");
    form.setItemDataSource(item);
    reader.setItemDataSource(item);
    reader.setCaption("Your registation details");
    reader.setReadOnly(true);

    button.addClickListener(
        new Button.ClickListener() {
          public void buttonClick(ClickEvent event) {

            Label message = new Label("You are Registered");
            layout.addComponent(message);
            layout.addComponent(reader);
          }
        });
    layout.addComponent(form);

    final RichTextArea area = new RichTextArea();
    area.setValue("Add more details here");
    layout.addComponent(area);

    layout.addComponent(button);
  }
  protected void replaceToCombo(String key, Container container, String defaultValue) {
    final TextField field = (TextField) map.get(key);
    HorizontalLayout layout = (HorizontalLayout) field.getParent();
    field.setVisible(false);
    final ComboBox comboBox = new ComboBox("", container);
    comboBox.setImmediate(true);
    comboBox.setNullSelectionAllowed(false);

    comboBox.addValueChangeListener(
        new Property.ValueChangeListener() {
          @Override
          public void valueChange(Property.ValueChangeEvent valueChangeEvent) {
            field.setValue((String) comboBox.getValue());
          }
        });

    if (container.containsId(field.getValue())) {
      comboBox.select(field.getValue());
    } else {
      field.setValue(defaultValue);
      comboBox.select(defaultValue);
    }
    layout.addComponent(comboBox, 1);
  }