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

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

Introduction

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

Prototype

public RequiredTextField(final String id, final IModel<T> model) 

Source Link

Usage

From source file:ar.edu.udc.cirtock.view.intranet.negocio.FormularioInsumo.java

License:Apache License

public FormularioInsumo(final PageParameters parameters) {

    super(parameters);

    add(new FeedbackPanel("feedbackErrors", new ExactLevelFeedbackMessageFilter(FeedbackMessage.ERROR)));
    formulario = new Form("formulario_insumo");

    nombre = new RequiredTextField<String>("nombre", new Model());

    nombre.add(new IValidator<String>() {
        @Override//  w w w.j  ava 2 s.  c  om
        public void validate(IValidatable<String> validatable) {
            String nombre = validatable.getValue().trim().toUpperCase();
            if (!nombre.matches("^[\\w\\s]{3,20}$")) {
                ValidationError error = new ValidationError();
                error.setMessage("El campo 'nombre' no es valido");
                validatable.error(error);
            }
        }

    });
    formulario.add(nombre);

    descripcion = new RequiredTextField<String>("descripcion", new Model());

    descripcion.add(new IValidator<String>() {
        @Override
        public void validate(IValidatable<String> validatable) {
            String descripcion = validatable.getValue().trim().toUpperCase();
            if (!descripcion.matches("^[A-Za-z  ]{3,50}$")) {
                ValidationError error = new ValidationError();
                error.setMessage("El campo 'descripcion' no es valido");
                validatable.error(error);
            }
        }

    });
    formulario.add(descripcion);

    cantidad = new NumberTextField<Integer>("cantidad", new Model());
    cantidad.setType(Integer.class);
    cantidad.add(new IValidator<Integer>() {
        @Override
        public void validate(IValidatable<Integer> validatable) {
            Integer cantidad = validatable.getValue();
            if (cantidad < 0) {
                ValidationError error = new ValidationError();
                error.setMessage("El campo 'cantidad' no es valido");
                validatable.error(error);
            }
        }
    });

    formulario.add(cantidad);

    formulario.add(new Button("enviar") {

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

        public void onSubmit() {
            String desc = (String) descripcion.getModelObject();
            String nomb = (String) nombre.getModelObject();
            Integer cant = cantidad.getModelObject();
            Connection conn = null;
            try {

                conn = CirtockConnection.getConection("cirtock", "cirtock", "cirtock");
                Insumo ins = new Insumo();
                ins.setDescripcion(desc);
                ins.setNombre(nomb);
                ins.setCantidad(cant);
                ins.insert("", conn);

            } catch (CirtockException e) {
                System.out.println("Error al acceder a la base de datos");
            } finally {
                try {
                    conn.close();
                } catch (SQLException e) {
                    ;
                }
            }
            setResponsePage(InsumoPage.class);
        };
    });

    add(formulario);
}

From source file:br.com.digilabs.web.page.HomePage.java

License:Apache License

public HomePage() {
    MyModal modalPanel = new MyModal("modal");
    UserForm form = new UserForm("form");
    form.add(new RequiredTextField<String>("name", new PropertyModel<String>(this, "name")));
    form.add(new BootstrapModalLink("modalLink", modalPanel));
    add(form);//ww w .jav  a  2  s  . c o  m
    add(modalPanel);

}

From source file:com.cubeia.backoffice.web.user.CreateUser.java

License:Open Source License

