コード例 #1
0
  public TaskSelectPanel(
      final FieldsetPanel fieldsetPanel,
      final IModel<TaskDO> model,
      final ISelectCallerPage caller,
      final String selectProperty) {
    super(fieldsetPanel.newChildId(), model, caller, selectProperty);
    this.fieldsetPanel = fieldsetPanel;
    fieldsetPanel.getFieldset().setOutputMarkupId(true).setOutputMarkupPlaceholderTag(true);
    TaskDO task = model.getObject();
    if (Hibernate.isInitialized(task) == false) {
      task = taskTree.getTaskById(task.getId());
      model.setObject(task);
    }
    divContainer =
        new WebMarkupContainer("div") {
          private static final long serialVersionUID = -8150112323444983335L;

          /** @see org.apache.wicket.Component#isVisible() */
          @Override
          public boolean isVisible() {
            // display only, if we are not in ajax task select mode
            return ajaxTaskSelectMode == false;
          }
        };
    divContainer.setOutputMarkupId(true);
    divContainer.setOutputMarkupPlaceholderTag(true);
    add(divContainer);
    ajaxTaskSelectMode = false;
  }
コード例 #2
0
 @SuppressWarnings("serial")
 public void redraw() {
   clearContent();
   {
     gridBuilder.newSecurityAdviceBox(Model.of(getString("calendar.icsExport.securityAdvice")));
     addFormFields();
     final FieldsetPanel fs =
         gridBuilder.newFieldset(getString("calendar.abonnement.url")).setLabelSide(false);
     urlTextArea =
         new TextArea<String>(
             fs.getTextAreaId(),
             new Model<String>() {
               @Override
               public String getObject() {
                 return WicketUtils.getAbsoluteContextPath() + getUrl();
               };
             });
     urlTextArea.setOutputMarkupId(true);
     fs.add(urlTextArea);
     urlTextArea.add(AttributeModifier.replace("onClick", "$(this).select();"));
   }
 }
コード例 #3
0
 @Override
 @SuppressWarnings("serial")
 protected void init() {
   super.init();
   gridBuilder.newGridPanel();
   reportPathPanel = gridBuilder.getPanel();
   reportPathPanel.add(
       new Heading1Panel(
           reportPathPanel.newChildId(),
           new Model<String>() {
             /** @see org.apache.wicket.model.Model#getObject() */
             @Override
             public String getObject() {
               return reportPathHeading;
             }
           }));
   gridBuilder.newGridPanel();
   {
     final FieldsetPanel fs = gridBuilder.newFieldset(getString("file"), "*.xsl, *.jrxml");
     fileUploadField = new FileUploadField(FileUploadPanel.WICKET_ID);
     fs.add(
         new DivTextPanel(
             fs.newChildId(),
             new Model<String>() {
               @Override
               public String getObject() {
                 final ReportScriptingStorage storage = getReportScriptingStorage();
                 return storage != null ? storage.getLastAddedFilename() : "";
               }
             }));
     fs.add(new FileUploadPanel(fs.newChildId(), fileUploadField));
     final Button uploadButton =
         new Button(SingleButtonPanel.WICKET_ID, new Model<String>("upload")) {
           @Override
           public final void onSubmit() {
             parentPage.upload();
           }
         };
     fs.add(
         new SingleButtonPanel(
             fs.newChildId(), uploadButton, getString("upload"), SingleButtonPanel.NORMAL));
   }
   {
     final FieldsetPanel fs = gridBuilder.newFieldset(getString("label.groovyScript"));
     final AceEditorPanel textArea =
         new AceEditorPanel(fs.newChildId(), new PropertyModel<String>(this, "groovyScript"));
     fs.add(textArea);
   }
   {
     final FieldsetPanel fs =
         gridBuilder.newFieldset(getString("label.groovy.result")).suppressLabelForWarning();
     final DivTextPanel groovyResultPanel =
         new DivTextPanel(
             fs.newChildId(),
             new Model<String>() {
               /** @see org.apache.wicket.model.Model#getObject() */
               @Override
               public String getObject() {
                 final GroovyResult groovyResult = parentPage.groovyResult;
                 final StringBuffer buf = new StringBuffer();
                 buf.append(groovyResult.getResultAsHtmlString());
                 if (groovyResult.getResult() != null
                     && StringUtils.isNotEmpty(groovyResult.getOutput()) == true) {
                   buf.append("<br/>\n");
                   buf.append(HtmlHelper.escapeXml(groovyResult.getOutput()));
                 }
                 return buf.toString();
               }
             }) {
           /** @see org.apache.wicket.Component#isVisible() */
           @Override
           public boolean isVisible() {
             final GroovyResult groovyResult = parentPage.groovyResult;
             return (groovyResult != null && groovyResult.hasResult() == true);
           }
         };
     groovyResultPanel.getLabel().setEscapeModelStrings(false);
     fs.add(groovyResultPanel);
   }
   {
     final Button executeButton =
         new Button(SingleButtonPanel.WICKET_ID, new Model<String>("execute")) {
           @Override
           public final void onSubmit() {
             parentPage.execute();
           }
         };
     final SingleButtonPanel executeButtonPanel =
         new SingleButtonPanel(
             actionButtons.newChildId(),
             executeButton,
             getString("execute"),
             SingleButtonPanel.DEFAULT_SUBMIT);
     actionButtons.add(executeButtonPanel);
     setDefaultButton(executeButton);
   }
 }
