|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--uci.gef.Editor
This class provides an editor for manipulating graphical documents. The editor is the central class of the graph editing framework, but it does not contain very much code. It can be this small because all the net-level models, graphical objects, layers, editor modes, editor commands, and supporting dialogs and frames are implemented in their own classes.
An Editor's LayerManager has a stack of Layer's. Normally Layers contain Figs. Some Figs are linked to NetPrimitives. When Figs are selected the SelectionManager holds a Selection object. The behavior of the Editor is determined by its current Mode. The Editor's ModeManager keeps track of all the active Modes. Modes interpert user input events and decide how to change the state of the diagram. The Editor acts as a shell for executing Commands that modify the document or the Editor itself.
When Figs change visible state (e.g., color, size, or postition) they tell their Layer that they are damaged and need to be repainted. The Layer tells all Editors that are editing that Layer. Each Editor has a RedrawManager that keeps track of what parts of the screen need to be redrawn, and does the redraws asynchronously. A major goal of GEF is to make it easy to extend the framework for application to a specific domain. It is very important that new functionality can be added without modifying what is already there. The fairly small size of the Editor is a good indicator that it is not a bottleneck for enhancing the framework.
Layer,
Fig,
NetPrimitive,
Selection,
Mode,
Cmd, Serialized Form| Field Summary | |
protected FigTextEditor |
_activeTextEditor
Each Editor has a RedrawManager that executes in a separate thread of control to update damaged regions of the display. |
protected Fig |
_curFig
The Fig that the mouse is in. |
protected Selection |
_curSel
The Selection object that the mouse is in. |
protected Object |
_document
This points to the document object that the user is working on. |
protected Guide |
_guide
The grid to snap points to. |
protected static Rectangle |
_hitRect
Temp var used to implement hit() without doing memory allocation. |
protected LayerManager |
_layerManager
The LayerManager for this Editor. |
protected ModeManager |
_modeManager
The user interface mode that the Editor is currently in. |
protected SelectionManager |
_selectionManager
_selections holds the SelectionMultiple object that describes all the selection objects for what the user currently has selected. |
static int |
GRIP_SIZE
Clicking exactly on a small shape is hard for users to do. |
| Constructor Summary | |
Editor()
|
|
Editor(Diagram d)
|
|
Editor(GraphModel gm)
|
|
Editor(GraphModel gm,
Component awt_comp)
Construct a new Editor to edit the given NetList |
|
Editor(GraphModel gm,
Component awt_comp,
Layer lay)
|
|
| Method Summary | |
void |
add(Fig f)
Add a Fig to the diagram being edited. |
void |
addGraphSelectionListener(GraphSelectionListener listener)
Remember to notify listener whenever the selection changes. |
void |
addModeChangeListener(ModeChangeListener listener)
Remember to notify listener whenever the mode changes. |
Object |
clone()
Clone the receiving editor. |
Image |
createImage(int w,
int h)
Create an Image (an off-screen bit-map) to be used to reduce flicker in redrawing. |
void |
damageAll()
Mark the entire visible area of this Editor as damaged. |
void |
damaged(Fig f)
|
void |
damaged(Rectangle r)
Calling any one of the following damaged() methods adds a damaged region (rectangle) to this Editor's RedrawManager. |
void |
damaged(Selection sel)
|
protected void |
defineLayers(GraphModel gm,
Layer lay)
|
Object |
document()
Get and set document being edited. |
void |
document(Object d)
|
void |
executeCmd(Cmd c,
InputEvent ie)
The editor acts as a shell for Cmds. |
Enumeration |
figs()
Returns a collection of all Figs in the layer currently being edited. |
Frame |
findFrame()
Find the AWT Frame that this Editor is being displayed in. |
void |
finishMode()
Set this Editor's current Mode to the next global Mode. |
Component |
getAwtComponent()
|
Color |
getBackground()
Get the backgrund color of the Editor. |
GraphEdgeRenderer |
getGraphEdgeRenderer()
Get the renderer object that decides how to display edges |
Graphics |
getGraphics()
Get the graphics context object that this editor should draw on. |
GraphModel |
getGraphModel()
Return the net under the diagram being edited. |
GraphNodeRenderer |
getGraphNodeRenderer()
Get the renderer object that decides how to display nodes |
Guide |
getGuide()
|
LayerManager |
getLayerManager()
Return the LayerComposite that holds the diagram being edited. |
ModeManager |
getModeManager()
|
SelectionManager |
getSelectionManager()
Reply the current SelectionManager of this Editor. |
Fig |
hit(int x,
int y)
|
Fig |
hit(int x,
int y,
int w,
int h)
|
Fig |
hit(Point p)
Reply the top Fig in the current layer that contains the given point. |
Fig |
hit(Rectangle r)
|
void |
keyPressed(KeyEvent ke)
Invoked when a key has been pressed. |
void |
keyReleased(KeyEvent ke)
Invoked when a key has been released. |
void |
keyTyped(KeyEvent ke)
Invoked when a key has been pressed and released. |
void |
mode(Mode m)
Set the current user interface mode to the given Mode instance. |
void |
mouseClicked(MouseEvent me)
Invoked after the mouse has been pressed and released. |
void |
mouseDragged(MouseEvent me)
Invoked when a mouse button is pressed in the Editor and then dragged. |
void |
mouseEntered(MouseEvent me)
Invoked when the mouse enters the Editor. |
void |
mouseExited(MouseEvent me)
Invoked when the mouse exits the Editor. |
void |
mouseMoved(MouseEvent me)
Invoked when the mouse button has been moved (with no buttons no down). |
void |
mousePressed(MouseEvent me)
Invoked when a mouse button has been pressed. |
void |
mouseReleased(MouseEvent me)
Invoked when a mouse button has been released. |
void |
paint(Graphics g)
Paints the graphs nodes by calling paint() on layers, selections, and mode. |
void |
postLoad()
Called after the Editor is loaded from a file. |
void |
postSave()
Called after the Editor is saved to a file. |
void |
preSave()
Called before the Editor is saved to a file. |
void |
print(Graphics g)
|
void |
remove(Fig f)
Remove a Fig from the diagram being edited. |
void |
removed(Fig f)
The given Fig was removed from the diagram this Editor is showing. |
void |
removeGraphSelectionListener(GraphSelectionListener listener)
Stop notifing listener of selection changes. |
void |
removeModeChangeListener(ModeChangeListener listener)
Stop notifing listener of mode changes. |
void |
repairDamage()
Tell my RedrawManager to repair all outstanding damaged regions now. |
void |
scrollToShow(int x,
int y)
Scroll the JGraph so that the given point is visible. |
void |
setActiveTextEditor(FigTextEditor fte)
|
void |
setAwtComponent(Component c)
|
void |
setCursor(Cursor c)
|
void |
setGraphEdgeRenderer(GraphEdgeRenderer rend)
|
void |
setGraphModel(GraphModel gm)
|
void |
setGraphNodeRenderer(GraphNodeRenderer rend)
|
void |
setGuide(Guide g)
|
protected void |
setUnderMouse(MouseEvent me)
Find the Fig under the mouse, and the node it represents, if any |
void |
snap(Point p)
Modify the given point to be on the guideline (In this case, a gridline). |
| Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
public static final int GRIP_SIZE
protected ModeManager _modeManager
ModeModify,
ModeSelect,
ModePlaceprotected Object _document
protected SelectionManager _selectionManager
protected LayerManager _layerManager
protected Guide _guide
protected Fig _curFig
protected Selection _curSel
protected transient FigTextEditor _activeTextEditor
protected static Rectangle _hitRect
| Constructor Detail |
public Editor(GraphModel gm,
Component awt_comp)
public Editor(GraphModel gm)
public Editor()
public Editor(Diagram d)
public Editor(GraphModel gm,
Component awt_comp,
Layer lay)
| Method Detail |
protected void defineLayers(GraphModel gm,
Layer lay)
public void preSave()
public void postSave()
public void postLoad()
public Object clone()
public ModeManager getModeManager()
public void mode(Mode m)
public void finishMode()
public LayerManager getLayerManager()
public GraphModel getGraphModel()
public void setGraphModel(GraphModel gm)
public GraphNodeRenderer getGraphNodeRenderer()
public void setGraphNodeRenderer(GraphNodeRenderer rend)
public GraphEdgeRenderer getGraphEdgeRenderer()
public void setGraphEdgeRenderer(GraphEdgeRenderer rend)
public Enumeration figs()
public void add(Fig f)
public void remove(Fig f)
public final Fig hit(Point p)
public final Fig hit(int x,
int y)
public final Fig hit(int x,
int y,
int w,
int h)
public Fig hit(Rectangle r)
protected void setUnderMouse(MouseEvent me)
public Object document()
public void document(Object d)
public void snap(Point p)
public Guide getGuide()
public void setGuide(Guide g)
public void damaged(Rectangle r)
public void damaged(Fig f)
public void damaged(Selection sel)
public void damageAll()
public void repairDamage()
public void paint(Graphics g)
RedrawManagerpublic void print(Graphics g)
public void scrollToShow(int x,
int y)
public SelectionManager getSelectionManager()
public Component getAwtComponent()
public void setAwtComponent(Component c)
public void setActiveTextEditor(FigTextEditor fte)
public void setCursor(Cursor c)
public Graphics getGraphics()
public Frame findFrame()
public Image createImage(int w,
int h)
public Color getBackground()
public void addGraphSelectionListener(GraphSelectionListener listener)
public void removeGraphSelectionListener(GraphSelectionListener listener)
public void addModeChangeListener(ModeChangeListener listener)
public void removeModeChangeListener(ModeChangeListener listener)
public void mouseClicked(MouseEvent me)
public void mousePressed(MouseEvent me)
public void mouseReleased(MouseEvent me)
public void mouseEntered(MouseEvent me)
public void mouseExited(MouseEvent me)
public void mouseDragged(MouseEvent me)
public void mouseMoved(MouseEvent me)
public void keyTyped(KeyEvent ke)
public void keyPressed(KeyEvent ke)
public void keyReleased(KeyEvent ke)
public void executeCmd(Cmd c,
InputEvent ie)
public void removed(Fig f)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||