/**
* Constructor that is invoked when page is invoked without a session.
* 
* @param parameters//from w  ww.  j  a v  a2s  .c o  m
*            Page parameters
*/
public CreateUser(final PageParameters parameters) {
    resetFormData();

    Form<?> userForm = new Form<Void>("userForm") {
        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit() {
            CreateUserRequest createUserData = new CreateUserRequest(user, password);
            CreateUserResponse createResponse = userService.createUser(createUserData);

            if (createResponse.getStatus() != OK) {
                error("Error creating user: " + createResponse.getStatus().name());
                return;
            }

            User createdUser = createResponse.getUser();
            log.debug("created user id = " + createdUser.getUserId());
            setResponsePage(EditUser.class, params(EditUser.PARAM_USER_ID, createdUser.getUserId()));
        }
    };

    CompoundPropertyModel<CreateUser> cpm = new CompoundPropertyModel<CreateUser>(this);

    userForm.add(new RequiredTextField<String>("userName", cpm.<String>bind("user.userName")));
    userForm.add(new TextField<String>("externalUserId", cpm.<String>bind("user.externalUserId")));
    userForm.add(new RequiredTextField<Long>("operatorId", cpm.<Long>bind("user.operatorId")));

    final RequiredTextField<String> passwordField = new RequiredTextField<String>("password",
            cpm.<String>bind("password"));
    final RequiredTextField<String> passwordConfirmField = new RequiredTextField<String>("passwordConfirm",
            cpm.<String>bind("passwordConfirm"));
    userForm.add(passwordField);
    userForm.add(passwordConfirmField);
    userForm.add(new EqualPasswordInputValidator(passwordField, passwordConfirmField));

    userForm.add(new TextField<String>("firstName", cpm.<String>bind("user.userInformation.firstName")));
    userForm.add(new TextField<String>("lastName", cpm.<String>bind("user.userInformation.lastName")));
    userForm.add(new TextField<String>("email", cpm.<String>bind("user.userInformation.email"))
            .add(EmailAddressValidator.getInstance()));
    userForm.add(new TextField<String>("title", cpm.<String>bind("user.userInformation.title")));
    userForm.add(new TextField<String>("city", cpm.<String>bind("user.userInformation.city")));
    userForm.add(
            new TextField<String>("billingAddress", cpm.<String>bind("user.userInformation.billingAddress")));
    userForm.add(new TextField<String>("fax", cpm.<String>bind("user.userInformation.fax")));
    userForm.add(new TextField<String>("cellphone", cpm.<String>bind("user.userInformation.cellphone")));
    userForm.add(new DropDownChoice<String>("country", cpm.<String>bind("user.userInformation.country"),
            Arrays.asList(Locale.getISOCountries()), new IChoiceRenderer<String>() {
                private static final long serialVersionUID = 1L;

                @Override
                public String getDisplayValue(String isoCountry) {
                    return new Locale(Locale.ENGLISH.getLanguage(), (String) isoCountry)
                            .getDisplayCountry(Locale.ENGLISH);
                }

                @Override
                public String getIdValue(String isoCountry, int id) {
                    return "" + id;
                }
            }));

    userForm.add(new TextField<String>("zipcode", cpm.<String>bind("user.userInformation.zipcode")));
    userForm.add(new TextField<String>("state", cpm.<String>bind("user.userInformation.state")));
    userForm.add(new TextField<String>("phone", cpm.<String>bind("user.userInformation.phone")));
    userForm.add(new TextField<String>("workphone", cpm.<String>bind("user.userInformation.workphone")));
    userForm.add(new DropDownChoice<Gender>("gender", cpm.<Gender>bind("user.userInformation.gender"),
            Arrays.asList(Gender.values())));

    add(userForm);
    add(new FeedbackPanel("feedback"));
}

From source file:com.cubeia.backoffice.web.wallet.CreateAccount.java

License:Open Source License