コード例 #4
0
  @SuppressWarnings("serial")
  @Override
  protected void init() {
    super.init();

    add(
        new IFormValidator() {

          @Override
          public FormComponent<?>[] getDependentFormComponents() {
            return dependentFormComponents;
          }

          @SuppressWarnings("unchecked")
          @Override
          public void validate(final Form<?> form) {
            final PFAutoCompleteTextField<SkillDO> skillTextField =
                (PFAutoCompleteTextField<SkillDO>) dependentFormComponents[0];
            final DropDownChoice<SkillRating> skillRatingDropDown =
                (DropDownChoice<SkillRating>) dependentFormComponents[1];
            if (skillTextField.getConvertedInput().isRateable() == true
                && skillRatingDropDown.getConvertedInput() == null) {
              error(getString("plugins.skillmatrix.error.rateableSkillWithNullRating"));
            } else if (skillTextField.getConvertedInput().isRateable() == false
                && skillRatingDropDown.getConvertedInput() != null) {
              error(getString("plugins.skillmatrix.error.unrateableSkillWithRating"));
            }

            final SkillRatingFilter filter = new SkillRatingFilter();
            filter.setSearchFields("user.username");
            filter.setSearchString(data.getUser().getUsername());
            final List<SkillRatingDO> list = skillRatingDao.getList(filter);
            for (final SkillRatingDO skillRatingDO : list) {
              final boolean isDeleted = skillRatingDO.getSkill().isDeleted();
              final boolean sameSkill =
                  skillRatingDO.getSkill().getTitle()
                      == skillTextField.getConvertedInput().getTitle();
              final boolean sameSkillRating = skillRatingDO.getCreated().equals(data.getCreated());
              if (isDeleted == false && sameSkill && sameSkillRating == false) {
                error(getString("plugins.skillmatrix.error.skillRatingExistsAlready"));
                break;
              }
            }
          }
        });

    gridBuilder.newGridPanel();
    {
      // User
      final FieldsetPanel fs =
          gridBuilder
              .newFieldset(getString("plugins.skillmatrix.skillrating.user"))
              .suppressLabelForWarning();
      final DivTextPanel username = new DivTextPanel(fs.newChildId(), data.getUser().getUsername());
      username.setStrong();
      fs.add(username);
    }
    {
      // Skill, look at UserSelectPanel for fine tuning ( getConverter() )
      final FieldsetPanel fs =
          gridBuilder.newFieldset(getString("plugins.skillmatrix.skillrating.skill"));
      final PFAutoCompleteTextField<SkillDO> autoCompleteTextField =
          new PFAutoCompleteTextField<SkillDO>(
              fs.getTextFieldId(), new PropertyModel<SkillDO>(data, "skill")) {
            @Override
            protected List<SkillDO> getChoices(final String input) {
              final BaseSearchFilter filter = new BaseSearchFilter();
              filter.setSearchFields("title");
              filter.setSearchString(input);
              final List<SkillDO> list = skillDao.getList(filter);
              return list;
            }

            @Override
            protected String formatLabel(final SkillDO skill) {
              if (skill == null) {
                return "";
              }
              return skill.getTitle();
            }

            @Override
            protected String formatValue(final SkillDO skill) {
              if (skill == null) {
                return "";
              }
              return skill.getTitle();
            }

            @SuppressWarnings({"unchecked", "rawtypes"})
            @Override
            public <C> IConverter<C> getConverter(final Class<C> type) {
              return new IConverter() {
                @Override
                public Object convertToObject(final String value, final Locale locale) {
                  if (StringUtils.isEmpty(value) == true) {
                    getModel().setObject(null);
                    return null;
                  }
                  final SkillDO skill = skillDao.getSkillTree().getSkill(value);
                  if (skill == null) {
                    error(getString("plugins.skillmatrix.error.skillNotFound"));
                  }
                  getModel().setObject(skill);
                  final AjaxRequestTarget target = RequestCycle.get().find(AjaxRequestTarget.class);
                  if (target != null) {
                    target.add(SkillRatingEditForm.this.fs.getFieldset());
                  }
                  return skill;
                }

                @Override
                public String convertToString(final Object value, final Locale locale) {
                  if (value == null) {
                    return "";
                  }
                  final SkillDO skill = (SkillDO) value;
                  return skill.getTitle();
                }
              };
            }
          };
      autoCompleteTextField
          .withLabelValue(true)
          .withMatchContains(true)
          .withMinChars(2)
          .withAutoSubmit(false)
          .withWidth(400)
          .setRequired(true);
      autoCompleteTextField.add(
          new AjaxFormComponentUpdatingBehavior("onChange") {

            @Override
            protected void onUpdate(final AjaxRequestTarget target) {
              // AjaxRequestTarget needs this.
            }
          });
      fs.add(autoCompleteTextField);
      dependentFormComponents[0] = autoCompleteTextField;
    }
    {
      // Skill rating
      fs = gridBuilder.newFieldset(getString("plugins.skillmatrix.skillrating.rating"));
      fs.getFieldset().setOutputMarkupId(true);
      final LabelValueChoiceRenderer<SkillRating> ratingChoiceRenderer =
          new LabelValueChoiceRenderer<SkillRating>(this, SkillRating.values());
      final DropDownChoicePanel<SkillRating> skillChoice =
          new DropDownChoicePanel<SkillRating>(
              fs.newChildId(),
              new PropertyModel<SkillRating>(data, "skillRating"),
              ratingChoiceRenderer.getValues(),
              ratingChoiceRenderer) {
            @Override
            public boolean isVisible() {
              if (data == null || data.getSkill() == null || !data.getSkill().isRateable()) {
                return false;
              } else {
                return true;
              }
            }
          };
      fs.add(skillChoice);
      dependentFormComponents[1] = skillChoice.getDropDownChoice();
    }
    {
      // Since year
      final FieldsetPanel fs =
          gridBuilder.newFieldset(getString("plugins.skillmatrix.skillrating.sinceyear"));
      fs.add(
          new MinMaxNumberField<Integer>(
              fs.getTextFieldId(), new PropertyModel<Integer>(data, "sinceYear"), 0, 9000));
    }
    {
      // Certificates
      final FieldsetPanel fs =
          gridBuilder.newFieldset(getString("plugins.skillmatrix.skillrating.certificates"));
      fs.add(
          new MaxLengthTextField(
              fs.getTextFieldId(), new PropertyModel<String>(data, "certificates")));
    }
    {
      // Training courses
      final FieldsetPanel fs =
          gridBuilder.newFieldset(getString("plugins.skillmatrix.skillrating.trainingcourses"));
      fs.add(
          new MaxLengthTextField(
              fs.getTextFieldId(), new PropertyModel<String>(data, "trainingCourses")));
    }
    {
      // Description
      final FieldsetPanel fs =
          gridBuilder.newFieldset(getString("plugins.skillmatrix.skillrating.description"));
      fs.add(
              new MaxLengthTextArea(
                  fs.getTextAreaId(), new PropertyModel<String>(data, "description")))
          .setAutogrow();
    }
    {
      // Comment
      final FieldsetPanel fs =
          gridBuilder.newFieldset(getString("plugins.skillmatrix.skillrating.comment"));
      fs.add(new MaxLengthTextArea(fs.getTextAreaId(), new PropertyModel<String>(data, "comment")))
          .setAutogrow();
    }
  }
