Package org.projectforge.web.wicket.components

Examples of org.projectforge.web.wicket.components.MaxLengthTextField


        } else {
          Integer maxLength = param.getMaxLength();
          if (maxLength == null || maxLength <= 0 || UserPrefEntryDO.MAX_STRING_VALUE_LENGTH < maxLength) {
            maxLength = UserPrefEntryDO.MAX_STRING_VALUE_LENGTH;
          }
          final MaxLengthTextField textField = new MaxLengthTextField(InputPanel.WICKET_ID, new PropertyModel<String>(param, "value"),
              maxLength);
          textField.setRequired(param.isRequired());
          fs.add(new InputPanel(fs.newChildId(), textField));
        }
      }
    }
  }
View Full Code Here


          };
        };
        fs.add(numberField);
        valueField = numberField;
      } else if (data.getConfigurationType() == ConfigurationType.STRING) {
        final MaxLengthTextField textField = new MaxLengthTextField(InputPanel.WICKET_ID, new PropertyModel<String>(data, "stringValue"));
        if (ConfigurationParam.CALENDAR_DOMAIN.getI18nKey().equals(data.getI18nKey()) == true) {
          textField.setRequired(true);
          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.add(textField);
View Full Code Here

      parentTaskSelectPanel.setRequired(true);
    }
    {
      // Title
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("task.title"));
      final MaxLengthTextField title = new RequiredMaxLengthTextField(InputPanel.WICKET_ID, new PropertyModel<String>(data, "title"));
      WicketUtils.setStrong(title);
      fs.add(title);
      if (isNew() == true) {
        WicketUtils.setFocus(title);
      }
    }
    gridBuilder.newSplitPanel(GridSize.COL50);
    {
      // Status drop down box:
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("status"));
      final LabelValueChoiceRenderer<TaskStatus> statusChoiceRenderer = new LabelValueChoiceRenderer<TaskStatus>(fs, TaskStatus.values());
      final DropDownChoice<TaskStatus> statusChoice = new DropDownChoice<TaskStatus>(fs.getDropDownChoiceId(),
          new PropertyModel<TaskStatus>(data, "status"), statusChoiceRenderer.getValues(), statusChoiceRenderer);
      statusChoice.setNullValid(false).setRequired(true);
      fs.add(statusChoice);
    }
    {
      // Assigned user:
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("task.assignedUser"));
      PFUserDO responsibleUser = data.getResponsibleUser();
      if (Hibernate.isInitialized(responsibleUser) == false) {
        responsibleUser = userGroupCache.getUser(responsibleUser.getId());
        data.setResponsibleUser(responsibleUser);
      }
      final UserSelectPanel responsibleUserSelectPanel = new UserSelectPanel(fs.newChildId(), new PropertyModel<PFUserDO>(data,
          "responsibleUser"), parentPage, "responsibleUserId");
      fs.add(responsibleUserSelectPanel);
      responsibleUserSelectPanel.init();
    }
    gridBuilder.newSplitPanel(GridSize.COL50);
    {
      // Priority drop down box:
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("priority"));
      final LabelValueChoiceRenderer<Priority> priorityChoiceRenderer = new LabelValueChoiceRenderer<Priority>(fs, Priority.values());
      final DropDownChoice<Priority> priorityChoice = new DropDownChoice<Priority>(fs.getDropDownChoiceId(), new PropertyModel<Priority>(
          data, "priority"), priorityChoiceRenderer.getValues(), priorityChoiceRenderer);
      priorityChoice.setNullValid(true);
      fs.add(priorityChoice);
    }
    {
      // Max hours:
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("task.maxHours"));
      final MinMaxNumberField<Integer> maxNumberField = new MinMaxNumberField<Integer>(InputPanel.WICKET_ID, new PropertyModel<Integer>(
          data, "maxHours"), 0, 9999);
      WicketUtils.setSize(maxNumberField, 6);
      fs.add(maxNumberField);
      if (isNew() == false && taskTree.hasOrderPositions(data.getId(), true) == true) {
        WicketUtils.setWarningTooltip(maxNumberField);
        WicketUtils.addTooltip(maxNumberField, getString("task.edit.maxHoursIngoredDueToAssignedOrders"));
      }
    }
    gridBuilder.newGridPanel();
    {
      // Short description:
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("shortDescription"));
      final IModel<String> model = new PropertyModel<String>(data, "shortDescription");
      fs.add(new MaxLengthTextField(InputPanel.WICKET_ID, model));
      fs.addJIRAField(model);
    }
    {
      // Reference
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("task.reference"));
      fs.add(new MaxLengthTextField(InputPanel.WICKET_ID, new PropertyModel<String>(data, "reference")));
    }

    // ///////////////////////////////
    // GANTT
    // ///////////////////////////////
    gridBuilder.newGridPanel();
    {
      final ToggleContainerPanel extendedSettingsPanel = new ToggleContainerPanel(gridBuilder.getPanel().newChildId()) {
        /**
         * @see org.projectforge.web.wicket.flowlayout.ToggleContainerPanel#wantsOnStatusChangedNotification()
         */
        @Override
        protected boolean wantsOnStatusChangedNotification()
        {
          return true;
        }
      };
      extendedSettingsPanel.setHeading(getString("task.gantt.settings"));
      gridBuilder.getPanel().add(extendedSettingsPanel);
      extendedSettingsPanel.setClosed();
      final GridBuilder innerGridBuilder = extendedSettingsPanel.createGridBuilder();
      innerGridBuilder.newSplitPanel(GridSize.COL50);
      {
        // Gantt object type:
        final FieldsetPanel fs = innerGridBuilder.newFieldset(getString("gantt.objectType"));
        final LabelValueChoiceRenderer<GanttObjectType> objectTypeChoiceRenderer = new LabelValueChoiceRenderer<GanttObjectType>(fs,
            GanttObjectType.values());
        final DropDownChoice<GanttObjectType> objectTypeChoice = new DropDownChoice<GanttObjectType>(fs.getDropDownChoiceId(),
            new PropertyModel<GanttObjectType>(data, "ganttObjectType"), objectTypeChoiceRenderer.getValues(), objectTypeChoiceRenderer);
        objectTypeChoice.setNullValid(true);
        fs.add(objectTypeChoice);
      }
      {
        // Gantt: start date
        final FieldsetPanel fs = innerGridBuilder.newFieldset(getString("gantt.startDate"));
        final DatePanel startDatePanel = new DatePanel(fs.newChildId(), new PropertyModel<Date>(data, "startDate"), DatePanelSettings.get()
            .withTargetType(java.sql.Date.class).withSelectProperty("startDate"));
        fs.add(startDatePanel);
      }
      {
        // Gantt: end date
        final FieldsetPanel fs = innerGridBuilder.newFieldset(getString("gantt.endDate"));
        final DatePanel endDatePanel = new DatePanel(fs.newChildId(), new PropertyModel<Date>(data, "endDate"), DatePanelSettings.get()
            .withTargetType(java.sql.Date.class).withSelectProperty("endDate"));
        fs.add(endDatePanel);
        dependentFormComponents[1] = endDatePanel;
      }

      innerGridBuilder.newSplitPanel(GridSize.COL50);
      {
        // Progress
        final FieldsetPanel fs = innerGridBuilder.newFieldset(getString("task.progress")).setUnit("%");
        final MinMaxNumberField<Integer> progressField = new MinMaxNumberField<Integer>(InputPanel.WICKET_ID, new PropertyModel<Integer>(
            data, "progress"), 0, 100) {
          @SuppressWarnings({ "unchecked", "rawtypes"})
          @Override
          public IConverter getConverter(final Class type)
          {
            return new IntegerPercentConverter(0);
          }
        };
        WicketUtils.setSize(progressField, 3);
        fs.add(progressField);
      }
      {
        // Gantt: duration
        final FieldsetPanel fs = innerGridBuilder.newFieldset(getString("gantt.duration")).suppressLabelForWarning();
        final MinMaxNumberField<BigDecimal> durationField = new MinMaxNumberField<BigDecimal>(InputPanel.WICKET_ID,
            new PropertyModel<BigDecimal>(data, "duration"), BigDecimal.ZERO, TaskEditForm.MAX_DURATION_DAYS);
        WicketUtils.setSize(durationField, 6);
        fs.add(durationField);
        dependentFormComponents[0] = durationField;
      }
      {
        // Gantt: predecessor offset
        final FieldsetPanel fs = innerGridBuilder.newFieldset(getString("gantt.predecessorOffset")).setUnit(getString("days"));
        final MinMaxNumberField<Integer> ganttPredecessorField = new MinMaxNumberField<Integer>(InputPanel.WICKET_ID,
            new PropertyModel<Integer>(data, "ganttPredecessorOffset"), Integer.MIN_VALUE, Integer.MAX_VALUE);
        WicketUtils.setSize(ganttPredecessorField, 6);
        fs.add(ganttPredecessorField);
      }
      innerGridBuilder.newGridPanel();
      {
        // Gantt relation type:
        final FieldsetPanel fs = innerGridBuilder.newFieldset(getString("gantt.relationType"));
        final LabelValueChoiceRenderer<GanttRelationType> relationTypeChoiceRenderer = new LabelValueChoiceRenderer<GanttRelationType>(fs,
            GanttRelationType.values());
        final DropDownChoice<GanttRelationType> relationTypeChoice = new DropDownChoice<GanttRelationType>(fs.getDropDownChoiceId(),
            new PropertyModel<GanttRelationType>(data, "ganttRelationType"), relationTypeChoiceRenderer.getValues(),
            relationTypeChoiceRenderer);
        relationTypeChoice.setNullValid(true);
        fs.add(relationTypeChoice);
      }
      {
        // Gantt: predecessor
        final FieldsetPanel fs = innerGridBuilder.newFieldset(getString("gantt.predecessor"));
        final TaskSelectPanel ganttPredecessorSelectPanel = new TaskSelectPanel(fs, new PropertyModel<TaskDO>(data, "ganttPredecessor"),
            parentPage, "ganttPredecessorId");
        fs.add(ganttPredecessorSelectPanel);
        ganttPredecessorSelectPanel.setShowFavorites(true);
        ganttPredecessorSelectPanel.init();
      }
    }

    // ///////////////////////////////
    // FINANCE ADMINISTRATION
    // ///////////////////////////////
    gridBuilder.newGridPanel();
    {
      final ToggleContainerPanel extendedSettingsPanel = new ToggleContainerPanel(gridBuilder.getPanel().newChildId()) {
        /**
         * @see org.projectforge.web.wicket.flowlayout.ToggleContainerPanel#wantsOnStatusChangedNotification()
         */
        @Override
        protected boolean wantsOnStatusChangedNotification()
        {
          return true;
        }
      };
      extendedSettingsPanel.setHeading(getString("financeAdministration"));
      gridBuilder.getPanel().add(extendedSettingsPanel);
      extendedSettingsPanel.setClosed();
      final GridBuilder innerGridBuilder = extendedSettingsPanel.createGridBuilder();
      innerGridBuilder.newSplitPanel(GridSize.COL50);

      if (Configuration.getInstance().isCostConfigured() == true) {
        // Cost 2 settings
        final FieldsetPanel fs = innerGridBuilder.newFieldset(getString("fibu.kost2"));
        this.projektKostLabel = new DivTextPanel(fs.newChildId(), "");
        WicketUtils.addTooltip(projektKostLabel.getLabel(), new Model<String>() {
          @Override
          public String getObject()
          {
            final List<Kost2DO> kost2DOs = taskTree.getKost2List(projekt, data, data.getKost2BlackWhiteItems(), data.isKost2IsBlackList());
            final String[] kost2s = TaskListPage.getKost2s(kost2DOs);
            if (kost2s == null || kost2s.length == 0) {
              return " - (-)";
            }
            return StringHelper.listToString("\n", kost2s);
          };
        });
        fs.add(projektKostLabel);
        final PropertyModel<String> model = new PropertyModel<String>(data, "kost2BlackWhiteList");
        kost2BlackWhiteTextField = new MaxLengthTextField(InputPanel.WICKET_ID, model);
        WicketUtils.setSize(kost2BlackWhiteTextField, 10);
        fs.add(kost2BlackWhiteTextField);
        final LabelValueChoiceRenderer<Boolean> kost2listTypeChoiceRenderer = new LabelValueChoiceRenderer<Boolean>() //
            .addValue(Boolean.FALSE, getString("task.kost2list.whiteList")) //
            .addValue(Boolean.TRUE, getString("task.kost2list.blackList"));
View Full Code Here

      WicketUtils.setStrong(name);
    }
    {
      // Organization
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("organization"));
      fs.add(new MaxLengthTextField(InputPanel.WICKET_ID, new PropertyModel<String>(getData(), "organization")));
    }
    {
      // Description
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("description"));
      fs.add(new MaxLengthTextArea(TextAreaPanel.WICKET_ID, new PropertyModel<String>(getData(), "description")));
