Package org.projectforge.web.wicket.components

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


    gridBuilder.newSplitPanel(GridSize.COL50);
    {
      // User
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("user"));
      if (adminAccess == true) {
        usernameTextField = new RequiredMaxLengthTextField(fs.getTextFieldId(), new PropertyModel<String>(data, "username"));
        WicketUtils.setStrong(usernameTextField);
        fs.add(usernameTextField);
        usernameTextField.add(new AbstractValidator<String>() {

          @Override
View Full Code Here


    }
    gridBuilder.newGridPanel();
    {
      // Title
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("fibu.auftrag.titel"));
      final MaxLengthTextField subject = new RequiredMaxLengthTextField(InputPanel.WICKET_ID, new PropertyModel<String>(data, "titel"));
      subject.add(WicketUtils.setFocus());
      fs.add(subject);
    }
    gridBuilder.newSplitPanel(GridSize.COL50);
    {
      // reference
View Full Code Here

    parentSelectPanel.setRequired(true);
    parentSelectPanel.init();

    // Title of training
    fs = gridBuilder.newFieldset(TrainingDO.class, "title");
    final RequiredMaxLengthTextField titleField = new RequiredMaxLengthTextField(fs.getTextFieldId(), new PropertyModel<String>(data,
        "title"));
    fs.add(titleField);
    dependentFormComponents[0] = titleField;
    WicketUtils.setFocus(titleField);

    gridBuilder.newSplitPanel(GridSize.COL50);
    {
      // Full access groups
      fs = gridBuilder.newFieldset(getString("plugins.teamcal.fullAccess"),
          getString("plugins.teamcal.access.groups"));
      final GroupsProvider groupsProvider = new GroupsProvider();
      final Collection<GroupDO> fullAccessGroups = new GroupsProvider().getSortedGroups(getData().getFullAccessGroupIds());
      fullAccessGroupsListHelper = new MultiChoiceListHelper<GroupDO>().setComparator(new GroupsComparator()).setFullList(
          groupsProvider.getSortedGroups());
      if (fullAccessGroups != null) {
        for (final GroupDO group : fullAccessGroups) {
          fullAccessGroupsListHelper.addOriginalAssignedItem(group).assignItem(group);
        }
      }
      final Select2MultiChoice<GroupDO> groups = new Select2MultiChoice<GroupDO>(fs.getSelect2MultiChoiceId(),
          new PropertyModel<Collection<GroupDO>> (this.fullAccessGroupsListHelper, "assignedItems"), groupsProvider);
      groups.add(new IValidator<Object>() {
        @Override
        public void validate(final IValidatable< Object > validatable)
        {
          @SuppressWarnings("unchecked")
          final ArrayList<GroupDO> groups = (ArrayList<GroupDO>) validatable.getValue();
          final Collection<Integer> curUserGroupIds = userDao.getAssignedGroups(PFUserContext.getUser());

          boolean isInUserGroups = false;
          for (final GroupDO group: groups) {
            if (curUserGroupIds.contains(group.getId()) == true) {
              isInUserGroups = true;
              break;
            }
          }
          if (isInUserGroups == false) {
            final ValidationError validationError = new ValidationError().addKey("plugins.skillmatrix.skilltraining.error.nousergroup");
            validatable.error(validationError);
          }
        }

      });
      groups.setRequired(true);
      fs.addHelpIcon(getString("plugins.skillmatrix.skilltraining.fullaccess"));
      fs.add(groups);
    }

    {
      // Read-only access groups
      fs = gridBuilder.newFieldset(getString("plugins.teamcal.readonlyAccess"),
          getString("plugins.teamcal.access.groups"));
      final GroupsProvider groupsProvider = new GroupsProvider();
      final Collection<GroupDO> readOnlyAccessGroups = new GroupsProvider().getSortedGroups(getData().getReadOnlyAccessGroupIds());
      readonlyAccessGroupsListHelper = new MultiChoiceListHelper<GroupDO>().setComparator(new GroupsComparator()).setFullList(
          groupsProvider.getSortedGroups());
      if (readOnlyAccessGroups != null) {
        for (final GroupDO group : readOnlyAccessGroups) {
          readonlyAccessGroupsListHelper.addOriginalAssignedItem(group).assignItem(group);
        }
      }
      final Select2MultiChoice<GroupDO> groups = new Select2MultiChoice<GroupDO>(fs.getSelect2MultiChoiceId(),
          new PropertyModel<Collection<GroupDO>>(this.readonlyAccessGroupsListHelper, "assignedItems"), groupsProvider);
      fs.addHelpIcon(getString("plugins.skillmatrix.skilltraining.readonlyaccess"));
      fs.add(groups);
    }

    gridBuilder.newGridPanel();
    {
      // Description
      fs = gridBuilder.newFieldset(TrainingDO.class, "description");
      fs.add(new MaxLengthTextArea(fs.getTextAreaId(), new PropertyModel<String>(data, "description"))).setAutogrow();
    }

    {
      // startDate
      fs = gridBuilder.newFieldset(TrainingDO.class, "startDate");
      fs.add(new DatePanel(fs.newChildId(), new PropertyModel<Date>(data, "startDate"), DatePanelSettings.get().withTargetType(
          java.sql.Date.class)));
    }

    {
      // EndDate
      fs = gridBuilder.newFieldset(TrainingDO.class, "endDate");
      fs.add(new DatePanel(fs.newChildId(), new PropertyModel<Date>(data, "endDate"), DatePanelSettings.get().withTargetType(
          java.sql.Date.class)));
    }

    {
      // Rating
      fs = gridBuilder.newFieldset(TrainingDO.class, "rating");
      valuesRating = new RequiredMaxLengthTextField(fs.getTextFieldId(), new PropertyModel<String>(data, "rating"));
      fs.addHelpIcon(getString("plugins.marketing.addressCampaign.values.format"));
      fs.add(valuesRating);
      fs.addAlertIcon(getString("plugins.skillmatrix.skilltraining.edit.warning.doNotChangeValues"));
      valuesRating.setRequired(false);
      valuesRating.add(new IValidator<String>() {
        @Override
        public void validate(final IValidatable<String> validatable)
        {
          if (TrainingDO.getValuesArray(validatable.getValue()) == null) {
            valuesRating.error(getString("plugins.skillmatrix.skilltraining.values.invalidFormat"));
          }
        }
      });
    }

    {
      // Certificate
      fs = gridBuilder.newFieldset(TrainingDO.class, "certificate");
      valuesCertificate = new RequiredMaxLengthTextField(fs.getTextFieldId(), new PropertyModel<String>(data, "certificate"));
      fs.addHelpIcon(getString("plugins.marketing.addressCampaign.values.format"));
      fs.add(valuesCertificate);
      fs.addAlertIcon(getString("plugins.skillmatrix.skilltraining.edit.warning.doNotChangeValues"));
      valuesCertificate.setRequired(false);
      valuesCertificate.add(new IValidator<String>() {
View Full Code Here

  {
    gridBuilder.newGridPanel();
    {
      // Subject
      final FieldsetPanel fs = gridBuilder.newFieldset(RechnungDO.class, "betreff");
      final MaxLengthTextField subject = new RequiredMaxLengthTextField(InputPanel.WICKET_ID, new PropertyModel<String>(data, "betreff"));
      subject.add(WicketUtils.setFocus());
      fs.add(subject);
    }
    // GRID 50% - BLOCK
    gridBuilder.newSplitPanel(GridSize.COL50, true).newSubSplitPanel(GridSize.COL50);
    {
View Full Code Here

      fs.add(productField);
    }
    {
      // Version
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("plugins.licensemanagement.version"));
      final RequiredMaxLengthTextField versionField = new RequiredMaxLengthTextField(fs.getTextFieldId(), new PropertyModel<String>(data,
          "version"));
      WicketUtils.setStrong(versionField);
      fs.add(versionField);
    }
    {
View Full Code Here

    // 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"));
    }
View Full Code Here

  {
    super.init();
    {
      // Title
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("title"));
      fs.add(new RequiredMaxLengthTextField(fs.getTextFieldId(), new PropertyModel<String>(data, "title")));
    }
    {
      // Values
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("values"));
      valuesField = new RequiredMaxLengthTextField(fs.getTextFieldId(), new PropertyModel<String>(data, "values"));
      fs.addHelpIcon(getString("plugins.marketing.addressCampaign.values.format"));
      fs.add(valuesField);
      fs.addAlertIcon(getString("plugins.marketing.addressCampaign.edit.warning.doNotChangeValues"));
      valuesField.add(new AbstractValidator<String>() {
        @Override
View Full Code Here

    super.init();
    gridBuilder.newSplitPanel(GridSize.COL50);
    {
      // Name
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("plugins.banking.account.name"));
      fs.add(new RequiredMaxLengthTextField(fs.getTextFieldId(), new PropertyModel<String>(data, "name")));
    }
    {
      // Account number
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("plugins.banking.account.number"));
      fs.add(new RequiredMaxLengthTextField(fs.getTextFieldId(), new PropertyModel<String>(data, "accountNumber")));
    }
    gridBuilder.newSplitPanel(GridSize.COL50);
    {
      // Bank
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("plugins.banking.bank"));
View Full Code Here

    }

    {
      // Subject
      final FieldsetPanel fs = gridBuilder.newFieldset(ToDoDO.class, "subject");
      final RequiredMaxLengthTextField subject = new RequiredMaxLengthTextField(fs.getTextFieldId(), new PropertyModel<String>(data,
          "subject"));
      if (isNew() == true) {
        // Only focus for new to-do's:
        subject.add(WicketUtils.setFocus());
      }
      fs.add(subject);
    }
    gridBuilder.newSplitPanel(GridSize.COL50);
    {
View Full Code Here

      fs.add(statusChoice);
    }
    {
      // Identifier
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("fibu.konto.bezeichnung"));
      final RequiredMaxLengthTextField identifier = new RequiredMaxLengthTextField(InputPanel.WICKET_ID, new PropertyModel<String>(data,
          "bezeichnung"));
      fs.add(identifier);
      if (isNew() == false) {
        WicketUtils.setFocus(identifier);
      }
View Full Code Here

TOP

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

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.