private Widget createNotesField() {
    noteField = new TextArea();
    noteField.setPreventScrollbars(true);
    noteField.setFieldLabel("Notes");

    return noteField;
  }
Пример #2
0
  private final ContentPanel createPropertiesContent() {
    FormPanel panel = new FormPanel();
    panel.setHeaderVisible(false);
    panel.setButtonAlign(HorizontalAlignment.RIGHT);
    panel.setStyleAttribute("padding", "20");

    KeyListener keyListener =
        new KeyListener() {
          public void componentKeyUp(ComponentEvent event) {
            editor.markDirty();
          }
        };

    name = new TextField<String>();
    name.setFieldLabel(constants.name());
    name.setEmptyText(constants.groupName());
    name.setAllowBlank(false);
    name.setMinLength(2);
    name.addKeyListener(keyListener);
    name.setStyleAttribute("marginTop", "5");
    name.setStyleAttribute("marginBottom", "5");
    panel.add(name);

    description = new TextArea();
    description.setPreventScrollbars(true);
    description.setFieldLabel(constants.description());
    description.addKeyListener(keyListener);
    description.setStyleAttribute("marginTop", "5");
    description.setStyleAttribute("marginBottom", "5");
    panel.add(description);

    return panel;
  }
Пример #3
0
  public CommentSection(int width, int height) {
    getFormLayout().setLabelAlign(LabelAlign.TOP);

    commentField = new TextArea();
    commentField.setName("comments");
    commentField.setFieldLabel(I18N.CONSTANTS.comments());
    if (width > 0) {
      getFormLayout().setDefaultWidth(width);
      commentField.setWidth(width);
    }
    if (height > 0) {
      commentField.setHeight(height);
    }
    add(commentField);
  }
  // ******************************************************
  // Method: getPanel
  //
  // ******************************************************
  private FormPanel getPanel() {
    FormLayout formLayout = new FormLayout(LabelAlign.LEFT);
    formLayout.setLabelWidth(160);

    FormPanel formPanel = new FormPanel();
    formPanel.setHeight(350);
    formPanel.setLayout(formLayout);
    formPanel.setPadding(10);
    formPanel.setFrame(false);
    formPanel.setBorders(false);
    formPanel.setBodyBorder(false);
    formPanel.setHeaderVisible(false);

    FormData formData = new FormData("95%");

    availableJndiNamesComboBox = new SimpleComboBox<String>();
    availableJndiNamesComboBox.add("FIT_DATA_TEST");
    availableJndiNamesComboBox.add("FIT_SOURCE_TEST");
    availableJndiNamesComboBox.add("FIT_CONFIG_TEST");
    availableJndiNamesComboBox.setAllowBlank(false);
    availableJndiNamesComboBox.setForceSelection(true);
    availableJndiNamesComboBox.setEditable(false);
    availableJndiNamesComboBox.setTriggerAction(TriggerAction.ALL);
    availableJndiNamesComboBox.setFieldLabel("Source JNDI*");
    availableJndiNamesComboBox.setSimpleValue("FIT_CONFIG_TEST");
    formPanel.add(availableJndiNamesComboBox, formData);

    sourceSqlQueryTextArea = new TextArea();
    sourceSqlQueryTextArea.setFieldLabel("Sql Query*");
    sourceSqlQueryTextArea.setAllowBlank(false);
    formPanel.add(sourceSqlQueryTextArea, new FormData(314, 200));

    setupRulesCheckBox = new CheckBox();
    setupRulesCheckBox.setFieldLabel("Setup Rules?");
    setupRulesCheckBox.setBoxLabel("");
    formPanel.add(setupRulesCheckBox, formData);
    return formPanel;
  }
Пример #5
0
  @Override
  protected void onRender(Element parent, int pos) {
    super.onRender(parent, pos);

    tfTitle.setFieldLabel("Title");
    tfTitle.setAllowBlank(false);
    tfTitle.getMessages().setBlankText("Title is required");

    taDescription.setFieldLabel("Description");
    taDescription.setAllowBlank(false);
    taDescription.getMessages().setBlankText("Description is required");

    tfLink.setFieldLabel("Link");
    tfLink.setAllowBlank(false);
    tfLink.setRegex("^http\\://[a-zA-Z0-9\\-\\.]+\\.[a-zA-Z]{2,3}(/\\S*)?$");
    tfLink.getMessages().setBlankText("Link is required");
    tfLink
        .getMessages()
        .setRegexText("The link field must be a URL e.g. http://www.example.com/rss.xml");

    add(tfTitle);
    add(taDescription);
    add(tfLink);
  }