/**
* Constructor that is invoked when page is invoked without a session.
* 
* @param parameters//w w  w. ja  v a2 s  . c o  m
*            Page parameters
*/
public CreateAccount(final PageParameters parameters) {
    resetFormData();
    final FeedbackPanel feedback = new FeedbackPanel("feedback");
    add(feedback);

    Form<?> accountForm = new Form<Void>("userForm") {
        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit() {
            CreateAccountRequest createAccountRequest = new CreateAccountRequest(null, account.getUserId(),
                    currency, account.getType(), info);
            createAccountRequest.setNegativeBalanceAllowed(account.getNegativeAmountAllowed());

            CreateAccountResult createResponse = null;
            try {
                createResponse = walletService.createAccount(createAccountRequest);
            } catch (Exception e) {
                log.error("Failed to create new account", e);
                feedback.error("Failed to create new account. Cause: " + e.getMessage());
                return;
            }
            log.debug("created account id = " + createResponse.getAccountId());
            feedback.info("Account created!");
        }
    };

    CompoundPropertyModel<CreateAccount> cpm = new CompoundPropertyModel<CreateAccount>(this);

    accountForm.add(new RequiredTextField<String>("userId", cpm.<String>bind("account.userId")));
    accountForm.add(new DropDownChoice<AccountType>("accountType", cpm.<AccountType>bind("account.type"),
            Arrays.asList(AccountType.values())).setRequired(true));
    accountForm
            .add(new DropDownChoice<AccountStatus>("accountStatus", cpm.<AccountStatus>bind("account.status"),
                    Arrays.asList(AccountStatus.values())).setRequired(true));
    accountForm.add(new RequiredTextField<String>("currency", cpm.<String>bind("currency")));
    accountForm.add(new TextField<String>("name", cpm.<String>bind("info.name")));
    accountForm.add(new CheckBox("negativeAmountAllowed", cpm.<Boolean>bind("account.negativeAmountAllowed")));

    add(accountForm);
}

From source file:com.cubeia.backoffice.web.wallet.CreateTransaction.java

License:Open Source License

/**
* Constructor that is invoked when page is invoked without a session.
* 
* @param parameters//from   w w w. j  a  va  2 s  .  c  o  m
*            Page parameters
*/
public CreateTransaction(final PageParameters parameters) {
    //        resetFormData();
    final FeedbackPanel feedback = new FeedbackPanel("feedback");
    add(feedback);

    @SuppressWarnings("unused")
    Form<Void> txForm = new Form<Void>("txForm") {
        private static final long serialVersionUID = 1L;

        private Long fromAccountId;
        private Long toAccountId;
        private BigDecimal amount;
        private String comment;

        @Override
        protected void onSubmit() {
            Account fromAccount = walletService.getAccountById(fromAccountId);
            Account toAccount = walletService.getAccountById(toAccountId);

            if (!fromAccount.getCurrencyCode().equals(toAccount.getCurrencyCode())) {
                feedback.error("Account currencies doesn't match.");
                return;
            }

            String currencyCode = fromAccount.getCurrencyCode();
            Currency currency = walletService.getCurrency(currencyCode);

            TransactionRequest tx = new TransactionRequest();
            tx.setComment(getComment());

            TransactionEntry fromEntry = new TransactionEntry(fromAccountId,
                    new Money(currencyCode, currency.getFractionalDigits(), getAmount().negate()));
            TransactionEntry toEntry = new TransactionEntry(toAccountId,
                    new Money(currencyCode, currency.getFractionalDigits(), getAmount()));
            tx.setEntries(Arrays.asList(fromEntry, toEntry));

            log.debug("transaction request: {}", tx);

            TransactionResult txResponse = walletService.doTransaction(tx);
            log.debug("created transaction: {}", txResponse);

            feedback.info("created transaction: " + txResponse.getTransactionId());
        }

        public Long getFromAccountId() {
            return fromAccountId;
        }

        public void setFromAccountId(Long fromAccountId) {
            this.fromAccountId = fromAccountId;
        }

        public Long getToAccountId() {
            return toAccountId;
        }

        public void setToAccountId(Long toAccountId) {
            this.toAccountId = toAccountId;
        }

        public BigDecimal getAmount() {
            return amount;
        }

        public void setAmount(BigDecimal amount) {
            this.amount = amount;
        }

        public String getComment() {
            return comment;
        }

        public void setComment(String comment) {
            this.comment = comment;
        }
    };

    CompoundPropertyModel<Form<Void>> txFormModel = new CompoundPropertyModel<Form<Void>>(txForm);

    Label fromAccountInfoLabel = new Label("fromAccountInfo", new Model<String>());
    fromAccountInfoLabel.setOutputMarkupId(true);
    txForm.add(fromAccountInfoLabel);

    Label toAccountInfoLabel = new Label("toAccountInfo", new Model<String>());
    toAccountInfoLabel.setOutputMarkupId(true);
    txForm.add(toAccountInfoLabel);

    RequiredTextField<Long> fromAccountIdField = new RequiredTextField<Long>("fromAccountIdField",
            txFormModel.<Long>bind("fromAccountId"));
    fromAccountIdField.add(new AccountInfoLoader(fromAccountInfoLabel, fromAccountIdField));
    txForm.add(fromAccountIdField);

    RequiredTextField<Long> toAccountIdField = new RequiredTextField<Long>("toAccountIdField",
            txFormModel.<Long>bind("toAccountId"));
    toAccountIdField.add(new AccountInfoLoader(toAccountInfoLabel, toAccountIdField));
    txForm.add(toAccountIdField);

    txForm.add(new RequiredTextField<BigDecimal>("amountField", txFormModel.<BigDecimal>bind("amount")));

    txForm.add(new TextField<String>("commentField", txFormModel.<String>bind("comment")));

    add(txForm);
}