コード例 #5
0
 @SuppressWarnings("serial")
 @Override
 protected void init() {
   super.init();
   /* GRID16 - BLOCK */
   gridBuilder.newGridPanel();
   {
     // Number
     final FieldsetPanel fs = gridBuilder.newFieldset(getString("fibu.kunde.nummer"));
     final MinMaxNumberField<Integer> number =
         new MinMaxNumberField<Integer>(
             InputPanel.WICKET_ID, new PropertyModel<Integer>(data, "id"), 0, KundeDO.MAX_ID) {
           @SuppressWarnings({"unchecked", "rawtypes"})
           @Override
           public IConverter getConverter(final Class type) {
             return new IntegerConverter(3);
           }
         };
     WicketUtils.setSize(number, 7);
     fs.add(number);
     if (isNew() == true) {
       WicketUtils.setFocus(number);
     }
   }
   {
     // Name
     final FieldsetPanel fs = gridBuilder.newFieldset(getString("fibu.kunde.name"));
     final RequiredMaxLengthTextField name =
         new RequiredMaxLengthTextField(
             InputPanel.WICKET_ID, new PropertyModel<String>(data, "name"));
     fs.add(name);
     if (isNew() == false) {
       WicketUtils.setFocus(name);
     }
   }
   if (Registry.instance().getKontoCache().isEmpty() == false) {
     // Show this field only if DATEV accounts does exist.
     final FieldsetPanel fs = gridBuilder.newFieldset(getString("fibu.konto"));
     final KontoSelectPanel kontoSelectPanel =
         new KontoSelectPanel(
             fs.newChildId(), new PropertyModel<KontoDO>(data, "konto"), null, "kontoId");
     kontoSelectPanel
         .setKontoNumberRanges(AccountingConfig.getInstance().getDebitorsAccountNumberRanges())
         .init();
     fs.addHelpIcon(getString("fibu.kunde.konto.tooltip"));
     fs.add(kontoSelectPanel);
   }
   {
     // Identifier
     final FieldsetPanel fs = gridBuilder.newFieldset(getString("fibu.kunde.identifier"));
     fs.add(
         new MaxLengthTextField(
             InputPanel.WICKET_ID, new PropertyModel<String>(data, "identifier")));
   }
   {
     // Identifier
     final FieldsetPanel fs = gridBuilder.newFieldset(getString("fibu.kunde.division"));
     fs.add(
         new MaxLengthTextField(
             InputPanel.WICKET_ID, new PropertyModel<String>(data, "division")));
   }
   {
     // Identifier
     final FieldsetPanel fs = gridBuilder.newFieldset(getString("description"));
     fs.add(
         new MaxLengthTextArea(
             TextAreaPanel.WICKET_ID, new PropertyModel<String>(data, "description")));
   }
   {
     // Status drop down box:
     final FieldsetPanel fs = gridBuilder.newFieldset(getString("status"));
     final LabelValueChoiceRenderer<KundeStatus> statusChoiceRenderer =
         new LabelValueChoiceRenderer<KundeStatus>(fs, KundeStatus.values());
     final DropDownChoice<KundeStatus> statusChoice =
         new DropDownChoice<KundeStatus>(
             fs.getDropDownChoiceId(),
             new PropertyModel<KundeStatus>(data, "status"),
             statusChoiceRenderer.getValues(),
             statusChoiceRenderer);
     statusChoice.setNullValid(false).setRequired(true);
     fs.add(statusChoice);
   }
 }
