JGraphpad Pro
v6.0.5.0


com.jgraph.pad.graph
Class JGraphpadTransferHandler

java.lang.Object
  extended byjavax.swing.TransferHandler
      extended byorg.jgraph.graph.GraphTransferHandler
          extended bycom.jgraph.pad.graph.JGraphpadTransferHandler
All Implemented Interfaces:
Serializable

public class JGraphpadTransferHandler
extends org.jgraph.graph.GraphTransferHandler

Transfer handler for graphs that accepts external files and text.

See Also:
Serialized Form

Field Summary
protected  Object prototype
          Holds the prototype which is used to create new vertices.
 
Fields inherited from class org.jgraph.graph.GraphTransferHandler
alwaysReceiveAsCopyAction, in, inCount, out
 
Fields inherited from class javax.swing.TransferHandler
COPY, COPY_OR_MOVE, MOVE, NONE
 
Constructor Summary
JGraphpadTransferHandler(Object prototype)
          Constructs a new transfer handler for the specified prototype.
 
Method Summary
 boolean canImport(JComponent comp, DataFlavor[] flavors)
          Extends the parent implementation to accept text and DataFlavor.javaFileListFlavor flavors.
protected  Object createCell(org.jgraph.graph.GraphModel model, Object userObject)
          Constructs a new cell from prototype using the specified model and assigns it the new user object.
protected  Point2D getInsertionLocation(org.jgraph.JGraph graph)
          Helper method to return the insertion location for a drop operation in the specified graph.
protected  String getString(Reader reader)
          Helper method to read the specified reader into a string.
 boolean importDataImpl(JComponent comp, Transferable t)
          Overrides the parent implementation to import transferable data.
protected  void insertValues(org.jgraph.JGraph graph, Point2D p, Object[] values)
          Inserts the specified list of values into the specified graph.
 
Methods inherited from class org.jgraph.graph.GraphTransferHandler
create, createTransferable, createTransferable, createTransferableForGraph, exportDone, getInsertionOffset, getSourceActions, handleExternalDrop, importData, isAlwaysReceiveAsCopyAction, setAlwaysReceiveAsCopyAction
 
Methods inherited from class javax.swing.TransferHandler
exportAsDrag, exportToClipboard, getCopyAction, getCutAction, getPasteAction, getVisualRepresentation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

prototype

protected transient Object prototype
Holds the prototype which is used to create new vertices.

Constructor Detail

JGraphpadTransferHandler

public JGraphpadTransferHandler(Object prototype)
Constructs a new transfer handler for the specified prototype.

Parameters:
prototype - The prototype to be used to create new cells.
Method Detail

createCell

protected Object createCell(org.jgraph.graph.GraphModel model,
                            Object userObject)
Constructs a new cell from prototype using the specified model and assigns it the new user object.

Parameters:
model - The model to use for cloning the prototype.
userObject - The user object to be assigned to the clone.
Returns:
Returns a prototype clone with the specified user object.

canImport

public boolean canImport(JComponent comp,
                         DataFlavor[] flavors)
Extends the parent implementation to accept text and DataFlavor.javaFileListFlavor flavors.

Parameters:
comp - The component to drop the transferable to.
flavors - The supported data flavors of the transferable.
Returns:
Returns true if the flavor is accepted.

importDataImpl

public boolean importDataImpl(JComponent comp,
                              Transferable t)
Overrides the parent implementation to import transferable data. Note: It is a special rule in JGraph not to override the GraphTransferHandler.importData(JComponent, Transferable) method because the return value has a different semantic. This implementation silently ignores all exceptions.

Parameters:
comp - The component to drop the transferable to.
t - The transferable data to be inserted into the component.
Returns:
Returns true if the transferable data was inserted.

getInsertionLocation

protected Point2D getInsertionLocation(org.jgraph.JGraph graph)
Helper method to return the insertion location for a drop operation in the specified graph. This implementation returns a scaled clone of BasicGraphUI.getInsertionLocation() or a dummy point if the insertion location is not available in the graph ui.

Parameters:
graph - The graph to determine the insertion location for.
Returns:
Returns the insertion location for the specified graph.

getString

protected String getString(Reader reader)
                    throws IOException
Helper method to read the specified reader into a string.

Parameters:
reader - The reader to read into the string.
Returns:
Returns the string stored in the reader.
Throws:
IOException

insertValues

protected void insertValues(org.jgraph.JGraph graph,
                            Point2D p,
                            Object[] values)
Inserts the specified list of values into the specified graph. If a known image extension is seen then the icon attribute is setup accordingly.

Parameters:
graph - The graph to insert the cells into.
p - The point at which to insert the cells.
values - The list of values to be inserted.

JGraphpad Pro
v6.0.5.0


Copyright (C) 2005 JGraph.com. All rights reserved.