Пример #1
0
  @Override
  public void registerFilters(DataTable<?> table, IModel<UserFilter> filterModel) {
    super.registerFilters(table, filterModel);

    List<Boolean> choises = Arrays.asList(Boolean.FALSE, Boolean.TRUE);
    DropDownChoice<Boolean> assignedFilter =
        new DropDownChoice<Boolean>(
            "assignedFilter",
            new PropertyModel<Boolean>(filterModel, UserFilter.FIELD_ASSIGNED),
            choises) {
          @Override
          protected String getNullValidDisplayValue() {
            return getString("assigned.nullValid");
          }
        };
    assignedFilter.setChoiceRenderer(
        new ChoiceRenderer<Boolean>() {
          @Override
          public Object getDisplayValue(Boolean object) {
            String key = "assigned." + object.toString();
            return getString(key);
          }
        });
    assignedFilter.setNullValid(true);
    addFilter(assignedFilter, new ResourceModel("user.assigned"));
  }
Пример #2
0
  public WorkspaceSwitcher(String id, IModel<Workspace> model) {
    super(id, model);

    IModel<List<? extends Workspace>> workspaceModel =
        new LoadableDetachableModel<List<? extends Workspace>>() {
          @Override
          protected List<? extends Workspace> load() {
            return getWorkspaces();
          }
        };
    DropDownChoice<Workspace> choice =
        new DropDownChoice<Workspace>("workspaces", model, workspaceModel, new Renderer()) {
          @Override
          protected boolean wantOnSelectionChangedNotifications() {
            return true;
          }

          @Override
          protected void onSelectionChanged(Workspace newSelection) {
            detach();
            super.onSelectionChanged(newSelection);
          }
        };
    choice.setNullValid(false);
    add(choice);
  }
Пример #3
0
  private void initRoot() {
    DropDownChoice<LoggingLevelType> rootLevel =
        new DropDownChoice<>(
            ID_ROOT_LEVEL,
            new PropertyModel<LoggingLevelType>(getModel(), LoggingDto.F_ROOT_LEVEL),
            WebComponentUtil.createReadonlyModelFromEnum(LoggingLevelType.class));
    rootLevel.add(new EmptyOnChangeAjaxFormUpdatingBehavior());
    add(rootLevel);

    DropDownChoice<String> rootAppender =
        new DropDownChoice<>(
            ID_ROOT_APPENDER,
            new PropertyModel<String>(getModel(), LoggingDto.F_ROOT_APPENDER),
            createAppendersListModel());
    rootAppender.setNullValid(true);
    rootAppender.add(
        new OnChangeAjaxBehavior() {

          @Override
          protected void onUpdate(AjaxRequestTarget target) {
            rootAppenderChangePerformed(target);
          }
        });
    rootAppender.add(new EmptyOnChangeAjaxFormUpdatingBehavior());
    add(rootAppender);
  }
Пример #4
0
  public BranchSelectionPanel(
      String id,
      IModel<String> repositoryUriModel,
      IModel<String> branchNameModel,
      Form<DataStoreInfo> storeEditForm) {
    super(id, branchNameModel);
    this.repositoryUriModel = repositoryUriModel;

    final List<String> choices = new ArrayList<String>();
    choice = new DropDownChoice<String>("branchDropDown", branchNameModel, choices);
    choice.setOutputMarkupId(true);
    choice.setNullValid(true);
    choice.setRequired(false);
    add(choice);
    updateChoices(false, null);

    final AjaxSubmitLink refreshLink =
        new AjaxSubmitLink("refresh", storeEditForm) {
          private static final long serialVersionUID = 1L;

          @Override
          protected void onError(AjaxRequestTarget target, Form<?> form) {
            onSubmit(target, form);
          }

          @Override
          protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            updateChoices(true, form);
            target.add(BranchSelectionPanel.this.choice);
          }
        };
    add(refreshLink);
  }
 private void buildCountryInput() {
   countryInput =
       new DropDownChoice<Country>(
           "country", Arrays.asList(Country.values()), new EnumChoiceRenderer<Country>(this));
   countryInput.setNullValid(true);
   countryInput.setOutputMarkupId(true);
   form.add(countryInput);
 }
 private void buildGenderInput() {
   genderInput =
       new DropDownChoice<Gender>(
           "gender", Arrays.asList(Gender.values()), new EnumChoiceRenderer<Gender>(this));
   genderInput.setNullValid(true);
   genderInput.setOutputMarkupId(true);
   form.add(genderInput);
 }
 private void buildNationalityInput() {
   nationalityInput =
       new DropDownChoice<Nationality>(
           "nationality",
           Arrays.asList(Nationality.values()),
           new EnumChoiceRenderer<Nationality>(this));
   nationalityInput.setNullValid(true);
   nationalityInput.setOutputMarkupId(true);
   form.add(nationalityInput);
 }