コード例 #6
0
 public static IconPanel getAlertTooltipIcon(
     final FieldsetPanel fieldset, final IModel<String> title, final IModel<String> tooltip) {
   final IconPanel icon = new IconPanel(fieldset.newIconChildId(), IconType.ALERT, title, tooltip);
   return icon;
 }
コード例 #7
0
 /**
  * Uses "jiraSupportTooltipImage" as component id. Please use {@link
  * FieldsetPanel#addJIRASupportHelpIcon()} instead of this method if possible.
  *
  * @param fieldset needed for localization and for getting new child id.
  * @return IconPanel which is invisible if JIRA isn't configured.
  */
 public static IconPanel getJIRASupportTooltipIcon(final FieldsetPanel fieldset) {
   return getJIRASupportTooltipIcon(fieldset, fieldset.newIconChildId());
 }
コード例 #8
0
 /**
  * Hook method which is called, when the task is set by auto complete field
  *
  * @param target
  * @param taskDo
  */
 protected void onModelSelected(final AjaxRequestTarget target, final TaskDO taskDo) {
   target.add(fieldsetPanel.getFieldset());
   target.add(divContainer);
   target.add(userselectContainer);
 }
コード例 #9
0
 @Override
 protected void init() {
   super.init();
   // GRID 50% - BLOCK
   gridBuilder.newSplitPanel(GridSize.COL50);
   {
     // Number
     final FieldsetPanel fs = gridBuilder.newFieldset(getString("legalAffaires.contract.number"));
     fs.add(new DivTextPanel(fs.newChildId(), "C-"));
     numberField =
         new MinMaxNumberField<Integer>(
             InputPanel.WICKET_ID, new PropertyModel<Integer>(data, "number"), 0, 99999999);
     numberField.setMaxLength(8);
     WicketUtils.setSize(numberField, 6);
     fs.add(numberField);
     if (NumberHelper.greaterZero(getData().getNumber()) == false) {
       fs.addHelpIcon(getString("fibu.tooltip.nummerWirdAutomatischVergeben"));
     }
   }
   {
     // Date
     final FieldsetPanel fs = gridBuilder.newFieldset(getString("date"));
     datePanel =
         new DatePanel(
             fs.newChildId(),
             new PropertyModel<Date>(data, "date"),
             DatePanelSettings.get().withTargetType(java.sql.Date.class));
     fs.add(datePanel);
   }
   {
     // Title
     final FieldsetPanel fs = gridBuilder.newFieldset(getString("title"));
     fs.add(createAutocompleteTextField("title"))
         .getField()
         .setRequired(true)
         .add(WicketUtils.setFocus());
   }
   {
     // Contract type
     final FieldsetPanel fs = gridBuilder.newFieldset(getString("legalAffaires.contract.type"));
     final List<ContractType> contractTypes = ConfigXml.getInstance().getContractTypes();
     final LabelValueChoiceRenderer<ContractType> typeChoiceRenderer =
         new LabelValueChoiceRenderer<ContractType>(contractTypes);
     final DropDownChoice<ContractType> typeChoice =
         new DropDownChoice<ContractType>(
             fs.getDropDownChoiceId(),
             new PropertyModel<ContractType>(data, "type"),
             typeChoiceRenderer.getValues(),
             typeChoiceRenderer);
     typeChoice.setNullValid(false);
     fs.add(typeChoice);
   }
   {
     // Status
     final FieldsetPanel fs = gridBuilder.newFieldset(getString("status"));
     // DropDownChoice for convenient selection of time periods.
     final LabelValueChoiceRenderer<String> statusChoiceRenderer =
         new LabelValueChoiceRenderer<String>();
     for (final ContractStatus status : ContractStatus.values()) {
       statusChoiceRenderer.addValue(status.name(), getString(status.getI18nKey()));
     }
     final DropDownChoice<String> statusChoice =
         new DropDownChoice<String>(
             fs.getDropDownChoiceId(),
             new PropertyModel<String>(data, "status"),
             statusChoiceRenderer.getValues(),
             statusChoiceRenderer);
     statusChoice.setNullValid(false);
     fs.add(statusChoice);
   }
   gridBuilder.newSplitPanel(GridSize.COL50);
   {
     // Reference
     final FieldsetPanel fs = gridBuilder.newFieldset(getString("fibu.common.reference"));
     fs.add(
         new MaxLengthTextField(
             InputPanel.WICKET_ID, new PropertyModel<String>(data, "reference")));
   }
   {
     // Resubmission date
     final FieldsetPanel fs = gridBuilder.newFieldset(getString("resubmissionOnDate"));
     resubmissionDatePanel =
         new DatePanel(
             fs.newChildId(),
             new PropertyModel<Date>(data, "resubmissionOnDate"),
             DatePanelSettings.get().withTargetType(java.sql.Date.class));
     fs.add(resubmissionDatePanel);
   }
   {
     // Due date
     final FieldsetPanel fs = gridBuilder.newFieldset(getString("dueDate"));
     dueDatePanel =
         new DatePanel(
             fs.newChildId(),
             new PropertyModel<Date>(data, "dueDate"),
             DatePanelSettings.get().withTargetType(java.sql.Date.class));
     fs.add(dueDatePanel);
   }
   {
     // Signing date
     final FieldsetPanel fs =
         gridBuilder.newFieldset(getString("legalAffaires.contract.signing"), getString("date"));
     signingDatePanel =
         new DatePanel(
             fs.newChildId(),
             new PropertyModel<Date>(data, "signingDate"),
             DatePanelSettings.get().withTargetType(java.sql.Date.class));
     fs.add(signingDatePanel);
   }
   {
     // Validity
     final FieldsetPanel fs =
         gridBuilder.newFieldset(getString("legalAffaires.contract.validity"));
     validFromDatePanel =
         new DatePanel(
             fs.newChildId(),
             new PropertyModel<Date>(data, "validFrom"),
             DatePanelSettings.get().withTargetType(java.sql.Date.class));
     fs.add(validFromDatePanel);
     fs.add(new DivTextPanel(fs.newChildId(), "-"));
     validUntilDatePanel =
         new DatePanel(
             fs.newChildId(),
             new PropertyModel<Date>(data, "validUntil"),
             DatePanelSettings.get().withTargetType(java.sql.Date.class));
     fs.add(validUntilDatePanel);
   }
   gridBuilder.newSplitPanel(GridSize.COL50);
   {
     // CocontractorA
     final FieldsetPanel fs =
         gridBuilder.newFieldset(getString("legalAffaires.contract.coContractorA"));
     fs.add(createAutocompleteTextField("coContractorA"));
   }
   {
     // CopersonA
     final FieldsetPanel fs =
         gridBuilder.newFieldset(getString("legalAffaires.contract.contractPersonA"));
     fs.add(createAutocompleteTextField("contractPersonA"));
   }
   {
     // SignerA
     final FieldsetPanel fs = gridBuilder.newFieldset(getString("legalAffaires.contract.signerA"));
     fs.add(createAutocompleteTextField("signerA"));
   }
   /* GRID8 */
   gridBuilder.newSplitPanel(GridSize.COL50);
   {
     // CocontractorB
     final FieldsetPanel fs =
         gridBuilder.newFieldset(getString("legalAffaires.contract.coContractorB"));
     fs.add(createAutocompleteTextField("coContractorB"));
   }
   {
     // CopersonB
     final FieldsetPanel fs =
         gridBuilder.newFieldset(getString("legalAffaires.contract.contractPersonB"));
     fs.add(createAutocompleteTextField("contractPersonB"));
   }
   {
     // SignerB
     final FieldsetPanel fs = gridBuilder.newFieldset(getString("legalAffaires.contract.signerB"));
     fs.add(createAutocompleteTextField("signerB"));
   }
   /* GRID16 */
   gridBuilder.newGridPanel();
   {
     // Text with JIRA support
     final FieldsetPanel fs = gridBuilder.newFieldset(getString("text"));
     final IModel<String> model = new PropertyModel<String>(data, "text");
     fs.add(new MaxLengthTextArea(TextAreaPanel.WICKET_ID, model));
     fs.addJIRAField(model);
   }
   {
     // Filing
     final FieldsetPanel fs = gridBuilder.newFieldset(getString("filing"));
     fs.add(
         new MaxLengthTextField(InputPanel.WICKET_ID, new PropertyModel<String>(data, "filing")));
   }
   addCloneButton();
 }
