org.jgraph.pad
Class GPDocument

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byorg.jgraph.pad.GPDocument
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ComponentListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.print.Printable, java.beans.PropertyChangeListener, java.io.Serializable

public class GPDocument
extends javax.swing.JPanel
implements java.awt.event.ComponentListener, java.awt.print.Printable, java.beans.PropertyChangeListener

A Document represents a single instance of a graph view with associated library and overview panes. The document deal with a lot of the listening required on the graph, prompting for save if modified, undo handling and top level UI issues relating to pane positioning.

See Also:
Serialized Form

Nested Class Summary
protected  class GPDocument.EventRedirector
          This will change the source of the actionevent to graph.
 
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
protected  Rule columnRule
          The column rule for the graph
protected  boolean enableTooltips
           
protected  java.net.URL file
          Filename for the current document.
protected  java.lang.String findPattern
          contains the find pattern for this document
protected  javax.swing.Action fitAction
          Action used for fitting the size
protected  GPGraph graph
          The joint graph for this document
protected  GPGraphpad graphpad
          A reference to the top level component
protected  GraphUndoManager graphUndoManager
          The graphUndoManager manager for the joint graph.
protected  GPInternalFrame internalFrame
          a reference to the internal Frame
protected static boolean isMetric
          true if the current graph is Metric.
protected  java.lang.Object lastFound
          contains the last found object
protected static boolean libraryExpanded
          true if the library expand is expanded default is true
protected  GPLibraryPanel libraryPanel
          The left site of this document Shows the libraries
protected  boolean modified
          True if this documents graph model was modified since last save.
protected  GraphNetworkModel networkModel
           
protected  javax.swing.JDialog overviewDialog
          The overview Dialog for this document.
protected  Rule rowRule
          The row rule for the graph
protected  javax.swing.JScrollPane scrollPane
          Container for the graph so that you can scroll over the graph
protected static boolean showRuler
          true if the ruler show is activated
protected  GPSplitPane splitPane
          Splitpane between the libraries and the graph
protected  Touch touch
          On the fly layout
protected  UndoHandler undoHandler
          The graphUndoManager handler for the current document.
 
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.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
GPDocument(GPGraphpad graphpad, java.net.URL file, GPGraph gpGraph, GraphModel model)
          Constructor for GPDocument.
 
Method Summary
 boolean close(boolean showConfirmDialog)
          Returns true if the user really wants to close.
 void componentHidden(java.awt.event.ComponentEvent e)
           
 void componentMoved(java.awt.event.ComponentEvent e)
           
 void componentResized(java.awt.event.ComponentEvent e)
           
 void componentShown(java.awt.event.ComponentEvent e)
           
protected  java.awt.Component createCenterComponent()
          Create the center component of this panel.
protected  GraphUndoManager createGraphUndoManager()
           
protected  GPLibraryPanel createLibrary()
           
protected  java.awt.Component createScrollPane()
           
 Rule getColumnRule()
          Returns the columnRule.
protected  java.lang.String getDocumentScale()
           
protected  java.lang.String getDocumentStatus()
           
protected  java.lang.String getDocumentTitle()
           
 java.net.URL getFilename()
          Returns the filename.
 java.lang.String getFindPattern()
          Returns the findPattern.
 java.lang.String getFrameTitle()
           
 GPGraph getGraph()
          Fetch the editor contained in this panel
 GraphLayoutCache getGraphLayoutCache()
          Returns the view from the current graph
 GPGraphpad getGraphpad()
          Returns the graphpad.
protected  GPGraphUI getGraphUI()
          returns the GPGraph UI
 GraphUndoManager getGraphUndoManager()
          Returns the graphUndoManager.
 GPInternalFrame getInternalFrame()
          Returns the internalFrame.
 java.lang.Object getLastFound()
          Returns the lastFound.
 GPLibraryPanel getLibraryPanel()
           
 GraphModel getModel()
          Returns the model of the graph
 GraphNetworkModel getNetworkModel()
          Returns the networkModel.
 javax.swing.JDialog getOverviewDialog()
          Returns the overviewDialog.
 Rule getRowRule()
          Returns the rowRule.
 javax.swing.JScrollPane getScrollPane()
          Returns the scrollPane.
 GPSplitPane getSplitPane()
          Returns the splitPane.
 Touch getTouch()
          Returns the touch.
 void graphChanged(GraphModelEvent e)
           
 void graphLayoutCacheChanged(GraphLayoutCacheEvent e)
           
 boolean isEnableTooltips()
          Returns the enableTooltips.
 int print(java.awt.Graphics g, java.awt.print.PageFormat pF, int page)
           
 void propertyChange(java.beans.PropertyChangeEvent evt)
           
