Java Code Examples for org.apache.pivot.collections.Sequence#getLength()

The following examples show how to use org.apache.pivot.collections.Sequence#getLength() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ScanFacade.java    From setupmaker with Apache License 2.0 6 votes vote down vote up
/**
 * Get only packs checked in treeview
 * @param sequence of checked paths in treeview
 * @return list of checked packs
 */
public List<Pack> getCheckedPacks(Sequence<Path> list) {
    List<Pack> selected = new ArrayList<Pack>();

    if (list.getLength() > 0) {
        Path p;
        for(int i = 0; i < list.getLength(); i++) {
            p = list.get(i);
            TreeNode node = treeData.get(p.get(0));
            for(Pack P:packs) {
                if (node.getParent() == null && P.getName().equalsIgnoreCase(node.getText()) ) {
                    selected.add(P);
                    break;
                }
            }
        }
    }
    return selected;
}
 
Example 2
Source File: BuildFacade.java    From setupmaker with Apache License 2.0 5 votes vote down vote up
public void copyToClipboard(Sequence<String> data)
{
    if (data.getLength() > 0) {
        String selCb = ""; // full selection data string
        for (int i = 0; i < data.getLength(); i++) { // concat selection with line ends
            selCb = String.format("%s%s%n", selCb, data.get(i));//selCb += sel.get(i) + "\n"; 
        }
        
        Out.print(LOG_LEVEL.DEBUG, "Copied to Clipboard: "+ selCb);
        StringSelection selection = new StringSelection(selCb);
        Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
        clipboard.setContents(selection, selection);
    }
}
 
Example 3
Source File: SetFacade.java    From setupmaker with Apache License 2.0 4 votes vote down vote up
public void pastePack(Sequence<Pack> packs) {
    for(int i = 0; i < packs.getLength(); i++)
        pastePack(packs.get(i));
}