private Component toggleInvalid() {
    CheckBox invalid = new CheckBox("Invalid");
    invalid.setImmediate(true);
    invalid.addValueChangeListener(
        new ValueChangeListener() {
          @Override
          public void valueChange(ValueChangeEvent event) {
            setInvalid((Boolean) event.getProperty().getValue());
          }
        });

    return invalid;
  }
 private CheckBox createSelected(final Object itemId) {
   final CheckBox c = new CheckBox();
   c.setBuffered(false);
   c.setImmediate(true);
   c.addValueChangeListener(
       new ValueChangeListener() {
         @Override
         public void valueChange(Property.ValueChangeEvent event) {
           Collection<Field<?>> fields =
               Collections2.filter(
                   getFieldsForItemId(itemId),
                   new Predicate<Field<?>>() {
                     @Override
                     public boolean apply(Field<?> eachField) {
                       return eachField != c;
                     }
                   });
           enableFields(fields, c.getValue());
         }
       });
   c.addValueChangeListener(validateOnValueChangeListener);
   return c;
 }
  private Component toggleReadOnly() {
    CheckBox readOnlyToggle = new CheckBox();
    readOnlyToggle.setImmediate(true);
    readOnlyToggle.setCaption("Read only");
    readOnlyToggle.addValueChangeListener(
        new ValueChangeListener() {
          @Override
          public void valueChange(ValueChangeEvent event) {
            setReadOnly((Boolean) event.getProperty().getValue());
          }
        });

    return readOnlyToggle;
  }
  private Component toggleEnabled() {
    CheckBox enabledToggle = new CheckBox();
    enabledToggle.setImmediate(true);
    enabledToggle.setValue(true);
    enabledToggle.setCaption("Enabled");
    enabledToggle.addValueChangeListener(
        new ValueChangeListener() {
          @Override
          public void valueChange(ValueChangeEvent event) {
            setEnabled((Boolean) event.getProperty().getValue());
          }
        });

    return enabledToggle;
  }
Beispiel #5
0
  @Override
  protected void setup(VaadinRequest request) {
    final Label status = new Label("Events received: " + count);
    status.setId("count");
    addComponent(status);

    CheckBox cb = new CheckBox("Non-immediate");
    ValueChangeListener listener =
        new ValueChangeListener() {
          @Override
          public void valueChange(ValueChangeEvent event) {
            count++;
            status.setValue("Events received: " + count);
          }
        };
    cb.addValueChangeListener(listener);
    cb.setImmediate(false);
    addComponent(cb);

    cb = new CheckBox("Immediate");
    cb.addValueChangeListener(listener);
    cb.setImmediate(true);
    addComponent(cb);
  }
  /*
   * (non-Javadoc)
   *
   * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server.
   * VaadinRequest)
   */
  @Override
  protected void setup(VaadinRequest request) {
    final Button btn = new Button();
    btn.setId("button");
    btn.setIcon(ICON, "initial alt text");
    addComponent(btn);

    final CheckBox enable = new CheckBox("Enable alt text", true);
    enable.addValueChangeListener(
        event -> {
          if (event.getValue()) {
            btn.setIconAlternateText("alt text");
          } else {
            btn.setIconAlternateText("");
          }
        });
    addComponent(enable);
  }
  private void initFormFields(Layout formLayout, Class<? extends CalendarEvent> eventClass) {

    startDateField = createDateField("Start date");
    endDateField = createDateField("End date");

    final CheckBox allDayField = createCheckBox("All-day");
    allDayField.addValueChangeListener(
        event -> {
          if (event.getValue()) {
            setFormDateResolution(Resolution.DAY);
          } else {
            setFormDateResolution(Resolution.MINUTE);
          }
        });

    captionField = createTextField("Caption");
    final TextField whereField = createTextField("Where");
    final TextArea descriptionField = createTextArea("Description");
    descriptionField.setRows(3);

    final ComboBox styleNameField = createStyleNameComboBox();

    formLayout.addComponent(startDateField);
    formLayout.addComponent(endDateField);
    formLayout.addComponent(allDayField);
    formLayout.addComponent(captionField);
    if (eventClass == CalendarTestEvent.class) {
      formLayout.addComponent(whereField);
    }
    formLayout.addComponent(descriptionField);
    formLayout.addComponent(styleNameField);

    scheduleEventFieldGroup.bind(startDateField, "start");
    scheduleEventFieldGroup.bind(endDateField, "end");
    scheduleEventFieldGroup.bind(captionField, "caption");
    scheduleEventFieldGroup.bind(descriptionField, "description");
    if (eventClass == CalendarTestEvent.class) {
      scheduleEventFieldGroup.bind(whereField, "where");
    }
    scheduleEventFieldGroup.bind(styleNameField, "styleName");
    scheduledEventBinder.bind(allDayField, CalendarEvent::isAllDay, null);
  }
  private void init() {
    final Label label = new Label(i18n.get("label.auto.assign.description"));

    checkBox = new CheckBox(i18n.get("label.auto.assign.enable"));
    checkBox.setId(UIComponentIdProvider.DIST_SET_SELECT_ENABLE_ID);
    checkBox.setImmediate(true);
    checkBox.addValueChangeListener(this);

    final VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.addComponent(label);
    verticalLayout.addComponent(checkBox);
    verticalLayout.addComponent(dsTable);

    window =
        new WindowBuilder(SPUIDefinitions.CREATE_UPDATE_WINDOW)
            .caption(i18n.get("caption.select.auto.assign.dist"))
            .content(verticalLayout)
            .layout(verticalLayout)
            .i18n(i18n)
            .saveDialogCloseListener(this)
            .buildCommonDialogWindow();
    window.setId(UIComponentIdProvider.DIST_SET_SELECT_WINDOW_ID);
  }
