org.jgraph
Class GPGraphpad

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byorg.jgraph.GPGraphpad
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class GPGraphpad
extends javax.swing.JPanel

this is the main JPanel where GPGraph instances and buttons are displayed. Subclass it to override its default behavior. If you only need small modifications, then you might think about properly setting GPGraphpad with its setters methods.

See Also:
Serialized Form

Nested Class Summary
protected  class GPGraphpad.AppCloser
          To shutdown when run as an application.
 
Nested classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 JGraphpad applet
          Pointer to enclosing JGraphpad applet, if any
static javax.swing.ImageIcon applicationIcon
          Application Icon.
protected static java.lang.String appTitle
          Application Title.
protected  GPBarFactory barFactory
          A factory for the menu, tool and popup bars
protected  GPConfiguration configuration
           
protected  javax.swing.ActionMap currentActionMap
          ActionMap contains the current ActionMap.
protected  javax.swing.ActionMap defaultActionMap
          ActionMap contains all default Actions for this application
protected  javax.swing.JDesktopPane desktop
          Desktoppane for the internal frames
protected  java.util.Hashtable doc2InternalFrame
          Contains the mapping between GPDocument objects and GPInternalFrames.
 java.lang.String downloadPath
           
protected static int entrySize
          Default entry size
protected static java.lang.String FRAME_HEIGHT
          Key for the Registry to save and load the frame height for the graphpad frame
protected static java.lang.String FRAME_STATE
          Key for the Registry to save and load the frame state for the graphpad frame
protected static java.lang.String FRAME_WIDTH
          Key for the Registry to save and load the frame width for the graphpad frame
protected static java.lang.String FRAME_X
          Key for the Registry to save and load the frame x position for the graphpad frame
protected static java.lang.String FRAME_Y
          Key for the Registry to save and load the frame y position for the graphpad frame
protected static GPGraphTools graphTools
          Global instance for some graph tool implementations.
 java.lang.String hostName
           
 java.lang.String hostPort
           
protected  GPLogConsole logger
          Log console for the System in and out messages
protected static javax.swing.ImageIcon logoIcon
          Application Icon.
protected  javax.swing.JPanel mainPanel
          The main Panel with the status bar and the desktop pane
 java.lang.String mapFile
           
protected  GPMarqueeHandler marqueeHandler
           
protected  javax.swing.JMenuBar menubar
          The current Menubar for this graphpad
 java.lang.String protocol
           
protected  GPStatusBar statusbar
          The current Statusbar for this Graphpad instance
protected  javax.swing.JPanel toolBarInnerPanel
          The current Toolbar for this graphpad
protected  javax.swing.JPanel toolBarMainPanel
          The current Toolbar for this graphpad
protected  boolean toolBarsVisible
          Boolean for the visible state of the toolbars
 java.lang.String uploadFile
           
 java.lang.String uploadPath
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
GPGraphpad()
          Creates a new default instance
GPGraphpad(GPConfiguration config, java.lang.String protocol, java.lang.String hostName, java.lang.String hostPort, java.lang.String downloadPath, java.lang.String uploadPath, java.lang.String uploadFile, java.lang.String mapFile, JGraphpad applet)
          Creates a new instance with the configuration from the config object.
GPGraphpad(JGraphpad applet)
          Creates a new default instance
GPGraphpad(java.lang.String protocol, java.lang.String hostName, java.lang.String hostPort, java.lang.String downloadPath, java.lang.String uploadPath, java.lang.String uploadFile, java.lang.String mapFile)
          Creates a new default instance
 
Method Summary
 void addDesktopContainerListener(java.awt.event.ContainerListener listener)
           
 void addDocument()
          Adds a new Document based on the GraphModelProvider.
 void addDocument(java.net.URL file)
          You can add a document by giving the filename.
 void addDocument(java.net.URL file, GPGraph gpGraph, GraphModel model, GraphUndoManager undo)
          Opens a new document frame based on the parameters
 void addGPInternalFrame(GPInternalFrame f)
          Adds a new Internal Frame to the Graphpad
protected  java.awt.event.WindowAdapter createAppCloser(java.awt.Frame frame)
          Creates a shutdown routine.
protected  GPBarFactory createBarFactory()
          Creates a barFactory.