Пример #8
0
    private void initLayout() {
      final Form searchForm = new Form(ID_SEARCH_FORM);
      add(searchForm);
      searchForm.setOutputMarkupId(true);

      final IModel<ReportOutputSearchDto> model = (IModel) getDefaultModel();

      BasicSearchPanel<ReportOutputSearchDto> basicSearch =
          new BasicSearchPanel<ReportOutputSearchDto>(ID_BASIC_SEARCH, model) {

            @Override
            protected IModel<String> createSearchTextModel() {
              return new PropertyModel<String>(model, UsersDto.F_TEXT);
            }

            @Override
            protected void searchPerformed(AjaxRequestTarget target) {
              PageCreatedReports page = (PageCreatedReports) getPage();
              page.searchPerformed(target);
            }

            @Override
            protected void clearSearchPerformed(AjaxRequestTarget target) {
              PageCreatedReports page = (PageCreatedReports) getPage();
              page.clearSearchPerformed(target);
            }
          };
      searchForm.add(basicSearch);

      DropDownChoice reportTypeSelect =
          new DropDownChoice(
              ID_REPORT_TYPE_SELECT,
              new PropertyModel(model, ReportOutputSearchDto.F_REPORT_TYPE),
              new PropertyModel(model, ReportOutputSearchDto.F_REPORT_TYPES),
              new ChoiceRenderer()) {

            @Override
            protected String getNullValidDisplayValue() {
              return getString("pageCreatedReports.filter.reportType");
            }
          };
      reportTypeSelect.add(
          new OnChangeAjaxBehavior() {

            @Override
            protected void onUpdate(AjaxRequestTarget target) {
              PageCreatedReports page = (PageCreatedReports) getPage();
              page.searchPerformed(target);
            }
          });
      reportTypeSelect.setOutputMarkupId(true);
      reportTypeSelect.setNullValid(true);
      searchForm.add(reportTypeSelect);
    }
Пример #9
0
  private void initLayout() {
    IModel data = new PropertyModel(getModel(), SearchValue.F_VALUE);

    final DisplayableRenderer renderer = new DisplayableRenderer(choices);
    final DropDownChoice input =
        new DropDownChoice(ID_COMBO_INPUT, data, choices, renderer) {

          @Override
          public IConverter getConverter(Class type) {
            return renderer;
          }
        };
    input.setNullValid(true);
    input.setOutputMarkupId(true);
    add(input);
  }
Пример #10
0
  private void initAudit() {
    CheckBox auditLog =
        WebComponentUtil.createAjaxCheckBox(
            "auditLog", new PropertyModel<Boolean>(getModel(), "auditLog"));
    add(auditLog);

    CheckBox auditDetails =
        WebComponentUtil.createAjaxCheckBox(
            "auditDetails", new PropertyModel<Boolean>(getModel(), "auditDetails"));
    add(auditDetails);

    DropDownChoice<String> auditAppender =
        new DropDownChoice<>(
            "auditAppender",
            new PropertyModel<String>(getModel(), "auditAppender"),
            createAppendersListModel());
    auditAppender.setNullValid(true);
    auditAppender.add(new EmptyOnChangeAjaxFormUpdatingBehavior());
    add(auditAppender);
  }
 @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);
   }
 }
 @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();
 }
