public void testUrlLinkModified() {
    // print(tester.getLastRenderedPage(), true, true);

    final FormTester requestFormTester = tester.newFormTester("demoRequestsForm");

    final String requestName = "WMS_describeLayer.url";

    requestFormTester.select("demoRequestsList", 1);

    /*
     * There's an AjaxFormSubmitBehavior attached to onchange so force it
     */
    tester.executeAjaxEvent("demoRequestsForm:demoRequestsList", "onchange");

    tester.assertModelValue("demoRequestsForm:demoRequestsList", requestName);

    final String modifiedUrl = "http://modified/url";

    TextField url = (TextField) tester.getComponentFromLastRenderedPage("demoRequestsForm:url");
    url.setModelValue(new String[] {modifiedUrl});

    assertEquals(modifiedUrl, url.getValue());

    final boolean isAjax = true;
    tester.clickLink("demoRequestsForm:submit", isAjax);

    tester.assertVisible("responseWindow");

    IModel model = tester.getLastRenderedPage().getModel();
    assertTrue(model.getObject() instanceof DemoRequest);
    DemoRequest req = (DemoRequest) model.getObject();

    String requestUrl = req.getRequestUrl();
    assertEquals(modifiedUrl, requestUrl);
  }
  /**
   * We have to resort to manual validation otherwise the ajax tricks performed by the drop down
   * won't work
   */
  protected boolean validate() {
    boolean valid = true;
    if (attribute.getName() == null || attribute.getName().trim().equals("")) {
      nameField.error((IValidationError) new ValidationError().addMessageKey("Required"));
      valid = false;
    }
    if (String.class.equals(attribute.getBinding())) {
      try {
        attribute.setSize(Integer.parseInt(size));
        if (attribute.getSize() <= 0) {
          sizeField.error(new ParamResourceModel("notPositive", this));
          valid = false;
        }
      } catch (Exception e) {
        sizeField.error(new ParamResourceModel("notInteger", this, size));
        valid = false;
      }
    }
    if (Geometry.class.isAssignableFrom(attribute.getBinding()) && attribute.getCrs() == null) {
      crsField.error((IValidationError) new ValidationError().addMessageKey("Required"));
      valid = false;
    }

    return valid;
  }
  @Override
  public void updateModel() {
    super.updateModel();
    comp.updateModel();
    creatingTablesComponent.updateModel();
    propertyFileNameDDLComponent.updateModel();
    propertyFileNameDMLComponent.updateModel();
    JDBCSecurityServiceConfig config = (JDBCSecurityServiceConfig) configHelper.getConfig();
    JDBCConnectConfig c = comp.getModelObject();
    config.setJndiName(null);
    config.setDriverClassName(null);
    config.setConnectURL(null);
    config.setUserName(null);
    config.setPassword(null);

    config.setJndi(c.getType().equals(JDBCConnectConfig.TYPEJNDI));
    if (config.isJndi()) {
      config.setJndiName(c.getJndiName());
    } else {
      config.setDriverClassName(c.getDriverName());
      config.setConnectURL(c.getConnectURL());
      config.setUserName(c.getUsername());
      config.setPassword(c.getPassword());
    }
  }
示例#4
0
    public CreateAccountForm(String id) {
      super(id);
      setModel(new Model<CreateAccountForm>(this));
      setMarkupId("createAccountForm");
      add(
          new TextField<String>(FIELD_USERNAME, new PropertyModel<String>(this, "username"))
              .setRequired(true)
              .add(StringValidator.lengthBetween(3, 32))
              .add(new PatternValidator("^\\w+$")));
      PasswordTextField pw =
          new PasswordTextField(FIELD_PASSWORD, new PropertyModel<String>(this, "password"));
      PasswordTextField pwc =
          new PasswordTextField(
              FIELD_PASSWORD_CONFIRM, new PropertyModel<String>(this, "password"));
      add(pw);
      add(pwc);
      add(new EqualPasswordInputValidator(pw, pwc));

      TextField<String> emailField =
          new TextField<String>(FIELD_EMAIL, new PropertyModel<String>(this, "email"));
      emailField.add(
          new IValidator<String>() {
            private static final long serialVersionUID = 1L;

            public void validate(IValidatable<String> validatable) {
              if (validatable.getValue() != null && !"".equals(validatable.getValue())) {
                EmailAddressValidator.getInstance().validate(validatable);
              }
            }
          });

      add(emailField);
      add(new TextField<String>(FIELD_CAPTCHA, new PropertyModel<String>(this, "captcha")));
      add(new FeedbackPanel("feedbackPanel"));
    }
