Changeset 4378


Ignore:
Timestamp:
2003-05-28T11:19:56+12:00 (21 years ago)
Author:
kjdon
Message:

disabled dragging of dummy nodes (Greenstone Collections) and file system root nodes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/gui/tree/DragTree.java

    r4366 r4378  
    191191        setSelectionPath(path);
    192192    }
     193    if (!isValidDrag()) {
     194        return;
     195    }
    193196    // Now update the selection stored as far as the group is concerned.
    194197    group.setSelection(getSelectionPaths());
     
    575578    Gatherer.g_man.menu_bar.setMetaAuditSuffix(getSelectionDetails());
    576579    }
     580   
     581    /** returns false for dummy nodes (ones without files), and system root
     582     * nodes */
     583    private boolean isValidDrag() {
     584    //because you cant select nodes that are children of another selection, and we use a contiguous selection model, we just test the first selection path
     585    TreePath node_path = getSelectionPath();
     586    FileNode node = (FileNode) node_path.getLastPathComponent();
     587   
     588    if (node.getFile() == null) {
     589        return false;
     590    }
     591    if (node.isFileSystemRoot()) {
     592        return false;
     593    }
     594    return true;
     595    }
    577596
    578597    private boolean isValidDrop(TreePath target_path) {
     
    580599    if(target_path != null) {
    581600        FileNode target_node = (FileNode) target_path.getLastPathComponent();
    582                 // We can only continue testing if the node is a folder.
     601        // We can only continue testing if the node is a folder.
    583602        if(!target_node.isLeaf()) {
    584603        // Now we check if the node is readonly.
Note: See TracChangeset for help on using the changeset viewer.