コード例 #10
0
  @Override
  @SuppressWarnings("serial")
  protected void init() {
    super.init();
    gridBuilder.newSplitPanel(GridSize.COL50);
    gridBuilder.newFormHeading(getString("system.admin.group.title.alertMessage"));
    {
      final FieldsetPanel fs =
          gridBuilder.newFieldset(getString("system.admin.group.title.alertMessage"));
      alertMessage = WicketApplication.getAlertMessage();

      fs.add(
              new MaxLengthTextArea(
                  TextAreaPanel.WICKET_ID, new PropertyModel<String>(this, "alertMessage"), 1000))
          .setAutogrow();
    }
    {
      final FieldsetPanel fs = gridBuilder.newFieldset("").suppressLabelForWarning();
      fs.add(
          new MyButtonPanel(fs.newChildId(), "setAlertMessage") {
            @Override
            public void onSubmit() {
              parentPage.setAlertMessage();
            }
          }.getButtonPanel());
      fs.add(
          new MyButtonPanel(fs.newChildId(), "clearAlertMessage") {
            @Override
            public void onSubmit() {
              parentPage.clearAlertMessage();
            }

            /** @see org.projectforge.web.admin.AdminForm.MyButtonPanel#isVisible() */
            @Override
            public boolean isVisible() {
              return StringUtils.isNotBlank(alertMessage);
            }
          }.getButtonPanel());
    }
    {
      final FieldsetPanel fs =
          gridBuilder
              .newFieldset(getString("system.admin.alertMessage.copyAndPaste.title"))
              .suppressLabelForWarning();
      fs.add(
          new DivTextPanel(
              fs.newChildId(),
              PFUserContext.getLocalizedMessage(
                  "system.admin.alertMessage.copyAndPaste.text", AppVersion.NUMBER)));
    }

    gridBuilder.newSplitPanel(GridSize.COL50);
    {
      final FieldsetPanel fs =
          gridBuilder.newFieldset(
              getString("system.admin.reindex.newestEntries"),
              getString("system.admin.reindex.newestEntries.subtitle"));
      fs.add(
          new MinMaxNumberField<Integer>(
              InputPanel.WICKET_ID,
              new PropertyModel<Integer>(this, "reindexNewestNEntries"),
              0,
              Integer.MAX_VALUE));
      fs.addHelpIcon(getString("system.admin.reindex.newestEntries.tooltip"));
    }
    {
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("system.admin.reindex.fromDate"));
      final DatePanel datePanel =
          new DatePanel(fs.newChildId(), new PropertyModel<Date>(this, "reindexFromDate"));
      fs.add(datePanel);
      fs.addHelpIcon(
          new Model<String>() {
            @Override
            public String getObject() {
              return getString("system.admin.reindex.fromDate.tooltip")
                  + (reindexFromDate != null
                      ? " (" + DateHelper.formatAsUTC(reindexFromDate) + ")"
                      : "");
            }
          });
      fs.add(
          new MyButtonPanel(fs.newChildId(), "reindex") {
            @Override
            public void onSubmit() {
              parentPage.reindex();
            }
          }.getButtonPanel());
    }

    gridBuilder.newGridPanel();
    {
      final FieldsetPanel fs =
          gridBuilder.newFieldset(getString("system.admin.group.title.misc.logEntries"));
      final MaxLengthTextArea logEntries =
          new MaxLengthTextArea(
              TextAreaPanel.WICKET_ID, new PropertyModel<String>(this, "logEntries"), 10000);
      logEntries.add(AttributeModifier.append("style", "width: 100%; height: 20em;"));
      fs.add(logEntries);
      fs.addHelpIcon(getString("system.admin.button.formatLogEntries.textarea.tooltip"));
    }
    {
      final FieldsetPanel fs = gridBuilder.newFieldset("").suppressLabelForWarning();
      fs.add(
          new MyButtonPanel(fs.newChildId(), "formatLogEntries") {
            @Override
            public void onSubmit() {
              parentPage.formatLogEntries();
            }
          }.getButtonPanel());
    }
    gridBuilder.newGridPanel();
    final DivPanel section = gridBuilder.getPanel();
    final DivTextPanel logMessages =
        new DivTextPanel(
            section.newChildId(),
            new Model<String>() {
              @Override
              public String getObject() {
                return formattedLogEntries;
              }
            });
    logMessages.getLabel().setEscapeModelStrings(false);
    section.add(logMessages);
  }