示例#5
0
  public RegisterHtmlForm(String id, RegisterForm registerForm) {
    super(id, new CompoundPropertyModel<RegisterForm>(registerForm));

    TextField<String> email =
        new RequiredTextField<String>(
            "register.email", new PropertyModel<String>(registerForm, "email"));
    add(email);
    email.add(EmailAddressValidator.getInstance());
    email.add(StringValidator.maximumLength(SimiConstants.VALID_EMAIL_MAX_LENGTH));

    PasswordTextField password =
        new PasswordTextField(
            "register.password", new PropertyModel<String>(registerForm, "password"));
    add(password);
    password.setRequired(true);
    password.add(
        StringValidator.lengthBetween(
            SimiConstants.VALID_PASSWORD_MIX_LENGTH, SimiConstants.VALID_PASSWORD_MAX_LENGTH));

    PasswordTextField repassword =
        new PasswordTextField(
            "register.repassword", new PropertyModel<String>(registerForm, "repassword"));
    add(repassword);
    repassword.setRequired(true);
    repassword.setResetPassword(false);
    repassword.add(
        StringValidator.lengthBetween(
            SimiConstants.VALID_PASSWORD_MIX_LENGTH, SimiConstants.VALID_PASSWORD_MAX_LENGTH));

    add(new EqualPasswordInputValidator(password, repassword));

    add(new FeedbackPanel(id + ".feedback", new ContainerFeedbackMessageFilter(this)));
  }
示例#6
0
 private void createMailInput(Form<T> form) {
   TextField<String> emailField = new TextField<String>("user.email");
   emailField.add(EmailAddressValidator.getInstance());
   emailField.add(new ValidatingFormComponentAjaxBehavior());
   form.add(emailField);
   form.add(new AjaxFormComponentFeedbackIndicator("emailValidationError", emailField));
 }
 public void validate(Form<?> form) {
   String commonName = this.commonNameTextField.getInput();
   if (commonName != null) {
     commonName = commonName.toLowerCase();
     if (commonNameTextField.getModelObject() != null
         && commonName.equals(commonNameTextField.getModelObject().toLowerCase())) return;
     for (TransferCapability transferCapability :
         this.applicationEntity.getTransferCapabilities()) {
       if (transferCapability.getCommonName() != null
           && commonName.equals(transferCapability.getCommonName().toLowerCase()))
         commonNameTextField.error(
             new StringResourceModel("TransferCapabilityValidator.commonName.invalid", form, null)
                 .getObject());
     }
   }
   String sopClass = this.sopClassTextField.getInput();
   String role = this.roleDropDown.getInput().equals("0") ? "SCP" : "SCU";
   if (sopClass.equals(sopClassTextField.getModelObject())
       && role.equals(roleDropDown.getModelObject().name())) return;
   for (TransferCapability transferCapability : this.applicationEntity.getTransferCapabilities()) {
     if (sopClass.equals(transferCapability.getSopClass())
         && role.equals(transferCapability.getRole().name()))
       sopClassTextField.error(
           new StringResourceModel("TransferCapabilityValidator.sopClass-role.invalid", form, null)
               .getObject());
   }
 }
 /**
  * Constructor, takes the wicket:id value (probably "form") and the RegistrationModel object to
  * be used as the model for the form.
  *
  * @param id
  * @param registrationModel
  */
 @SuppressWarnings("serial")
 public OpenIdRegistrationInformationDisplayForm(
     final String id, final RegistrationModel registrationModel) {
   super(id, new CompoundPropertyModel(registrationModel));
   //
   final TextField openId = new TextField("openId");
   openId.setEnabled(false);
   add(openId);
   //
   final TextField fullName = new RequiredTextField("fullName");
   add(fullName);
   //
   final TextField emailAddress = new RequiredTextField("emailAddress");
   add(emailAddress);
   //
   final TextField zipCode = new TextField("zipCode");
   add(zipCode);
   //
   final TextField dateOfBirth = new RequiredTextField("dateOfBirth", Date.class);
   add(dateOfBirth);
   //
   final Button saveButton =
       new Button("saveButton") {
         public void onSubmit() {
           // Store registration in the DB
           if (saveRegistrationInfo()) {
             info("Registration Info saved.");
           } else {
             error("Registration Info could not be saved!");
           }
         }
       };
   add(saveButton);
 }