protected  javax.swing.JFrame createFrame()
          Creates a frame for this Graphpad panel
 GPGraph createGraphInstance()
          In order one can customize the JGraphpad behavior by subclassing GPGraphpad, any instanciation of graph must use this method.
protected  GPStatusBar createStatusBar()
          Create a status bar
 void error(java.lang.String message)
          Show a dialog with the given error message.
 void exit()
          Adds a new Document based on the GraphModelProvider.
 void fillDefaultActionMap()
           
 GPDocument[] getAllDocuments()
          Returns all of the documents.
 javax.swing.JInternalFrame[] getAllFrames()
           
 JGraphpad getApplet()
          Adds a new Document based on the GraphModelProvider.
static javax.swing.ImageIcon getApplicationIcon()
          Returns the applicationIcon.
 GPBarFactory getBarFactory()
          Returns the barFactory.
 VertexnPortsCreatorInterface[] getCellToolBoxes()
           
 javax.swing.ActionMap getCurrentActionMap()
          Returns the current Action Map
 GPDocument getCurrentDocument()
          Returns the currently selected document.
 GPGraph getCurrentGraph()
          Returns the current graph.
 javax.swing.JInternalFrame getCurrentInternalFrame()
          Returns the currently selected internal frame If no one is selected, then the first one will be select.
 javax.swing.Action[] getDefaultActions()
           
 AbstractActionDefault getEditRedoAction()
          Returns the redoAction.
 AbstractActionDefault getEditUndoAction()
          Returns the undoAction.
 DefaultGraphModelFileFormatXML getFileFormat()
           
 java.awt.Frame getFrame()
          Find the hosting frame, for the file-chooser dialog.
static GPGraphTools getGraphTools()
          Returns the graphTools.
 GPLogConsole getLogConsole()
           
 GPMarqueeHandler getMarqueeHandler()
          Returns the marqueeHandler.
 javax.swing.JMenuBar getMenubar()
           
 GPStatusBar getStatusBar()
           
 boolean isApplet()
          Adds a new Document based on the GraphModelProvider.
 boolean isToolBarsVisible()
           
 void removeDesktopContainerListener(java.awt.event.ContainerListener listener)
           
 void removeDocument(GPDocument doc)
           
 void removeGPInternalFrame(GPInternalFrame f)
          removes the specified Internal Frame from the Graphpad
 void setApplet(JGraphpad applet)
          Adds a new Document based on the GraphModelProvider.
static void setApplicationIcon(javax.swing.ImageIcon applicationIcon)
          Sets the applicationIcon.
 void setBarFactory(GPBarFactory barFactory)
          Sets the barFactory.
 void setCellToolBoxes(VertexnPortsCreatorInterface[] cellToolBoxes)
           
 void setDefaultActions(javax.swing.Action[] defaultActions)
           
 void setFileFormat(DefaultGraphModelFileFormatXML fileFormat)
           
protected  void setMe4Actions()
           
 void setParentActionMap(javax.swing.ActionMap map)
           
 void setToolBarsVisible(boolean state)
           
 void update()
           
 void upload(GPGraph graph)
           
 void uploadMap(GPGraph graph)
           
 void uploadPNG(java.awt.image.BufferedImage image)
           
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

applet

public transient JGraphpad applet
Pointer to enclosing JGraphpad applet, if any


applicationIcon

public static javax.swing.ImageIcon applicationIcon
Application Icon. From resource file.


logoIcon

protected static javax.swing.ImageIcon logoIcon
Application Icon. From resource file.


appTitle

protected static java.lang.String appTitle
Application Title. From resource file.


entrySize

protected static int entrySize
Default entry size


FRAME_WIDTH

protected static java.lang.String FRAME_WIDTH
Key for the Registry to save and load the frame width for the graphpad frame


FRAME_HEIGHT

protected static java.lang.String FRAME_HEIGHT
Key for the Registry to save and load the frame height for the graphpad frame


FRAME_STATE

protected static java.lang.String FRAME_STATE
Key for the Registry to save and load the frame state for the graphpad frame


FRAME_X

protected static java.lang.String FRAME_X
Key for the Registry to save and load the frame x position for the graphpad frame


FRAME_Y

protected static java.lang.String FRAME_Y
Key for the Registry to save and load the frame y position for the graphpad frame