protected  void registerListeners(JGraph graph)
           
 void resetGraphUndoManager()
          Resets the Graph undo manager
 void setColumnRule(Rule columnRule)
          Sets the columnRule.
 void setEnableTooltips(boolean enableTooltips)
          Sets the enableTooltips.
 void setFilename(java.net.URL filename)
          Sets the filename.
 void setFindPattern(java.lang.String findPattern)
          Sets the findPattern.
 void setFontNameForSelection(java.lang.String name)
           
 void setFontSizeForSelection(float size)
           
 void setFontStyleForSelection(int style)
           
 void setGraphpad(GPGraphpad graphpad)
          Sets the graphpad.
 void setGraphUndoManager(GraphUndoManager graphUndoManager)
          Sets the graphUndoManager.
protected  void setInternalFrame(GPInternalFrame internalFrame)
          Sets the internalFrame.
 void setLastFound(java.lang.Object lastFound)
          Sets the lastFound.
 void setModified(boolean modified)
           
 void setNetworkModel(GraphNetworkModel networkModel)
          Sets the networkModel.
 void setOverviewDialog(javax.swing.JDialog overviewDialog)
          Sets the overviewDialog.
 void setResizeAction(javax.swing.AbstractAction e)
           
 void setRowRule(Rule rowRule)
          Sets the rowRule.
 void setScale(double scale)
           
 void setScrollPane(javax.swing.JScrollPane scrollPane)
          Sets the scrollPane.
 void setSelectionAttributes(java.util.Map map)
           
 void setSplitPane(GPSplitPane splitPane)
          Sets the splitPane.
 void setTouch(Touch touch)
          Sets the touch.
protected  void unregisterListeners(JGraph graph)
           
protected  void update()
           
protected  void updateFrameTitle()
           
 void updatePageFormat()
          not from Printable interface, but related
 void valueChanged(GraphSelectionEvent e)
           
 
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

enableTooltips

protected boolean enableTooltips

file

protected java.net.URL file
Filename for the current document. Null if never saved or opened.


graphpad

protected GPGraphpad graphpad
A reference to the top level component


splitPane

protected GPSplitPane splitPane
Splitpane between the libraries and the graph


libraryPanel

protected GPLibraryPanel libraryPanel
The left site of this document Shows the libraries


scrollPane

protected javax.swing.JScrollPane scrollPane
Container for the graph so that you can scroll over the graph


graph

protected GPGraph graph
The joint graph for this document


overviewDialog

protected javax.swing.JDialog overviewDialog
The overview Dialog for this document. Can be null.


columnRule

protected Rule columnRule
The column rule for the graph


rowRule

protected Rule rowRule
The row rule for the graph


graphUndoManager

protected GraphUndoManager graphUndoManager
The graphUndoManager manager for the joint graph.

See Also:
graph

undoHandler

protected UndoHandler undoHandler
The graphUndoManager handler for the current document. Each document has his own handler. So you can make an graphUndoManager seperate for each document.


touch

protected Touch touch
On the fly layout


modified

protected boolean modified
True if this documents graph model was modified since last save.


isMetric

protected static boolean isMetric
true if the current graph is Metric. default is true.


libraryExpanded

protected static boolean libraryExpanded
true if the library expand is expanded default is true


showRuler

protected static boolean showRuler
true if the ruler show is activated


fitAction

protected javax.swing.Action fitAction
Action used for fitting the size


findPattern

protected java.lang.String findPattern
contains the find pattern for this document


lastFound

protected java.lang.Object lastFound
contains the last found object


internalFrame

protected GPInternalFrame internalFrame
a reference to the internal Frame


networkModel

protected GraphNetworkModel networkModel
Constructor Detail

GPDocument

public GPDocument(GPGraphpad graphpad,
                  java.net.URL file,
                  GPGraph gpGraph,
                  GraphModel model)
Constructor for GPDocument.

Method Detail

getFilename

public java.net.URL getFilename()
Returns the filename.

Returns:
String

setFilename

public void setFilename(java.net.URL filename)
Sets the filename.

Parameters:
filename - The filename to set

createCenterComponent

protected java.awt.Component createCenterComponent()
Create the center component of this panel. This creates a scroll- pane for the current graph variable and stores the scrollpane in the scrollPane variable.


createScrollPane

protected java.awt.Component createScrollPane()

createLibrary

protected GPLibraryPanel createLibrary()

createGraphUndoManager

protected GraphUndoManager createGraphUndoManager()

getGraph

public GPGraph getGraph()
Fetch the editor contained in this panel


getModel

public GraphModel getModel()
Returns the model of the graph


getGraphUI

protected GPGraphUI getGraphUI()
returns the GPGraph UI


getGraphLayoutCache

public GraphLayoutCache getGraphLayoutCache()
Returns the view from the current graph


registerListeners

protected void registerListeners(JGraph graph)

unregisterListeners

protected void unregisterListeners(JGraph graph)

setModified

public void setModified(boolean modified)

getDocumentTitle

protected java.lang.String getDocumentTitle()

getDocumentStatus

protected java.lang.String getDocumentStatus()

getDocumentScale

protected java.lang.String getDocumentScale()

setSelectionAttributes

public void setSelectionAttributes(java.util.Map map)

setFontSizeForSelection

public void setFontSizeForSelection(float size)

setFontStyleForSelection

public void setFontStyleForSelection(int style)

setFontNameForSelection

