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

Examples of org.apache.wicket.markup.html.form.TextField


                   userService.createUser(user);
                }
                setResponsePage(ShowAllBook.class);
            }
        };
        form.add(new TextField("firstName", new PropertyModel<String>(user, "firstName")).setRequired(true));
        form.add( new TextField("lastName", new PropertyModel<String>(user, "lastName")).setRequired(true));
        form.add(new TextField("email", new PropertyModel<String>(user, "email")).setRequired(true));
        form.add(new TextField( "password", new PropertyModel<String>(user, "password")).setRequired(true));
        add(form);
    }
View Full Code Here


        DropDownChoice choiceState=new DropDownChoice("status", new PropertyModel(book, "status"), STATES);
        form.add(choiceState.setRequired(true));
        DropDownChoice choiceGenre=new DropDownChoice("genre", new PropertyModel(book, "genre"), GENRES);
        form.add(choiceGenre.setRequired(true));
       
        form.add(new TextField("title", new PropertyModel<String>(book, "title")).setRequired(true));
        form.add( new TextField("author", new PropertyModel<String>(book, "author")).setRequired(true));
        form.add(new TextField("publicationYear", new PropertyModel<String>(book, "publicationYear")).setRequired(true));
        form.add(new TextField( "publicationPlace", new PropertyModel<String>(book, "publicationPlace")).setRequired(true));
        form.add(new TextField("publisher", new PropertyModel<String>(book, "publisher")).setRequired(true));
        form.add(new TextField("ISBN", new PropertyModel<String>(book, "ISBN")).setRequired(true));

        BookmarkablePageLink books = new BookmarkablePageLink<>(
                "list", ShowAllBook.class);
        add(books);
    }
View Full Code Here

                setResponsePage(ShowAllReader.class);
            }
        };
        add(form);

        form.add(new TextField("firstName", new PropertyModel<String>(reader, "firstName")).setRequired(true));
        form.add(new TextField("surname", new PropertyModel<String>(reader, "surname")).setRequired(true));
        form.add(new TextField("birthNumber", new PropertyModel<String>(reader, "birthNumber")).setRequired(true));
        form.add(new TextField("address", new PropertyModel<String>(reader, "address")).setRequired(true));
        form.add(new TextField("email", new PropertyModel<String>(reader, "email")).setRequired(true));
        form.add(new TextField("telephoneNumber", new PropertyModel<String>(reader, "telephoneNumber")));
        form.add(new PasswordTextField("password", new PropertyModel<String>(reader, "password")));
       
        BookmarkablePageLink readers = new BookmarkablePageLink<>(
                "list", ShowAllReader.class);
        add(readers);
View Full Code Here

      {
        formSubmitted = formSubmitted | FORM;
      }
    };
    add(form);
    form.add(new TextField("txt1"));
    form.add(new TextField("txt2"));
    form.add(new AjaxFallbackButton("submit", form)
    {
      private static final long serialVersionUID = 1L;

      protected void onSubmit(AjaxRequestTarget target, Form form)
View Full Code Here

        }

        afterSubmit();
      }
    };
    form.add(new TextField("navigatorAppName"));
    form.add(new TextField("navigatorAppVersion"));
    form.add(new TextField("navigatorAppCodeName"));
    form.add(new TextField("navigatorCookieEnabled"));
    form.add(new TextField("navigatorJavaEnabled"));
    form.add(new TextField("navigatorLanguage"));
    form.add(new TextField("navigatorPlatform"));
    form.add(new TextField("navigatorUserAgent"));
    form.add(new TextField("screenWidth"));
    form.add(new TextField("screenHeight"));
    form.add(new TextField("screenColorDepth"));
    form.add(new TextField("utcOffset"));
    form.add(new TextField("utcDSTOffset"));
    form.add(new TextField("browserWidth"));
    form.add(new TextField("browserHeight"));
    add(form);
  }
