Package org.apache.wicket.markup.html.form

Examples of org.apache.wicket.markup.html.form.FormComponent$MessageSource


   */
  public void setFile(final String formComponentId, final File file, final String contentType)
  {
    checkClosed();

    FormComponent formComponent = (FormComponent)workingForm.get(formComponentId);

    if (formComponent instanceof FileUploadField == false)
    {
      throw new IllegalArgumentException("'" + formComponentId + "' is not " +
        "a FileUploadField. You can only attach a file to form " +
        "component of this type.");
    }

    MockHttpServletRequest servletRequest = baseWicketTester.getServletRequest();
    servletRequest.addFile(formComponent.getInputName(), file, contentType);
  }
View Full Code Here


    Bean bean=new Bean();
    Form<Bean> form = new Form<Bean>("form", new CompoundPropertyModel<Bean>(bean));
    add(form);
    form.setOutputMarkupId(true);

    FormComponent fc;

    // add form components to the form as usual

    fc = new RequiredTextField<String>("name");
    fc.add(StringValidator.minimumLength(4));
    fc.setLabel(new ResourceModel("label.name"));

    form.add(fc);
    form.add(new SimpleFormComponentLabel("name-label", fc));

    fc = new RequiredTextField<String>("email");
    fc.add(EmailAddressValidator.getInstance());
    fc.setLabel(new ResourceModel("label.email"));

    form.add(fc);
    form.add(new SimpleFormComponentLabel("email-label", fc));

    // attach an ajax validation behavior to all form component's onkeydown
View Full Code Here

    addOption("indicator", indicator.getMarkupId());
  }

  @Override
  protected void respond(AjaxRequestTarget target) {
    FormComponent formComponent = (FormComponent)getComponent();

    formComponent.validate();
    if (formComponent.isValid())
    {
      formComponent.updateModel();
    }
    String input = formComponent.getValue();
    RequestCycle.get().setRequestTarget(new StringRequestTarget(formatResultsAsUnorderedList(getResults(input))));
  }
View Full Code Here

  {
    private static final long serialVersionUID = 1L;

    @Override
    protected void respond(AjaxRequestTarget target) {
      FormComponent formComponent = (FormComponent)getComponent();
      formComponent.validate();
      if (formComponent.isValid())
      {
        formComponent.updateModel();
      }
      RequestCycle.get().setRequestTarget(new StringRequestTarget(getDisplayValue()));
    }
View Full Code Here

   * (org.apache.wicket.markup.html.form.IFormVisitorParticipant)
   */
  @SuppressWarnings("unchecked")
  public Object formComponent(IFormVisitorParticipant formComponent) {
    if (FormComponent.class.isAssignableFrom(formComponent.getClass())) {
      FormComponent component = (FormComponent) formComponent;

      if (component.isRequired()) {
        buffer.append(messageBuilder.requiredMessage(component));
      }

      // Add a Yav rule for some converters (type validation instead of
      // value validation), one type per field
      addYavRuleOnConverter(component);

      // Iterate over all the validators and add a Yav Rule
      List<IValidator> validators = component.getValidators();
      for (IValidator validator : validators) {
        addYavRuleOnValidator(validator, component);
      }
     
      // Check if this form component is included in a FormValidator
View Full Code Here

  @SuppressWarnings("unchecked")
  private void verifyExistingValidatorOnComponent(FormComponent formComponent) {
    for (IFormValidator formValidator : this.formValidators) {
      if (EqualInputValidator.class.isAssignableFrom(formValidator.getClass())) {
        FormComponent[] dependentFormComponents = formValidator.getDependentFormComponents();
        final FormComponent formComponent1 = dependentFormComponents[0];
        final FormComponent formComponent2 = dependentFormComponents[1];

        if (formComponent2.equals(formComponent)) {         
          buffer.append(messageBuilder.equalFieldMessage(formComponent1, formComponent2));
        }
      }
    }
  }
View Full Code Here

        .add(EmailAddressValidator.getInstance()));

    form.add(new RequiredTextField("pattern", new Model())
        .add(new PatternValidator(".*\\.com")));

    FormComponent formComponent1 = new RequiredTextField("dateOfBirth1");
    FormComponent formComponent2 = new RequiredTextField("dateOfBirth2");
    form.add(formComponent1);
    form.add(formComponent2);
    form.add(new EqualInputValidator(formComponent1, formComponent2));

    form.add(new RequiredTextField("rangeLong", Long.class)
View Full Code Here

                Parameter p = pv.getParameter();
                item.add(new Label("param", buildParamSpec(p)));
                item.add(new Label("paramDescription", p.description.toString(Locale.ENGLISH)));
                if (!pv.isComplex() && !pv.isCoordinateReferenceSystem() && !pv.isBoundingBox()) {
                    Fragment f = new Fragment("paramValue", "literal", WPSRequestBuilderPanel.this);
                    FormComponent literal = new TextField("literalValue", new PropertyModel(pv,
                            "values[0].value"));
                    literal.setRequired(p.minOccurs > 0);
                    literal.setLabel(new Model(p.key));
                    f.add(literal);
                    item.add(f);
                } else if (pv.isBoundingBox()) {
                    EnvelopePanel envelope = new EnvelopePanel("paramValue", new PropertyModel(pv,
                            "values[0].value"));
View Full Code Here

    private FormComponent addRasterTable(final CoverageStoreInfo storeInfo, final IModel paramsModel) {

        final String resourceKey = RESOURCE_KEY_PREFIX + "." + TABLE_NAME;

        boolean isNew = storeInfo.getId() == null;
        FormComponent tableComponent = addTableNameComponent(paramsModel, isNew);
        return tableComponent;
    }
View Full Code Here

     * @return a combobox set up to display the list of available raster tables if the StoreInfo is
     *         new, or a non editable text box if we're editing an existing StoreInfo
     */
    private FormComponent addTableNameComponent(final IModel paramsModel, final boolean isNew) {

        final FormComponent tableNameComponent;
        final String panelId = "tableNamePanel";

        if (isNew) {
            RasterTableSelectionPanel selectionPanel;
            selectionPanel = new RasterTableSelectionPanel(panelId, paramsModel, storeEditForm,
                    server, port, instance, user, password);
            add(selectionPanel);

            DropDownChoice tableDropDown = selectionPanel.getFormComponent();
            tableNameComponent = tableDropDown;
        } else {
            /*
             * We're editing an existing store. Don't allow to change the table name, it could be
             * catastrophic for the Catalog/ResourcePool as ability to get to the coverage is really
             * based on the Store's URL and the CoverageInfo is tied to it
             */
            final IModel paramValue = new MapModel(paramsModel, TABLE_NAME);
            final String resourceKey = RESOURCE_KEY_PREFIX + "." + TABLE_NAME;
            final IModel paramLabelModel = new ResourceModel(resourceKey, TABLE_NAME);
            final boolean required = true;
            TextParamPanel tableNamePanel;
            tableNamePanel = new TextParamPanel(panelId, paramValue, paramLabelModel, required);
            add(tableNamePanel);

            tableNameComponent = tableNamePanel.getFormComponent();
            tableNameComponent.setEnabled(false);

            final String titleKey = resourceKey + ".title";
            ResourceModel titleModel = new ResourceModel(titleKey);
            String title = String.valueOf(titleModel.getObject());

View Full Code Here

TOP

Related Classes of org.apache.wicket.markup.html.form.FormComponent$MessageSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.