@Override
  protected void setup() {
    FormLayout formLayout = new FormLayout();
    CheckBox control = new CheckBox("Messages On/Off");
    control.addListener(
        new ValueChangeListener() {

          @Override
          public void valueChange(ValueChangeEvent event) {
            messages.setVisible((Boolean) event.getProperty().getValue());
            messages.setRequired(true);
            messages.setCaption("Messages visible");
          }
        });
    control.setImmediate(true);
    formLayout.addComponent(control);

    messages = new TextArea("Messages hidden");
    messages.setRows(10);
    messages.setColumns(40);
    messages.setVisible(false);
    messages.setEnabled(false);
    formLayout.addComponent(messages);

    addComponent(formLayout);
  }
    @Override
    protected Field createField(Object propertyId, String caption) {

      if (RelatedProjectsExt.PROPERTY_CALCULATED.equals(propertyId)) {
        final CheckBox field = new CheckBox(caption);
        field.setImmediate(true);
        field.addListener(
            new ValueChangeListener() {

              private static final long serialVersionUID = 3996507266934851419L;

              @Override
              public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) {
                if (comboBox != null) {
                  comboBox.setEnabled(!field.booleanValue());
                }
              }
            });
        return field;
      } else if (RelatedProjectsExt.PROPERTY_RELATED_PROJECT.equals(propertyId)) {
        UUIDList ids = extension.getRelatedProjects();
        comboBox = new MultiComboBox(caption, ids);
        comboBox.setEnabled(!extension.getCalculated());
        return comboBox;
      }
      return null;
    }
  public SearchView(final AddressBookApplication app) {
    this.app = app;
    addStyleName("view");

    setCaption("Search contacts");
    setSizeFull();

    /* Use a FormLayout as main layout for this Panel */
    FormLayout formLayout = new FormLayout();
    setContent(formLayout);

    /* Create UI components */
    tf = new TextField("Search term");
    fieldToSearch = new NativeSelect("Field to search");
    saveSearch = new CheckBox("Save search");
    searchName = new TextField("Search name");
    Button search = new Button("Search");

    /* Initialize fieldToSearch */
    for (int i = 0; i < PersonContainer.NATURAL_COL_ORDER.length; i++) {
      fieldToSearch.addItem(PersonContainer.NATURAL_COL_ORDER[i]);
      fieldToSearch.setItemCaption(
          PersonContainer.NATURAL_COL_ORDER[i], PersonContainer.COL_HEADERS_ENGLISH[i]);
    }

    fieldToSearch.setValue("lastName");
    fieldToSearch.setNullSelectionAllowed(false);

    /* Initialize save checkbox */
    saveSearch.setValue(true);
    saveSearch.setImmediate(true);
    saveSearch.addListener(
        new ClickListener() {
          public void buttonClick(ClickEvent event) {
            searchName.setVisible(event.getButton().booleanValue());
          }
        });

    search.addListener(
        new Button.ClickListener() {
          public void buttonClick(ClickEvent event) {
            performSearch();
          }
        });

    /* Add all the created components to the form */
    addComponent(tf);
    addComponent(fieldToSearch);
    addComponent(saveSearch);
    addComponent(searchName);
    addComponent(search);
  }
  private Component toggleRequired() {
    CheckBox requiredToggle = new CheckBox();
    requiredToggle.setImmediate(true);
    requiredToggle.setCaption("Required");
    requiredToggle.addListener(
        new ValueChangeListener() {

          @Override
          public void valueChange(ValueChangeEvent event) {
            setRequired((Boolean) event.getProperty().getValue());
          }
        });
    return requiredToggle;
  }
  private Component toggleIcon() {
    CheckBox iconToggle = new CheckBox();
    iconToggle.setImmediate(true);
    iconToggle.setCaption("Icons");
    iconToggle.addListener(
        new ValueChangeListener() {

          @Override
          public void valueChange(ValueChangeEvent event) {
            setIcon((Boolean) event.getProperty().getValue());
          }
        });
    return iconToggle;
  }
  public SpecialAccessControl() {
    setMargin(true);
    setSpacing(true);

    addComponent(userList());

    allowedBackwardInputAttendance.setCaption("Allow user to enter previous attendance.");
    allowedBackwardInputAttendance.addListener(
        new ClickListener() {

          @Override
          public void buttonClick(Button.ClickEvent event) {
            if (event.getButton().booleanValue()) {
              val = 1;
            } else {
              val = 0;
            }
          }
        });
    allowedBackwardInputAttendance.setImmediate(true);
    addComponent(allowedBackwardInputAttendance);

    Button button = new Button("UPDATE");
    button.setWidth("200px");
    button.addListener(
        new ClickListener() {

          @Override
          public void buttonClick(Button.ClickEvent event) {
            if (users.getValue() == null) {
              getWindow()
                  .showNotification("Select a User!", Window.Notification.TYPE_WARNING_MESSAGE);
              return;
            }

            boolean isUserAllowed =
                service.updateUserAllowedToEnterPreviousAttendance(
                    util.convertStringToInteger(users.getValue().toString()), isAllowed());
            if (isUserAllowed) {
              getWindow()
                  .showNotification(
                      "User is allowed to Enter Previous Attendance!",
                      Window.Notification.TYPE_TRAY_NOTIFICATION);
            }
          }
        });
    button.setImmediate(true);
    addComponent(button);
  }
