Example #1
0
  public CustomerFormPanel(String id, CompoundPropertyModel<CustomerAdminBackingBean> model) {
    super(id, model);

    GreySquaredRoundedBorder greyBorder = new GreySquaredRoundedBorder("border");
    add(greyBorder);

    setOutputMarkupId(true);

    final Form<CustomerAdminBackingBean> form =
        new Form<CustomerAdminBackingBean>("customerForm", model);

    // name
    RequiredTextField<String> nameField = new RequiredTextField<String>("customer.name");
    form.add(nameField);

    nameField.add(StringValidator.lengthBetween(0, 64));
    nameField.setLabel(new ResourceModel("admin.customer.name"));
    nameField.add(new ValidatingFormComponentAjaxBehavior());
    form.add(new AjaxFormComponentFeedbackIndicator("nameValidationError", nameField));

    // code
    final RequiredTextField<String> codeField = new RequiredTextField<String>("customer.code");
    form.add(codeField);
    codeField.add(StringValidator.lengthBetween(0, 16));
    codeField.setLabel(new ResourceModel("admin.customer.code"));
    codeField.add(new ValidatingFormComponentAjaxBehavior());
    form.add(new UniqueCustomerValidator(nameField, codeField));
    form.add(new AjaxFormComponentFeedbackIndicator("codeValidationError", codeField));

    // description
    TextArea<String> textArea = new KeepAliveTextArea("customer.description");
    textArea.setLabel(new ResourceModel("admin.customer.description"));
    form.add(textArea);

    // active
    form.add(new CheckBox("customer.active"));

    // data save label
    form.add(new ServerMessageLabel("serverMessage", "formValidationError"));

    //

    boolean deletable = model.getObject().getCustomer().isDeletable();
    FormConfig formConfig =
        new FormConfig()
            .forForm(form)
            .withDelete(deletable)
            .withSubmitTarget(this)
            .withDeleteEventType(CustomerAjaxEventType.CUSTOMER_DELETED)
            .withSubmitEventType(CustomerAjaxEventType.CUSTOMER_UPDATED);

    FormUtil.setSubmitActions(formConfig);

    greyBorder.add(form);
  }
Example #2
0
  public void addReason(String reason_, List form, int errorFlag) throws WingException {
    TextArea reason = form.addItem("reason", null).addTextArea("reason");
    reason.setLabel(T_reason);
    reason.setHelp(T_reason_help);

    if (!isAdvancedFormEnabled) {
      if (globalReason != null) reason.setValue(globalReason);
    } else {
      if (reason_ != null && errorFlag != org.dspace.submit.step.AccessStep.STATUS_COMPLETE)
        reason.setValue(reason_);
    }
  }
  private void renderRejectPage(Division div) throws WingException {
    Request request = ObjectModelHelper.getRequest(objectModel);

    List form = div.addList("reject-workflow", List.TYPE_FORM);

    form.addItem(T_info2);

    TextArea reason = form.addItem().addTextArea("reason");
    reason.setLabel(T_reason);
    reason.setRequired();
    reason.setSize(15, 50);

    if (Action.getErrorFields(request).contains("reason")) reason.addError(T_reason_required);

    div.addHidden("page").setValue(ReviewAction.REJECT_PAGE);

    org.dspace.app.xmlui.wing.element.Item actions = form.addItem();
    actions.addButton("submit_reject").setValue(T_submit_reject);
    actions.addButton("submit_cancel").setValue(T_submit_cancel);
  }