Class sfclasses.DragDrop
All Packages Class Hierarchy This Package Previous Next Index
Class sfclasses.DragDrop
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----java.awt.Panel
|
+----sfclasses.DragDrop
- public class DragDrop
- extends Panel
This class is used for graphically displaying and drag-and-drop editing
of graphs. Vertex objects must implement DragDropObj.
The drag and drop panel consists of a canvas to display and edit the
topology, two scrollbars and a status line. Object dependent methods
are defined in DragDropObj.
This is a GUI class.
- See Also:
- DragDropObj, Graph
-
graph
-
-
offset_x
-
-
offset_y
-
-
DragDrop(Graph, Class)
- Create a canvas and two scrollbars and lay them out in the panel
-
DragDrop(Graph, Class, boolean)
-
Create a canvas and two scrollbars and lay them out in the panel
-
disableEdit()
-
Diable editing functions
-
drawEdge(Graphics, DragDropObj, DragDropObj)
- Draw edge between two objects.
-
enableEdit()
-
Enable editing functions
-
getGraph()
-
Get graph object; note that you have to call repaint()
after making changes in the graph topology manually
-
getSelected()
-
Get highlighted object
-
handleEvent(Event)
-
Event handler
mouse click on background creates new object
left mouse button to draw lines
right mouse button (or button + META) to drag objects
double click on object to call object's execute() method
-
reshape(int, int, int, int)
-
Called when panel size changes (e.g.
-
setClass(Class)
- Set the class for creation of new objects
graph
protected Graph graph
offset_x
protected int offset_x
offset_y
protected int offset_y
DragDrop
public DragDrop(Graph g,
Class newObjectClass)
- Create a canvas and two scrollbars and lay them out in the panel
- Parameters:
- g - graph to store objects and edges
- newObjectClass - class for object creation
(must be public and implement DragDropObj)
DragDrop
public DragDrop(Graph g,
Class newObjectClass,
boolean edit)
- Create a canvas and two scrollbars and lay them out in the panel
- Parameters:
- g - graph to store objects and edges
- newObjectClass - class for object creation
(must be public and implement DragDropObj)
- edit - enable / disable editing functions on startup
handleEvent
public boolean handleEvent(Event e)
- Event handler
mouse click on background creates new object
left mouse button to draw lines
right mouse button (or button + META) to drag objects
double click on object to call object's execute() method
- Overrides:
- handleEvent in class Component
reshape
public synchronized void reshape(int x,
int y,
int width,
int height)
- Called when panel size changes (e.g. on startup)
- Overrides:
- reshape in class Component
enableEdit
public void enableEdit()
- Enable editing functions
disableEdit
public boolean disableEdit()
- Diable editing functions
- Returns:
- true if successful, false if state != STATE_NONE
getSelected
public DragDropObj getSelected()
- Get highlighted object
- Returns:
- selected object or null if no object has been selected
setClass
public void setClass(Class newObjectClass)
- Set the class for creation of new objects
- Parameters:
- newObjectClass - class for object creation
getGraph
public Graph getGraph()
- Get graph object; note that you have to call repaint()
after making changes in the graph topology manually
- Returns:
- graph object
- See Also:
- Graph
drawEdge
protected void drawEdge(Graphics g,
DragDropObj V1,
DragDropObj V2)
- Draw edge between two objects.
- Parameters:
- g - Graphics context
- V1 - First object
- V1 - Second object
All Packages Class Hierarchy This Package Previous Next Index