Examples of FieldsetPanel


Examples of org.projectforge.web.wicket.flowlayout.FieldsetPanel

  protected void init()
  {
    super.init();
    gridBuilder.newGridPanel();
    {
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("task"));
      final TaskSelectPanel taskSelectPanel = new TaskSelectPanel(fs, new PropertyModel<TaskDO>(data, "task"), parentPage, "taskId") {
        @Override
        protected void selectTask(final TaskDO task)
        {
          super.selectTask(task);
          parentPage.refresh(); // Task was changed. Therefore update the kost2 list.
        }
      };
      fs.add(taskSelectPanel);
      taskSelectPanel.init();
      taskSelectPanel.setRequired(true);
    }
    gridBuilder.newSplitPanel(GridSize.COL50);
    {
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("gantt.name"));
      final RequiredMaxLengthTextField name = new RequiredMaxLengthTextField(fs.getTextFieldId(), new PropertyModel<String>(data, "name"));
      WicketUtils.setStrong(name);
      fs.add(name);
    }
    gridBuilder.newSplitPanel(GridSize.COL50);
    {
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("gantt.owner"));
      final UserSelectPanel userSelectPanel = new UserSelectPanel(fs.newChildId(), new PropertyModel<PFUserDO>(data, "owner"), parentPage,
          "ownerId");
      fs.add(userSelectPanel);
      userSelectPanel.init();
    }
    gridBuilder.newSplitPanel(GridSize.COL50);
    {
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("title"));
      final RequiredMaxLengthTextField title = new RequiredMaxLengthTextField(fs.getTextFieldId(), new PropertyModel<String>(getSettings(),
          "title"), 100);
      WicketUtils.setStrong(title);
      fs.add(title);
    }
    gridBuilder.newSplitPanel(GridSize.COL50);
    {
      // read-access:
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("access.read"));
      final LabelValueChoiceRenderer<GanttAccess> readAccessChoiceRenderer = new LabelValueChoiceRenderer<GanttAccess>(this,
          GanttAccess.values());
      final DropDownChoice<GanttAccess> readAccessChoice = new DropDownChoice<GanttAccess>(fs.getDropDownChoiceId(),
          new PropertyModel<GanttAccess>(getData(), "readAccess"), readAccessChoiceRenderer.getValues(), readAccessChoiceRenderer);
      readAccessChoice.setNullValid(false);
      fs.add(readAccessChoice);
    }
    gridBuilder.newSplitPanel(GridSize.COL50);
    {
      // Width
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("gantt.settings.width"));
      fs.add(new MinMaxNumberField<Integer>(fs.getTextFieldId(), new PropertyModel<Integer>(data.getStyle(), "width"), 100, 10000));
    }
    gridBuilder.newSplitPanel(GridSize.COL50);
    {
      // write-access:
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("access.write"));
      final LabelValueChoiceRenderer<GanttAccess> writeAccessChoiceRenderer = new LabelValueChoiceRenderer<GanttAccess>(this,
          GanttAccess.values());
      final DropDownChoice<GanttAccess> writeAccessChoice = new DropDownChoice<GanttAccess>(fs.getDropDownChoiceId(),
          new PropertyModel<GanttAccess>(getData(), "writeAccess"), writeAccessChoiceRenderer.getValues(), writeAccessChoiceRenderer);
      writeAccessChoice.setNullValid(false);
      fs.add(writeAccessChoice);
    }
    gridBuilder.newSplitPanel(GridSize.COL50);
    {
      // Total label width:
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("gantt.settings.totalLabelWidth"));
      fs.add(new MinMaxNumberField<Double>(fs.getTextFieldId(), new PropertyModel<Double>(data.getStyle(), "totalLabelWidth"), 10.0,
          10000.0));
    }
    gridBuilder.newSplitPanel(GridSize.COL50);
    {
      // Options
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("label.options")).suppressLabelForWarning();
      final DivPanel checkBoxPanel = fs.addNewCheckBoxButtonDiv();
      checkBoxPanel.addCheckBoxButton(new PropertyModel<Boolean>(data.getStyle(), "relativeTimeValues"),
          getString("gantt.style.relativeTimeValues"));
      checkBoxPanel.addCheckBoxButton(new PropertyModel<Boolean>(data.getStyle(), "showToday"), getString("gantt.style.showToday"));
      checkBoxPanel.addCheckBoxButton(new PropertyModel<Boolean>(data.getStyle(), "showCompletion"), getString("gantt.style.showCompletion"));
      checkBoxPanel.add(new CheckBoxButton(checkBoxPanel.newChildId(), new PropertyModel<Boolean>(getSettings(), "showOnlyVisibles"),
          getString("gantt.settings.showOnlyVisibles")) {
        /**
         * @see org.projectforge.web.wicket.flowlayout.CheckBoxButton#wantOnSelectionChangedNotifications()
         */
        @Override
        protected boolean wantOnSelectionChangedNotifications()
        {
          // Submit form after toggling the check box.
          return true;
        }
      });
    }
    gridBuilder.newSplitPanel(GridSize.COL50);
    {
      // Time period
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("timePeriod")).suppressLabelForWarning();
      final DatePanel fromDatePanel = new DatePanel(fs.newChildId(), new PropertyModel<Date>(getSettings(), "fromDate"), DatePanelSettings
          .get().withSelectProperty("fromDate"));
      fs.add(fromDatePanel);
      fs.add(new DivTextPanel(fs.newChildId(), "-"));
      final DatePanel toDatePanel = new DatePanel(fs.newChildId(), new PropertyModel<Date>(getSettings(), "toDate"), DatePanelSettings
          .get().withSelectProperty("toDate"));
      fs.add(toDatePanel);
    }
    gridBuilder.newSplitPanel(GridSize.COL50);
    {
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("export"));
      final LabelValueChoiceRenderer<String> exportFormatChoiceRenderer = new LabelValueChoiceRenderer<String>();
      exportFormatChoiceRenderer.addValue(EXPORT_JPG, getString("gantt.export.jpg"));
      exportFormatChoiceRenderer.addValue(EXPORT_MS_PROJECT_MPX, getString("gantt.export.msproject.mpx"));
      exportFormatChoiceRenderer.addValue(EXPORT_MS_PROJECT_XML, getString("gantt.export.msproject.xml"));
      exportFormatChoiceRenderer.addValue(EXPORT_PDF, getString("gantt.export.pdf"));
      exportFormatChoiceRenderer.addValue(EXPORT_PNG, getString("gantt.export.png"));
      exportFormatChoiceRenderer.addValue(EXPORT_PROJECTFORGE, getString("gantt.export.projectforge"));
      exportFormatChoiceRenderer.addValue(EXPORT_SVG, getString("gantt.export.svg"));
      final DropDownChoice<String> exportFormatChoice = new DropDownChoice<String>(fs.getDropDownChoiceId(), new PropertyModel<String>(
          this, "exportFormat"), exportFormatChoiceRenderer.getValues(), exportFormatChoiceRenderer);
      exportFormatChoice.setNullValid(false);
      fs.add(exportFormatChoice);
      fs.add(new SingleButtonPanel(fs.newChildId(), new Button(SingleButtonPanel.WICKET_ID, new Model<String>("export")) {
        @Override
        public final void onSubmit()
        {
          parentPage.export(exportFormat);
        }
View Full Code Here

Examples of org.projectforge.web.wicket.flowlayout.FieldsetPanel

      }
    });
    final TimesheetFilter filter = getSearchFilter();
    {
      gridBuilder.newSplitPanel(GridSize.COL66);
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("task")).suppressLabelForWarning();
      final TaskSelectPanel taskSelectPanel = new TaskSelectPanel(fs, new Model<TaskDO>() {
        @Override
        public TaskDO getObject()
        {
          return taskTree.getTaskById(getSearchFilter().getTaskId());
        }

        @Override
        public void setObject(final TaskDO task)
        {
          if (task != null) {
            getSearchFilter().setTaskId(task.getId());
          } else {
            getSearchFilter().setTaskId(null);
          }
        }
      }, parentPage, "taskId");
      fs.add(taskSelectPanel);
      taskSelectPanel.init();
      taskSelectPanel.setRequired(false);
    }
    {
      // Assignee
      gridBuilder.newSplitPanel(GridSize.COL33);
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("user"));
      final UserSelectPanel assigneeSelectPanel = new UserSelectPanel(fs.newChildId(), new Model<PFUserDO>() {
        @Override
        public PFUserDO getObject()
        {
          return userGroupCache.getUser(filter.getUserId());
        }

        @Override
        public void setObject(final PFUserDO object)
        {
          if (object == null) {
            filter.setUserId(null);
          } else {
            filter.setUserId(object.getId());
          }
        }
      }, parentPage, "userId");
      fs.add(assigneeSelectPanel);
      assigneeSelectPanel.setDefaultFormProcessing(false);
      assigneeSelectPanel.init().withAutoSubmit(true);
    }
    {
      gridBuilder.newSplitPanel(GridSize.COL66);
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("timePeriod"));
      startDate = new DatePanel(fs.newChildId(), new PropertyModel<Date>(filter, "startTime"), DatePanelSettings.get()
          .withSelectPeriodMode(true));
      fs.add(dependentFormComponents[0] = startDate);
      fs.setLabelFor(startDate);
      fs.add(new DivTextPanel(fs.newChildId(), " - "));
      stopDate = new DatePanel(fs.newChildId(), new PropertyModel<Date>(filter, "stopTime"), DatePanelSettings.get().withSelectPeriodMode(
          true));
      fs.add(dependentFormComponents[1] = stopDate);
      {
        final SubmitLink unselectPeriodLink = new SubmitLink(IconLinkPanel.LINK_ID) {
          @Override
          public void onSubmit()
          {
            getSearchFilter().setStartTime(null);
            getSearchFilter().setStopTime(null);
            clearInput();
            parentPage.refresh();
          };
        };
        unselectPeriodLink.setDefaultFormProcessing(false);
        fs.add(new IconLinkPanel(fs.newChildId(), IconType.REMOVE_SIGN, new ResourceModel("calendar.tooltip.unselectPeriod"),
            unselectPeriodLink).setColor(CSSColor.RED));
      }
      final QuickSelectPanel quickSelectPanel = new QuickSelectPanel(fs.newChildId(), parentPage, "quickSelect", startDate);
      fs.add(quickSelectPanel);
      quickSelectPanel.init();
      fs.add(new DivTextPanel(fs.newChildId(), new Model<String>() {
        @Override
        public String getObject()
        {
          return WicketUtils.getCalendarWeeks(TimesheetListForm.this, filter.getStartTime(), filter.getStopTime());
        }
      }));
      fs.add(new HtmlCommentPanel(fs.newChildId(), new Model<String>() {
        @Override
        public String getObject()
        {
          return WicketUtils.getUTCDates(filter.getStartTime(), filter.getStopTime());
        }
      }));
    }
    {
      // Duration
      gridBuilder.newSplitPanel(GridSize.COL33);
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("timesheet.totalDuration")).suppressLabelForWarning();
      fs.add(new DivTextPanel(fs.newChildId(), new Model<String>() {
        @Override
        public String getObject()
        {
          long duration = 0;
          if (parentPage.getList() != null) {
View Full Code Here

Examples of org.projectforge.web.wicket.flowlayout.FieldsetPanel

  {
    super.init();
    gridBuilder.newGridPanel();
    {
      // Statistics
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("statistics")).suppressLabelForWarning();
      fs.add(new DivTextPanel(fs.newChildId(), new Model<String>() {
        @Override
        public String getObject()
        {
          return getString("fibu.common.brutto") + ": " + CurrencyFormatter.format(getStats().getBrutto()) + WebConstants.HTML_TEXT_DIVIDER;
        }
      }));
      fs.add(new DivTextPanel(fs.newChildId(), new Model<String>() {
        @Override
        public String getObject()
        {
          return getString("fibu.common.netto") + ": " + CurrencyFormatter.format(getStats().getNetto()) + WebConstants.HTML_TEXT_DIVIDER;
        }
      }));
      fs.add(new DivTextPanel(fs.newChildId(), new Model<String>() {
        @Override
        public String getObject()
        {
          return getString("fibu.rechnung.offen") + ": " + CurrencyFormatter.format(getStats().getOffen()) + WebConstants.HTML_TEXT_DIVIDER;
        }
      }, TextStyle.BLUE));
      fs.add(new DivTextPanel(fs.newChildId(), new Model<String>() {
        @Override
        public String getObject()
        {
          return getString("fibu.rechnung.filter.ueberfaellig") + ": " + CurrencyFormatter.format(getStats().getUeberfaellig());
        }
      }, TextStyle.RED));
      fs.add(new DivTextPanel(fs.newChildId(), new Model<String>() {
        @Override
        public String getObject()
        {
          return WebConstants.HTML_TEXT_DIVIDER
              + getString("fibu.rechnung.skonto")
              + ": "
              + CurrencyFormatter.format(getStats().getSkonto())
              + WebConstants.HTML_TEXT_DIVIDER;
        }
      }));
      // fieldset.add(new HtmlCodePanel(fieldset.newChildId(), "<br/>"));
      fs.add(new DivTextPanel(fs.newChildId(), new Model<String>() {
        @Override
        public String getObject()
        {
          return getString("fibu.rechnung.zahlungsZiel")
              + ": Ø "
              + String.valueOf(getStats().getZahlungszielAverage())
              + WebConstants.HTML_TEXT_DIVIDER;
        }
      }));
      fs.add(new DivTextPanel(fs.newChildId(), new Model<String>() {
        @Override
        public String getObject()
        {
          return getString("fibu.rechnung.zahlungsZiel.actual") + ": Ø " + String.valueOf(getStats().getTatsaechlichesZahlungzielAverage());
        }
View Full Code Here

Examples of org.projectforge.web.wicket.flowlayout.FieldsetPanel

  @Override
  @SuppressWarnings("serial")
  protected void init()
  {
    super.init();
    FieldsetPanel fs = gridBuilder.newFieldset(getString("address.sendSms.phoneNumber"));
    final PFAutoCompleteTextField<String> numberTextField = new PFAutoCompleteTextField<String>(InputPanel.WICKET_ID,
        new PropertyModel<String>(data, "phoneNumber")) {
      @Override
      protected List<String> getChoices(final String input)
      {
        final AddressFilter addressFilter = new AddressFilter();
        addressFilter.setSearchString(input);
        final List<String> list = new ArrayList<String>();
        for (final AddressDO address : addressDao.getList(addressFilter)) {
          buildAutocompleteEntry(list, address, address.getMobilePhone());
          buildAutocompleteEntry(list, address, address.getPrivateMobilePhone());
        }
        return list;
      }

      @Override
      protected List<String> getFavorites()
      {
        return getRecentSearchTermsQueue().getRecents();
      }
    };
    numberTextField.withMatchContains(true).withMinChars(2).withFocus(true);
    numberTextField.setRequired(true);
    fs.add(numberTextField);
    data.setMessage(getInitalMessageText());
    fs = gridBuilder.newFieldset(getString("address.sendSms.message"));
    final MaxLengthTextArea messageTextArea = new MaxLengthTextArea(TextAreaPanel.WICKET_ID, new PropertyModel<String>(data, "message"),
        MAX_MESSAGE_LENGTH);
    // messageTextArea.add(AttributeModifier.append("onKeyDown", "limitText(this.form.limitedtextarea,this.form.countdown,"
    // + MAX_MESSAGE_LENGTH
    // + ")"));
    // messageTextArea.add(AttributeModifier.append("onKeyUp", "limitText(this.form.limitedtextarea,this.form.countdown,"
    // + MAX_MESSAGE_LENGTH
    // + ")"));
    messageTextArea.add(AttributeModifier.append("maxlength", MAX_MESSAGE_LENGTH));
    fs.add(messageTextArea);
    fs = gridBuilder.newFieldset("");
    final DivTextPanel charsRemaining = new DivTextPanel(fs.newChildId(), "");
    charsRemaining.setMarkupId("charsRemaining");
    fs.add(charsRemaining);

    {
      final Button resetButton = new Button(SingleButtonPanel.WICKET_ID, new Model<String>("reset")) {
        @Override
        public final void onSubmit()
View Full Code Here

Examples of org.projectforge.web.wicket.flowlayout.FieldsetPanel

  {
    super.init();
    prefillParameters();
    gridBuilder.newGridPanel();
    {
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("scripting.script.name")).suppressLabelForWarning();
      fs.add(new DivTextPanel(fs.newChildId(), data.getName()));
    }
    {
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("description")).suppressLabelForWarning();
      fs.add(new DivTextPanel(fs.newChildId(), data.getDescription()));
    }
    {
      addCancelButton(new Button(SingleButtonPanel.WICKET_ID, new Model<String>("cancel")) {
        @Override
        public final void onSubmit()
View Full Code Here

Examples of org.projectforge.web.wicket.flowlayout.FieldsetPanel

    });

    gridBuilder.newGridPanel();
    {
      // Title
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("book.title"));
      final RequiredMaxLengthTextField title = new RequiredMaxLengthTextField(InputPanel.WICKET_ID,
          new PropertyModel<String>(data, "title"));
      title.add(WicketUtils.setFocus());
      fs.add(title);
    }
    {
      // Authors
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("book.authors"));
      final MaxLengthTextField authors = new MaxLengthTextField(InputPanel.WICKET_ID, new PropertyModel<String>(data, "authors"));
      fs.add(dependentFormComponents[0] = authors);
    }
    gridBuilder.newSplitPanel(GridSize.COL50);
    {
      // DropDownChoice bookType
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("book.type"));
      final LabelValueChoiceRenderer<BookType> bookTypeChoiceRenderer = new LabelValueChoiceRenderer<BookType>(this, BookType.values());
      final DropDownChoice<BookType> bookTypeChoice = new DropDownChoice<BookType>(fs.getDropDownChoiceId(),
          new PropertyModel<BookType>(data, "type"), bookTypeChoiceRenderer.getValues(), bookTypeChoiceRenderer);
      bookTypeChoice.setNullValid(false).setRequired(true);
      fs.add(bookTypeChoice);
    }
    {
      // Year of publishing
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("book.yearOfPublishing"));
      final MaxLengthTextField yearOfPublishing = new MaxLengthTextField(InputPanel.WICKET_ID, new PropertyModel<String>(data,
          "yearOfPublishing"));
      fs.add(dependentFormComponents[1] = yearOfPublishing);
    }
    {
      // DropDownChoice bookStatus
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("status"));
      final LabelValueChoiceRenderer<BookStatus> bookStatusChoiceRenderer = new LabelValueChoiceRenderer<BookStatus>(this,
          BookStatus.values());
      final DropDownChoice<BookStatus> bookStatusChoice = new DropDownChoice<BookStatus>(fs.getDropDownChoiceId(),
          new PropertyModel<BookStatus>(data, "status"), bookStatusChoiceRenderer.getValues(), bookStatusChoiceRenderer);
      bookStatusChoice.setNullValid(false).setRequired(true);
      fs.add(bookStatusChoice);
    }
    {
      // Signature
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("book.signature"));
      final MaxLengthTextField signature = new MaxLengthTextField(InputPanel.WICKET_ID, new PropertyModel<String>(data, "signature"));
      signature.add(new AbstractValidator<String>() {
        private static final long serialVersionUID = 6488923290863235755L;

        @Override
        protected void onValidate(final IValidatable<String> validatable)
        {
          data.setSignature(validatable.getValue());
          if (bookDao.doesSignatureAlreadyExist(data) == true) {
            validatable.error(new ValidationError().addMessageKey("book.error.signatureAlreadyExists"));
          }
        }
      });
      fs.add(dependentFormComponents[2] = signature);
    }
    gridBuilder.newSplitPanel(GridSize.COL50);
    {
      // ISBN
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("book.isbn"));
      fs.add(new MaxLengthTextField(InputPanel.WICKET_ID, new PropertyModel<String>(data, "isbn")));
    }
    {
      // Keywords
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("book.keywords"));
      fs.add(new MaxLengthTextField(InputPanel.WICKET_ID, new PropertyModel<String>(data, "keywords")));
    }
    {
      // Publisher
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("book.publisher"));
      final MaxLengthTextField publisher = new MaxLengthTextField(InputPanel.WICKET_ID, new PropertyModel<String>(data, "publisher"));
      fs.add(dependentFormComponents[3] = publisher);
    }
    {
      // Editor
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("book.editor"));
      final MaxLengthTextField editor = new MaxLengthTextField(InputPanel.WICKET_ID, new PropertyModel<String>(data, "editor"));
      fs.add(dependentFormComponents[4] = editor);
    }
    gridBuilder.newGridPanel();
    {
      // Abstract
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("book.abstract"));
      fs.add(new MaxLengthTextArea(TextAreaPanel.WICKET_ID, new PropertyModel<String>(data, "abstractText")));
    }
    {
      // Comment
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("comment"));
      fs.add(new MaxLengthTextArea(TextAreaPanel.WICKET_ID, new PropertyModel<String>(data, "comment")));
    }
    if (isNew() == false) {
      {
        // Lend out
        final FieldsetPanel fs = gridBuilder.newFieldset(getString("book.lending")).suppressLabelForWarning();
        fs.add(new DivTextPanel(fs.newChildId(), new Model<String>() {
          /**
           * @see org.apache.wicket.model.Model#getObject()
           */
          @Override
          public String getObject()
          {
            if (data.getLendOutBy() == null) {
              return "";
            }
            final StringBuffer buf = new StringBuffer();
            // Show full user name:
            buf.append(data.getLendOutBy().getFullname());
            if (data.getLendOutDate() != null) {
              buf.append(", ");
              // Show lend out date:
              buf.append(DateTimeFormatter.instance().getFormattedDate(data.getLendOutDate()));
            }
            return buf.toString();
          }
        }) {
          /**
           * @see org.apache.wicket.Component#isVisible()
           */
          @Override
          public boolean isVisible()
          {
            return data.getLendOutBy() != null;
          }
        });
        fs.add(new SingleButtonPanel(fs.newChildId(), new Button(SingleButtonPanel.WICKET_ID, new Model<String>("lendout")) {
          @Override
          public final void onSubmit()
          {
            parentPage.lendOut();
          }
        }, getString("book.lendOut"), SingleButtonPanel.NORMAL));
        fs.add(new SingleButtonPanel(fs.newChildId(), new Button(SingleButtonPanel.WICKET_ID, new Model<String>("returnBook")) {
          @Override
          public final void onSubmit()
          {
            parentPage.returnBook();
          }
        }, getString("book.returnBook"), SingleButtonPanel.DANGER) {
          /**
           * @see org.apache.wicket.Component#isVisible()
           */
          @Override
          public boolean isVisible()
          {
            return data.getLendOutBy() != null;
          }
        });
      }
      {
        // Lend out comment
        final FieldsetPanel fs = gridBuilder.newFieldset(getString("book.lendOutNote"));
        fs.add(new MaxLengthTextArea(TextAreaPanel.WICKET_ID, new PropertyModel<String>(data, "lendOutComment")));
      }
    }

  }
