Package org.projectforge.web.wicket.bootstrap

Examples of org.projectforge.web.wicket.bootstrap.GridBuilder


    {
      final ToggleContainerPanel extendedSettingsPanel = new ToggleContainerPanel(gridBuilder.getPanel().newChildId());
      extendedSettingsPanel.setHeading(getString("plugins.teamcal.event.expertSettings"));
      gridBuilder.getPanel().add(extendedSettingsPanel);
      extendedSettingsPanel.setClosed();
      final GridBuilder innerGridBuilder = extendedSettingsPanel.createGridBuilder();
      {
        // Until. Only visible if recurrenceData.interval != NONE.
        recurrenceExDateFieldset = innerGridBuilder.newFieldset(getString("plugins.teamcal.event.recurrence.exDate"));
        recurrenceExDateFieldset.add(new MaxLengthTextField(recurrenceExDateFieldset.getTextFieldId(), new PropertyModel<String>(data,
            "recurrenceExDate")));
        recurrenceExDateFieldset.getFieldset().setOutputMarkupId(true);
        recurrenceExDateFieldset.addHelpIcon(getString("plugins.teamcal.event.recurrence.exDate.tooltip"));
      }
      {
        final FieldsetPanel fs = innerGridBuilder.newFieldset(getString("plugins.teamcal.event.externalUid"));
        fs.add(new MaxLengthTextField(fs.getTextFieldId(), new PropertyModel<String>(data, "externalUid")));
      }
    }

    gridBuilder.newGridPanel();
View Full Code Here


  @Override
  @SuppressWarnings("serial")
  protected void init()
  {
    add(createFeedbackPanel());
    final GridBuilder gridBuilder = newGridBuilder(this, "flowform");
    gridBuilder.newFormHeading(getString("import"));
    {
      // Upload dump file
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("administration.setup.dumpFile"));
      fileUploadField = new FileUploadField(FileUploadPanel.WICKET_ID);
      fs.add(new FileUploadPanel(fs.newChildId(), fileUploadField));
    }
    final RepeatingView actionButtons = new RepeatingView("buttons");
    add(actionButtons);
