Example usage for org.apache.commons.collections CollectionUtils addAll

List of usage examples for org.apache.commons.collections CollectionUtils addAll

Introduction

In this page you can find the example usage for org.apache.commons.collections CollectionUtils addAll.

Prototype

public static void addAll(Collection collection, Object[] elements) 

Source Link

Document

Adds all elements in the array to the given collection.

Usage

From source file:de.inren.service.security.RightServiceImpl.java

@Override
public List<Right> loadAllRights() {
    List<Right> res = new ArrayList<Right>();
    CollectionUtils.addAll(res, rightRepository.findAll().iterator());
    return res;//from   w w w.  ja  va 2s  . co m
}

From source file:de.inren.service.security.RoleServiceImpl.java

@Override
public List<Role> loadAllRoles() {
    List<Role> res = new ArrayList<Role>();
    CollectionUtils.addAll(res, roleRepository.findAll().iterator());
    return res;//from www .  j  av a2s.  c o  m
}

From source file:de.inren.service.group.GroupServiceImpl.java

@Override
public List<Group> loadAllGroups() {
    List<Group> res = new ArrayList<Group>();
    CollectionUtils.addAll(res, groupRepository.findAll().iterator());
    return res;//from   w  w w  .  j  ava  2  s . c  o  m
}

From source file:com.cyclopsgroup.waterview.MapAttributes.java

/**
 * Overwrite or implement method in MapValueParser
 *
 * @see com.cyclopsgroup.waterview.Attributes#doGetValues(java.lang.String)
 *///  ww  w.ja v  a  2s  .com
protected String[] doGetValues(String name) throws Exception {
    Object object = getMap().get(name);
    if (object == null) {
        return ArrayUtils.EMPTY_STRING_ARRAY;
    }
    ArrayList values = new ArrayList();
    CollectionUtils.addAll(values, TypeUtils.iterate(object));
    String[] ret = new String[values.size()];
    for (int i = 0; i < ret.length; i++) {
        Object value = values.get(i);
        ret[i] = TypeUtils.toString(value);
    }
    return ret;
}

From source file:com.cyclopsgroup.waterview.utils.TypeUtils.java

/**
 *Create a collection of vertical groups
 *
 * @param items Any collection objects/*w  ww  .j  a  v a  2 s. c o  m*/
 * @param size Size of group
 * @return List of groups
 */
public static List createVerticalGroup(Object items, int size) {
    Iterator ite = iterate(items);
    List list = new ArrayList();
    CollectionUtils.addAll(list, ite);
    int length = list.size() / size;
    if (list.size() % size > 0) {
        length++;
    }
    List[] bags = new List[length];
    for (int i = 0; i < length; i++) {
        bags[i] = new ArrayList();
    }
    for (int i = 0; i < list.size(); i++) {
        Object item = list.get(i);
        List bag = bags[i % length];
        bag.add(i / length, item);
    }
    List ret = new ArrayList();
    CollectionUtils.addAll(ret, bags);
    return ret;
}

From source file:com.googlecode.commons.swing.component.datetime.MiniDateCalendar.java