Пример #6
0
  @Override
  public Widget asWidget() {

    // show window
    window.setSize(400, 310);
    window.setPlain(true);
    window.setModal(true);
    window.setClosable(false);
    window.setResizable(false);
    window.setHeading(AppController.Lang.AddNew(AppController.Lang.RunValue().toLowerCase()));
    window.setLayout(new FitLayout());

    // form
    final FormData formData = new FormData("-20");
    FormPanel simple = new FormPanel();
    simple.setHeaderVisible(false);
    simple.setFrame(true);
    simple.setAutoWidth(true);
    simple.setLabelWidth(100);
    // run
    cbName.setDisplayField("n");
    cbName.setFieldLabel(AppController.Lang.Run());
    cbName.setStore(storeName);
    cbName.setEnabled(false);
    cbName.setMinLength(Constants.LIMIT_NAME_MIN);
    cbName.setMaxLength(Constants.LIMIT_NAME_MAX);
    cbName.setAllowBlank(false);
    cbName.setTriggerAction(TriggerAction.ALL);
    simple.add(cbName, formData);
    // date
    final DateField tfDate = CommonUtils.getDateField(date);
    simple.add(tfDate, formData);
    // time
    final TimeSelectFieldView tfTime = new TimeSelectFieldView(0, null);
    tfTime.setFieldLabel(AppController.Lang.Time());
    simple.add(tfTime);

    // duration
    final MySpinnerField tfDuration = CommonUtils.getDurationSpinner();
    simple.add(tfDuration, formData);
    // pulse
    final SpinnerField tfPulse = CommonUtils.getPulseSpinner();
    simple.add(tfPulse, formData);
    // pulse max
    final SpinnerField tfPulseMax = CommonUtils.getPulseSpinner();
    tfPulseMax.setFieldLabel(AppController.Lang.MaxPulse());
    simple.add(tfPulseMax, formData);
    // calories
    final SpinnerField tfCalories = CommonUtils.getCaloriesSpinner();
    simple.add(tfCalories, formData);

    // info
    final TextArea tfInfo = new TextArea();
    tfInfo.setPreventScrollbars(true);
    tfInfo.setFieldLabel(AppController.Lang.Info());
    simple.add(tfInfo, formData);

    // buttons eventhandler
    Button btnAdd = new Button(AppController.Lang.Add());
    btnAdd.setScale(ButtonScale.MEDIUM);
    btnAdd.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @SuppressWarnings("deprecation")
          @Override
          public void componentSelected(ButtonEvent ce) {
            try {
              // return model
              if (handler != null) {

                final int pulse = (int) tfPulse.getValue().doubleValue();
                final int pulseMax = (int) tfPulseMax.getValue().doubleValue();
                final int calories = (int) tfCalories.getValue().doubleValue();
                // date and time
                Date date = tfDate.getValue();
                final double time = CommonUtils.getTimeToSeconds(tfTime.getValue());
                date.setHours((int) (time / 3600));
                date.setMinutes((int) ((time % 3600) / 60));
                date = CommonUtils.trimDateToDatabase(date, false);
                final String info = tfInfo.getValue();
                final long duration = tfDuration.getValue().intValue();

                RunValueModel value = new RunValueModel();
                value.setCalories(calories);
                value.setDate(date);
                value.setDuration(duration);
                value.setInfo(info);
                value.setPulse(pulse);
                value.setPulseMax(pulseMax);

                // get run
                RunModel run = null;
                // if no values
                if (cbName.getValue() == null) {
                  final String str = cbName.getRawValue();
                  run = new RunModel(0L, str);
                }
                // if user typed new value
                else if (!cbName.getRawValue().equals(cbName.getValue().getNameClient())) {
                  final String str = cbName.getRawValue();
                  run = new RunModel(0L, str);
                }
                // value selected from list
                else {
                  run = cbName.getValue();
                }

                handler.newValue(run, value);
              }

            } catch (Exception e) {
              Motiver.showException(e);
            }
          }
        });
    simple.addButton(btnAdd);
    Button btnCancel = new Button(AppController.Lang.Cancel());
    btnCancel.setScale(ButtonScale.MEDIUM);
    // hide window
    btnCancel.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            handler.cancel();
          }
        });
    simple.addButton(btnCancel);
    simple.setButtonAlign(HorizontalAlignment.CENTER);
    FormButtonBinding binding = new FormButtonBinding(simple);
    binding.addButton(btnAdd);
    window.add(simple);

    window.show();

    return this;
  }
Пример #7
0
  private TextArea getCommandLineTextArea() {
    if (txtrEnterTheCommand == null) {
      txtrEnterTheCommand = new TextArea();
      txtrEnterTheCommand.setFieldLabel("Enter the command to run");
      txtrEnterTheCommand.setAllowBlank(false);
      txtrEnterTheCommand.addListener(
          Events.KeyUp,
          new Listener<BaseEvent>() {

            public void handleEvent(BaseEvent be) {

              String text = txtrEnterTheCommand.getValue();
              String exe;
              if (text == null) {
                exe = "";
              } else {
                int firstWhitespace = text.indexOf(" ");
                if (firstWhitespace == -1) {
                  exe = text;
                } else {
                  exe = text.substring(0, firstWhitespace);
                }
              }

              if (lastCalculatedExecutable != null && lastCalculatedExecutable.equals(exe)) {
                return;
              }

              final String executable = exe;
              lastCalculatedExecutable = exe;

              suggestJobname();

              if (exe.length() == 0) {
                lastCalculatedExecutable = null;
                setStatus("No executable specified.");
                setAppNotAvailable();
                return;
              }

              setStatus("Trying to find application(s) for executable: " + executable);

              GrisuClientService.Util.getInstance()
                  .getApplicationForExecutable(
                      exe,
                      new AsyncCallback<String[]>() {

                        public void onFailure(Throwable arg0) {
                          getApplicationPanel().setHeading("Application");
                          arg0.printStackTrace();
                        }

                        public void onSuccess(String[] arg0) {

                          if (arg0.length == 0) {
                            setStatus("Could not find application for executable: " + executable);
                            setAppNotAvailable();
                            return;
                          }

                          if (arg0.length > 1) {
                            setStatus(
                                "Found more than one application for executable: "
                                    + executable
                                    + ". Please contact [email protected] and tell them to bloody fix this.");
                            // return;
                          }

                          setStatus(
                              "Found "
                                  + arg0.length
                                  + " applications for executable "
                                  + executable
                                  + ". Getting Versions...");

                          setCurrentApplication(arg0);

                          fillVersionsComboBox();
                        }
                      });
            }
          });
    }
    return txtrEnterTheCommand;
  }