jcreek.cke.conceptview
Class DrawingSurface

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byjcreek.cke.conceptview.DrawingSurface
All Implemented Interfaces:
javax.accessibility.Accessible, ConceptView, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.print.Printable, java.beans.PropertyChangeListener, java.io.Serializable

public class DrawingSurface
extends javax.swing.JPanel
implements ConceptView, java.beans.PropertyChangeListener

Title: Description: Copyright: Copyright (c) 2002 Company:

Version:
1.0
Author:
See Also:
Serialized Form

Nested Class Summary
 
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  Graph graph
          List of relations from the model.
protected  double hSpacing
           
protected  javax.swing.event.EventListenerList listeners
          List of event listeners.
protected  int MAX_NUM_PAGE
           
protected  CreekModel model
           
protected  VisualEntity rootEnt
           
protected  double vSpacing
           
 
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
DrawingSurface()
           
 
Method Summary
 DPoint activateEntity(VisualEntity activator)
           
 void addResizeListener(ResizeListener rl)
           
 void addViewListener(ConceptViewListener l)
          Adds a view listener to this object's listener list.
 void addViewPaintListener(ConceptViewPaintListener l)
          Adds a view paint listener to this object's listener list.
 void attach(CreekModel model)
          We're being attached to a document for the first time.
 void center()
           
 DDimension contentsSize()
           
 java.awt.image.BufferedImage createPrintImage()
           
 void dataChanged(VertexList vl, RelationList rl)
          Deprectaed, use setGraph()
 void detach()
          The view is being shut down.
 void drawObjects(java.awt.Graphics2D graphics)
           
 void drawSelectedNodes()
           
 int entitySize()
           
 VisualEntity findVisualEntity(double x, double y)
           
 void fireContentsResize()
           
protected  void firePaintAfter(java.awt.Graphics2D g)
          Give all the paint listeners a chance to draw after the view has drawn the graph.
protected  void firePaintBefore(java.awt.Graphics2D g)
          Give all the paint listeners a chance to draw before the view draws.
 java.awt.Rectangle getBounds()
           
 java.awt.geom.Rectangle2D.Double getContentRect(java.awt.Graphics g)
           
 Graph getGraph()
           
 double getHSpacing()
          changed
 java.awt.Point getMidPoint()
           
 Matrix33 getMoveTransform()
           
 DPoint getOffset()
           
 java.awt.Dimension getPreferredSize()
           
 VisualEntity getRoot()
           
 double getScale()
           
 Matrix33 getViewTransform()
           
 double getWinHeight()
           
 double getWinWidth()
           
 double getVSpacing()
          changed
protected  void paintComponent(java.awt.Graphics g)
           
 void paintOver(java.awt.Graphics g)
           
 int print(java.awt.Graphics pg, java.awt.print.PageFormat pageFormat, int pageIndex)
           
 void propertyChange(java.beans.PropertyChangeEvent e)
           
 void removeResizeListeners(ResizeListener rl)
           
 void removeViewListener(ConceptViewListener l)
          Removes a view listener from this object's listener list.
 void removeViewPaintListener(ConceptViewPaintListener l)
          Removes a view paint listener from this object's listener list.
 void setGraph(Graph graph)
          Updates the display to match the current state of the model.
 void setOffsets(double xoffset, double yoffset, boolean redraw)
           
 void setRoot(VisualEntity vent)
           
 void setScale(double new_scale)
           
 void stateChanged(javax.swing.event.ChangeEvent event)
          The settings object we're listening to has changed.
 java.lang.String toString()
           
 
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, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getWidth, getVisibleRect, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, 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, 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, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jcreek.cke.conceptview.ConceptView
repaint, repaint
 

Field Detail

listeners

protected javax.swing.event.EventListenerList listeners
List of event listeners.


graph

protected Graph graph
List of relations from the model.


model

protected CreekModel model

hSpacing

protected double hSpacing

vSpacing

protected double vSpacing

rootEnt

protected VisualEntity rootEnt

MAX_NUM_PAGE

protected int MAX_NUM_PAGE
Constructor Detail

DrawingSurface

public DrawingSurface()
Method Detail

getPreferredSize

public java.awt.Dimension getPreferredSize()

paintComponent

protected void paintComponent(java.awt.Graphics g)

paintOver

public void paintOver(java.awt.Graphics g)

drawSelectedNodes

public void drawSelectedNodes()
Specified by:
drawSelectedNodes in interface ConceptView

drawObjects

public void drawObjects(java.awt.Graphics2D graphics)

contentsSize

