Ignore:
Timestamp:
2003-10-03T17:09:38+12:00 (21 years ago)
Author:
mdewsnip
Message:

More small updates and tooltips added.

File:
1 edited

Legend:

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

    r4801 r5571  
    113113    // Is row at top of screen?
    114114    if(pt.y + bounds.y <= AUTOSCROLL_MARGIN) {
    115                 // Yes, scroll up one row
     115        // Yes, scroll up one row
    116116        if(row <= 0) {
    117117        row = 0;
     
    122122    }
    123123    else {
    124                 // No, scroll down one row
     124        // No, scroll down one row
    125125        if(row < getRowCount() - 1) {
    126126        row = row + 1;
     
    131131
    132132    /** In order for the appearance to be consistant, given we may be in the situation where the pointer has left our focus but the ghost remains, this method allows other members of the GGroup to tell this component to clear its ghost.
    133       */
     133     */
    134134    public void clearGhost() {
    135135    // Erase the last ghost image and cue line
     
    138138
    139139    /** Any implementation of DragSourceListener must include this method so we can be notified when the drag event ends (somewhere else), which will in turn remove actions.
    140       * @param event A <strong>DragSourceDropEvent</strong> containing all the information about the end of the drag event.
    141       */
     140     * @param event A <strong>DragSourceDropEvent</strong> containing all the information about the end of the drag event.
     141     */
    142142    public void dragDropEnd(DragSourceDropEvent event) {
    143143    if(event.getDropSuccess()) {
    144                 // Do whatever I do when the drop is successful.
     144        // Do whatever I do when the drop is successful.
    145145    }
    146146    }
    147147    /** Any implementation of DragSourceListener must include this method so we can be notified when the drag focus enters this component.
    148       * @param event A <strong>DragSourceDragEvent</strong> containing all the information
    149       * about the drag event.
    150       */
     148     * @param event A <strong>DragSourceDragEvent</strong> containing all the information
     149     * about the drag event.
     150     */
    151151    public void dragEnter(DragSourceDragEvent event) {
    152152    // Handled elsewhere.
    153153    }
    154154    /** Any implementation of DropTargetListener must include this method so we can be notified when the drag focus enters this component, which in this case is to grab focus from within our group.
    155       * @param event A <strong>DropTargetDragEvent</strong> containing all the information about the drag event.
    156       */
     155     * @param event A <strong>DropTargetDragEvent</strong> containing all the information about the drag event.
     156     */
    157157    public void dragEnter(DropTargetDragEvent event) {
    158158    group.grabFocus(this);
    159159    }
    160160    /** Any implementation of DragSourceListener must include this method so we can be notified when the drag focus leaves this component.
    161       * @param event A <strong>DragSourceEvent</strong> containing all the information about the drag event.
    162       */
     161     * @param event A <strong>DragSourceEvent</strong> containing all the information about the drag event.
     162     */
    163163    public void dragExit(DragSourceEvent event) {
    164164    clearGhost();
     
    166166
    167167    /** Any implementation of DropTargetListener must include this method
    168       * so we can be notified when the drag focus leaves this component.
    169       * @param event A DropTargetEvent containing all the information
    170       * about the drag event.
    171       */
     168     * so we can be notified when the drag focus leaves this component.
     169     * @param event A DropTargetEvent containing all the information
     170     * about the drag event.
     171     */
    172172    public void dragExit(DropTargetEvent event) {
    173173    clearGhost();
     
    175175
    176176    /** Any implementation of DragGestureListener must include this method
    177       * so we can be notified when a drag action has been noticed, thus a
    178       * drag action has begun.
    179       * @param event A DragGestureEvent containing all the information about
    180       * the drag event.
    181       */
     177     * so we can be notified when a drag action has been noticed, thus a
     178     * drag action has begun.
     179     * @param event A DragGestureEvent containing all the information about
     180     * the drag event.
     181     */
    182182    public void dragGestureRecognized(DragGestureEvent event) {
    183183    // Can never drag from MetaEdit tree
     
    253253
    254254    /** Implementation side-effect.
    255       * @param event A DragSourceDragEvent containing all the information about the drag event.
    256       */
     255     * @param event A DragSourceDragEvent containing all the information about the drag event.
     256     */
    257257    public void dragOver(DragSourceDragEvent event) {
    258258    }
    259259
    260260    /** Any implementation of DropTargetListener must include this method
    261       * so we can be notified when the drag moves in this component.
    262       * @param event A DropTargetDragEvent containing all the information
    263       * about the drag event.
    264       */
     261     * so we can be notified when the drag moves in this component.
     262     * @param event A DropTargetDragEvent containing all the information
     263     * about the drag event.
     264     */
    265265    public void dragOver(DropTargetDragEvent event) {
    266266    // Draw the mouse ghost
     
    324324            target = (FileNode) target_path.getLastPathComponent();
    325325        }
    326         //else {
    327         //    // Warn that this is an invalid drop.
    328         //    MessageTask invalid_target_task = new MessageTask(Gatherer.dictionary.get("General.Error"), Gatherer.dictionary.get("FileActions.InvalidTarget"));
    329         //    invalid_target_task.start();
    330         //    invalid_target_task = null;
    331         //}
    332326        }
    333327        else {
     
    357351        }
    358352    }
    359     //else {
    360     //     Warn that this is an invalid drop.
    361     //    ///ystem.err.println("About to show a modal dialog box from JOptionPane.");
    362     //    MessageTask read_only_task = new MessageTask(Gatherer.dictionary.get("General.Error"), Gatherer.dictionary.get("FileActions.ReadOnlyTarget"));
    363     //    read_only_task.start();
    364     //    read_only_task = null;
    365     //    ///ystem.err.println("Returning from a modal dialog box.");
    366     //}
    367353    // Clear up the group.image_ghost
    368354    paintImmediately(ra_ghost.getBounds());
     
    370356    }
    371357
    372     //private class MessageTask
    373     //  extends Thread {
    374     //  private String message;
    375     //  private String title;
    376     //
    377     //  MessageTask(String title, String message) {
    378     //      this.message = message;
    379     //      this.title = title;
    380     //  }
    381     //
    382     //  public void run() {
    383     //      JOptionPane.showMessageDialog(Gatherer.g_man, message, title, JOptionPane.ERROR_MESSAGE);
    384     //  }
    385     //}
    386358
    387359    /** Any implementation of DragSourceListener must include this method
    388       * so we can be notified when the action to be taken upon drop changes.
    389       * @param event A DragSourceDragEvent containing all the information
    390       * about the drag event.
    391       */
     360     * so we can be notified when the action to be taken upon drop changes.
     361     * @param event A DragSourceDragEvent containing all the information
     362     * about the drag event.
     363     */
    392364    public void dropActionChanged(DragSourceDragEvent event) {
    393365    }
    394366
    395367    /** Any implementation of DropTargetListener must include this method
    396       * so we can be notified when the action to be taken upon drop changes.
    397       * @param event A DropTargetDragEvent containing all the information
    398       * about the drag event.
    399       */
     368     * so we can be notified when the action to be taken upon drop changes.
     369     * @param event A DropTargetDragEvent containing all the information
     370     * about the drag event.
     371     */
    400372    public void dropActionChanged(DropTargetDragEvent event) {
    401373    }
    402374
    403375    /** Used to notify this component that it has gained focus. It should
    404       * make some effort to inform the user of this.
    405       */
     376     * make some effort to inform the user of this.
     377     */
    406378    public void gainFocus() {
    407379    ///ystem.err.println("Gained focus: " + this);
     
    411383
    412384    /** Autoscroll Interface...
    413       * The following code was borrowed from the book:
    414       *              Java Swing
    415       *              By Robert Eckstein, Marc Loy & Dave Wood
    416       *              Paperback - 1221 pages 1 Ed edition (September 1998)
    417       *              O'Reilly & Associates; ISBN: 156592455X
    418       *
    419       * The relevant chapter of which can be found at:
    420       *              http://www.oreilly.com/catalog/jswing/chapter/dnd.beta.pdf
    421       * Calculate the insets for the *JTREE*, not the viewport
    422       * the tree is in. This makes it a bit messy.
    423       */
     385     * The following code was borrowed from the book:
     386     *              Java Swing
     387     *              By Robert Eckstein, Marc Loy & Dave Wood
     388     *              Paperback - 1221 pages 1 Ed edition (September 1998)
     389     *              O'Reilly & Associates; ISBN: 156592455X
     390     *
     391     * The relevant chapter of which can be found at:
     392     *              http://www.oreilly.com/catalog/jswing/chapter/dnd.beta.pdf
     393     * Calculate the insets for the *JTREE*, not the viewport
     394     * the tree is in. This makes it a bit messy.
     395     */
    424396    public Insets getAutoscrollInsets()
    425397    {
     
    441413
    442414    /** This method is used to inform this component when it loses focus,
    443       * and should indicate this somehow.
    444       */
     415     * and should indicate this somehow.
     416     */
    445417    public void loseFocus() {
    446418    ///ystem.err.println("Lost focus: " + this);
     
    501473
    502474    /** Override the normal setEnabled so the Tree exhibits a little more
    503       * change, which in this instance is the background colour changing.
    504       * @param state Whether this GTree should be in an enabled state.
    505       */
     475     * change, which in this instance is the background colour changing.
     476     * @param state Whether this GTree should be in an enabled state.
     477     */
    506478    public void setEnabled(boolean state) {
    507479    super.setEnabled(state);
     
    571543        }
    572544        }
    573                 // 3c. If not found then return as this node can't exists somehow.
     545        // 3c. If not found then return as this node can't exists somehow.
    574546        if(!found) {
    575547        return;
Note: See TracChangeset for help on using the changeset viewer.