Beispiel #9
0
  @Override
  public void initUI() {
    // TODO Auto-generated method stub

    CssLayout buttonLayout = new CssLayout();

    Button buttonAdd = new Button("Add");
    buttonAdd.addClickListener(
        new ClickListener() {

          @Override
          public void buttonClick(ClickEvent event) {
            // TODO Auto-generated method stub

            addSite();
          }
        });
    buttonLayout.addComponent(buttonAdd);
    Button buttonRemove = new Button("Remove");
    buttonRemove.addClickListener(
        new ClickListener() {

          @Override
          public void buttonClick(ClickEvent event) {
            // TODO Auto-generated method stub

            if (!isSelected()) {

              Notification.show("Must select at least one");
              return;
            }

            Collection<URI> value = getSelected();
            for (URI u : value) {

              removeSite(u.toString());
            }

            loadSites();
          }
        });
    buttonLayout.addComponent(buttonRemove);
    Button buttonEdit = new Button("Edit");
    buttonEdit.addClickListener(
        new ClickListener() {

          @Override
          public void buttonClick(ClickEvent event) {
            // TODO Auto-generated method stub
            modificSite();
          }
        });
    buttonLayout.addComponent(buttonEdit);
    VerticalLayout verticalLayoutButton = new VerticalLayout();

    CheckBox enableChek = new CheckBox("Enable");
    verticalLayoutButton.addComponent(enableChek);

    enableChek.addValueChangeListener(
        new ValueChangeListener() {

          @Override
          public void valueChange(ValueChangeEvent event) {
            // TODO Auto-generated method stub
            if (!isSelected()) {

              Notification.show("Must select at least one");
              return;
            }
            Boolean value = (Boolean) event.getProperty().getValue();

            Collection<URI> selected = getSelected();
            for (URI uri : selected) {

              sitesManager.setRepositoryEnabled(agent, uri, value);
            }

            loadSites();
          }
        });
    Button reloadButton = new Button("Reload");
    reloadButton.addClickListener(
        new ClickListener() {

          @Override
          public void buttonClick(ClickEvent event) {
            // TODO Auto-generated method stub

            loadSites();
          }
        });
    verticalLayoutButton.addComponent(reloadButton);
    Button importButton = new Button("Import");
    verticalLayoutButton.addComponent(importButton);
    Button exportButton = new Button("Export");
    verticalLayoutButton.addComponent(exportButton);

    treeTable = new TreeTable("List of avaible software sites");
    treeTable.addContainerProperty("Name", String.class, "");
    treeTable.addContainerProperty("Location", String.class, "");
    treeTable.addContainerProperty("Enable", String.class, "");
    treeTable.setPageLength(5);
    treeTable.setWidth("40em");
    treeTable.setSelectable(true);
    treeTable.setImmediate(true);
    treeTable.setMultiSelect(true);

    HorizontalLayout simpleContainer = new HorizontalLayout();
    simpleContainer.addComponent(treeTable);
    simpleContainer.addComponent(verticalLayoutButton);

    mainLayout.addComponent(buttonLayout);
    mainLayout.addComponent(simpleContainer);
  }
 private void initDisabledButton() {
   disabledButton = new CheckBox("Disabled");
   disabledButton.addValueChangeListener(
       event -> calendarComponent.setEnabled(!disabledButton.getValue()));
 }
 private void initReadOnlyButton() {
   readOnlyButton = new CheckBox("Read-only mode");
   readOnlyButton.addValueChangeListener(
       event -> calendarComponent.setReadOnly(readOnlyButton.getValue()));
 }
 private void initHideWeekEndButton() {
   hideWeekendsButton = new CheckBox("Hide weekends");
   hideWeekendsButton.addValueChangeListener(
       event -> setWeekendsHidden(hideWeekendsButton.getValue()));
 }