From source file:com.cubeia.backoffice.web.wallet.EditCurrencies.java

License:Open Source License

/**
* Constructor that is invoked when page is invoked without a session.
*
*//*from ww  w. jav  a2  s  .c om*/
@SuppressWarnings("serial")
public EditCurrencies() {
    add(new FeedbackPanel("feedback", new ComponentFeedbackMessageFilter(EditCurrencies.this)));

    IModel<List<Currency>> currencyModel = new LoadableDetachableModel<List<Currency>>() {
        @Override
        protected List<Currency> load() {
            CurrencyListResult supportedCurrencies = walletService.getSupportedCurrencies();

            if (supportedCurrencies == null) {
                return Collections.<Currency>emptyList();
            }

            ArrayList<Currency> curs = new ArrayList<Currency>(supportedCurrencies.getCurrencies());
            log.debug("got currencies: {}", curs);
            Collections.sort(curs, new Comparator<Currency>() {
                @Override
                public int compare(Currency o1, Currency o2) {
                    return o1.getCode().compareTo(o2.getCode());
                }
            });
            return curs;
        }
    };

    add(new ListView<Currency>("currencies", currencyModel) {
        @Override
        protected void populateItem(ListItem<Currency> item) {
            final Currency c = item.getModelObject();
            item.add(new Label("code", Model.of(c.getCode())));
            item.add(new Label("digits", Model.of(c.getFractionalDigits())));

            item.add(new Link<String>("removeLink") {
                @Override
                public void onClick() {
                    log.debug("removing currency: {}", c);
                    walletService.removeCurrency(c.getCode());
                }
            }.add(new ConfirmOnclickAttributeModifier("Really remove this currency?")));
        }
    });

    final CompoundPropertyModel<Currency> newCurrencyModel = new CompoundPropertyModel<Currency>(
            new Currency(null, 2));

    Form<Currency> addForm = new Form<Currency>("addForm", newCurrencyModel) {
        @Override
        protected void onSubmit() {
            Currency cur = getModelObject();
            log.debug("submit: {}", cur);

            try {
                walletService.addCurrency(cur);
            } catch (Exception e) {
                error("Error creating currency: " + e.getMessage());
                return;
            }

            info("Added currency " + cur.getCode() + " with " + cur.getFractionalDigits()
                    + " fractional digits");
            newCurrencyModel.setObject(new Currency(null, 2));
        }
    };

    addForm.add(new RequiredTextField<String>("code", newCurrencyModel.<String>bind("code"))
            .add(StringValidator.exactLength(3)));
    addForm.add(new RequiredTextField<Integer>("digits", newCurrencyModel.<Integer>bind("fractionalDigits"))
            .add(new RangeValidator<Integer>(0, 8)));
    addForm.add(new FeedbackPanel("feedback", new ContainerFeedbackMessageFilter(addForm)));
    addForm.add(new WebMarkupContainer("submitButton")
            .add(new ConfirmOnclickAttributeModifier("Are you sure you want to add this currency?")));
    add(addForm);
}