toolBarsVisible

protected boolean toolBarsVisible
Boolean for the visible state of the toolbars


graphTools

protected static GPGraphTools graphTools
Global instance for some graph tool implementations.


logger

protected GPLogConsole logger
Log console for the System in and out messages


desktop

protected javax.swing.JDesktopPane desktop
Desktoppane for the internal frames


doc2InternalFrame

protected java.util.Hashtable doc2InternalFrame
Contains the mapping between GPDocument objects and GPInternalFrames.


barFactory

protected GPBarFactory barFactory
A factory for the menu, tool and popup bars


toolBarMainPanel

protected javax.swing.JPanel toolBarMainPanel
The current Toolbar for this graphpad


toolBarInnerPanel

protected javax.swing.JPanel toolBarInnerPanel
The current Toolbar for this graphpad


menubar

protected javax.swing.JMenuBar menubar
The current Menubar for this graphpad


statusbar

protected GPStatusBar statusbar
The current Statusbar for this Graphpad instance


defaultActionMap

protected javax.swing.ActionMap defaultActionMap
ActionMap contains all default Actions for this application


mainPanel

protected javax.swing.JPanel mainPanel
The main Panel with the status bar and the desktop pane


currentActionMap

protected javax.swing.ActionMap currentActionMap
ActionMap contains the current ActionMap.


marqueeHandler

protected GPMarqueeHandler marqueeHandler

configuration

protected GPConfiguration configuration

protocol

public java.lang.String protocol

hostName

public java.lang.String hostName

hostPort

public java.lang.String hostPort

downloadPath

public java.lang.String downloadPath

uploadPath

public java.lang.String uploadPath

uploadFile

public java.lang.String uploadFile

mapFile

public java.lang.String mapFile
Constructor Detail

GPGraphpad

public GPGraphpad()
Creates a new default instance


GPGraphpad

public GPGraphpad(java.lang.String protocol,
                  java.lang.String hostName,
                  java.lang.String hostPort,
                  java.lang.String downloadPath,
                  java.lang.String uploadPath,
                  java.lang.String uploadFile,
                  java.lang.String mapFile)
Creates a new default instance


GPGraphpad

public GPGraphpad(JGraphpad applet)
Creates a new default instance


GPGraphpad

public GPGraphpad(GPConfiguration config,
                  java.lang.String protocol,
                  java.lang.String hostName,
                  java.lang.String hostPort,
                  java.lang.String downloadPath,
                  java.lang.String uploadPath,
                  java.lang.String uploadFile,
                  java.lang.String mapFile,
                  JGraphpad applet)
Creates a new instance with the configuration from the config object.

Parameters:
config - The configuration object.
Method Detail

upload

public void upload(GPGraph graph)
            throws java.io.IOException
Throws:
java.io.IOException

uploadMap

public void uploadMap(GPGraph graph)
               throws java.io.IOException
Throws:
java.io.IOException

uploadPNG

public void uploadPNG(java.awt.image.BufferedImage image)
               throws java.io.IOException
Throws:
java.io.IOException

createGraphInstance

public GPGraph createGraphInstance()
In order one can customize the JGraphpad behavior by subclassing GPGraphpad, any instanciation of graph must use this method. Then, if you want to user custom graphs, simply define your graph class that should subclass GPGraph and override this method!

Returns:

createFrame

protected javax.swing.JFrame createFrame()
Creates a frame for this Graphpad panel


fillDefaultActionMap

public void fillDefaultActionMap()

setMe4Actions

protected void setMe4Actions()

getCurrentActionMap

public javax.swing.ActionMap getCurrentActionMap()
Returns the current Action Map


createAppCloser

protected java.awt.event.WindowAdapter createAppCloser(java.awt.Frame frame)
Creates a shutdown routine.


getFrame

public java.awt.Frame getFrame()
Find the hosting frame, for the file-chooser dialog.


getMenubar

public javax.swing.JMenuBar getMenubar()

createStatusBar

protected GPStatusBar createStatusBar()
Create a status bar


getStatusBar

public GPStatusBar getStatusBar()

error

public void error(java.lang.String message)
Show a dialog with the given error message.


getCurrentGraph

public GPGraph getCurrentGraph()
Returns the current graph.

