Search in sources :

Example 16 with List

use of org.apache.pivot.collections.List in project pivot by apache.

the class TerraVFSBrowserSkin method selectedFileAdded.

@Override
public void selectedFileAdded(VFSBrowser fileBrowser, FileObject file) {
    if (!updatingSelection) {
        @SuppressWarnings("unchecked") List<FileObject> files = (List<FileObject>) fileTableView.getTableData();
        int index = files.indexOf(file);
        if (index != -1) {
            updatingSelection = true;
            fileTableView.addSelectedIndex(index);
            updatingSelection = false;
        }
    }
}
Also used : ArrayList(org.apache.pivot.collections.ArrayList) List(org.apache.pivot.collections.List) FileObject(org.apache.commons.vfs2.FileObject) Point(org.apache.pivot.wtk.Point)

Example 17 with List

use of org.apache.pivot.collections.List in project pivot by apache.

the class TerraVFSBrowserSkin method updateSelectedFiles.

private void updateSelectedFiles(VFSBrowser fileBrowser) {
    if (!updatingSelection) {
        Sequence<FileObject> selectedFiles = fileBrowser.getSelectedFiles();
        ArrayList<Span> selectedRanges = new ArrayList<>();
        for (int i = 0, n = selectedFiles.getLength(); i < n; i++) {
            FileObject selectedFile = selectedFiles.get(i);
            @SuppressWarnings("unchecked") List<FileObject> files = (List<FileObject>) fileTableView.getTableData();
            int index = files.indexOf(selectedFile);
            if (index != -1) {
                selectedRanges.add(new Span(index, index));
            }
        }
        updatingSelection = true;
        fileTableView.setSelectedRanges(selectedRanges);
        updatingSelection = false;
    }
}
Also used : ArrayList(org.apache.pivot.collections.ArrayList) ArrayList(org.apache.pivot.collections.ArrayList) List(org.apache.pivot.collections.List) FileObject(org.apache.commons.vfs2.FileObject) Span(org.apache.pivot.wtk.Span) Point(org.apache.pivot.wtk.Point)

Example 18 with List

use of org.apache.pivot.collections.List in project pivot by apache.

the class TerraFileBrowserSkin method selectedFileAdded.

@Override
public void selectedFileAdded(FileBrowser fileBrowser, File file) {
    if (!updatingSelection) {
        @SuppressWarnings("unchecked") List<File> files = (List<File>) fileTableView.getTableData();
        int index = files.indexOf(file);
        if (index != -1) {
            updatingSelection = true;
            fileTableView.addSelectedIndex(index);
            updatingSelection = false;
        }
    }
}
Also used : ArrayList(org.apache.pivot.collections.ArrayList) List(org.apache.pivot.collections.List) File(java.io.File) Point(org.apache.pivot.wtk.Point)

Example 19 with List

use of org.apache.pivot.collections.List in project pivot by apache.

the class TerraFileBrowserSkin method updateSelectedFiles.

private void updateSelectedFiles(FileBrowser fileBrowser) {
    if (!updatingSelection) {
        Sequence<File> selectedFiles = fileBrowser.getSelectedFiles();
        ArrayList<Span> selectedRanges = new ArrayList<>();
        for (int i = 0, n = selectedFiles.getLength(); i < n; i++) {
            File selectedFile = selectedFiles.get(i);
            @SuppressWarnings("unchecked") List<File> files = (List<File>) fileTableView.getTableData();
            int index = files.indexOf(selectedFile);
            if (index != -1) {
                selectedRanges.add(new Span(index, index));
            }
        }
        updatingSelection = true;
        fileTableView.setSelectedRanges(selectedRanges);
        updatingSelection = false;
    }
}
Also used : ArrayList(org.apache.pivot.collections.ArrayList) ArrayList(org.apache.pivot.collections.ArrayList) List(org.apache.pivot.collections.List) File(java.io.File) Span(org.apache.pivot.wtk.Span) Point(org.apache.pivot.wtk.Point)

Example 20 with List

use of org.apache.pivot.collections.List in project pivot by apache.

the class TerraFileBrowserSkin method selectedFileRemoved.

@Override
public void selectedFileRemoved(FileBrowser fileBrowser, File file) {
    if (!updatingSelection) {
        @SuppressWarnings("unchecked") List<File> files = (List<File>) fileTableView.getTableData();
        int index = files.indexOf(file);
        if (index != -1) {
            updatingSelection = true;
            fileTableView.removeSelectedIndex(index);
            updatingSelection = false;
        }
    }
}
Also used : ArrayList(org.apache.pivot.collections.ArrayList) List(org.apache.pivot.collections.List) File(java.io.File) Point(org.apache.pivot.wtk.Point)

Aggregations

List (org.apache.pivot.collections.List)47 ArrayList (org.apache.pivot.collections.ArrayList)37 TableView (org.apache.pivot.wtk.TableView)11 Span (org.apache.pivot.wtk.Span)10 Button (org.apache.pivot.wtk.Button)8 ListView (org.apache.pivot.wtk.ListView)8 Point (org.apache.pivot.wtk.Point)8 IOException (java.io.IOException)7 BXMLSerializer (org.apache.pivot.beans.BXMLSerializer)7 SerializationException (org.apache.pivot.serialization.SerializationException)6 Component (org.apache.pivot.wtk.Component)6 File (java.io.File)5 HashMap (org.apache.pivot.collections.HashMap)5 Map (org.apache.pivot.collections.Map)5 JSONSerializer (org.apache.pivot.json.JSONSerializer)5 ButtonPressListener (org.apache.pivot.wtk.ButtonPressListener)5 TableViewSortListener (org.apache.pivot.wtk.TableViewSortListener)5 Color (java.awt.Color)4 FileObject (org.apache.commons.vfs2.FileObject)4 Task (org.apache.pivot.util.concurrent.Task)4