View Full Code Here

  @Override
  @SuppressWarnings("serial")
  protected void init()
  {
    add(createFeedbackPanel());
    final GridBuilder gridBuilder = newGridBuilder(this, "flowform");
    gridBuilder.newFormHeading(getString("administration.setup.heading"));
    final DivPanel panel = gridBuilder.getPanel();
    panel.add(new ParTextPanel(panel.newChildId(), getString("administration.setup.heading.subtitle")));
    {
      // RadioChoice mode
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("administration.setup.target"));
      final DivPanel radioPanel = fs.addNewRadioBoxButtonDiv();
      fs.add(radioPanel);
      fs.setLabelFor(radioPanel);
      final RadioGroupPanel<SetupTarget> radioGroup = new RadioGroupPanel<SetupTarget>(radioPanel.newChildId(), "setuptarget",
          new PropertyModel<SetupTarget>(this, "setupMode"));
      radioPanel.add(radioGroup);
      for (final SetupTarget target : SetupTarget.values()) {
        radioGroup.add(new Model<SetupTarget>(target), getString(target.getI18nKey()), getString(target.getI18nKey() + ".tooltip"));
      }
    }
    // final RequiredMaxLengthTextField organizationField = new RequiredMaxLengthTextField(this, "organization", getString("organization"),
    // new PropertyModel<String>(this, "organization"), 100);
    // add(organizationField);
    {
      // User name
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("username"));
      fs.add(new RequiredMaxLengthTextField(InputPanel.WICKET_ID, new PropertyModel<String>(adminUser, "username"), 100));
    }
    final PasswordTextField passwordField = new PasswordTextField(PasswordPanel.WICKET_ID, new PropertyModel<String>(this, "password")) {
      @Override
      protected void onComponentTag(final ComponentTag tag)
      {
        super.onComponentTag(tag);
        if (adminUser.getPassword() == null) {
          tag.put("value", "");
        } else if (StringUtils.isEmpty(getConvertedInput()) == false) {
          tag.put("value", MAGIC_PASSWORD);
        }
      }
    };
    {
      // Password
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("password"));
      passwordField.setRequired(true); // No setReset(true), otherwise uploading and re-entering passwords is a real pain.
      fs.add(passwordField);
      WicketUtils.setFocus(passwordField);
    }
    {
      // Password repeat
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("passwordRepeat"));
      final PasswordTextField passwordRepeatField = new PasswordTextField(PasswordPanel.WICKET_ID, new PropertyModel<String>(this,
          "passwordRepeat")) {
        @Override
        protected void onComponentTag(final ComponentTag tag)
        {
          super.onComponentTag(tag);
          if (adminUser.getPassword()  == null) {
            tag.put("value", "");
          } else if (StringUtils.isEmpty(getConvertedInput()) == false) {
            tag.put("value", MAGIC_PASSWORD);
          }
        }
      };
      passwordRepeatField.setRequired(true); // No setReset(true), otherwise uploading and re-entering passwords is a real pain.
      passwordRepeatField.add(new IValidator<String>() {
        @Override
        public void validate(final IValidatable<String> validatable)
        {
          final String input = validatable.getValue();
          final String passwordInput = passwordField.getConvertedInput();
          if (StringUtils.equals(input, passwordInput) == false) {
            passwordRepeatField.error(getString("user.error.passwordAndRepeatDoesNotMatch"));
            adminUser.setPassword(null);
            return;
          }
          if (MAGIC_PASSWORD.equals(passwordInput) == false || adminUser.getPassword() == null) {
            final String errorMsgKey = userDao.checkPasswordQuality(passwordInput);
            if (errorMsgKey != null) {
              adminUser.setPassword(null);
              passwordField.error(getString(errorMsgKey));
            } else {
              userDao.createEncryptedPassword(adminUser, passwordInput);
            }
          }
        }
      });
      fs.add(passwordRepeatField);
    }
    {
      // Time zone
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("administration.configuration.param.timezone"));
      final TimeZonePanel timeZone = new TimeZonePanel(fs.newChildId(), new PropertyModel<TimeZone>(this, "timeZone"));
      fs.setLabelFor(timeZone);
      fs.add(timeZone);
      fs.addHelpIcon(getString("administration.configuration.param.timezone.description"));
    }
    {
      // Calendar domain
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("administration.configuration.param.calendarDomain"));
      final RequiredMaxLengthTextField textField = new RequiredMaxLengthTextField(InputPanel.WICKET_ID, new PropertyModel<String>(this,
          "calendarDomain"), ConfigurationDO.PARAM_LENGTH);
      fs.add(textField);
      textField.add(new IValidator<String>() {
        @Override
        public void validate(final IValidatable<String> validatable)
        {
          if (Configuration.isDomainValid(validatable.getValue()) == false) {
            textField.error(getString("validation.error.generic"));
          }
        }
      });
      fs.addHelpIcon(getString("administration.configuration.param.calendarDomain.description"));
    }
    {
      // E-Mail sysops
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("administration.configuration.param.systemAdministratorEMail.label"),
          getString("email"));
      fs.add(new MaxLengthTextField(InputPanel.WICKET_ID, new PropertyModel<String>(this, "sysopEMail"), ConfigurationDO.PARAM_LENGTH));
      fs.addHelpIcon(getString("administration.configuration.param.systemAdministratorEMail.description"));
    }
    {
      // E-Mail sysops
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("administration.configuration.param.feedbackEMail.label"),
          getString("email"));
      fs.add(new MaxLengthTextField(InputPanel.WICKET_ID, new PropertyModel<String>(this, "feedbackEMail"), ConfigurationDO.PARAM_LENGTH));
      fs.addHelpIcon(getString("administration.configuration.param.feedbackEMail.description"));
    }
    final RepeatingView actionButtons = new RepeatingView("buttons");
