Example usage for org.apache.wicket.markup.html.form EmailTextField EmailTextField

List of usage examples for org.apache.wicket.markup.html.form EmailTextField EmailTextField

Introduction

In this page you can find the example usage for org.apache.wicket.markup.html.form EmailTextField EmailTextField.

Prototype

public EmailTextField(String id, IModel<String> model) 

Source Link

Document

Construct.

Usage

From source file:ch.bd.qv.quiz.panels.DataPanel.java

License:Apache License

public DataPanel(String id) {
    super(id, new CompoundPropertyModel<>(new Person()));
    final EmailTextField email = new EmailTextField("email", new Model());
    email.setRequired(true);//from ww  w .j a  va  2 s  .  co  m
    email.add(new AjaxFormComponentUpdatingBehavior("onchange") {
        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            Person p = personBean.getPersonByEmail(email.getDefaultModelObjectAsString());
            if (p != null) {
                LOGGER.debug("person found: " + p.getEmail() + " replacing model ");
                setDefaultModelObject(p);
                target.add(findParent(BasePanel.class));
            }
            ((Person) getDefaultModelObject()).setEmail(email.getModelObject());
        }
    });
    add(new FcBorder("emailcont", email));

    add(new FcBorder("namecont", new TextField<String>("name").setRequired(true)));
    add(new FcBorder("vornamecont", new TextField("vorname").setRequired(true)));
    add(new FcBorder("firmacont", new TextField("firma").setRequired(true)));
    add(new FcBorder("telcont", new TextField("tel")));

}

From source file:com.alfredmuponda.lostandfound.pages.LostReportForm.java

public LostReportForm() {
    itemTypes = Arrays.asList("Wallet", "National ID", "Drivers Licence", "Passport");
    lf_items = new ArrayList();
    contactInfo = new ContactInformation();
    item = new Item();

    Form form = new Form("form");
    add(new HeaderPanel("headerpanel"));
    add(form);//from w  ww .  j ava2s .  c  o m

    firstNameField = new TextField("firstname", new PropertyModel(contactInfo, "firstName"));
    surnameField = new TextField("surname", new PropertyModel(contactInfo, "surname"));
    addressField = new TextField("address", new PropertyModel(contactInfo, "address"));
    phoneNumberField = new TextField("phonenumber", new PropertyModel(contactInfo, "phoneNumber"));
    emailAddressField = new EmailTextField("emailaddress", new PropertyModel(contactInfo, "emailAddress"));

    dateField = new TextField("date", new PropertyModel(item, "dateLorF"));
    itemTypeField = new DropDownChoice("itemtype", new PropertyModel(item, "itemType"), itemTypes);
    itemIDField = new TextField("itemid", new PropertyModel(item, "itemID"));
    locationField = new TextArea("location", new PropertyModel(item, "location"));
    descriptionField = new TextArea("description", new PropertyModel(item, "description"));

    //Add validators for user input
    firstNameField.setRequired(true);
    surnameField.setRequired(true);
    addressField.setRequired(true);
    phoneNumberField.setRequired(true).add(new PhoneNumberValidator());
    dateField.setRequired(true);
    itemTypeField.setRequired(true);
    itemIDField.add(new ItemNumberValidator(itemTypeField));
    locationField.setRequired(true);
    descriptionField.setRequired(true);
    emailAddressField.add(EmailAddressValidator.getInstance());

    form.add(new FeedbackPanel("feedback"));

    form.add(firstNameField);
    form.add(surnameField);
    form.add(addressField);
    form.add(phoneNumberField);
    form.add(emailAddressField);
    form.add(dateField);
    form.add(itemTypeField);
    form.add(itemIDField);
    form.add(locationField);
    form.add(descriptionField);

    form.add(new Button("submit") {
        @Override
        public void onSubmit() {
            getInfoInForm();
            //JDBC persistence
            /*
            uuid = UUID.randomUUID().toString();
            db = new ReadWriteDatabase(contactInfo, lf_items);
            db.addItemData(uuid);
            lf_items.clear(); 
             */

            //HIBERNATE persistance*
            persist();
            lf_items.clear();

            clear();
        }
    });
    form.add(new Button("addItem") {
        @Override
        public void onSubmit() {
            getInfoInForm();
            check();
            partialClear();
        }
    });
    form.add(new Link("clear") {
        @Override
        public void onClick() {
            clear();
        }
    });
    form.add(new Link("cancel") {
        @Override
        public void onClick() {
            setResponsePage(HomePage.class);
        }
    });
    form.add(new Link("policereport") {
        @Override
        public void onClick() {
            PoliceReport report = new PoliceReport();
            report.generatePoliceReport(uuid);
            setResponsePage(HomePage.class);
        }
    });
}