示例#9
0
  @Override
  protected void onInitialize() {
    super.onInitialize();

    TextField<String> userinput = new TextField<String>("userinput", Model.of(""));
    userinput.add(
        new AjaxFormSubmitBehavior("onchange") {
          private static final long serialVersionUID = 1L;

          @Override
          protected void onSubmit(AjaxRequestTarget target) {}

          @Override
          protected void onError(AjaxRequestTarget target) {}

          @Override
          protected IAjaxCallDecorator getAjaxCallDecorator() {
            super.getAjaxCallDecorator();
            return new MyAjaxCallDecorator();
          }
        });

    Form<Void> form = new Form<Void>("form");
    add(form);

    form.add(userinput);

    AjaxRequestTarget.get();
    getPageParameters();
  }
 @SuppressWarnings("unchecked")
 @Test
 public void testSelectImport_shouldSelectImport() throws Exception {
   tester.clickLink("tree:i:1:nodeComponent:contentLink", true);
   TextField<String> importName =
       (TextField<String>) tester.getComponentFromLastRenderedPage("editForm:importName");
   assertTrue(importName.isEnabled());
   assertEquals("aaaa.bbbb.ccc", importName.getModelObject());
 }
示例#11
0
 /*
  * (non-Javadoc)
  *
  * @see au.org.theark.core.web.form.AbstractDetailForm#attachValidators()
  */
 @Override
 protected void attachValidators() {
   customFieldGroupTxtFld
       .setRequired(true)
       .setLabel(
           new StringResourceModel(
               "customFieldGroup.name", this, new Model<String>("Custom Field Group Name")));
   customFieldGroupTxtFld.add(StringValidator.maximumLength(1000));
 }