View Full Code Here

  public StatelessPage()
  {
    setStatelessHint(true);
    add(new Label("message", new SessionModel()));
    add(new BookmarkablePageLink("indexLink", Index.class));
    final TextField field = new TextField("textfield", new PropertyModel(this, "number"));
    field.add(NumberValidator.maximum(20));
    field.setRequired(true);

    StatelessForm statelessForm = new StatelessForm("statelessform")
    {
      /**
       * @see org.apache.wicket.markup.html.form.Form#onSubmit()
       */
      @Override
      protected void onSubmit()
      {
        info("Submitted text: " + field.getModelObject());
      }
    };
    statelessForm.add(field);
    add(statelessForm);
    add(new FeedbackPanel("feedback"));
View Full Code Here

  public Wicket2105Panel(String id)
  {
    super(id);
    Form form = new Form("signInForm", new CompoundPropertyModel(new ValueMap()));
    form.add(new TextField("username"));
    form.add(new PasswordTextField("password"));
    form.add(new DropDownChoice("domain", Arrays.asList(new Object[] { "Wicket", "Tapestry",
        "JSF", ".Net" })));
    form.add(new CheckBox("rememberMe"));
    form.add(new WebMarkupContainer("loginZonderTokenContainer").add(new CheckBox(
View Full Code Here

    // component properly set up (getRelativePath() etc.). See setUp().
    final Page page = application.getLastRenderedPage();

    // Get the form and form component created
    final TestForm form = (TestForm)page.get("form");
    final TextField textField = (TextField)form.get("input");

    // Make sure a valid cycle is available through RequestCycle.get().
    // The RequestCycle's constructor will attach the new cycle to
    // the threadLocal retrieved by RequestCycle.get().
    // Attached to this cycle must be a valid request and response
    final WebRequestCycle cycle = application.createRequestCycle();

    // Just after init, the requests and responses cookie lists must be
    // empty
    assertNull(getRequestCookies(cycle));
    assertEquals(0, getResponseCookies(cycle).size());

    // The persister to be used for the tests
    final CookieValuePersister persister = new CookieValuePersister();

    // See comment on CookieValuePersister on how clearing a value with
    // Cookies works. As no cookies in the request, no "delete" cookie
    // will be added to the response.
    persister.clear(textField);
    assertNull(getRequestCookies(cycle));
    assertEquals(0, getResponseCookies(cycle).size());

    // Save the input field's value (add it to the response's cookie list)
    persister.save(textField);
    assertNull(getRequestCookies(cycle));
    assertEquals(1, getResponseCookies(cycle).size());
    assertEquals("test", ((Cookie)getResponseCookies(cycle).get(0)).getValue());
    assertEquals("form.input", ((Cookie)getResponseCookies(cycle).get(0)).getName());
    assertEquals("/WicketTester$DummyWebApplication",
      ((Cookie)getResponseCookies(cycle).get(0)).getPath());

    // To clear in the context of cookies means to add a special cookie
    // (maxAge=0) to the response, provided a cookie with
    // the same name has been provided in the request. Thus, no changes in
    // our test case
    persister.clear(textField);
    assertNull(getRequestCookies(cycle));
    assertEquals(1, getResponseCookies(cycle).size());
    assertEquals("test", ((Cookie)getResponseCookies(cycle).get(0)).getValue());
    assertEquals("form.input", ((Cookie)getResponseCookies(cycle).get(0)).getName());
    assertEquals("/WicketTester$DummyWebApplication",
      ((Cookie)getResponseCookies(cycle).get(0)).getPath());

    // Try to load it. Because there is no Cookie matching the textfield's name
    // it remains unchanged
    persister.load(textField);
    assertEquals("test", textField.getModelObjectAsString());

    // Simulate loading a textfield. Initialize textfield with a new
    // (default) value, copy the cookie from respone to request (simulating
    // a browser), than load the textfield from cookie and voala the
    // textfields value should change.
    // save means: add it to the respone
    // load means: take it from request
    assertEquals("test", textField.getModelObjectAsString());
    textField.setModelObject("new text");
    assertEquals("new text", textField.getModelObjectAsString());
    copyCookieFromResponseToRequest(cycle);
    assertEquals(1, getRequestCookies(cycle).length);
    assertEquals(1, getResponseCookies(cycle).size());

    persister.load(textField);
    assertEquals("test", textField.getModelObjectAsString());
    assertEquals(1, getRequestCookies(cycle).length);
    assertEquals(1, getResponseCookies(cycle).size());

    // remove all cookies from mock response
    // Because I'll find the cookie to be removed in the request, the
View Full Code Here

   *            The model
   * @return The editor
   */
  protected FormComponent newEditor(MarkupContainer parent, String componentId, IModel model)
  {
    TextField editor = new TextField(componentId, model)
    {
      private static final long serialVersionUID = 1L;

      public IConverter getConverter(Class type)
      {
        IConverter c = AjaxEditableLabel.this.getConverter(type);
        return c != null ? c : super.getConverter(type);
      }

      protected void onModelChanged()
      {
        super.onModelChanged();
        AjaxEditableLabel.this.onModelChanged();
      }

      protected void onModelChanging()
      {
        super.onModelChanging();
        AjaxEditableLabel.this.onModelChanging();
      }
    };
    editor.setOutputMarkupId(true);
    editor.setVisible(false);
    editor.add(new EditorAjaxBehavior());
    return editor;
  }
View Full Code Here

      {
        super.configure(widgetProperties);
        DateTimeField.this.configure(widgetProperties);
      }
    });
    add(hoursField = new TextField("hours", new PropertyModel(this, "hours"), Integer.class));
    hoursField.add(new HoursValidator());
    hoursField.setLabel(new Model("hours"));
    add(minutesField = new TextField("minutes", new PropertyModel(this, "minutes"),
        Integer.class)
    {
      private static final long serialVersionUID = 1L;

      public IConverter getConverter(Class type)
View Full Code Here

TOP

Related Classes of org.apache.wicket.markup.html.form.TextField

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.