Example usage for org.apache.wicket.markup.html.form Form getString

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

Introduction

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

Prototype

public final String getString(final String key) 

Source Link

Usage

From source file:com.evolveum.midpoint.web.util.DateValidator.java

License:Apache License

@Override
public void validate(Form<?> form) {
    if (dateFrom == null || dateTo == null) {
        return;/*from   w  w w  .  ja  v  a 2  s.co m*/
    }

    Date from = dateFrom.getConvertedInput();
    Date to = dateTo.getConvertedInput();

    if (from == null || to == null) {
        return;
    }

    if (from.after(to)) {
        form.error(form.getString(getMessageKey()));
    }
}

From source file:org.projectforge.web.user.UserEditForm.java

License:Open Source License

@SuppressWarnings("serial")
public static void createAuthenticationToken(final GridBuilder gridBuilder, final PFUserDO user,
        final UserDao userDao, final Form<?> form) {
    // Authentication token
    final FieldsetPanel fs = gridBuilder.newFieldset(gridBuilder.getString("user.authenticationToken"))
            .supressLabelForWarning();/* w ww. j  ava 2  s  .  c  om*/
    fs.add(new DivTextPanel(fs.newChildId(), new Model<String>() {
        @Override
        public String getObject() {
            if (PFUserContext.getUserId().equals(user.getId()) == true) {
                return userDao.getAuthenticationToken(user.getId());
            } else {
                // Administrators shouldn't see the token.
                return "*****";
            }
        }
    }));
    fs.addHelpIcon(gridBuilder.getString("user.authenticationToken.tooltip"));
    final Button button = new Button(SingleButtonPanel.WICKET_ID, new Model<String>("renewAuthenticationKey")) {
        @Override
        public final void onSubmit() {
            userDao.renewAuthenticationToken(user.getId());
            form.error(getString("user.authenticationToken.renew.successful"));
        }
    };
    button.add(WicketUtils
            .javaScriptConfirmDialogOnClick(form.getString("user.authenticationToken.renew.securityQuestion")));
    fs.add(new SingleButtonPanel(fs.newChildId(), button,
            gridBuilder.getString("user.authenticationToken.renew"), SingleButtonPanel.RED));
    WicketUtils.addTooltip(button, gridBuilder.getString("user.authenticationToken.renew.tooltip"));
}