Пример #13
0
  protected void initUI(StyleInfo style) {
    IModel<StyleInfo> styleModel =
        new CompoundPropertyModel(
            style != null
                ? new StyleDetachableModel(style)
                : getCatalog().getFactory().createStyle());

    styleForm =
        new Form("form", styleModel) {
          @Override
          protected void onSubmit() {
            super.onSubmit();
            onStyleFormSubmit();
          }
        };
    styleForm.setMarkupId("mainForm");
    add(styleForm);

    styleForm.add(nameTextField = new TextField("name"));
    nameTextField.setRequired(true);

    DropDownChoice<WorkspaceInfo> wsChoice =
        new DropDownChoice("workspace", new WorkspacesModel(), new WorkspaceChoiceRenderer());
    wsChoice.setNullValid(true);
    if (!isAuthenticatedAsAdmin()) {
      wsChoice.setNullValid(false);
      wsChoice.setRequired(true);
    }

    styleForm.add(wsChoice);
    styleForm.add(editor = new CodeMirrorEditor("SLD", new PropertyModel(this, "rawSLD")));
    // force the id otherwise this blasted thing won't be usable from other forms
    editor.setTextAreaMarkupId("editor");
    editor.setOutputMarkupId(true);
    editor.setRequired(true);
    styleForm.add(editor);

    if (style != null) {
      try {
        setRawSLD(readFile(style));
      } catch (IOException e) {
        // ouch, the style file is gone! Register a generic error message
        Session.get()
            .error(new ParamResourceModel("sldNotFound", this, style.getFilename()).getString());
      }
    }

    // style copy functionality
    styles =
        new DropDownChoice(
            "existingStyles", new Model(), new StylesModel(), new StyleChoiceRenderer());
    styles.setOutputMarkupId(true);
    styles.add(
        new AjaxFormComponentUpdatingBehavior("onchange") {

          @Override
          protected void onUpdate(AjaxRequestTarget target) {
            styles.validate();
            copyLink.setEnabled(styles.getConvertedInput() != null);
            target.addComponent(copyLink);
          }
        });
    styleForm.add(styles);
    copyLink = copyLink();
    copyLink.setEnabled(false);
    styleForm.add(copyLink);

    uploadForm = uploadForm(styleForm);
    uploadForm.setMultiPart(true);
    uploadForm.setMaxSize(Bytes.megabytes(1));
    uploadForm.setMarkupId("uploadForm");
    add(uploadForm);

    uploadForm.add(fileUploadField = new FileUploadField("filename"));

    add(validateLink());
    Link cancelLink =
        new Link("cancel") {
          @Override
          public void onClick() {
            setResponsePage(StylePage.class);
          }
        };
    add(cancelLink);
  }
  @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);
  }
  /** @param ruleId */
  private void addNewComponentForm(final Integer ruleId) {
    IModel<DNRuleComponent> formModel =
        new CompoundPropertyModel<DNRuleComponent>(new DNRuleComponent());

    Form<DNRuleComponent> form =
        new Form<DNRuleComponent>("newDNRuleComponentForm", formModel) {
          private static final long serialVersionUID = 1L;

          @Override
          protected void onSubmit() {
            DNRuleComponent dnRuleComponent = this.getModelObject();
            dnRuleComponent.setRuleId(ruleId);

            try {
              dnRuleComponentDao.save(dnRuleComponent);
            } catch (DaoException ex) {
              logger.error(ex.getMessage(), ex);
              getSession().error(ex.getMessage());
              return;
            } catch (Exception ex) {
              logger.error(ex.getMessage(), ex);
              getSession()
                  .error("The component could not be registered due to an unexpected error.");

              return;
            }

            getSession().info("The component was successfuly registered.");
            setResponsePage(new DNRuleDetailPage(ruleId));
          }
        };

    final TextArea<String> modification = new TextArea<String>("modification");

    ChoiceRenderer<DNRuleComponentType> renderer =
        new ChoiceRenderer<DNRuleComponentType>("label", "id");
    LoadableDetachableModel<List<DNRuleComponentType>> choices =
        new LoadableDetachableModel<List<DNRuleComponentType>>() {
          private static final long serialVersionUID = 1L;

          @Override
          protected List<DNRuleComponentType> load() {
            return dnRuleComponentTypeDao.loadAll();
          }
        };
    DropDownChoice<DNRuleComponentType> type =
        new DropDownChoice<DNRuleComponentType>("type", choices, renderer) {
          private static final long serialVersionUID = 1L;

          @Override
          public void onSelectionChanged(DNRuleComponentType newType) {
            String hint;

            if (newType.getLabel().equals("INSERT")) {

              hint = insertHint;

            } else if (newType.getLabel().equals("DELETE")) {

              hint = deleteHint;

            } else {

              hint = modifyHint;
            }

            modification.add(new AttributeModifier("placeholder", hint));
          }

          @Override
          protected boolean wantOnSelectionChangedNotifications() {
            return true;
          }

          @Override
          protected CharSequence getDefaultChoice(String selectedValue) {
            return !isNullValid() && !getChoices().isEmpty()
                ? ""
                : super.getDefaultChoice(selectedValue);
          }
        };
    type.setNullValid(false);
    type.setRequired(true);
    form.add(type);

    modification.setRequired(true);
    modification.add(
        new DNComponentValidator(
            ConfigLoader.getConfig().getBackendGroup().getDirtyDBJDBCConnectionCredentials(),
            type));
    modification.add(new AttributeModifier("placeholder", insertHint));
    form.add(modification);

    form.add(createTextarea("description", false));

    add(form);
  }