コード例 #11
0
  @SuppressWarnings("serial")
  @Override
  protected void init() {
    super.init();
    gridBuilder.newGridPanel();
    {
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("plugins.teamcal.event.teamCal"));
      final List<TeamCalDO> list = teamCalDao.getAllCalendarsWithFullAccess();
      final LabelValueChoiceRenderer<TeamCalDO> calChoiceRenderer =
          new LabelValueChoiceRenderer<TeamCalDO>();
      for (final TeamCalDO cal : list) {
        calChoiceRenderer.addValue(cal, cal.getTitle());
      }
      final DropDownChoice<TeamCalDO> calDropDownChoice =
          new DropDownChoice<TeamCalDO>(
              fs.getDropDownChoiceId(),
              new PropertyModel<TeamCalDO>(this, "calendar"),
              calChoiceRenderer.getValues(),
              calChoiceRenderer) {
            /**
             * @see
             *     org.apache.wicket.markup.html.form.DropDownChoice#wantOnSelectionChangedNotifications()
             */
            @Override
            protected boolean wantOnSelectionChangedNotifications() {
              return true;
            }

            /**
             * @see
             *     org.apache.wicket.markup.html.form.DropDownChoice#onSelectionChanged(java.lang.Object)
             */
            @Override
            protected void onSelectionChanged(final TeamCalDO newSelection) {
              parentPage.reconcile();
            }
          };
      calDropDownChoice.setNullValid(false);
      calDropDownChoice.setRequired(true);
      fs.add(calDropDownChoice);
    }
    {
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("file"), "*.ics");
      fileUploadField = new FileUploadField(FileUploadPanel.WICKET_ID);
      fs.add(new FileUploadPanel(fs.newChildId(), fileUploadField));
      fs.add(
          new SingleButtonPanel(
                  fs.newChildId(),
                  new Button(SingleButtonPanel.WICKET_ID, new Model<String>("importEvents")) {
                    @Override
                    public final void onSubmit() {
                      parentPage.importEvents();
                    }
                  },
                  getString("upload"),
                  SingleButtonPanel.NORMAL)
              .setTooltip(getString("common.import.upload.tooltip")));
      addClearButton(fs);
    }
    {
      addImportFilterRadio(gridBuilder);
    }
    gridBuilder.newGridPanel();
    final DivPanel panel = gridBuilder.getPanel();
    storagePanel = new TeamCalImportStoragePanel(panel.newChildId(), parentPage, importFilter);
    panel.add(storagePanel);
  }