- Timestamp:
- 2004-03-29T15:36:55+12:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/gui/GatherPane.java
r7123 r7143 666 666 private class KeyListenerImpl 667 667 extends KeyAdapter { 668 private boolean vk_left_pressed = false; 668 669 /** Called whenever a key that was pressed is released, it is this action that will cause the desired effects (this allows for the key event itself to be processed prior to this listener dealing with it). */ 669 670 public void keyReleased(KeyEvent event) { … … 728 729 if(path != null) { 729 730 File file = ((FileNode)path.getLastPathComponent()).getFile(); 730 if(file != null && file.isFile()) { 731 TreePath parent_path = path.getParentPath(); 732 if (parent_path != null && parent_path.getParentPath() != null) { 733 // if this file is in the top level folder, don't move the focus 734 tree.setImmediate(true); 735 tree.clearSelection(); 736 tree.setSelectionPath(parent_path); 737 tree.setImmediate(false); 731 if(file != null) { 732 if (file.isFile() || vk_left_pressed) { 733 vk_left_pressed = false; 734 TreePath parent_path = path.getParentPath(); 735 if (parent_path != null && parent_path.getParentPath() != null) { 736 // if this file is in the top level folder, don't move the focus 737 tree.setImmediate(true); 738 tree.clearSelection(); 739 tree.setSelectionPath(parent_path); 740 tree.setImmediate(false); 741 } 738 742 } 739 743 } … … 741 745 } 742 746 } 743 744 } 745 747 748 // we need to watch for left clicks on an unopened folder - should shift the focus to teh parent folder. But because there is some other mysterious key listener that does opening and closing folders on right and left clicks, we must detect the situation before the other handler has done its job, and process it after. 749 public void keyPressed(KeyEvent event) { 750 if (event.getKeyCode() == KeyEvent.VK_LEFT) { 751 // left key on closed directory shifts the selection to the parent folder 752 DragTree tree = (DragTree)event.getSource(); 753 TreePath path = tree.getLeadSelectionPath(); 754 if(path == null) return; 755 File file = ((FileNode)path.getLastPathComponent()).getFile(); 756 if(file == null) return; 757 758 if (file.isDirectory() && tree.isCollapsed(path)) { 759 vk_left_pressed = true; 760 } 761 } 762 } 763 } 764 746 765 /** This provides a small prompt for gathering addition details about a special directory mapping such as its symbolic name. */ 747 766 private class MappingPrompt
Note:
See TracChangeset
for help on using the changeset viewer.