示例#12
0
  private void createNameInput(Form<T> form) {
    TextField<String> firstNameField = new TextField<String>("user.firstName");
    form.add(firstNameField);

    TextField<String> lastNameField = new RequiredTextField<String>("user.lastName");
    form.add(lastNameField);
    lastNameField.setLabel(new ResourceModel("admin.user.lastName"));
    lastNameField.add(new ValidatingFormComponentAjaxBehavior());
    form.add(new AjaxFormComponentFeedbackIndicator("lastNameValidationError", lastNameField));
  }
    @Override
    public final void onSubmit() {
      if (AccountDAO.checkIsUserRegistered(username.getModelObject())) {
        orderDao.addNewOrder(
            getSelectedOption(),
            getSelectedHotel(),
            getSelectedOption(),
            username.getModelObject(),
            getCalculatedTotalCostSum(),
            selected);
        pageParams.add("feedBack", "Order has been placed !");
        setResponsePage(new CreateOrderForUser(pageParams));
      }
      if (username.getModelObject() == null || username.getModelObject() == "") {
        error("EnterUserName");
      }

      if (!AccountDAO.checkIsUserRegistered(username.getModelObject())
          && (!(email.getModelObject() == "") || !(email.getModelObject() == null))) {
        AccountDAO.addNewAccount(username.getModelObject(), "123qwe");
        orderDao.addNewOrder(
            getSelectedOption(),
            getSelectedHotel(),
            getSelectedOption(),
            username.getModelObject(),
            getCalculatedTotalCostSum(),
            selected);
        setResponsePage(CreateOrderForUser.class);
      }
    }
  public LdapCreateUpdatePanel(CreateUpdateAction action, LdapSetting ldapDescriptor) {
    /**
     * Creating a local copy of the original descriptor so that we can fool around with it without
     * changing the original until we need to save
     */
    super(action, new LdapSetting(ldapDescriptor));
    originalDescriptor = ldapDescriptor;
    setWidth(500);

    add(form);

    TitledBorder border = new TitledBorder("border");
    form.add(border);

    // Ldap key
    RequiredTextField<String> ldapKeyField = new RequiredTextField<String>("key");
    setDefaultFocusField(ldapKeyField);
    ldapKeyField.setEnabled(isCreate()); // don't allow key update
    if (isCreate()) {
      ldapKeyField.add(new XsdNCNameValidator("Invalid LDAP key '%s'"));
      ldapKeyField.add(new UniqueXmlIdValidator(centralConfigService.getMutableDescriptor()));
    }
    border.add(ldapKeyField);
    border.add(new SchemaHelpBubble("key.help"));

    border.add(new StyledCheckbox("enabled"));

    TextField<String> ldapUrlField = new RequiredTextField<String>("ldapUrl");
    ldapUrlField.add(new UriValidator("ldap", "ldaps"));
    border.add(ldapUrlField);
    border.add(new SchemaHelpBubble("ldapUrl.help"));

    TitledBorder borderDn = new TitledBorder("borderDn");
    form.add(borderDn);
    borderDn.add(new TextField("userDnPattern"));
    borderDn.add(new TextField("emailAttribute"));
    borderDn.add(new SchemaHelpBubble("emailAttribute.help"));
    borderDn.add(new StyledCheckbox("autoCreateUser"));
    borderDn.add(new SchemaHelpBubble("autoCreateUser.help"));
    borderDn.add(new SchemaHelpBubble("userDnPattern.help"));

    addSearchFields(borderDn);

    addTestConnectionFields();

    // Cancel button
    form.add(new ModalCloseLink("cancel"));

    // Submit button
    TitledAjaxSubmitLink submitButton = createSubmitButton();
    form.add(submitButton);
    form.add(new DefaultButtonBehavior(submitButton));

    add(form);
  }
示例#15
0
  /** @see Form#Form(String) */
  public UploadForm(String id) {
    super(id);

    // multipart always needed for uploads
    setMultiPart(true);

    // input field for identifier text
    identifier = new TextField<String>("identifier", new Model<String>());
    // pattern validator
    identifier.add(new PatternValidator("[A-Za-z0-9 _\\-]+"));
    // validator that checks if the project name is already taken
    identifier.add(
        new IValidator<String>() {

          private static final long serialVersionUID = 275885544279441469L;

          @Override
          public void validate(IValidatable<String> validatable) {
            String name = validatable.getValue();
            for (String project : projects.getResources()) {
              // ignore case to avoid confusion
              if (name.equalsIgnoreCase(project)) {
                validatable.error(new ValidationError().setMessage("Identifier already in use"));
                break;
              }
            }
          }
        });
    FieldMessage identifierMessage =
        new FieldMessage(
            "identifierMessage",
            new Model<String>("Unique identifier for the project"),
            identifier);
    identifier.add(new FieldValidatingBehavior("onblur", identifierMessage));
    identifier.setOutputMarkupId(true);
    identifier.setRequired(true);
    //		identifier.add(new DefaultFocus()); XXX not working well with ajax
    add(identifier);
    add(identifierMessage);

    // Add one file input field
    add(file = new FileUploadField("file"));
    add(new FeedbackPanel("feedback"));

    addAllowedContentType("application/zip");
    addAllowedContentType("application/x-zip");
    addAllowedContentType("application/x-zip-compressed");
    addAllowedContentType("application/octet-stream");

    //		setCustomTypeErrorMessage("Only ZIP archives are supported for upload");

    setMaxSize(Bytes.megabytes(20));
  }