public void setFontNameForSelection(java.lang.String name)

setResizeAction

public void setResizeAction(javax.swing.AbstractAction e)

componentHidden

public void componentHidden(java.awt.event.ComponentEvent e)
Specified by:
componentHidden in interface java.awt.event.ComponentListener

componentMoved

public void componentMoved(java.awt.event.ComponentEvent e)
Specified by:
componentMoved in interface java.awt.event.ComponentListener

componentResized

public void componentResized(java.awt.event.ComponentEvent e)
Specified by:
componentResized in interface java.awt.event.ComponentListener

componentShown

public void componentShown(java.awt.event.ComponentEvent e)
Specified by:
componentShown in interface java.awt.event.ComponentListener

setScale

public void setScale(double scale)

updatePageFormat

public void updatePageFormat()
not from Printable interface, but related


print

public int print(java.awt.Graphics g,
                 java.awt.print.PageFormat pF,
                 int page)
Specified by:
print in interface java.awt.print.Printable

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener

valueChanged

public void valueChanged(GraphSelectionEvent e)

graphLayoutCacheChanged

public void graphLayoutCacheChanged(GraphLayoutCacheEvent e)

graphChanged

public void graphChanged(GraphModelEvent e)

update

protected void update()

getGraphUndoManager

public GraphUndoManager getGraphUndoManager()
Returns the graphUndoManager.

Returns:
GraphUndoManager

setGraphUndoManager

public void setGraphUndoManager(GraphUndoManager graphUndoManager)
Sets the graphUndoManager.

Parameters:
graphUndoManager - The graphUndoManager to set

resetGraphUndoManager

public void resetGraphUndoManager()
Resets the Graph undo manager


getGraphpad

public GPGraphpad getGraphpad()
Returns the graphpad.

Returns:
GPGraphpad

setGraphpad

public void setGraphpad(GPGraphpad graphpad)
Sets the graphpad.

Parameters:
graphpad - The graphpad to set

getTouch

public Touch getTouch()
Returns the touch.

Returns:
Touch

setTouch

public void setTouch(Touch touch)
Sets the touch.

Parameters:
touch - The touch to set

close

public boolean close(boolean showConfirmDialog)
Returns true if the user really wants to close. Gives chance to save work.


getLibraryPanel

public GPLibraryPanel getLibraryPanel()

getFindPattern

public java.lang.String getFindPattern()
Returns the findPattern.

Returns:
String

setFindPattern

public void setFindPattern(java.lang.String findPattern)
Sets the findPattern.

Parameters:
findPattern - The findPattern to set

getLastFound

public java.lang.Object getLastFound()
Returns the lastFound.

Returns:
Object

setLastFound

public void setLastFound(java.lang.Object lastFound)
Sets the lastFound.

Parameters:
lastFound - The lastFound to set

getOverviewDialog

public javax.swing.JDialog getOverviewDialog()
Returns the overviewDialog.

Returns:
JDialog

setOverviewDialog

public void setOverviewDialog(javax.swing.JDialog overviewDialog)
Sets the overviewDialog.

Parameters:
overviewDialog - The overviewDialog to set

getSplitPane

public GPSplitPane getSplitPane()
Returns the splitPane.

Returns:
JSplitPane

setSplitPane

public void setSplitPane(GPSplitPane splitPane)
Sets the splitPane.

Parameters:
splitPane - The splitPane to set

getScrollPane

public javax.swing.JScrollPane getScrollPane()
Returns the scrollPane.

Returns:
JScrollPane

setScrollPane

public void setScrollPane(javax.swing.JScrollPane scrollPane)
Sets the scrollPane.

Parameters:
scrollPane - The scrollPane to set

getColumnRule

public Rule getColumnRule()
Returns the columnRule.

Returns:
Rule

getRowRule

public Rule getRowRule()
Returns the rowRule.

Returns:
Rule

setColumnRule

public void setColumnRule(Rule columnRule)
Sets the columnRule.

Parameters:
columnRule - The columnRule to set

setRowRule

public void setRowRule(Rule rowRule)
Sets the rowRule.

Parameters:
rowRule - The rowRule to set

isEnableTooltips

public boolean isEnableTooltips()
Returns the enableTooltips.

Returns:
boolean

setEnableTooltips

public void setEnableTooltips(boolean enableTooltips)
Sets the enableTooltips.

Parameters:
enableTooltips - The enableTooltips to set

getInternalFrame

public GPInternalFrame getInternalFrame()
Returns the internalFrame.

Returns:
GPInternalFrame

setInternalFrame

protected void setInternalFrame(GPInternalFrame internalFrame)
Sets the internalFrame.

Parameters:
internalFrame - The internalFrame to set

updateFrameTitle

protected void updateFrameTitle()

getFrameTitle

public java.lang.String getFrameTitle()

getNetworkModel

public GraphNetworkModel getNetworkModel()
Returns the networkModel.

Returns:
GraphNetworkModel

setNetworkModel

public void setNetworkModel(GraphNetworkModel networkModel)
Sets the networkModel.

Parameters:
networkModel - The networkModel to set