private void init() {
    final DateFormatSymbols dfs = new DateFormatSymbols(locale);
    CollectionUtils.addAll(this.weekdays, dfs.getShortWeekdays());

    for (int i = 0; i < 7; i++) {
        orderedWeekdays.add(((i + weekDayStart - 1) % 7) + 1);
    }/*from w ww.j  a va  2  s  .co  m*/

    setLayout(new BorderLayout());
    SizeUtils.setAllWidths(this, 150);
    SizeUtils.setAllHeights(this, 180);

    panNorth = new JPanel(new BorderLayout());
    add(panNorth, BorderLayout.NORTH);

    btnPrev = new JButton();
    SizeUtils.setAllWidths(btnPrev, 18);
    SizeUtils.setAllHeights(btnPrev, 18);
    btnPrev.setIcon(DefaultIcons.resultset_previous());
    btnPrev.setMargin(new Insets(0, 0, 0, 0));
    btnPrev.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            onClickPrev();
        }
    });
    panNorth.add(btnPrev, BorderLayout.WEST);

    lblMonth = new JLabel();
    SizeUtils.setMinHeight(lblMonth, 0);
    SizeUtils.setPreferredHeight(lblMonth, 0);
    lblMonth.setHorizontalAlignment(SwingConstants.CENTER);
    panNorth.add(lblMonth, BorderLayout.CENTER);

    btnNext = new JButton();
    btnNext.setIcon(DefaultIcons.resultset_next());
    SizeUtils.setAllWidths(btnNext, 18);
    SizeUtils.setAllHeights(btnNext, 18);
    btnNext.setMargin(new Insets(0, 0, 0, 0));
    btnNext.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            onClickNext();
        }
    });
    panNorth.add(btnNext, BorderLayout.EAST);

    panCenter = new JPanel();
    panCenter.setLayout(new GridLayout(7, 7));
    add(panCenter, BorderLayout.CENTER);

    for (int col = 0; col < 7; col++) {
        JLabel lblDay = new JLabel(weekdays.get(orderedWeekdays.get(col)));
        lblDay.setHorizontalAlignment(SwingConstants.CENTER);
        panCenter.add(lblDay);
    }

    ButtonGroup grp = new ButtonGroup();
    for (int row = 0; row < 6; row++) {
        for (int col = 0; col < 7; col++) {
            final int day = orderedWeekdays.get(col);
            final DayButton btn = createDayButton(day, weekdays.get(day));
            btn.setMargin(new Insets(0, 0, 0, 0));
            btn.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    onClickDay(btn.value);
                }
            });
            days.add(btn);
            grp.add(btn);
            panCenter.add(btn);
        }
    }
    refresh();
}

From source file:info.magnolia.jcr.nodebuilder.AbstractNodeOperation.java

@Override
public NodeOperation then(NodeOperation... childrenOps) {
    // add the operations to allow multiple calls on the method.
    CollectionUtils.addAll(this.childrenOps, childrenOps);
    return this;
}

From source file:com.google.gdt.eclipse.designer.launch.JUnitGwtLaunchConfigurationDelegate.java

private String[] getClasspathAll(ILaunchConfiguration configuration) throws CoreException {
    List<String> entries = new ArrayList<String>();
    // add source folders
    IProject project;//  ww  w .  jav  a2s.  c  om
    {
        String projectName = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME,
                "");
        project = Utils.getProject(projectName);
        AbstractGwtLaunchConfigurationDelegate.addSourceFolders(new HashSet<IProject>(), entries, project);
    }
    // add usual project classpath entries
    // we add them after source folders because GWT Shell compiles sources itself
    {
        String[] originalEntries = super.getClasspath(configuration);
        CollectionUtils.addAll(entries, originalEntries);
    }
    // add GWT DEV jar
    entries.add(Utils.getDevLibPath(project).toPortableString());
    //
    return entries.toArray(new String[entries.size()]);
}

From source file:com.cyclopsgroup.waterview.spi.ThemeManager.java

/**
 * Get all theme names/*from w w w  .  ja v a2 s. com*/
 *
 * @return Array of them names
 */
public String[] getThemeNames() {
    HashSet names = new HashSet();
    for (Iterator i = themeProviders.iterator(); i.hasNext();) {
        ThemeProvider provider = (ThemeProvider) i.next();
        CollectionUtils.addAll(names, provider.getThemeNames());
    }
    return (String[]) names.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
}

From source file:com.google.gdt.eclipse.designer.Activator.java

/**
 * @return array of entry sub-paths in given path.
 *///from  w  w  w  .  j av a2  s .  c om
@SuppressWarnings("unchecked")
public static String[] getEntriesPaths(String path) {
    List<String> entryPaths;
    {
        entryPaths = Lists.newArrayList();
        Enumeration<String> entryPathsEnumeration = getBundleStatic().getEntryPaths(path);
        CollectionUtils.addAll(entryPaths, entryPathsEnumeration);
    }
    // remove ".svn" files (for case when we use runtime workbench)
    for (Iterator<String> I = entryPaths.iterator(); I.hasNext();) {
        String entryPath = I.next();
        if (entryPath.indexOf(".svn") != -1) {
            I.remove();
        }
    }
    // convert to array
    return entryPaths.toArray(new String[entryPaths.size()]);
}