View Full Code Here

Examples of org.projectforge.web.wicket.flowlayout.FieldsetPanel

    parameterFieldsets = new FieldsetPanel[scriptParameters.size()];
    int index = 0;
    boolean focusSet = false;
    fieldSetsPanel = gridBuilder.getPanel();
    for (final ScriptParameter parameter : scriptParameters) {
      final FieldsetPanel fs = gridBuilder.newFieldset(StringUtils.capitalize(parameter.getParameterName()),
          getString("scripting.script.parameter") + " " + (index + 1));
      parameterFieldsets[index] = fs;
      InputPanel inputPanel = null;
      if (parameter.getType() == ScriptParameterType.INTEGER) {
        inputPanel = fs.add(new TextField<Integer>(fs.getTextFieldId(), new PropertyModel<Integer>(parameter, "intValue")));
      } else if (parameter.getType() == ScriptParameterType.STRING) {
        inputPanel = fs.add(new TextField<String>(fs.getTextFieldId(), new PropertyModel<String>(parameter, "stringValue")));
      } else if (parameter.getType() == ScriptParameterType.DECIMAL) {
        inputPanel = fs.add(new TextField<BigDecimal>(fs.getTextFieldId(), new PropertyModel<BigDecimal>(parameter, "decimalValue")));
      } else if (parameter.getType() == ScriptParameterType.DATE || parameter.getType() == ScriptParameterType.TIME_PERIOD) {
        final String property = parameter.getType() == ScriptParameterType.TIME_PERIOD ? "timePeriodValue.fromDate" : "dateValue";
        datePanel1[index] = new DatePanel(fs.newChildId(), new PropertyModel<Date>(parameter, property));
        fs.add(datePanel1[index]);
        if (parameter.getType() == ScriptParameterType.TIME_PERIOD) {
          fs.add(new DivTextPanel(fs.newChildId(), " - "));
          datePanel2[index] = new DatePanel(fs.newChildId(), new PropertyModel<Date>(parameter, "timePeriodValue.toDate"));
          fs.add(datePanel2[index]);
          quickSelectPanel[index] = new QuickSelectPanel(fs.newChildId(), parentPage, "quickSelect:" + index, datePanel1[index]);
          fs.add(quickSelectPanel[index]);
          quickSelectPanel[index].init();
        }
      } else if (parameter.getType() == ScriptParameterType.TASK) {
        final TaskSelectPanel taskSelectPanel = new TaskSelectPanel(fs, new PropertyModel<TaskDO>(parameter, "task"), parentPage, "taskId:"
            + index);
        fs.add(taskSelectPanel);
        taskSelectPanel.init();
        taskSelectPanel.setRequired(true);
      } else if (parameter.getType() == ScriptParameterType.USER) {
        final UserSelectPanel userSelectPanel = new UserSelectPanel(fs.newChildId(), new PropertyModel<PFUserDO>(parameter, "user"),
            parentPage, "userId:" + index);
        fs.add(userSelectPanel);
        userSelectPanel.init();
        userSelectPanel.setRequired(true);
      } else {
        throw new UnsupportedOperationException("Parameter type: " + parameter.getType() + " not supported.");
      }
View Full Code Here

Examples of org.projectforge.web.wicket.flowlayout.FieldsetPanel

    if (isNew() == true) {
      addTemplatesRow();
    }
    {
      // Task
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("task"));
      final TaskSelectPanel taskSelectPanel = new TaskSelectPanel(fs, new PropertyModel<TaskDO>(data, "task"), parentPage, "taskId") {
        @Override
        protected void selectTask(final TaskDO task)
        {
          super.selectTask(task);
          refresh(); // Task was changed. Therefore update the kost2 list.
        }

        /**
         * @see org.projectforge.web.task.TaskSelectPanel#onModelSelected(org.apache.wicket.ajax.AjaxRequestTarget,
         *      org.projectforge.task.TaskDO)
         */
        @Override
        protected void onModelSelected(final AjaxRequestTarget target, final TaskDO taskDO)
        {
          refresh();
          super.onModelSelected(target, taskDO);
          if (cost2ChoiceFieldset != null) {
            target.add(cost2ChoiceFieldset.getFieldset());
          }
        }
      };
      taskSelectPanel.setAutocompleteOnlyTaskBookableForTimesheets(true);
      fs.add(taskSelectPanel);
      taskSelectPanel.init();
      taskSelectPanel.setRequired(true);
    }
    if (cost2Exists == true) {
      // Cost 2 entries does exist in the data-base.
      cost2ChoiceFieldset = gridBuilder.newFieldset(getString("fibu.kost2"));
      cost2ChoiceFieldset.getFieldset().setOutputMarkupId(true);
      cost2ChoiceFieldset.getFieldset().setOutputMarkupPlaceholderTag(true);
      cost2List = taskTree.getKost2List(data.getTaskId());
      final LabelValueChoiceRenderer<Integer> cost2ChoiceRenderer = getCost2LabelValueChoiceRenderer(parentPage.getBaseDao(), cost2List,
          data, null);
      cost2Choice = createCost2ChoiceRenderer(cost2ChoiceFieldset.getDropDownChoiceId(), parentPage.getBaseDao(), taskTree,
          cost2ChoiceRenderer, data, cost2List);
      cost2ChoicePanel = cost2ChoiceFieldset.add(cost2Choice);
      dependentFormComponentsWithCost2[3] = cost2Choice;
      updateCost2ChoiceValidation();
    }
    {
      // User
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("user"));
      PFUserDO user = data.getUser();
      if (Hibernate.isInitialized(user) == false) {
        user = userGroupCache.getUser(user.getId());
        data.setUser(user);
      }
      userSelectPanel = new UserSelectPanel(fs.newChildId(), new PropertyModel<PFUserDO>(data, "user"), parentPage, "userId");
      userSelectPanel.setRequired(true);
      fs.add(userSelectPanel);
      userSelectPanel.init();
    }
    {
      // Time period
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("timePeriod"));
      final DateTimePanel startDateTimePanel = new DateTimePanel(fs.newChildId(), new PropertyModel<Date>(data, "startTime"),
          (DateTimePanelSettings) DateTimePanelSettings.get().withSelectStartStopTime(true).withTargetType(java.sql.Timestamp.class)
          .withRequired(true), DatePrecision.MINUTE_15);
      dependentFormComponentsWithCost2[0] = dependentFormComponentsWithoutCost2[0] = startDateTimePanel;
      fs.add(startDateTimePanel);
      WicketUtils.addTooltip(startDateTimePanel.getDateField(), new Model<String>() {
        @Override
        public String getObject()
        {
          final StringBuffer buf = new StringBuffer();
          if (data.getStartTime() != null) {
            buf.append(DateHelper.TECHNICAL_ISO_UTC.get().format(data.getStartTime()));
            if (data.getStopTime() != null) {
              buf.append(" - ");
            }
          }
          if (data.getStopTime() != null) {
            buf.append(DateHelper.TECHNICAL_ISO_UTC.get().format(data.getStopTime()));
          }
          return buf.toString();
        }
      });
      fs.add(new DivTextPanel(fs.newChildId(), getString("until")));
      // Stop time
      final DropDownChoice<Integer> stopHourOfDayDropDownChoice = new DropDownChoice<Integer>(fs.getDropDownChoiceId(),
          new PropertyModel<Integer>(this, "stopHourOfDay"), DateTimePanel.getHourOfDayRenderer().getValues(),
          DateTimePanel.getHourOfDayRenderer());
      stopHourOfDayDropDownChoice.setNullValid(false);
      stopHourOfDayDropDownChoice.setRequired(true);
      fs.add(stopHourOfDayDropDownChoice);
      dependentFormComponentsWithCost2[1] = dependentFormComponentsWithoutCost2[1] = stopHourOfDayDropDownChoice;
      final DropDownChoice<Integer> stopMinuteDropDownChoice = new DropDownChoice<Integer>(fs.getDropDownChoiceId(),
          new PropertyModel<Integer>(this, "stopMinute"), DateTimePanel.getMinutesRenderer(DatePrecision.MINUTE_15).getValues(),
          DateTimePanel.getMinutesRenderer(DatePrecision.MINUTE_15));
      stopMinuteDropDownChoice.setNullValid(false);
      stopMinuteDropDownChoice.setRequired(true);
      fs.add(stopMinuteDropDownChoice);
      dependentFormComponentsWithCost2[2] = dependentFormComponentsWithoutCost2[2] = stopMinuteDropDownChoice;
    }
    {
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("task.consumption")).suppressLabelForWarning();
      consumptionBarId = fs.newChildId();
      fs.add(getConsumptionBar());
      fs.add(new DivTextPanel(fs.newChildId(), new Model<String>() {
        /**
         * @see org.apache.wicket.model.Model#getObject()
         */
        @Override
        public String getObject()
        {
          return consumptionBarPanel.getTooltip();
        }
      }));
    }
    {
      final AbstractFieldsetPanel< ? > fs = timesheetPageSupport.addLocation(filter);
      locationTextField = (PFAutoCompleteMaxLengthTextField) fs.getStoreObject();
      locationTextField.withDeletableItem(true);
    }
    {
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("timesheet.description"));
      final IModel<String> model = new PropertyModel<String>(data, "description");
      fs.add(descriptionArea = new MaxLengthTextArea(TextAreaPanel.WICKET_ID, model)).setAutogrow();
      fs.addJIRAField(model);
    }
    {
      // Save as template checkbox:
      final FieldsetPanel fs = gridBuilder.newFieldset("").suppressLabelForWarning();
      fs.addCheckBox(new PropertyModel<Boolean>(this, "saveAsTemplate"), getString("userPref.saveAsTemplate"));
    }
    addCloneButton();
  }
