Example usage for org.apache.wicket.util.lang Generics newArrayList

List of usage examples for org.apache.wicket.util.lang Generics newArrayList

Introduction

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

Prototype

public static <T> ArrayList<T> newArrayList() 

Source Link

Document

Creates a new ArrayList

Usage

From source file:com.googlecode.wicket.jquery.core.template.JQueryTemplate.java

License:Apache License

@Override
public List<String> getTextProperties() {
    return Generics.newArrayList();
}

From source file:com.googlecode.wicket.kendo.ui.datatable.DataTableBehavior.java

License:Apache License

/**
 * Gets the {@code List} of visible {@link ToolbarButton}{@code s}
 * //from ww w  .  j  a  v  a 2s .  c  o m
 * @return the {@code List} of visible {@code ToolbarButton}{@code s}
 */
protected List<ToolbarButton> getVisibleToolbarButtons() {
    List<ToolbarButton> buttons = Generics.newArrayList();

    for (ToolbarButton button : this.getToolbarButtons()) {
        if (button.isVisible()) {
            buttons.add(button);
        }
    }

    return buttons;
}

From source file:com.googlecode.wicket.kendo.ui.datatable.DataTableBehavior.java

License:Apache License

/**
 * Gets the {@code List} of visible {@link CommandButton}{@code s} as json string
 * /*w w  w  . j av  a 2  s . c  o  m*/
 * @param column the {@code CommandColumn}, containing the {@code CommandButton}{@code s}
 * @param behaviors the {@code List} of {@code CommandAjaxBehavior}{@code s} which may be bound to buttons
 * @return the {@code List} of visible {@code CommandButton} as json string
 */
private List<String> getCommandButtonsAsString(CommandColumn column, List<CommandAjaxBehavior> behaviors) {
    List<String> list = Generics.newArrayList();

    for (CommandButton button : column.getButtons()) {
        if (button.isVisible()) {
            JQueryAjaxBehavior behavior = this.getCommandAjaxBehavior(button, behaviors);

            list.add(button.toString(behavior));
        }
    }

    return list;
}

From source file:com.googlecode.wicket.kendo.ui.form.multiselect.lazy.MultiSelect.java

License:Apache License

@Override
public void convertInput() {
    List<T> list = Generics.newArrayList();

    for (String value : this.getInputAsArray()) {
        for (T choice : this.choices) {
            if (this.renderer.getValue(choice).equals(value)) {
                list.add(choice);//www .  ja  v  a 2 s . c o m
            }
        }
    }

    this.setConvertedInput(list);
}

From source file:com.googlecode.wicket.kendo.ui.form.multiselect.lazy.MultiSelect.java

License:Apache License

@Override
protected String getModelValue() {
    List<String> values = Generics.newArrayList();

    for (T value : this.getModelObject()) {
        values.add(String.format("{ %s }", this.renderer.render(value)));
    }/* w  w  w .  ja  v  a2 s  .  c o  m*/

    return values.toString();
}

From source file:com.googlecode.wicket.kendo.ui.scheduler.SchedulerEventFactory.java

License:Apache License

/**
 * Converts a {@link JSONObject} to a {@link SchedulerEvent}
 *
 * @param object the {@code JSONObject}//from   w ww.  j  a v a  2 s. c om
 * @param lists the {@code List} of {@link ResourceList}{@code s}
 * @return the {@code SchedulerEvent}
 */
public SchedulerEvent toObject(JSONObject object, List<ResourceList> lists) {
    try {
        SchedulerEvent event = new SchedulerEvent();
        event.setId(object.getInt("id"));
        event.setTitle(object.optString("title"));
        event.setDescription(object.optString("description"));

        event.setStart(object.getLong("start"));
        event.setEnd(object.getLong("end"));
        event.setAllDay(object.getBoolean("isAllDay"));

        event.setRecurrenceId(object.optString("recurrenceId"));
        event.setRecurrenceRule(object.optString("recurrenceRule"));
        event.setRecurrenceException(object.optString("recurrenceException"));

        // Resources //
        Pattern pattern = Pattern.compile("([\\w-]+)");

        for (ResourceList list : lists) {
            List<String> values = Generics.newArrayList();

            String field = list.getField();
            String value = object.optString(field);

            if (value != null) {
                Matcher matcher = pattern.matcher(value);

                while (matcher.find()) {
                    values.add(matcher.group());
                }
            }

            if (list.isMultiple()) {
                event.setResource(field, values);
            } else if (!values.isEmpty()) {
                event.setResource(field, values.get(0)); // if the underlying value is a number (even a string-number), it will be handled by Id#valueOf(I)
            }
        }

        return event;
    } catch (JSONException e) {
        LOG.error(e.getMessage(), e);
    }

    return null;
}

From source file:com.googlecode.wicket.kendo.ui.utils.TreeNodeUtils.java

License:Apache License

/**
 * Retrieves children {@link TreeNode}{@code s} for a specified parent node
 * /*www .ja  va 2s  . co m*/
 * @param parentId the node parent id
 * @param nodes the {@code List} of nodes
 * @return the children nodes
 */
public static List<? extends TreeNode<?>> getChildren(int parentId, List<TreeNode<?>> nodes) {
    List<TreeNode<?>> list = Generics.newArrayList();

    for (TreeNode<?> node : nodes) {
        if (node.getParentId() == parentId) {
            list.add(node);
        }
    }

    return list;
}

From source file:eu.uqasar.web.pages.errors.ErrorPage.java

License:Apache License

/**
 *
 * @param throwable//from ww w .ja  v  a2s.co m
 * <p>
 * @return
 */
private List<Throwable> convertToList(final Throwable throwable) {
    List<Throwable> al = Generics.newArrayList();
    Throwable cause = throwable;
    al.add(cause);
    while ((cause.getCause() != null) && (cause != cause.getCause())) {
        cause = cause.getCause();
        al.add(cause);
    }
    return al;
}

From source file:org.onexus.ui.api.pages.error.ExceptionErrorPage.java

License:Apache License

/**
 * @param throwable/*from   w w  w  .ja v a  2s  .com*/
 * @return xxx
 */
private List<Throwable> convertToList(final Throwable throwable) {
    List<Throwable> al = Generics.newArrayList();
    Throwable cause = throwable;
    al.add(cause);
    while (cause.getCause() != null && cause != cause.getCause()) {
        cause = cause.getCause();
        al.add(cause);
    }
    return al;
}