View Full Code Here

        }
      };
      schedulesPanel.setClosed();
      schedulesPanel.setHeading(getPaymentScheduleHeading(data.getPaymentSchedules(), schedulesPanel));
      gridBuilder.getPanel().add(schedulesPanel);
      final GridBuilder innerGridBuilder = schedulesPanel.createGridBuilder();
      final DivPanel dp = innerGridBuilder.getPanel();
      dp.add(paymentSchedulePanel = new PaymentSchedulePanel(dp.newChildId(), new CompoundPropertyModel<AuftragDO>(data), getUser()));
      paymentSchedulePanel.setVisible(data.getPaymentSchedules() != null && data.getPaymentSchedules().isEmpty() == false);
      final Button addPositionButton = new Button(SingleButtonPanel.WICKET_ID) {
        @Override
        public final void onSubmit()
View Full Code Here

      } else {
        positionsPanel.setOpen();
      }
      positionsPanel.setHeading(getPositionHeading(position, positionsPanel));

      final GridBuilder posGridBuilder = positionsPanel.createGridBuilder();
      posGridBuilder.newGridPanel();
      {
        final FieldsetPanel fs = posGridBuilder.newFieldset(getString("fibu.auftrag.titel"));
        fs.add(new MaxLengthTextField(InputPanel.WICKET_ID, new PropertyModel<String>(position, "titel")));
      }
      posGridBuilder.newSplitPanel(GridSize.COL33);
      {
        // DropDownChoice type
        final FieldsetPanel fs = posGridBuilder.newFieldset(getString("fibu.auftrag.position.art"));
        final LabelValueChoiceRenderer<AuftragsPositionsArt> artChoiceRenderer = new LabelValueChoiceRenderer<AuftragsPositionsArt>(fs,
            AuftragsPositionsArt.values());
        final DropDownChoice<AuftragsPositionsArt> artChoice = new DropDownChoice<AuftragsPositionsArt>(fs.getDropDownChoiceId(),
            new PropertyModel<AuftragsPositionsArt>(position, "art"), artChoiceRenderer.getValues(), artChoiceRenderer);
        artChoice.setNullValid(false);
        artChoice.setRequired(true);
        fs.add(artChoice);
      }
      posGridBuilder.newSplitPanel(GridSize.COL33);
      {
        // Person days
        final FieldsetPanel fs = posGridBuilder.newFieldset(getString("projectmanagement.personDays"));
        fs.add(new MinMaxNumberField<BigDecimal>(InputPanel.WICKET_ID, new PropertyModel<BigDecimal>(position, "personDays"),
            BigDecimal.ZERO, MAX_PERSON_DAYS));
      }
      posGridBuilder.newSplitPanel(GridSize.COL33);
      {
        // Net sum
        final FieldsetPanel fs = posGridBuilder.newFieldset(getString("fibu.auftrag.nettoSumme"));
        fs.add(new TextField<String>(InputPanel.WICKET_ID, new PropertyModel<String>(position, "nettoSumme")) {
          @SuppressWarnings({ "rawtypes", "unchecked"})
          @Override
          public IConverter getConverter(final Class type)
          {
            return new CurrencyConverter();
          }
        });
        if (abgeschlossenUndNichtFakturiert == true) {
          fs.setWarningBackground();
        }
      }
      posGridBuilder.newSplitPanel(GridSize.COL33);
      final Set<RechnungsPositionVO> invoicePositionsByOrderPositionId = rechnungCache
          .getRechnungsPositionVOSetByAuftragsPositionId(position.getId());
      final boolean showInvoices = CollectionUtils.isNotEmpty(invoicePositionsByOrderPositionId);
      {
        // Invoices
        final FieldsetPanel fs = posGridBuilder.newFieldset(getString("fibu.rechnungen")).suppressLabelForWarning();
        if (showInvoices == true) {
          final InvoicePositionsPanel panel = new InvoicePositionsPanel(fs.newChildId());
          fs.add(panel);
          panel.init(invoicePositionsByOrderPositionId);
        } else {
          fs.add(AbstractUnsecureBasePage.createInvisibleDummyComponent(fs.newChildId()));
        }
      }
      posGridBuilder.newSplitPanel(GridSize.COL33);
      {
        // invoiced
        final FieldsetPanel fs = posGridBuilder.newFieldset(getString("fibu.fakturiert")).suppressLabelForWarning();
        if (showInvoices == true) {
          fs.add(new DivTextPanel(fs.newChildId(), CurrencyFormatter.format(RechnungDao.getNettoSumme(invoicePositionsByOrderPositionId))));
        } else {
          fs.add(AbstractUnsecureBasePage.createInvisibleDummyComponent(fs.newChildId()));
        }
        if (UserRights.getAccessChecker().hasRight(getUser(), RechnungDao.USER_RIGHT_ID, UserRightValue.READWRITE) == true) {
          final DivPanel checkBoxDiv = fs.addNewCheckBoxButtonDiv();
          checkBoxDiv.add(new CheckBoxButton(checkBoxDiv.newChildId(), new PropertyModel<Boolean>(position, "vollstaendigFakturiert"),
              getString("fibu.auftrag.vollstaendigFakturiert")));
        }
      }
      posGridBuilder.newSplitPanel(GridSize.COL33);
      {
        // DropDownChoice status
        final FieldsetPanel fs = posGridBuilder.newFieldset(getString("status"));
        final LabelValueChoiceRenderer<AuftragsPositionsStatus> statusChoiceRenderer = new LabelValueChoiceRenderer<AuftragsPositionsStatus>(
            fs, AuftragsPositionsStatus.values());
        final DropDownChoice<AuftragsPositionsStatus> statusChoice = new DropDownChoice<AuftragsPositionsStatus>(fs.getDropDownChoiceId(),
            new PropertyModel<AuftragsPositionsStatus>(position, "status"), statusChoiceRenderer.getValues(), statusChoiceRenderer);
        statusChoice.setNullValid(true);
        statusChoice.setRequired(false);
        fs.add(statusChoice);
        if (abgeschlossenUndNichtFakturiert == true) {
          fs.setWarningBackground();
        }
      }
      posGridBuilder.newSplitPanel(GridSize.COL100);
      {
        // Task
        final FieldsetPanel fs = posGridBuilder.newFieldset(getString("task"));
        final TaskSelectPanel taskSelectPanel = new TaskSelectPanel(fs, new PropertyModel<TaskDO>(position, "task"), parentPage, "taskId:"
            + position.getNumber()) {
          @Override
          protected void selectTask(final TaskDO task)
          {
            super.selectTask(task);
            parentPage.getBaseDao().setTask(position, task.getId());
          }
        };
        fs.add(taskSelectPanel);
        taskSelectPanel.init();
      }

      posGridBuilder.newSplitPanel(GridSize.COL100);
      {
        // Period of performance
        final FieldsetPanel fs = posGridBuilder.newFieldset(getString("fibu.periodOfPerformance"));
        final LabelValueChoiceRenderer<PeriodOfPerformanceType> performanceChoiceRenderer = new LabelValueChoiceRenderer<PeriodOfPerformanceType>(
            fs, PeriodOfPerformanceType.values());
        final DropDownChoice<PeriodOfPerformanceType> performanceChoice = new DropDownChoice<PeriodOfPerformanceType>(
            fs.getDropDownChoiceId(), new PropertyModel<PeriodOfPerformanceType>(position, "periodOfPerformanceType"),
            performanceChoiceRenderer.getValues(), performanceChoiceRenderer) {
          /**
           * @see org.apache.wicket.markup.html.form.AbstractSingleSelectChoice#getDefaultChoice(java.lang.String)
           */
          @Override
          protected CharSequence getDefaultChoice(final String selectedValue)
          {
            if (posHasOwnPeriodOfPerformance(position.getNumber()) == true) {
              return super.getDefaultChoice(PeriodOfPerformanceType.OWN.toString());
            } else {
              return super.getDefaultChoice(PeriodOfPerformanceType.SEEABOVE.toString());
            }
          }
        };
        performanceChoice.add(new AjaxFormComponentUpdatingBehavior("onchange") {
          @Override
          protected void onUpdate(final AjaxRequestTarget target)
          {
            final short pos = position.getNumber();
            final PeriodOfPerformanceType s = performanceChoice.getModelObject();
            final boolean visible = s.equals(PeriodOfPerformanceType.OWN);
            setPosPeriodOfPerformanceVisible(pos, visible);
            if (ajaxPosTargets != null) {
              for (final Component ajaxPosTarget : ajaxPosTargets)
                target.add(ajaxPosTarget);
            }
          }
        });
        performanceChoice.setOutputMarkupPlaceholderTag(true);
        fs.add(performanceChoice);

        final DatePanel fromDatePanel = new DatePanel(fs.newChildId(), new PropertyModel<Date>(position, "periodOfPerformanceBegin"),
            DatePanelSettings.get().withTargetType(java.sql.Date.class));
        fromDatePanel.getDateField().setOutputMarkupPlaceholderTag(true);
        fs.add(fromDatePanel);
        ajaxPosTargets.add(fromDatePanel.getDateField());
        dependentComponents.add(fromDatePanel);

        final DivTextPanel divPanel = new DivTextPanel(fs.newChildId(), "-");
        divPanel.getLabel4Ajax().setOutputMarkupPlaceholderTag(true);
        fs.add(divPanel);
        ajaxPosTargets.add(divPanel.getLabel4Ajax());

        final DatePanel endDatePanel = new DatePanel(fs.newChildId(), new PropertyModel<Date>(position, "periodOfPerformanceEnd"),
            DatePanelSettings.get().withTargetType(java.sql.Date.class));
        endDatePanel.getDateField().setOutputMarkupPlaceholderTag(true);
        fs.add(endDatePanel);
        ajaxPosTargets.add(endDatePanel.getDateField());
        dependentComponents.add(endDatePanel);

        final LabelValueChoiceRenderer<ModeOfPaymentType> paymentChoiceRenderer = new LabelValueChoiceRenderer<ModeOfPaymentType>(fs,
            ModeOfPaymentType.values());
        final DropDownChoice<ModeOfPaymentType> paymentChoice = new DropDownChoice<ModeOfPaymentType>(fs.getDropDownChoiceId(),
            new PropertyModel<ModeOfPaymentType>(position, "modeOfPaymentType"), paymentChoiceRenderer.getValues(), paymentChoiceRenderer);
        paymentChoice.setOutputMarkupPlaceholderTag(true);
        fs.add(paymentChoice);
        ajaxPosTargets.add(paymentChoice);
      }
      posGridBuilder.newGridPanel();
      {
        // Comment
        final FieldsetPanel fs = posGridBuilder.newFieldset(getString("comment"));
        fs.add(new MaxLengthTextArea(TextAreaPanel.WICKET_ID, new PropertyModel<String>(position, "bemerkung")));
      }
      setPosPeriodOfPerformanceVisible(position.getNumber(), posHasOwnPeriodOfPerformance(position.getNumber()));
    }
    positionsDependentFormComponents = dependentComponents.toArray(new FormComponent[0]);
View Full Code Here

TOP

Related Classes of org.projectforge.web.wicket.bootstrap.GridBuilder

Copyright © 2018 www.massapicom. 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.