示例#16
0
 public DateTimeField(String id, IModel model) {
   super(id, model);
   setType(Date.class);
   PropertyModel dateFieldModel = new PropertyModel(this, "date");
   add(dateField = newDateTextField("date", dateFieldModel));
   dateField.add(new DatePicker());
   add(hoursField = new TextField("hours", new PropertyModel(this, "hours"), Integer.class));
   hoursField.add(NumberValidator.range(0, 24));
   hoursField.setLabel(new Model("hours"));
   add(minutesField = new TextField("minutes", new PropertyModel(this, "minutes"), Integer.class));
   minutesField.add(NumberValidator.range(0, 59));
   minutesField.setLabel(new Model("minutes"));
 }
  public SpatialFilePanel(String id) {
    super(id);

    add(dialog = new GeoServerDialog("dialog"));

    Form form = new Form("form", new CompoundPropertyModel(this));
    add(form);

    fileField = new TextField("file");
    fileField.setRequired(true);
    fileField.setOutputMarkupId(true);
    form.add(fileField);
    form.add(chooserButton(form));
  }
示例#18
0
 public HTTPLayerConfig(String id, IModel<LayerInfo> model) {
   super(id, model);
   add(
       new CheckBox(
           ResourceInfo.CACHING_ENABLED,
           new MapModel(new PropertyModel(model, "resource.metadata"), "cachingEnabled")));
   TextField<Long> maxAge =
       new TextField<Long>(
           ResourceInfo.CACHE_AGE_MAX,
           new MapModel(new PropertyModel(model, "resource.metadata"), "cacheAgeMax"),
           Long.class);
   maxAge.add(NumberValidator.range(0, Long.MAX_VALUE));
   add(maxAge);
 }
示例#19
0
  public SearchBookForm(String id, String action) {
    super(id);
    this.action = action;
    setDefaultModel(new CompoundPropertyModel<SearchBookForm>(this));

    TextField<String> title = new TextField<>("title");
    title.setLabel(Model.of("Title"));
    add(title);

    TextField<String> author = new TextField<>("author");
    author.setLabel(Model.of("Author"));
    author.setRequired(false);
    add(author);

    add(new Button("searchBookSubmit"));
  }