Beispiel #7
0
 @Override
 protected void setup() {
   useCustomStyles = new CheckBox("Use custom styling");
   useCustomStyles.setDebugId("styles");
   useCustomStyles.setImmediate(true);
   super.setup();
   addComponentAsFirst(useCustomStyles);
   useCustomStyles.addListener(
       new ValueChangeListener() {
         @Override
         public void valueChange(ValueChangeEvent event) {
           observations.setPlotOptions(getPlotBoxOptions());
           chart.drawChart();
         }
       });
 }
  /**
   * Fills the form with current field component. Adds additional widgets if needed (i.e. "select
   * all" box)
   *
   * @param form The form to place the field in
   * @param layout The layout that displays the field
   */
  public void placeYourselfInForm(Form form, FormLayout layout) {
    if (fieldComponent == null) {
      return;
    }

    if (fieldComponent instanceof Field) {
      form.addField(name, (Field) fieldComponent);
    } else if (fieldComponent instanceof FilterContainer) {
      for (Select select : ((FilterContainer) fieldComponent).getLevels()) {
        form.addField(select.getCaption(), select);
      }
    } else {
      layout.addComponent(fieldComponent);
    }

    if (selectAll) {
      final CheckBox saCheckbox = UiFactory.createCheckBox(UiIds.AR_MSG_SELECT_ALL, null);
      saCheckbox.addListener(
          new Property.ValueChangeListener() {
            @Override
            public void valueChange(ValueChangeEvent event) {
              boolean selected = (Boolean) saCheckbox.getValue();
              if (fieldComponent instanceof Select) {
                for (Object itemId : ((Select) fieldComponent).getItemIds()) {
                  if (selected) {
                    ((Select) fieldComponent).select(itemId);
                  } else {
                    ((Select) fieldComponent).unselect(itemId);
                  }
                }
              }
              if (fieldComponent instanceof FilterContainer) {
                List<Select> selectList = ((FilterContainer) fieldComponent).getLevels();
                Select select = selectList.get(selectList.size() - 1);
                for (Object itemId : select.getItemIds()) {
                  if (selected) {
                    select.select(itemId);
                  } else {
                    select.unselect(itemId);
                  }
                }
              }
            }
          });
      form.addField(name + "_all", saCheckbox);
    }
  }
  @SuppressWarnings("serial")
  @Override
  public void afterPropertiesSet() throws Exception {
    setHeight("200px");
    setWidth("700px");

    crossNameOptionGroup = new OptionGroup();
    sequenceNumCheckBox = new CheckBox();
    sequenceNumCheckBox.setImmediate(true);
    sequenceNumCheckBox.addListener(
        new Property.ValueChangeListener() {
          @Override
          public void valueChange(ValueChangeEvent event) {
            enableSpecifyLeadingZerosComponents(sequenceNumCheckBox.booleanValue());
          }
        });

    specifyPrefixLabel = new Label();
    prefixTextField = new TextField();
    prefixTextField.setWidth("500px");

    howManyDigitsLabel = new Label();
    leadingZerosSelect = new Select();
    for (int i = 1; i <= MAX_LEADING_ZEROS; i++) {
      leadingZerosSelect.addItem(Integer.valueOf(i));
    }
    leadingZerosSelect.setNullSelectionAllowed(false);
    leadingZerosSelect.select(Integer.valueOf(1));
    leadingZerosSelect.setWidth("50px");

    specifySuffixLabel = new Label();
    suffixTextField = new TextField();
    suffixTextField.setWidth("500px");

    nextNameInSequenceLabel = new Label();
    generatedNameLabel = new Label();

    generateButton = new Button();
    generateButton.setData(GENERATE_BUTTON_ID);
    generateButton.addListener(new CrossingManagerImportButtonClickListener(this));

    layoutComponents();
    initializeToggableComponents();
  }
