|
JGraphpad Pro
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.jgraph.graph.BasicMarqueeHandler
com.jgraph.editor.JGraphEditorTool
com.jgraph.pad.tool.JGraphpadVertexTool
Tool that inserts vertices based on a prototype.
| Field Summary | |
static String |
NAME_VERTEXTOOL
Defines the default name for tools of this kind. |
protected boolean |
previewEnabled
Specifies if the cellview should be previewed. |
protected org.jgraph.graph.CellView |
previewView
Preview vertex view. |
protected Object |
prototype
Holds the prototype to create new cells with. |
protected Dimension |
singleClickSize
Defines the default size for vertices that are generated with a single click. |
protected int |
threshold
Defines the threshhold (minimum size) for a drag to be used for an insert. |
| Fields inherited from class com.jgraph.editor.JGraphEditorTool |
isAlwaysActive, name |
| Fields inherited from class org.jgraph.graph.BasicMarqueeHandler |
currentPoint, marqueeBounds, previousCursor, startPoint |
| Constructor Summary | |
JGraphpadVertexTool(Object prototype)
Constructs a new vertex tool for the specified prototype using NAME_VERTEXTOOL. |
|
JGraphpadVertexTool(String name,
Object prototype)
Constructs a new vertex tool for the specified name and prototype. |
|
| Method Summary | |
protected Object |
createCell(org.jgraph.graph.GraphModel model)
Returns a deep clone of the cell prototype. |
protected void |
execute(org.jgraph.JGraph graph,
Object cell)
Provides a hook for subclassers to insert the specified cell into cache. |
Object |
getPrototype()
Returns the prototype used to create new cells. |
Dimension |
getSingleClickSize()
Returns the single click size which should be used to insert cells with a single click. |
int |
getThreshold()
Returns the threshold for a drag to count as an insert. |
protected boolean |
isConstrainedSizeEvent(MouseEvent event)
Hook for subclassers to define the key assignments for constrained inserts. |
boolean |
isPreviewEnabled()
Sets if the cellview should be previewed. |
void |
mousePressed(MouseEvent event)
Extends the parent's implementation to create a clone of the pototype using createCell(GraphModel) and a new view using the layout
cache's factory. |
void |
mouseReleased(MouseEvent event)
Overrides the parent's implementation to check if the event triggers an insert (checks threshold & singleClickSize) and
inserts the cell stored in previewView using
#execute(GraphLayoutCache, Object). |
void |
overlay(org.jgraph.JGraph graph,
Graphics g,
boolean clear)
Extends the parent's implementation to draw the previewView. |
protected void |
processMouseDraggedEvent(MouseEvent event)
Overrides the parent's implementation to update the preview bounds to the current BasicMarqueeHandler.marqueeBounds. |
void |
setPreviewEnabled(boolean previewEnabled)
Returns if the cellview should be previewed. |
void |
setPrototype(Object prototype)
Sets the prototype to be used to create new cells. |
void |
setSingleClickSize(Dimension singleClickSize)
Sets the size of cells to be inserted with a single click. |
void |
setThreshold(int threshold)
Sets the threshold for a drag to count as an insert. |
| Methods inherited from class com.jgraph.editor.JGraphEditorTool |
getName, isAlwaysActive, setAlwaysActive, setName |
| Methods inherited from class org.jgraph.graph.BasicMarqueeHandler |
getCurrentPoint, getGraphForEvent, getMarqueeBounds, getPreviousCursor, getStartPoint, handleMarqueeEvent, isForceMarqueeEvent, isMarqueeTriggerEvent, mouseDragged, mouseMoved, paint, setCurrentPoint, setMarqueeBounds, setPreviousCursor, setStartPoint |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final String NAME_VERTEXTOOL
protected Object prototype
protected int threshold
protected Dimension singleClickSize
protected transient org.jgraph.graph.CellView previewView
protected transient boolean previewEnabled
| Constructor Detail |
public JGraphpadVertexTool(Object prototype)
NAME_VERTEXTOOL.
prototype - The prototype cell to create new vertices with.
public JGraphpadVertexTool(String name,
Object prototype)
name - The name of the tool to be created.prototype - The prototype cell to create new vertices with.| Method Detail |
public Object getPrototype()
public void setPrototype(Object prototype)
prototype - The prototype to set.public Dimension getSingleClickSize()
public void setSingleClickSize(Dimension singleClickSize)
singleClickSize - The singleClickSize to set.public int getThreshold()
public void setThreshold(int threshold)
threshold - The threshold to set.public boolean isPreviewEnabled()
public void setPreviewEnabled(boolean previewEnabled)
previewEnabled - The previewEnabled to set.public void mousePressed(MouseEvent event)
createCell(GraphModel) and a new view using the layout
cache's factory. The view is then configured and stored in
previewView.
event - The object that describes the event.protected Object createCell(org.jgraph.graph.GraphModel model)
model - The model to use for cloning the prototype.
prototype.protected void processMouseDraggedEvent(MouseEvent event)
BasicMarqueeHandler.marqueeBounds.
event - The object that describes the event.protected boolean isConstrainedSizeEvent(MouseEvent event)
BasicGraphUI.isConstrainedMoveEvent(MouseEvent).
event - The object that describes the event.public void mouseReleased(MouseEvent event)
threshold & singleClickSize) and
inserts the cell stored in previewView using
#execute(GraphLayoutCache, Object).
event - The object that describes the event.
protected void execute(org.jgraph.JGraph graph,
Object cell)
cache. This implementation passes the cell to the
GraphLayoutCache.insert(Object).
cell - The cell to be inserted into cache.
public void overlay(org.jgraph.JGraph graph,
Graphics g,
boolean clear)
previewView.
graph - The graph to paint in.g - The graphics to use for paiting.clear - Wether to clear the display.
|
JGraphpad Pro
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||