Beispiel #13
0
  // Build the UI components
  private void buildview() {
    logger.info(
        "Company ID : "
            + companyid
            + " | User Name : "
            + username
            + " > "
            + "Painting Email logger UI");
    btnAdd.setVisible(false);
    btnDownload.setVisible(false);
    btnEdit.setVisible(false);
    btnAuditRecords.setVisible(false);
    // Email-id text box
    tfemailid = new TextField("Email Id");
    // product combo box
    cbproduct = new GERPComboBox("Product Name");
    cbproduct.setItemCaptionPropertyId("prodname");
    loadProductList();
    // Email start date
    dfemailStartdate = new GERPPopupDateField("Log Start Dt");
    dfemailStartdate.setInputPrompt("Select Date");
    // Email End date
    dfemailEndDate = new GERPPopupDateField("Log End Dt");
    dfemailEndDate.setInputPrompt("Select Date");
    btndelete = new Button("Delete");
    btndelete.addStyleName("delete");
    btndelete.setEnabled(true);
    btndelete.setVisible(true);
    btndelete.addClickListener(
        new ClickListener() {
          private static final long serialVersionUID = 1L;

          @Override
          public void buttonClick(ClickEvent event) {
            btndelete.setEnabled(true);
            if (cockeckall.getValue().equals(true)) {
              for (EmailLoggerDM obj : emailList) {
                serviceemailLogger.delete(obj.getEmaillogId());
              }

            } else {
              delete();
            }

            loadSrchRslt();
            /*	btndelete.setEnabled(false);
            cockeckall.setValue(false);*/
          }
        });
    cockeckall = new CheckBox("Select All");
    cockeckall.addStyleName("delete");
    cockeckall.setEnabled(true);
    cockeckall.setVisible(true);
    setCheckBoxTable();
    cockeckall.setImmediate(true);
    cockeckall.addValueChangeListener(
        new Property.ValueChangeListener() {
          private static final long serialVersionUID = 1L;

          public void valueChange(ValueChangeEvent event) {
            if (event.getProperty().getValue().equals(true)) {
              loadSrchRslt();
              btndelete.setEnabled(true);
            } else {
              loadSrchRslt();
              btndelete.setEnabled(false);
            }
          }
        });
    hlCmdBtnLayout.addComponent(cockeckall);
    hlCmdBtnLayout.setSpacing(true);
    hlCmdBtnLayout.setComponentAlignment(cockeckall, Alignment.MIDDLE_RIGHT);
    hlCmdBtnLayout.addComponent(btndelete);
    hlCmdBtnLayout.setComponentAlignment(btndelete, Alignment.MIDDLE_RIGHT);
    hlCmdBtnLayout.setExpandRatio(btndelete, 1);
    // build search layout
    hlSearchLayout = new GERPAddEditHLayout();
    assembleSearchLayout();
    hlSrchContainer.addComponent(GERPPanelGenerator.createPanel(hlSearchLayout));
    resetFields();
    loadSrchRslt();
  }