View Full Code Here

Examples of org.projectforge.web.wicket.flowlayout.FieldsetPanel

  protected void init()
  {
    super.init();
    gridBuilder.newSplitPanel(GridSize.COL50);
    {
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("timesheet.user"));
      if (UserRights.getAccessChecker().hasLoggedInUserAccessToTimesheetsOfOtherUsers() == true) {
        final UserSelectPanel userSelectPanel = new UserSelectPanel(fs.newChildId(), new PropertyModel<PFUserDO>(filter, "user"),
            parentPage, "user");
        userSelectPanel.setRequired(true);
        fs.add(userSelectPanel);
        userSelectPanel.init();
      } else {
        filter.setUser(PFUserContext.getUser());
        fs.add(new DivTextPanel(fs.newChildId(), filter.getUser().getFullname()));
      }
    }
    gridBuilder.newSplitPanel(GridSize.COL50);
    {
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("calendar.month"));
      yearChoice = new DropDownChoice<Integer>(fs.getDropDownChoiceId(), new PropertyModel<Integer>(filter, "year"),
          new ArrayList<Integer>()) {
        /**
         * @see org.apache.wicket.markup.html.form.DropDownChoice#wantOnSelectionChangedNotifications()
         */
        @Override
        protected boolean wantOnSelectionChangedNotifications()
        {
          return true;
        }
      };
      yearChoice.setNullValid(false).setRequired(true);
      fs.add(yearChoice);
      // DropDownChoice months
      final LabelValueChoiceRenderer<Integer> monthChoiceRenderer = new LabelValueChoiceRenderer<Integer>();
      for (int i = 0; i <= 11; i++) {
        monthChoiceRenderer.addValue(i, StringHelper.format2DigitNumber(i + 1));
      }
      monthChoice = new DropDownChoice<Integer>(fs.getDropDownChoiceId(), new PropertyModel<Integer>(filter, "month"),
          monthChoiceRenderer.getValues(), monthChoiceRenderer) {
        /**
         * @see org.apache.wicket.markup.html.form.DropDownChoice#wantOnSelectionChangedNotifications()
         */
        @Override
        protected boolean wantOnSelectionChangedNotifications()
        {
          return true;
        }
      };
      monthChoice.setNullValid(false).setRequired(true);
      fs.add(monthChoice);
      final QuickSelectMonthPanel quickSelectPanel = new QuickSelectMonthPanel(fs.newChildId(), new Model<Date>() {
        /**
         * @see org.apache.wicket.model.Model#getObject()
         */
        @Override
        public Date getObject()
        {
          final DateHolder dh = new DateHolder();
          dh.setDate(filter.getYear(), filter.getMonth(), 1, 0, 0, 0);
          return dh.getDate();
        }

        /**
         * @see org.apache.wicket.model.Model#setObject(java.io.Serializable)
         */
        @Override
        public void setObject(final Date object)
        {
          if (object != null) {
            setDate(object);
          }
        }
      }, parentPage, "quickSelect");
      fs.add(quickSelectPanel);
      quickSelectPanel.init();
    }
    {
      final Button showButton = new Button(SingleButtonPanel.WICKET_ID, new Model<String>("show"));
      final SingleButtonPanel showButtonPanel = new SingleButtonPanel(actionButtons.newChildId(), showButton, getString("show"),
View Full Code Here

Examples of org.projectforge.web.wicket.flowlayout.FieldsetPanel

  }

  public static void createFirstName(final GridBuilder gridBuilder, final PFUserDO user)
  {
    // First name
    final FieldsetPanel fs = gridBuilder.newFieldset(gridBuilder.getString("firstName"));
    final RequiredMaxLengthTextField firstName = new RequiredMaxLengthTextField(fs.getTextFieldId(), new PropertyModel<String>(user,
        "firstname"));
    WicketUtils.setStrong(firstName);
    fs.add(firstName);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.