Ignore:
Timestamp:
2003-05-27T15:57:37+12:00 (21 years ago)
Author:
kjdon
Message:

re-tabbed the code for java

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/file/FileOpenActionListener.java

    r4293 r4366  
    4848 */
    4949public class FileOpenActionListener
    50     extends MouseAdapter
    51     implements TreeExpansionListener {
    52     /** This flag gets toggled to <i>true</i> if the listener determines that the next mouse clicked event it will recieve is actually caused by the tree expanding or collapsing. */
    53     private boolean ignore = false;
    54     /** The constructor. */
    55     public FileOpenActionListener() {
    56     }
    57     /** Any subclass of MouseAdapter can override this method to respond to mouse click events. In this case we want to start an external application if someone double clicks on an appropriate file record.
     50    extends MouseAdapter
     51    implements TreeExpansionListener {
     52    /** This flag gets toggled to <i>true</i> if the listener determines that the next mouse clicked event it will recieve is actually caused by the tree expanding or collapsing. */
     53    private boolean ignore = false;
     54    /** The constructor. */
     55    public FileOpenActionListener() {
     56    }
     57    /** Any subclass of MouseAdapter can override this method to respond to mouse click events. In this case we want to start an external application if someone double clicks on an appropriate file record.
    5858      * @param event A <strong>MouseEvent</strong> containing further information about the mouse click performed.
    5959      * @see org.greenstone.gatherer.Gatherer
     
    6161      * @see org.greenstone.gatherer.tree.GTree
    6262      */
    63     public void mouseClicked(MouseEvent event) {
    64           ///ystem.err.println("Mouse clicked");
    65           if(!ignore) {
    66                 if(event.getClickCount() >= 2) {
    67                      // Find the file we're clicking on.
    68                      JTree tree = (JTree)event.getSource();
    69                      TreePath path = tree.getClosestPathForLocation(event.getX(), event.getY());
    70                      if(path != null) {
    71                           FileNode record = (FileNode)path.getLastPathComponent();
    72                           ///ystem.err.println("Double clicked on " + record);
    73                           File file = record.getFile();
    74                           if(file != null && file.isFile()) {
    75                                 ///ystem.err.println("Running " + file);
    76                                 Gatherer.self.spawnApplication(file);
    77                           }
    78                      }
    79                 }
    80           }
    81           else {
     63    public void mouseClicked(MouseEvent event) {
     64    ///ystem.err.println("Mouse clicked");
     65    if(!ignore) {
     66        if(event.getClickCount() >= 2) {
     67        // Find the file we're clicking on.
     68        JTree tree = (JTree)event.getSource();
     69        TreePath path = tree.getClosestPathForLocation(event.getX(), event.getY());
     70        if(path != null) {
     71            FileNode record = (FileNode)path.getLastPathComponent();
     72            ///ystem.err.println("Double clicked on " + record);
     73            File file = record.getFile();
     74            if(file != null && file.isFile()) {
     75            ///ystem.err.println("Running " + file);
     76            Gatherer.self.spawnApplication(file);
     77            }
     78        }
     79        }
     80    }
     81    else {
    8282                ///ystem.err.println("Caused by tree expansion / collapse. Ignoring.");
    83                 ignore = false;
    84           }
    85     }
    86     /** Any implementation of TreeExpansionListener must include this method so that we can be informed when a tree node has been collapsed, thus indicating that any mouse click events about to be recieved are most likely related to this event.
     83        ignore = false;
     84    }
     85    }
     86    /** Any implementation of TreeExpansionListener must include this method so that we can be informed when a tree node has been collapsed, thus indicating that any mouse click events about to be recieved are most likely related to this event.
    8787      * @param event A <strong>TreeExpansionEvent</strong> containing information about the node collapsed.
    8888      */
    89     public void treeCollapsed(TreeExpansionEvent event) {
    90           ///ystem.err.println("Tree Collapsed");
    91           ignore = true;
    92     }
    93     /** Any implementation of TreeExpansionListener must include this method so that we can be informed when a tree node has been expanded, thus indicating that any mouse click events about to be recieved are most likely related to this event.
     89    public void treeCollapsed(TreeExpansionEvent event) {
     90    ///ystem.err.println("Tree Collapsed");
     91    ignore = true;
     92    }
     93    /** Any implementation of TreeExpansionListener must include this method so that we can be informed when a tree node has been expanded, thus indicating that any mouse click events about to be recieved are most likely related to this event.
    9494      * @param event A <strong>TreeExpansionEvent</strong> containing information about the node expanded.
    9595      */
    96     public void treeExpanded(TreeExpansionEvent event) {
    97           ///ystem.err.println("Tree Expanded");
    98           ignore = true;
    99     }
     96    public void treeExpanded(TreeExpansionEvent event) {
     97    ///ystem.err.println("Tree Expanded");
     98    ignore = true;
     99    }
    100100}
Note: See TracChangeset for help on using the changeset viewer.