public DDimension contentsSize()

getOffset

public DPoint getOffset()

setOffsets

public void setOffsets(double xoffset,
                       double yoffset,
                       boolean redraw)
Specified by:
setOffsets in interface ConceptView

center

public void center()

addResizeListener

public void addResizeListener(ResizeListener rl)

removeResizeListeners

public void removeResizeListeners(ResizeListener rl)

fireContentsResize

public void fireContentsResize()
Specified by:
fireContentsResize in interface ConceptView

addViewListener

public void addViewListener(ConceptViewListener l)
Adds a view listener to this object's listener list.

Specified by:
addViewListener in interface ConceptView
Parameters:
l - listener to add to view's list

addViewPaintListener

public void addViewPaintListener(ConceptViewPaintListener l)
Adds a view paint listener to this object's listener list.

Specified by:
addViewPaintListener in interface ConceptView
Parameters:
l - listener to add to view's list

firePaintAfter

protected void firePaintAfter(java.awt.Graphics2D g)
Give all the paint listeners a chance to draw after the view has drawn the graph.

Parameters:
g - graphics context to draw to

firePaintBefore

protected void firePaintBefore(java.awt.Graphics2D g)
Give all the paint listeners a chance to draw before the view draws.

Parameters:
g - graphics context to draw to

removeViewListener

public void removeViewListener(ConceptViewListener l)
Removes a view listener from this object's listener list.

Specified by:
removeViewListener in interface ConceptView
Parameters:
l - listener to remove from view's list

removeViewPaintListener

public void removeViewPaintListener(ConceptViewPaintListener l)
Removes a view paint listener from this object's listener list.

Specified by:
removeViewPaintListener in interface ConceptView
Parameters:
l - listener to remove from view's list

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent event)
The settings object we're listening to has changed. Check if we have to change our drawing options.

Parameters:
event - change event

detach

public void detach()
The view is being shut down. This gives the view a chance to remove itself from any listener lists it may be on.

Specified by:
detach in interface ConceptView

dataChanged

public void dataChanged(VertexList vl,
                        RelationList rl)
Deprectaed, use setGraph()

Specified by:
dataChanged in interface ConceptView

setGraph

public void setGraph(Graph graph)
Updates the display to match the current state of the model.

Specified by:
setGraph in interface ConceptView

attach

public void attach(CreekModel model)
We're being attached to a document for the first time.

Specified by:
attach in interface ConceptView

getViewTransform

public Matrix33 getViewTransform()
Specified by:
getViewTransform in interface ConceptView

getMoveTransform

public Matrix33 getMoveTransform()
Specified by:
getMoveTransform in interface ConceptView

getWinWidth

public double getWinWidth()
Specified by:
getWinWidth in interface ConceptView

getWinHeight

public double getWinHeight()
Specified by:
getWinHeight in interface ConceptView

getMidPoint

public java.awt.Point getMidPoint()
Specified by:
getMidPoint in interface ConceptView

toString

public java.lang.String toString()

setScale

public void setScale(double new_scale)
Specified by:
setScale in interface ConceptView

getScale

public double getScale()
Specified by:
getScale in interface ConceptView

getBounds

public java.awt.Rectangle getBounds()
Specified by:
getBounds in interface ConceptView

findVisualEntity

public VisualEntity findVisualEntity(double x,
                                     double y)
Specified by:
findVisualEntity in interface ConceptView

getHSpacing

public double getHSpacing()
changed

Specified by:
getHSpacing in interface ConceptView

getVSpacing

public double getVSpacing()
changed

Specified by:
getVSpacing in interface ConceptView

getRoot

public VisualEntity getRoot()
Specified by:
getRoot in interface ConceptView

setRoot

public void setRoot(VisualEntity vent)
Specified by:
setRoot in interface ConceptView

entitySize

public int entitySize()

getGraph

public Graph getGraph()

activateEntity

public DPoint activateEntity(VisualEntity activator)
Specified by:
activateEntity in interface ConceptView

createPrintImage

public java.awt.image.BufferedImage createPrintImage()
Specified by:
createPrintImage in interface ConceptView

getContentRect

public java.awt.geom.Rectangle2D.Double getContentRect(java.awt.Graphics g)

print

public int print(java.awt.Graphics pg,
                 java.awt.print.PageFormat pageFormat,
                 int pageIndex)
          throws java.awt.print.PrinterException
Specified by:
print in interface java.awt.print.Printable
Throws:
java.awt.print.PrinterException

propertyChange

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


Created at IDI, NTNU by the Artificial Intelligence and Learning group