示例#20
0
 @Override
 protected void convertInput() {
   Date date = (Date) dateField.getConvertedInput();
   if (date != null) {
     Calendar calendar = Calendar.getInstance(getLocale());
     calendar.setTime(date);
     Integer hours = (Integer) hoursField.getConvertedInput();
     Integer minutes = (Integer) minutesField.getConvertedInput();
     if (hours != null) {
       calendar.set(Calendar.HOUR_OF_DAY, hours % 12);
       calendar.set(Calendar.MINUTE, (minutes != null) ? minutes : 0);
     }
     setConvertedInput(calendar.getTime());
   } else {
     setConvertedInput(null);
   }
 }
    @Override
    protected TextField<String> newTextField(
        String id, IModel<String> valueModel, final ImportableRemoteRepo rowObject) {
      TextField<String> textField = super.newTextField(id, valueModel, rowObject);
      textField.setLabel(Model.of("Key"));
      textField.setOutputMarkupId(true);
      textField.setRequired(true);
      textField.add(new NameValidator("Invalid repository key '%s'."));
      textField.add(new XsdNCNameValidator("Invalid repository key '%s'."));
      textField.add(
          new AjaxFormComponentUpdatingBehavior("onkeyup") {
            @Override
            protected void onUpdate(AjaxRequestTarget target) {
              validateRepoKey(rowObject);
              // On each update, refresh import button to customize the warning messages of the call
              // decorator
              target.add(importButton);
            }

            @Override
            protected void onError(AjaxRequestTarget target, RuntimeException e) {
              super.onError(target, e);
              AjaxUtils.refreshFeedback();
            }

            @Override
            protected IAjaxCallDecorator getAjaxCallDecorator() {
              return new NoAjaxIndicatorDecorator();
            }
          });
      return textField;
    }
  private void createComponents() {
    managerForm =
        new Form<ManagerDTO>("managerForm", managerModel) {
          @Override
          protected void onSubmit() {
            switch (buttonAction) {
              case SUBMIT:
                info(this.getModelObject().getCandidateRestaurants());
                break;
              case ADD:
                selectorPanel.refresh(buttonAction);
                break;
            }
          }

          @Override
          public void process(IFormSubmitter submittingComponent) {
            if (submittingComponent == submitButton) {
              buttonAction = BUTTON_ACTION.SUBMIT;
            } else {
              buttonAction = BUTTON_ACTION.ADD;
            }
            super.process(submittingComponent);
          }
        };

    TextField nameField = new TextField("name");
    SimpleTextValidator generalValidator = new SimpleTextValidator("Name required");
    nameField.add(generalValidator);
    getManagerForm().add(nameField);
    TextField phoneField = new TextField("phone");
    generalValidator = new SimpleTextValidator("Phone required");
    phoneField.add(generalValidator);
    getManagerForm().add(phoneField);

    FeedbackPanel feedbackPanel = new FeedbackPanel("feedbackPanel");
    getManagerForm().add(feedbackPanel);
    submitButton = new Button("submitButton", new Model("Save Manager"));
    getManagerForm().add(submitButton);
    selectorPanel = new RestaurantSelectorPanel("selectorPanel", this);
    getManagerForm().add(selectorPanel);
    add(getManagerForm());
  } // end create components
  // Events //
  @Override
  protected void onInitialize() {
    super.onInitialize();

    this.add(JQueryWidget.newWidgetBehavior(this));

    if (this.template != null) {
      this.add(this.templateBehavior = new KendoTemplateBehavior(this.template));
    }
  }
示例#24
0
  @Test
  @SuppressWarnings("unchecked")
  public void testRenderNew() {
    PageParameters pageParameters = new PageParameters();
    tester.startPage(EditProductPage.class, pageParameters);

    tester.assertRenderedPage(EditProductPage.class);

    tester.assertNoErrorMessage();
    tester.assertComponent("productPanel:feedback", FeedbackPanel.class);
    tester.assertComponent("productPanel:productForm", Form.class);

    tester.assertComponent("productPanel:productForm:control.uuid:uuid", TextField.class);

    final TextField<String> uuidField =
        (TextField<String>)
            tester.getComponentFromLastRenderedPage("productPanel:productForm:control.uuid:uuid");
    assertTrue(uuidField.isEnabled(), "uuid should be enabled when creating a new product");
  }
示例#25
0
  public CoverageAccessPage() {
    final IModel geoServerModel = getGeoServerModel();
    final IModel coverageModel = getCoverageAccessModel();

    // form and submit
    Form form = new Form("form", new CompoundPropertyModel(coverageModel));
    add(form);
    form.add(new PoolSizeValidator());
    // All the fields
    TextField corePoolSize = new TextField("corePoolSize");
    corePoolSize.add(new MinimumValidator(1));
    form.add(corePoolSize);

    TextField maxPoolSize = new TextField("maxPoolSize");
    maxPoolSize.add(new MinimumValidator(1));
    form.add(maxPoolSize);

    TextField keepAliveTime = new TextField("keepAliveTime");
    keepAliveTime.add(new MinimumValidator(1));
    form.add(keepAliveTime);

    final DropDownChoice queueType =
        new DropDownChoice(
            "queueType",
            Arrays.asList(CoverageAccessInfo.QueueType.values()),
            new QueueTypeRenderer());
    form.add(queueType);

    TextField imageIOCacheThreshold = new TextField("imageIOCacheThreshold");
    imageIOCacheThreshold.add(new MinimumValidator(0l));
    form.add(imageIOCacheThreshold);

    Button submit =
        new Button("submit", new StringResourceModel("submit", this, null)) {
          @Override
          public void onSubmit() {
            GeoServer gs = (GeoServer) geoServerModel.getObject();
            gs.getGlobal().setCoverageAccess((CoverageAccessInfo) coverageModel.getObject());
            gs.save(gs.getGlobal());
            doReturn();
          }
        };
    form.add(submit);

    Button cancel =
        new Button("cancel") {
          @Override
          public void onSubmit() {
            doReturn();
          }
        };
    form.add(cancel);
  }
