Example usage for org.apache.wicket.util.lang Args notEmpty

List of usage examples for org.apache.wicket.util.lang Args notEmpty

Introduction

In this page you can find the example usage for org.apache.wicket.util.lang Args notEmpty.

Prototype

public static <T extends Collection<?>> T notEmpty(final T collection, final String name) 

Source Link

Document

Checks argument is not null or empty

Usage

From source file:com.conwax.ajax.SimpleAjaxEventBehavior.java

License:Apache License

/**
 * @param event/*from w w  w  .j  av a2 s. c o m*/
 * @param simpleAjaxFallbackLink
 */
public SimpleAjaxEventBehavior(String event) {
    Args.notEmpty(event, "event");

    event = event.toLowerCase();
    if (event.startsWith("on")) {
        event = event.substring(2);
    }

    this.event = event;
}

From source file:com.wicketinaction.HandlebarsButton.java

License:Apache License

/**
 * Constructor./*from  w ww . j  a  v a  2s. c o m*/
 *
 * @param id the component id
 * @param templateId the id of the Handlebars template
 *      E.g. <script id="THIS_ID" type="text/x-handlebars-template">
 * @param targetSelector the css selector to use to find the HTML element that
 *      should be updated with the populated Handlebars template
 */
public HandlebarsButton(String id, String templateId, String targetSelector) {
    super(id);

    Args.notEmpty(templateId, "templateId");
    Args.notEmpty(targetSelector, "targetSelector");

    PackageTextTemplate blogJs = new PackageTextTemplate(HandlebarsButton.class, "HandlebarsButton.js.tmpl");
    Map<String, Object> variables = Generics.newHashMap();
    variables.put("templateId", templateId);
    variables.put("targetSelector", targetSelector);
    this.onSuccessFunction = new JsonFunction(blogJs.asString(variables));
}

From source file:de.alpharogroup.wicket.components.link.PhoneLink.java

License:Apache License

/**
 * Instantiates a new {@link PhoneLink}.
 *
 * @param id//from w ww  .j  a  v a 2 s. co  m
 *            the id
 * @param model
 *            the model
 */
public PhoneLink(final String id, final IModel<CharSequence> model) {
    super(id, model);
    Args.notNull(model, "model");
    Args.notNull(model.getObject(), "model");
    Args.notEmpty(model.getObject(), "model");
    onValidate(model);
}

From source file:de.alpharogroup.wicket.js.addon.popupoverlay.PopupoverlayJsGenerator.java

License:Apache License

/**
 * Instantiates a new {@link PopupoverlayJsGenerator} with the given
 * {@link PopupoverlaySettings}./*from   w  ww . ja v  a  2 s  .co m*/
 *
 * @param settings
 *            the settings for the jquery-popup-overlay plugin.
 * @param componentId
 *            the component id
 * @param withDocumentReadyFunction
 *            the flag if the script will be wrapped with document ready function
 */
public PopupoverlayJsGenerator(final PopupoverlaySettings settings, final String componentId,
        final boolean withDocumentReadyFunction) {
    super(settings);
    setComponentId(Args.notEmpty(componentId, "componentId"));
    setWithComponentId(true);
    setMethodName("popup");
    setWithDocumentReadyFunction(withDocumentReadyFunction);
}

From source file:de.alpharogroup.wicket.js.addon.tooltipster.TooltipsterJsGenerator.java

License:Apache License

/**
 * Instantiates a new {@link TooltipsterJsGenerator} with the given {@link TooltipsterSettings}.
 *
 * @param settings/*from  w  w w .  j  a  v  a 2 s  .c  o m*/
 *            the settings for the tooltipster plugin.
 *
 * @param componentId
 *            the component id
 * @param withDocumentReadyFunction
 *            the flag if the script will be wrapped with document ready function
 */
public TooltipsterJsGenerator(final TooltipsterSettings settings, final String componentId,
        final boolean withDocumentReadyFunction) {
    super(settings);
    setComponentId(Args.notEmpty(componentId, "componentId"));
    setWithComponentId(true);
    setMethodName("tooltipster");
    setWithDocumentReadyFunction(withDocumentReadyFunction);
}

From source file:eu.uqasar.service.AuthenticationService.java

License:Apache License

public boolean updateUserPassword(User user, final String password, final String passwordConfirmation) {
    Args.notNull(user, "User may not be null!");
    Args.notEmpty(password, "Password may not be null or empty!");
    Args.notEmpty(passwordConfirmation, "Password confirmation may not be null or empty!");
    try {//from w ww . j a va2 s  .c o m
        byte[] salt = generateSalt();
        byte[] encryptedPassword = getEncryptedPassword(password, salt);

        user.setPassword(encryptedPassword);
        user.setPwSalt(salt);
        userService.update(user);
        return true;
    } catch (NoSuchAlgorithmException | InvalidKeySpecException e) {
        throw new RuntimeException("An unexpected error occurred!", e);
    }
}

From source file:jp.xet.uncommons.wicket.converter.BooleanConverter.java

License:Apache License

/**
 * ??/*w w  w  .j ava2 s  .  c o m*/
 * 
 * @param prefix ?
 * @throws IllegalArgumentException ?{@code null}???
 */
public BooleanConverter(String prefix) {
    Args.notEmpty(prefix, "prefix");
    this.prefix = prefix;
}

From source file:org.cdlflex.ui.markup.css.CssClassNameProvider.java

License:Apache License

public CssClassNameProvider(String cssClassName) {
    this.cssClassName = Args.notEmpty(cssClassName, "cssClassName").toLowerCase();
}

From source file:org.sakaiproject.sitestats.tool.wicket.components.paging.infinite.InfinitePagingDataTable.java

License:Educational Community License

public InfinitePagingDataTable(String id, final List<? extends IColumn<T, S>> columns,
        final InfiniteDataProvider<T> dataProvider, final long rowsPerPage) {
    super(id);/*  w ww .  j  a v  a 2s  . c om*/

    Args.notEmpty(columns, "columns");

    this.columns = columns;
    this.caption = new Caption("caption", getCaptionModel());
    add(caption);
    body = newBodyContainer("body");
    datagrid = newInfinitePagingDataGridView("rows", columns, dataProvider);
    datagrid.setItemsPerPage(rowsPerPage);
    body.add(datagrid);
    add(body);
    topToolbars = new ToolbarsContainer("topToolbars");
    bottomToolbars = new ToolbarsContainer("bottomToolbars");
    add(topToolbars);
    add(bottomToolbars);
}

From source file:org.wicketstuff.datastores.memcached.MemcachedSettings.java

License:Apache License

@Override
public IMemcachedSettings setServerNames(String serverNames) {
    Args.notEmpty(serverNames, "serverNames");

    String[] ss = Strings.split(serverNames, ',');
    this.servers = Generics.newArrayList(ss.length);
    for (String server : ss) {
        this.servers.add(server.trim());
    }/* ww w . j a  v  a 2s  .  c o m*/
    return this;
}