Beispiel #10
0
  protected Component createMainArea() {
    layout = new VerticalLayout();

    layout.setSpacing(true);
    layout.setMargin(true);
    layout.setSizeFull();

    HorizontalLayout filterLine = new HorizontalLayout();

    TextField filterBox = new TextField();
    filterBox.addStyleName(JabylonStyle.SEARCH_FIELD.getCSSName());
    filterBox.addListener(
        new TextChangeListener() {

          @Override
          public void textChange(TextChangeEvent event) {
            propertyFilter.setFilterText(event.getText());
            propertyPairContainer.addContainerFilter(propertyFilter);
          }
        });
    filterBox.setInputPrompt(
        Messages.getString("PropertiesEditor_FILTER_INPUT_PROMPT")); // $NON-NLS-1$
    filterLine.addComponent(filterBox);

    final CheckBox untranslatedBox =
        new CheckBox(
            Messages.getString(
                "PropertiesEditor_SHOW_ONLY_UNTRANSLATED_BUTTON_CAPTION")); //$NON-NLS-1$
    untranslatedBox.addListener(
        new ClickListener() {

          @Override
          public void buttonClick(ClickEvent event) {
            propertyPairContainer.removeContainerFilter(untranslatedFilter);
            if (untranslatedBox.getValue().equals(Boolean.TRUE))
              propertyPairContainer.addContainerFilter(untranslatedFilter);
          }
        });
    untranslatedBox.setImmediate(true);
    filterLine.addComponent(untranslatedBox);

    layout.addComponent(filterLine);
    layout.setExpandRatio(filterLine, 0);

    table = new Table();
    table.addStyleName(JabylonStyle.TABLE_STRIPED.getCSSName());
    table.setSizeFull();
    target = descriptor.loadProperties();
    source = descriptor.getMaster().loadProperties();

    propertyPairContainer = new PropertyPairContainer(source, target);
    table.setContainerDataSource(propertyPairContainer);
    table.setVisibleColumns(
        propertyPairContainer.getContainerPropertyIds().subList(0, 2).toArray());
    table.setWidth(100, Table.UNITS_PERCENTAGE);
    table.addGeneratedColumn(
        Messages.getString("PropertiesEditor_PROBLEMS_COLUMN_HEADER"),
        new ColumnGenerator() { //$NON-NLS-1$

          @Override
          public Object generateCell(Table source, Object itemId, Object columnId) {

            if (reviews.containsKey(itemId)) {
              Embedded embedded = new Embedded("", ImageConstants.IMAGE_ERROR); // $NON-NLS-1$

              Review review = reviews.get((String) itemId).iterator().next();
              // TODO: this can't be the right way to refresh?
              if (review.cdoInvalid()) {
                reviews.remove(itemId, review); // the review is
                // no
                // longer valid
                embedded.setIcon(ImageConstants.IMAGE_OK);
                embedded.setDescription(""); // $NON-NLS-1$
              } else {
                embedded.setDescription(review.getMessage());
              }

              return embedded;
            } else return new Embedded("", ImageConstants.IMAGE_OK); // $NON-NLS-1$
          }
        });

    table.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_EXPLICIT);

    table.setColumnHeaders(
        new String[] {
          Messages.getString("PropertiesEditor_ORIGINAL_COLUMN_HEADER"),
          Messages.getString("PropertiesEditor_TRANSLATED_COLUMN_HEADER"),
          Messages.getString("PropertiesEditor_PROBLEMS_COLUMN_HEADER")
        }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    table.setColumnExpandRatio(propertyPairContainer.getContainerPropertyIds().get(0), 1.0f);
    table.setColumnExpandRatio(propertyPairContainer.getContainerPropertyIds().get(1), 1.0f);
    table.setColumnExpandRatio(
        Messages.getString("PropertiesEditor_PROBLEMS_COLUMN_HEADER"), 0.0f); // $NON-NLS-1$

    table.setEditable(false);
    table.setWriteThrough(false);

    table.setSelectable(true);
    table.setMultiSelect(false);
    table.setImmediate(true); // react at once when something is selected
    table.addListener(this);

    layout.addComponent(table);

    layout.setExpandRatio(table, 2);
    createEditorArea();
    return layout;
  }