示例#26
0
    public void validate(Form<?> form) {
      // only validate on final submit
      if (form.findSubmittingButton() != form.get("submit")) {
        return;
      }

      // Getting pool components
      final Component maxPoolComponent = form.get("maxPoolSize");
      final Component corePoolComponent = form.get("corePoolSize");

      int maxPool;
      int corePool;

      // checking limits are properly set
      if (maxPoolComponent != null
          && maxPoolComponent instanceof TextField<?>
          && corePoolComponent != null
          && corePoolComponent instanceof TextField<?>) {
        final TextField maxPoolField = (TextField) maxPoolComponent;
        final TextField corePoolField = (TextField) corePoolComponent;
        final String mp = maxPoolField.getValue();
        final String cp = corePoolField.getValue();
        if (!(mp == null || cp == null || mp.trim().isEmpty() || cp.trim().isEmpty())) {
          try {
            maxPool = Integer.valueOf(mp);
          } catch (NumberFormatException nfe) {
            // The MinimumValidator(1) should already deal with that
            return;
          }

          try {
            corePool = Integer.valueOf(cp);
          } catch (NumberFormatException nfe) {
            // The MinimumValidator(1) should already deal with that
            return;
          }

          if (maxPool >= 1 && corePool >= 1 && maxPool < corePool) {
            form.error(new ParamResourceModel("poolSizeCheck", getPage()).getString());
          }
        }
      }
    }
示例#27
0
  private void setFormFieldsFromQuestion(Question question) {
    Answer.AnswerType aType = question.getAnswerType();

    questionTitleField.setModelObject(question.getTitle());
    questionPromptField.setModelObject(question.getPrompt());
    questionPrefaceField.setModelObject(question.getPreface());
    questionCitationField.setModelObject(question.getCitation());
    questionResponseTypeModel.setObject(question.getAnswerType());
    Long answerReasonId = question.getAnswerReasonExpressionId();
    questionAnswerReasonModel.setObject(
        answerReasonId == null ? answerAlways : Expressions.get(answerReasonId));
    String msg = "Asking style in setFormFields: " + askingStyleModel.getObject();
    askingStyleModel.setObject(question.getAskingStyleList());
    msg +=
        " -> "
            + askingStyleModel.getObject()
            + " (question had "
            + question.getAskingStyleList()
            + ")";
    // throw new RuntimeException(msg);
    // questionUseIfField.setModelObject(question.getUseIfExpression());
    otherSpecifyCheckBox.setModelObject(question.getOtherSpecify());
    noneButtonCheckBox.setModelObject(question.getNoneButton());
    if (aType == Answer.AnswerType.NUMERICAL) {
      numericLimitsPanel.setVisible(true);
    } else if (aType == Answer.AnswerType.MULTIPLE_SELECTION) {
      multipleSelectionLimitsPanel.setVisible(true);
      noneButtonLabel.setVisible(true);
      noneButtonCheckBox.setVisible(true);
    }
    if (aType == Answer.AnswerType.SELECTION || aType == Answer.AnswerType.MULTIPLE_SELECTION) {
      otherSpecifyLabel.setVisible(true);
      otherSpecifyCheckBox.setVisible(true);
    } else {
      otherSpecifyLabel.setVisible(false);
      otherSpecifyCheckBox.setVisible(false);
    }
    if (aType == Answer.AnswerType.DATE || aType == Answer.AnswerType.TIME_SPAN) {
      timeUnitsPanel.setVisible(true);
    } else {
      timeUnitsPanel.setVisible(false);
    }
    numericLimitsPanel.setMinLimitType(question.getMinLimitType());
    numericLimitsPanel.setMinLiteral(question.getMinLiteral());
    numericLimitsPanel.setMinPrevQues(question.getMinPrevQues());
    numericLimitsPanel.setMaxLimitType(question.getMaxLimitType());
    numericLimitsPanel.setMaxLiteral(question.getMaxLiteral());
    numericLimitsPanel.setMaxPrevQues(question.getMaxPrevQues());

    multipleSelectionLimitsPanel.setMinCheckableBoxes(question.getMinCheckableBoxes());
    multipleSelectionLimitsPanel.setMaxCheckableBoxes(question.getMaxCheckableBoxes());

    listLimitsPanel.setQuestion(question);
  }