From source file:com.cubeia.games.poker.admin.wicket.pages.system.BroadcastMessage.java

License:Open Source License

@SuppressWarnings("rawtypes")
public BroadcastMessage(PageParameters p) {
    super(p);/*from  ww  w  . j a va2  s  .co m*/
    FirebaseJMXFactory jmxFactory = new FirebaseJMXFactory();
    mbeanProxy = jmxFactory.createClientRegistryProxy();
    // Send message form
    Form broadcastForm = new Form("broadcastForm") {
        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit() {
            sendSystemMessage(message);
            info("Message \"" + message + "\" sent.");
        }
    };

    broadcastForm.add(new RequiredTextField<String>("message", new PropertyModel<String>(this, "message")));
    add(broadcastForm);
    add(new FeedbackPanel("feedback"));
}

From source file:com.cubeia.games.poker.admin.wicket.pages.tournaments.configuration.TournamentConfigurationPanel.java

License:Open Source License

@SuppressWarnings({ "unchecked", "rawtypes" })
public TournamentConfigurationPanel(String id, Form<?> form,
        PropertyModel<TournamentConfiguration> propertyModel, boolean sitAndGo) {
    super(id, propertyModel);
    this.model = propertyModel;
    add(new RequiredTextField<String>("name", new PropertyModel(model, "name")));
    add(new RequiredTextField<Integer>("seatsPerTable", new PropertyModel(model, "seatsPerTable")));
    DropDownChoice<TimingProfile> timing = new DropDownChoice<TimingProfile>("timingType", model("timingType"),
            adminDAO.getTimingProfiles(), renderer("name"));
    timing.setRequired(true);/*from w w  w  . java2s  .c  o m*/
    add(timing);
    TextField<Integer> minPlayers = new TextField<Integer>("minPlayers",
            new PropertyModel(model, "minPlayers"));
    minPlayers.add(RangeValidator.minimum(2));
    add(minPlayers);
    TextField<Integer> maxPlayers = new TextField<Integer>("maxPlayers",
            new PropertyModel(model, "maxPlayers"));
    maxPlayers.add(RangeValidator.minimum(2));
    add(maxPlayers);
    add(new RequiredTextField<BigDecimal>("buyIn", new PropertyModel(model, "buyIn")));
    add(new RequiredTextField<BigDecimal>("fee", new PropertyModel(model, "fee")));
    add(new RequiredTextField<BigDecimal>("guaranteedPrizePool",
            new PropertyModel(model, "guaranteedPrizePool")));
    add(new CheckBox("payoutAsBonus", new PropertyModel(model, "payOutAsBonus")));
    add(new RequiredTextField<BigDecimal>("startingChips", new PropertyModel(model, "startingChips")));
    DropDownChoice<BetStrategyType> strategy = new DropDownChoice<BetStrategyType>("betStrategy",
            new PropertyModel(model, "betStrategy"), asList(BetStrategyType.values()), renderer("name"));
    strategy.setRequired(true);
    add(strategy);

    DropDownChoice<PokerVariant> variant = new DropDownChoice<PokerVariant>("variant",
            new PropertyModel(model, "variant"), asList(PokerVariant.values()), renderer("name"));
    variant.setRequired(true);
    add(variant);
    form.add(new TournamentPlayersValidator(minPlayers, maxPlayers));

    final List<OperatorDTO> operators = networkClient.getOperators();

    add(new ListMultipleChoice<Long>("operatorIds", model("operatorIds"), getOperatorIds(operators),
            new IChoiceRenderer<Long>() {

                @Override
                public Object getDisplayValue(Long id) {
                    return getOperatorName(operators, id);
                }

                @Override
                public String getIdValue(Long object, int index) {
                    return object.toString();
                }
            }));
    TextField<String> userRule = new TextField<String>("userRuleExpression",
            new PropertyModel(model, "userRuleExpression"));
    add(userRule);

    DropDownChoice<String> currency = new DropDownChoice<String>("currency", model("currency"),
            networkClient.getCurrencies(), new ChoiceRenderer<String>());
    currency.setRequired(true);
    add(currency);
    DropDownChoice<BlindsStructure> blindsStructure = new DropDownChoice<BlindsStructure>("blindsStructure",
            model("blindsStructure"), adminDAO.getBlindsStructures(), renderer("name"));
    blindsStructure.setRequired(true);
    add(blindsStructure);
    DropDownChoice<PayoutStructure> payoutStructure = new DropDownChoice<PayoutStructure>("payoutStructure",
            model("payoutStructure"), adminDAO.getPayoutStructures(), renderer("name"));
    payoutStructure.setRequired(true);
    add(payoutStructure);

    if (sitAndGo) {
        maxPlayers.setVisible(false);
    }

    TextArea<String> description = new TextArea<String>("description", new PropertyModel(model, "description"));
    description.add(StringValidator.maximumLength(1000));
    add(description);
}