Returns:
GPGraph

getCurrentInternalFrame

public javax.swing.JInternalFrame getCurrentInternalFrame()
Returns the currently selected internal frame If no one is selected, then the first one will be select.

Returns:
GPDocument

getCurrentDocument

public GPDocument getCurrentDocument()
Returns the currently selected document. If no one is selected, then the first one will be select.

Returns:
GPDocument

getAllDocuments

public GPDocument[] getAllDocuments()
Returns all of the documents.

Returns:
GPGraphTools or null if no documents

getGraphTools

public static GPGraphTools getGraphTools()
Returns the graphTools.

Returns:
GPGraphTools

getEditUndoAction

public AbstractActionDefault getEditUndoAction()
Returns the undoAction.

Returns:
UndoAction

getEditRedoAction

public AbstractActionDefault getEditRedoAction()
Returns the redoAction.

Returns:
RedoAction

getLogConsole

public GPLogConsole getLogConsole()

isToolBarsVisible

public boolean isToolBarsVisible()

setToolBarsVisible

public void setToolBarsVisible(boolean state)

addGPInternalFrame

public void addGPInternalFrame(GPInternalFrame f)
Adds a new Internal Frame to the Graphpad


removeGPInternalFrame

public void removeGPInternalFrame(GPInternalFrame f)
removes the specified Internal Frame from the Graphpad


exit

public void exit()
Adds a new Document based on the GraphModelProvider.


setApplet

public void setApplet(JGraphpad applet)
Adds a new Document based on the GraphModelProvider.


getApplet

public JGraphpad getApplet()
Adds a new Document based on the GraphModelProvider.


isApplet

public boolean isApplet()
Adds a new Document based on the GraphModelProvider.


addDocument

public void addDocument()
Adds a new Document based on the GraphModelProvider.


addDocument

public void addDocument(java.net.URL file)
You can add a document by giving the filename. Before you can add a document with the specified filename you must add the corresponding GraphModelProvider and the corresponding GraphModelFileFormat at the GraphModelProviderRegistry.

See Also:
org.jgraph.pad.GraphModelProviderRegistry, org.jgraph.pad.GraphModelProvider, org.jgraph.pad.GraphModelFileFormat

addDocument

public void addDocument(java.net.URL file,
                        GPGraph gpGraph,
                        GraphModel model,
                        GraphUndoManager undo)
Opens a new document frame based on the parameters


removeDocument

public void removeDocument(GPDocument doc)

update

public void update()

createBarFactory

protected GPBarFactory createBarFactory()
Creates a barFactory.


getBarFactory

public GPBarFactory getBarFactory()
Returns the barFactory.

Returns:
GPBarFactory

setBarFactory

public void setBarFactory(GPBarFactory barFactory)
Sets the barFactory.

Parameters:
barFactory - The barFactory to set

getAllFrames

public javax.swing.JInternalFrame[] getAllFrames()

setParentActionMap

public void setParentActionMap(javax.swing.ActionMap map)

getApplicationIcon

public static javax.swing.ImageIcon getApplicationIcon()
Returns the applicationIcon.

Returns:
ImageIcon

setApplicationIcon

public static void setApplicationIcon(javax.swing.ImageIcon applicationIcon)
Sets the applicationIcon.

Parameters:
applicationIcon - The applicationIcon to set

getMarqueeHandler

public GPMarqueeHandler getMarqueeHandler()
Returns the marqueeHandler.

Returns:
GPMarqueeHandler

addDesktopContainerListener

public void addDesktopContainerListener(java.awt.event.ContainerListener listener)

removeDesktopContainerListener

public void removeDesktopContainerListener(java.awt.event.ContainerListener listener)

getFileFormat

public DefaultGraphModelFileFormatXML getFileFormat()

setFileFormat

public void setFileFormat(DefaultGraphModelFileFormatXML fileFormat)

getDefaultActions

public javax.swing.Action[] getDefaultActions()

setDefaultActions

public void setDefaultActions(javax.swing.Action[] defaultActions)

getCellToolBoxes

public VertexnPortsCreatorInterface[] getCellToolBoxes()

setCellToolBoxes

public void setCellToolBoxes(VertexnPortsCreatorInterface[] cellToolBoxes)