View Full Code Here

    }
    {
      // Beleg
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("fibu.buchungssatz.beleg"));
      final MaxLengthTextField belegField = new MaxLengthTextField(InputPanel.WICKET_ID, new PropertyModel<String>(data, "beleg"));
      WicketUtils.setReadonly(belegField);
      fs.add(belegField);
    }
    gridBuilder.newSplitPanel(GridSize.COL50);
    {
      // Cost 1 / cost2
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("fibu.kost1") + "/" + getString("fibu.kost2"));
      final Kost1FormComponent kost1Component = new Kost1FormComponent(InputPanel.WICKET_ID, new PropertyModel<Kost1DO>(data, "kost1"),
          true);
      fs.add(kost1Component);
      WicketUtils.setReadonly(kost1Component);
      final Kost2FormComponent kost2Component = new Kost2FormComponent(InputPanel.WICKET_ID, new PropertyModel<Kost2DO>(data, "kost2"),
          true);
      fs.add(kost2Component);
      WicketUtils.setReadonly(kost2Component);
    }
    {
      // Cost 1 / cost2
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("fibu.buchungssatz.konto")
          + "/"
          + getString("fibu.buchungssatz.gegenKonto"));
      final KontoFormComponent kontoComponent = new KontoFormComponent(InputPanel.WICKET_ID, new PropertyModel<KontoDO>(data, "konto"),
          true);
      fs.add(kontoComponent);
      WicketUtils.setReadonly(kontoComponent);
      final KontoFormComponent gegenKontoComponent = new KontoFormComponent(InputPanel.WICKET_ID, new PropertyModel<KontoDO>(data,
          "gegenKonto"), true);
      fs.add(gegenKontoComponent);
      WicketUtils.setReadonly(gegenKontoComponent);
    }
    {
      // Text
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("fibu.buchungssatz.text"));
      final MaxLengthTextField textField = new MaxLengthTextField(InputPanel.WICKET_ID, new PropertyModel<String>(data, "text"));
      WicketUtils.setReadonly(textField);
      fs.add(textField);
    }
    {
      // Menge
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("fibu.buchungssatz.menge"));
      final MaxLengthTextField mengeField = new MaxLengthTextField(InputPanel.WICKET_ID, new PropertyModel<String>(data, "menge"));
      WicketUtils.setReadonly(mengeField);
      fs.add(mengeField);
    }
    gridBuilder.newGridPanel();
    {
View Full Code Here

  public AbstractFieldsetPanel< ? > addName()
  {
    final FieldProperties<String> props = getNameProperties();
    final AbstractFieldsetPanel< ? > fs = gridBuilder.newFieldset(props);
    final MaxLengthTextField name = new MaxLengthTextField(fs.getTextFieldId(), props.getModel());
    fs.add(dependentFormComponents[1] = name);
    if (isNew() == true) {
      WicketUtils.setFocus(name);
    }
    return fs;
View Full Code Here

  public AbstractFieldsetPanel< ? > addFirstName()
  {
    final FieldProperties<String> props = getFirstNameProperties();
    final AbstractFieldsetPanel< ? > fs = gridBuilder.newFieldset(props);
    fs.add(dependentFormComponents[0] = new MaxLengthTextField(fs.getTextFieldId(), props.getModel()));
    return fs;
  }
View Full Code Here

  public AbstractFieldsetPanel< ? > addTitle()
  {
    final FieldProperties<String> props = getTitleProperties();
    final AbstractFieldsetPanel< ? > fs = gridBuilder.newFieldset(props);
    fs.add(new MaxLengthTextField(fs.getTextFieldId(), props.getModel()));
    return fs;
  }
View Full Code Here

  public AbstractFieldsetPanel< ? > addWebsite()
  {
    final FieldProperties<String> props = getWebsiteProperties();
    final AbstractFieldsetPanel< ? > fs = gridBuilder.newFieldset(props);
    fs.add(new MaxLengthTextField(fs.getTextFieldId(), props.getModel()), props);
    return fs;
  }
View Full Code Here

  public AbstractFieldsetPanel< ? > addDivision()
  {
    final FieldProperties<String> props = getDivisionProperties();
    final AbstractFieldsetPanel< ? > fs = gridBuilder.newFieldset(props);
    fs.add(new MaxLengthTextField(fs.getTextFieldId(), props.getModel()));
    return fs;
  }
View Full Code Here

TOP

Related Classes of org.projectforge.web.wicket.components.MaxLengthTextField

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.