From source file:com.cubeia.games.poker.admin.wicket.pages.tournaments.scheduled.EditTournament.java

License:Open Source License

@SuppressWarnings({ "unchecked", "rawtypes" })
public EditTournament(final PageParameters parameters) {
    super(parameters);
    final Integer tournamentId = parameters.get(PARAM_TOURNAMENT_ID).toOptionalInteger();

    newTournament = tournamentId == null;

    if (newTournament) {
        tournament = new ScheduledTournamentConfiguration();
        tournament.setSchedule(new TournamentSchedule(new Date(), new Date(), "", 0, 0, 0));
    } else {//  w w w.  j a  v a  2s .  c o m
        tournament = adminDAO.getItem(ScheduledTournamentConfiguration.class, tournamentId);
    }

    tournamentForm = new Form<ScheduledTournamentConfiguration>("tournamentForm",
            new CompoundPropertyModel<ScheduledTournamentConfiguration>(tournament)) {
        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit() {
            log.debug("submit");
            ScheduledTournamentConfiguration configuration = getModel().getObject();
            TournamentConfiguration tournamentConfiguration = configuration.getConfiguration();
            PokerVariant variant = tournamentConfiguration.getVariant();
            if (variant == PokerVariant.SEVEN_CARD_STUD && tournamentConfiguration.getSeatsPerTable() > 7) {
                error("Maximum number of seats per table for 7 card stud is 7");
                return;
            }
            ScheduledTournamentConfiguration savedTournamentConfig = adminDAO.merge(configuration);
            info("Tournament updated, id = " + tournamentId);

            if (newTournament) {
                setResponsePage(new EditTournament(
                        new PageParameters().add(PARAM_TOURNAMENT_ID, savedTournamentConfig.getId())));
            }
        }
    };

    configPanel = new TournamentConfigurationPanel("configuration", tournamentForm,
            new PropertyModel<TournamentConfiguration>(tournament, "configuration"), false);
    tournamentForm.add(configPanel);
    tournamentForm.add(new DateField("startDate", new PropertyModel(this, "tournament.schedule.startDate")));
    tournamentForm.add(new DateField("endDate", new PropertyModel(this, "tournament.schedule.endDate")));
    tournamentForm
            .add(new RequiredTextField("schedule", new PropertyModel(this, "tournament.schedule.cronSchedule"))
                    .add(new CronExpressionValidator()));
    tournamentForm.add(new TextField<Integer>("minutesInAnnounced",
            new PropertyModel(this, "tournament.schedule.minutesInAnnounced")));
    tournamentForm.add(new TextField<Integer>("minutesInRegistering",
            new PropertyModel(this, "tournament.schedule.minutesInRegistering")));
    tournamentForm.add(new TextField<Integer>("minutesVisibleAfterFinished",
            new PropertyModel(this, "tournament.schedule.minutesVisibleAfterFinished")));

    addRebuyPanel(tournamentForm);

    add(new FeedbackPanel("feedback"));
    add(tournamentForm);
}