示例#28
0
 public void addDetailFormComponents() {
   arkCrudContainerVO.getDetailPanelFormContainer().add(phoneIdTxtFld.setEnabled(false));
   arkCrudContainerVO.getDetailPanelFormContainer().add(areaCodeTxtFld);
   arkCrudContainerVO.getDetailPanelFormContainer().add(phoneNumberTxtFld);
   arkCrudContainerVO.getDetailPanelFormContainer().add(phoneTypeChoice);
   arkCrudContainerVO.getDetailPanelFormContainer().add(phoneStatusChoice);
   arkCrudContainerVO.getDetailPanelFormContainer().add(commentsTxtArea);
   arkCrudContainerVO.getDetailPanelFormContainer().add(dateReceivedDp);
   arkCrudContainerVO.getDetailPanelFormContainer().add(silentModeChoice);
   arkCrudContainerVO.getDetailPanelFormContainer().add(source);
 }
示例#29
0
  public PageInscription(PageParameters pp) {
    super(pp);
    setStatelessHint(true);
    final TextField<String> field =
        new TextField<String>("email", new PropertyModel<String>(this, "email"));
    field.add(EmailAddressValidator.getInstance());
    field.setRequired(true);

    StatelessForm<?> statelessForm =
        new StatelessForm("statelessform") {

          @Override
          protected void onSubmit() {
            serviceUser.log("Création user pour : " + field.getDefaultModelObject());
            info("Un email de validation vous a été envoyé.");
          }
        };
    statelessForm.add(field);
    add(statelessForm);
    add(new FeedbackPanel("feedback"));
  }
示例#30
0
  public void initialiseSourceForm() {

    PropertyModel<DataSourceType> pm =
        new PropertyModel<DataSourceType>(cpmModel, "dataSource.type");

    dataSourceIdTxtFld = new TextField<String>(Constants.DATA_SOURCE_ID);
    dataSourceIdTxtFld.setEnabled(false);

    dataSourceServiceTxtFld = new TextField<String>(Constants.DATA_SOURCE_MICRO_SERVICE_NAME);
    dataSourceServiceTxtFld.setEnabled(false);

    dataSourceNameTxtFld = new TextField<String>(Constants.DATA_SOURCE_NAME);
    dataSourceNameTxtFld.setEnabled(false);

    dataSourceDescTxtFld = new TextArea<String>(Constants.DATA_SOURCE_DESCRIPTION);

    dataSourcePathTxtFld = new TextField<String>(Constants.DATA_SOURCE_PATH);
    dataSourcePathTxtFld.setEnabled(false);

    dataSourceDataCenterTxtFld = new TextField<String>(Constants.DATA_SOURCE_DATA_CENTER);
    dataSourceDataCenterTxtFld.setEnabled(false);

    dataSourceTypeList = iGenomicService.listDataSourceTypes();
    initDataSourceTypesDDC(pm);

    dataSourceStatusTxtFld = new TextField<String>(Constants.DATA_SOURCE_STATUS);
    dataSourceStatusTxtFld.setEnabled(false);

    addDetailFormComponents();
  }