Overview | Package | Class | Tree | Index | Help NetCharts Pro (Applets) 7.0
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class netcharts.graphics.
NFDraggable

java.lang.Object
  |
  +--netcharts.graphics.NFDraggable
Subclasses:
NFLegend, NFNoteSet

public abstract class NFDraggable
This abstract class is used to handle the dragging of objects on the screen. Extensions to this object need only implement methods to find objects when a mouse position is given and to move the object as the mouse is dragged. This class takes care of all other activities, including interacting with an NFDragObserver observers.


Constructor Summary
NFDraggable()
          Constructor for NFDraggable class
 
Method Summary
boolean abortPreDrag(double[] curCoords, double[] newCoords)
          Check with the observers to see if we can drag.
void addObserver(java.lang.Object observer)
          This method can be called to add an NFDragObserver to the dragging process.
boolean dragTo(double[] coords)
          This method is called after the observers have approved the new drag location provided in the coords[] array.
double[] getCoords()
          This method should return the current coordinates for the object being dragged.
boolean isDraggable(java.awt.Event evt, int x, int y)
          This method should return true if the given coordinate is inside of something that can be dragged.
boolean mouseDown(java.awt.Event evt, int x, int y)
          This method handles all mouseDown events for dragging purposes.
boolean mouseDrag(java.awt.Event evt, int x, int y)
          This method handles all mouseDrag events for dragging purposes.
boolean mouseUp(java.awt.Event evt, int x, int y)
          This method handles all mouseUp events for dragging purposes.
double[] moveRelative(java.awt.Event evt, int dx, int dy)
          This method is called when the draggable item needs to be moved by the given amount.
void notifyPostDrag()
          Notify the observers of the drag.
void removeObserver(java.lang.Object observer)
          This method is used to remove an NFDragObserver from the dragging process.
 

Constructor Detail

NFDraggable

public NFDraggable()
Constructor for NFDraggable class
Method Detail

isDraggable

public abstract boolean isDraggable(java.awt.Event evt,
                                    int x,
                                    int y)
This method should return true if the given coordinate is inside of something that can be dragged. This method is called by the mouseDown method when a drag activity is first started.
Parameters:
evt - The Event.
x - The X coordinate.
y - The Y coordinate.
Returns:
true if draggable, false otherwise.

getCoords

public abstract double[] getCoords()
This method should return the current coordinates for the object being dragged. These are supplied to any observers who might be monitoring this activity.

The curCoord[] array can be used for the return value.

Returns:
The coordinates.

moveRelative

public abstract double[] moveRelative(java.awt.Event evt,
                                      int dx,
                                      int dy)
This method is called when the draggable item needs to be moved by the given amount. If null is returned, then no drag is performed for this mouse event. Otherwise, the array returned should contain the new values. After verifying these values with all observers, they will be passed to the dragTo() method to actually move the object being dragged.

The newCoord[] array can be used for the return value.

Parameters:
evt - The Event.
dx - The change in the X coordinate.
dy - The change in the Y coordinate.
Returns:
The new coordinates.

dragTo

public abstract boolean dragTo(double[] coords)
This method is called after the observers have approved the new drag location provided in the coords[] array. These coords were previously generated by the moveRelative() method.

If true is returned, the new mouse location is recorded, otherwise the drag operation is completely ignored.

Parameters:
coords - The coordinates to drag to.
Returns:
true if dragged, false otherwise.

addObserver

public void addObserver(java.lang.Object observer)
This method can be called to add an NFDragObserver to the dragging process.
Parameters:
observer - The Observer to add.

removeObserver

public void removeObserver(java.lang.Object observer)
This method is used to remove an NFDragObserver from the dragging process.
Parameters:
observer - The Observer to remove.

mouseDown

public boolean mouseDown(java.awt.Event evt,
                         int x,
                         int y)
This method handles all mouseDown events for dragging purposes.
Parameters:
evt - The Event.
x - The X coordinate.
y - The Y coordinate.
Returns:
true if the event is handled, false otherwise.

mouseDrag

public boolean mouseDrag(java.awt.Event evt,
                         int x,
                         int y)
This method handles all mouseDrag events for dragging purposes.
Parameters:
evt - The Event.
x - The X coordinate.
y - The Y coordinate.
Returns:
true if the event is handled, false otherwise.

mouseUp

public boolean mouseUp(java.awt.Event evt,
                       int x,
                       int y)
This method handles all mouseUp events for dragging purposes.
Parameters:
evt - The Event.
x - The X coordinate.
y - The Y coordinate.
Returns:
true if the event is handled, false otherwise.

abortPreDrag

public boolean abortPreDrag(double[] curCoords,
                            double[] newCoords)
Check with the observers to see if we can drag.
Parameters:
curCoords - The current coordinates.
newCoords - The new coordinates.
Returns:
true if the drag should be aborted, false otherwise.

notifyPostDrag

public void notifyPostDrag()
Notify the observers of the drag.

Overview | Package | Class | Tree | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD


Visual Mining, Inc.
2099 Gaither Grove Rd.
Suite 220
Rockville, MD 20850
800.308.0731
301.947.8293 FAX

Copyright © Visual Mining, Inc. 1996 - 2010
All Rights Reserved.

NetCharts ProTM is a registered trademark of Visual Mining, Inc. Other brands and their products are trademarks of their respective holders.

Last Modified: Jun 29, 2010