From source file:com.cubeia.games.poker.admin.wicket.pages.user.CreateUser.java

License:Open Source License

/**
* Constructor that is invoked when page is invoked without a session.
* 
* @param parameters/*w  w w  .j  av a  2  s .com*/
*            Page parameters
*/
public CreateUser(final PageParameters parameters) {
    super(parameters);
    resetFormData();

    Form<?> userForm = new Form<Void>("userForm") {
        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit() {
            CreateUserRequest createUserData = new CreateUserRequest(user, password);
            CreateUserResponse createResponse = userService.createUser(createUserData);

            if (createResponse.getStatus() != OK) {
                error("Error creating user: " + createResponse.getStatus().name());
                return;
            }

            User createdUser = createResponse.getUser();
            log.debug("created user id = " + createdUser.getUserId());
            setResponsePage(EditUser.class, params(EditUser.PARAM_USER_ID, createdUser.getUserId()));
        }
    };

    CompoundPropertyModel<CreateUser> cpm = new CompoundPropertyModel<CreateUser>(this);

    userForm.add(new RequiredTextField<String>("userName", cpm.<String>bind("user.userName")));
    userForm.add(new TextField<String>("externalUserId", cpm.<String>bind("user.externalUserId")));
    userForm.add(new RequiredTextField<Long>("operatorId", cpm.<Long>bind("user.operatorId")));

    final RequiredTextField<String> passwordField = new RequiredTextField<String>("password",
            cpm.<String>bind("password"));
    final RequiredTextField<String> passwordConfirmField = new RequiredTextField<String>("passwordConfirm",
            cpm.<String>bind("passwordConfirm"));
    userForm.add(passwordField);
    userForm.add(passwordConfirmField);
    userForm.add(new EqualPasswordInputValidator(passwordField, passwordConfirmField));

    userForm.add(new TextField<String>("firstName", cpm.<String>bind("user.userInformation.firstName")));
    userForm.add(new TextField<String>("lastName", cpm.<String>bind("user.userInformation.lastName")));
    userForm.add(new TextField<String>("email", cpm.<String>bind("user.userInformation.email"))
            .add(EmailAddressValidator.getInstance()));
    userForm.add(new TextField<String>("title", cpm.<String>bind("user.userInformation.title")));
    userForm.add(new TextField<String>("city", cpm.<String>bind("user.userInformation.city")));
    userForm.add(
            new TextField<String>("billingAddress", cpm.<String>bind("user.userInformation.billingAddress")));
    userForm.add(new TextField<String>("fax", cpm.<String>bind("user.userInformation.fax")));
    userForm.add(new TextField<String>("cellphone", cpm.<String>bind("user.userInformation.cellphone")));
    userForm.add(new DropDownChoice<String>("country", cpm.<String>bind("user.userInformation.country"),
            Arrays.asList(Locale.getISOCountries()), new IChoiceRenderer<String>() {
                private static final long serialVersionUID = 1L;

                @Override
                public String getDisplayValue(String isoCountry) {
                    return new Locale(Locale.ENGLISH.getLanguage(), (String) isoCountry)
                            .getDisplayCountry(Locale.ENGLISH);
                }

                @Override
                public String getIdValue(String isoCountry, int id) {
                    return "" + id;
                }
            }));

    userForm.add(new TextField<String>("zipcode", cpm.<String>bind("user.userInformation.zipcode")));
    userForm.add(new TextField<String>("state", cpm.<String>bind("user.userInformation.state")));
    userForm.add(new TextField<String>("phone", cpm.<String>bind("user.userInformation.phone")));
    userForm.add(new TextField<String>("workphone", cpm.<String>bind("user.userInformation.workphone")));
    userForm.add(new DropDownChoice<Gender>("gender", cpm.<Gender>bind("user.userInformation.gender"),
            Arrays.asList(Gender.values())));

    add(userForm);
    add(new FeedbackPanel("feedback"));
}