Beispiel #11
0
  /**
   * The constructor should first build the main layout, set the composition root and then do any
   * custom initialization.
   *
   * <p>The constructor will not be automatically regenerated by the visual editor.
   *
   * @throws Exception
   * @throws IllegalArgumentException
   */
  public JobViewForm() throws IllegalArgumentException, Exception {
    buildMainLayout();
    setCompositionRoot(mainLayout);

    // TODO add user code here
    initComponents();

    cronExpressionField.setVisible(false);
    future_timeField.setEnabled(false);
    startTimeField.setResolution(DateField.RESOLUTION_SEC);
    endTimeField.setResolution(DateField.RESOLUTION_SEC);

    // configure Type data
    areaField.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY);
    areaField.setItemCaptionPropertyId("name");

    jobTriggerTypeField.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY);
    jobTriggerTypeField.setItemCaptionPropertyId("description");

    jobIntervalTypeField.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY);
    jobIntervalTypeField.setItemCaptionPropertyId("description");

    // get form services from OSGi Service Registry
    getServices();

    // load data sources
    loadData();

    futureField.setImmediate(true);
    futureField.addListener(
        new ValueChangeListener() {
          @Override
          public void valueChange(ValueChangeEvent event) {
            if (event.getProperty().getValue() == null) return;

            if ((Boolean) event.getProperty().getValue()) future_timeField.setEnabled(true);
            else {
              future_timeField.setValue(null);
              future_timeField.setEnabled(false);
            }
          }
        });

    jobTriggerTypeField.setImmediate(true);
    jobTriggerTypeField.setNullSelectionAllowed(false);
    jobTriggerTypeField.addListener(
        new ValueChangeListener() {
          @Override
          public void valueChange(ValueChangeEvent event) {
            if (event.getProperty().getValue() == null) return;

            if (((JobTriggerType) event.getProperty().getValue())
                .getCode()
                .equals(Job.JOB_TRIGGER_TYPE.SIMPLE.name())) {
              jobIntervalField.setVisible(true);
              jobIntervalTypeField.setVisible(true);
              repeatCountField.setVisible(true);
              cronExpressionField.setVisible(false);
            } else {
              jobIntervalField.setVisible(false);
              jobIntervalTypeField.setVisible(false);
              repeatCountField.setVisible(false);
              cronExpressionField.setVisible(true);
            }
          }
        });
  }
Beispiel #12
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();
  }
Beispiel #13
0
  private void buildWorkSpace() {
    mainLayout.addTab(workSpace, "Work Space");
    workSpace.setSizeFull();

    final TextField className = new TextField("Correlator Class Name");
    final TextArea classCode = new TextArea("Correlator Code");

    final TextField builderClassName = new TextField("Builder Class Name");
    final TextArea builderClassCode = new TextArea("Builder Code");

    final CheckBox withBuilder = new CheckBox("Correlator comes with builder?");
    withBuilder.setImmediate(true);
    withBuilder.addListener(
        new Property.ValueChangeListener() {
          public void valueChange(Property.ValueChangeEvent event) {
            if (withBuilder.booleanValue()) {
              builderClassName.setVisible(true);
              builderClassCode.setVisible(true);
            } else {
              builderClassName.setVisible(false);
              builderClassCode.setVisible(false);
            }
          }
        });

    final Button compile = new Button("Add Correlator");
    compile.addListener(
        new Button.ClickListener() {
          public void buttonClick(Button.ClickEvent event) {

            if (!withBuilder.booleanValue()) {
              CorrelatorFromCodeFactory.createCorrelator(
                  (String) helper.getBean("classPath"),
                  className.getValue().toString(),
                  classCode.getValue().toString(),
                  correlatorBuilderManager,
                  feed,
                  correlatorPool,
                  null,
                  null,
                  null);
            } else {
              RuntimeJavaFileCompiler.compile(
                  (String) helper.getBean("classPath"),
                  className.getValue().toString(),
                  classCode.getValue().toString());
              CorrelatorBuilderFromCodeFactory.createCorrelatorBuilder(
                  (String) helper.getBean("classPath"),
                  builderClassName.getValue().toString(),
                  builderClassCode.getValue().toString(),
                  correlatorBuilderManager,
                  feed,
                  correlatorPool);
            }
          }
        });

    workSpace.addComponent(className);
    workSpace.addComponent(classCode);
    workSpace.addComponent(withBuilder);
    workSpace.addComponent(builderClassName);
    workSpace.addComponent(builderClassCode);
    builderClassName.setVisible(false);
    builderClassCode.setVisible(false);
    workSpace.addComponent(compile);

    classCode.setWidth("100%");
    classCode.setHeight("500px");
    builderClassCode.setWidth("100%");
    builderClassCode.setHeight("500px");
  }