From source file:de.alpharogroup.wicket.components.factory.ComponentFactory.java

License:Apache License

/**
 * Factory method for create a new {@link EmailTextField}.
 *
 * @param id//from ww w  .j  a v  a2  s.  c  o m
 *            the id
 * @param model
 *            the model
 * @return the new {@link EmailTextField}.
 */
public static EmailTextField newEmailTextField(final String id, final IModel<String> model) {
    final EmailTextField emailTextField = new EmailTextField(id, model);
    emailTextField.setOutputMarkupId(true);
    return emailTextField;
}

From source file:de.alpharogroup.wicket.components.sign.in.password.forgotten.AbstractPasswordForgottenPanel.java

License:Apache License

/**
 * Factory method for creating the EmailTextField for the email. This method is invoked in the
 * constructor from the derived classes and can be overridden so users can provide their own
 * version of a EmailTextField for the email.
 *
 * @param id//from   w  w w.j a va  2  s  . co m
 *            the id
 * @param model
 *            the model
 * @return the text field
 */
protected Component newEmailTextField(final String id, final IModel<PasswordForgottenModelBean> model) {
    final IModel<String> labelModel = ResourceModelFactory.newResourceModel("password.forgotten.content.label",
            this, "Give email in the Textfield");
    final IModel<String> placeholderModel = ResourceModelFactory
            .newResourceModel("global.enter.your.email.label", this, "Enter your email here");
    final LabeledEmailTextFieldPanel<String, PasswordForgottenModelBean> emailTextField = new LabeledEmailTextFieldPanel<String, PasswordForgottenModelBean>(
            id, model, labelModel) {

        /**
         * The serialVersionUID.
         */
        private static final long serialVersionUID = 1L;

        /**
         * {@inheritDoc}
         */
        @Override
        protected EmailTextField newEmailTextField(final String id,
                final IModel<PasswordForgottenModelBean> model) {
            final EmailTextField emailTextField = new EmailTextField(id, new PropertyModel<>(model, "email"));
            emailTextField.setOutputMarkupId(true);
            emailTextField.setRequired(true);
            if (placeholderModel != null) {
                emailTextField.add(new AttributeAppender("placeholder", placeholderModel));
            }
            return emailTextField;
        }
    };
    return emailTextField;
}

From source file:example.UserProfilePanel.java

License:Apache License

private Form<Void> UserProfile() {
    final TextField name = new TextField("name", Model.of("Joe Blogs"));
    final EmailTextField email = new EmailTextField("email", Model.of("joe@example.com"));
    Form<Void> form = new BootstrapForm<Void>("form");
    form.add(new FormBehavior().type(FormType.Horizontal));

    FormGroup formGroupInfo = new FormGroup("formGroupInfo", Model.of("Name"));
    formGroupInfo.add(name);// w w w  . j a v a  2s .  c  o  m
    formGroupInfo.add(email);
    form.add(formGroupInfo);

    FormGroup formGroupEmail = new FormGroup("formGroupEmail", Model.of("Email Address"));
    formGroupEmail.add(email);
    form.add(formGroupEmail);

    FormGroup formGrouButton = new FormGroup("formGroupButton");
    BootstrapButton submitButton = new BootstrapButton("submit-button", Buttons.Type.Default);
    submitButton.setLabel(Model.of("Submit"));
    formGrouButton.add(submitButton);
    form.add(formGrouButton);

    return form;
}

From source file:fiftyfive.wicket.shiro.markup.LoginForm.java

License:Apache License

/**
 * Creates a login form that does not have a {@code rememberme} checkbox.
 *//*from w ww.  j av a2  s  . c o m*/
public LoginForm(String id) {
    super(id);
    add(new EmailTextField("email", new Model<String>()).setRequired(true));
    add(new PasswordTextField("password", new Model<String>()));
}

From source file:name.martingeisse.wicket.component.stdform.StandardFormPanel.java

License:Open Source License

/**
 * Adds an email text field using the specified model.
 * @param label the label for the text field
 * @param model the model/*  ww  w.  j  ava 2 s .c  om*/
 * @return a configurator that can be used to further configure the added components
 */
public final SingleFormComponentElementConfigurator addEmailTextField(final String label,
        final IModel<String> model) {
    final EmailTextField textField = new EmailTextField("textField", model);
    final Fragment wrapperFragment = addFormControl(label,
            new Fragment(FORM_CONTROL_ID, "emailTextFieldFragment", this).add(textField), textField, textField);
    return new SingleFormComponentElementConfigurator(wrapperFragment, textField);
}