org.fraid.graphics
Class GraphicsUser

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by org.fraid.graphics.GraphicsUser
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible
Direct Known Subclasses:
GraphicsPanel, SaveToFileUser

public abstract class GraphicsUser
extends javax.swing.JPanel
implements java.awt.image.ImageObserver

The abstract superclass of all classes responsible for generating 2D images in FrAid.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  PaintAlgorithmThread mAlgorithmThread
          The thread responsible for generating images.
protected  java.awt.Dimension mImageSize
          The size of the generated image.
protected  BehaviorBean mPlugIn
          The plugin working with the thread.
 
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
GraphicsUser()
           
 
Method Summary
protected abstract  void destroy()
          Called by the owning containers to perform any meaningful clenup when leaving.
 PaintAlgorithmThread getAlgorithm()
          Returns the paint thread.
 java.awt.Dimension getImageSize()
          Returns the image size.
 BehaviorBean getPlugIn()
          Returns the current plugin.
abstract  javax.swing.JPopupMenu getPopUp()
          Returns the associated popup menu (if any).
abstract  void interruptWatchingThread()
          Interrupts the watching thread (if there is any).
abstract  void notifyWatchingThread()
          Notifyes the watching thread (if there is any).
abstract  void recalculateAndRepaint()
          Similar to repaint() but with recalculation of the whole image.
 void setAlgorithm(PaintAlgorithmThread aAlgorithmThread)
          Sets the pain thread (do not use directly).
abstract  void setOffscreenImage(java.awt.image.BufferedImage bi)
          If the subclasses support offscreen image this method sets it.
abstract  void setOffscreenImage(int[] offscreenPixels)
          If the subclasses support offscreen image this method sets it.
abstract  void setOffScreenOrigin(int x, int y)
          Implemented by subclasses which support scrolling the image.
 BehaviorBean setPlugIn(BehaviorBean aPlugIn)
          The method used to set the plugin after BehaviourPlugInAdapter#clone().
 BehaviorBean setPlugIn(java.lang.String aPlugInName)
          The method used to initialize the tripple GraphicsPanel - BehaviourPlugIn - PaintAlgorithmThread.
abstract  void setStop()
          A method used by all subclasses which have a stop button.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, 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, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, 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
 
Methods inherited from interface java.awt.image.ImageObserver
imageUpdate
 

Field Detail

mAlgorithmThread

protected PaintAlgorithmThread mAlgorithmThread
The thread responsible for generating images.


mPlugIn

protected BehaviorBean mPlugIn
The plugin working with the thread.


mImageSize

protected java.awt.Dimension mImageSize
The size of the generated image.

Constructor Detail

GraphicsUser

public GraphicsUser()
Method Detail

setPlugIn

public BehaviorBean setPlugIn(java.lang.String aPlugInName)
                       throws PlugInException
The method used to initialize the tripple GraphicsPanel - BehaviourPlugIn - PaintAlgorithmThread. Do not use any other way for initialization.

Parameters:
aPlugInName - a String which could be: 1)String representation of an XML serialized BehaviourPlugIn, 2) PlugIn class name or 3)a file name of an XML serialized BehaviourPlugIn (checked in this order).
Returns:
a BehaviourPlugInAdapter value
Throws:
PlugInException - if the aPlugInName doesn't match anything.
See Also:
PlugInFactory

setPlugIn

public BehaviorBean setPlugIn(BehaviorBean aPlugIn)
                       throws PlugInException
The method used to set the plugin after BehaviourPlugInAdapter#clone(). Used when a SaveToFileUser is "cloned" from a GraphicsPanel.

Parameters:
aPlugIn - the cloned BehaviourPlugInAdapter
Returns:
returns the same input object
Throws:
PlugInException - if an error occurs

getAlgorithm

public PaintAlgorithmThread getAlgorithm()
Returns the paint thread.

Returns:
a PaintAlgorithmThread value

setAlgorithm

public void setAlgorithm(PaintAlgorithmThread aAlgorithmThread)
Sets the pain thread (do not use directly). Used by PaintAlgorithmThread#constructor( GraphicsUser, BehaviourPlugInAdapter ) (not to be used directly aswell).

Parameters:
aAlgorithmThread - a PaintAlgorithmThread value
See Also:
setPlugIn( String )

getPlugIn

public BehaviorBean getPlugIn()
Returns the current plugin.

Returns:
a BehaviourPlugIn value

getImageSize

public java.awt.Dimension getImageSize()
Returns the image size.

Returns:
a Dimension value

setStop

public abstract void setStop()
A method used by all subclasses which have a stop button.


notifyWatchingThread

public abstract void notifyWatchingThread()
Notifyes the watching thread (if there is any). Used by the associated PaintAlgorithmThread.


interruptWatchingThread

public abstract void interruptWatchingThread()
Interrupts the watching thread (if there is any). Used by the associated PaintAlgorithmThread.


setOffScreenOrigin

public abstract void setOffScreenOrigin(int x,
                                        int y)
Implemented by subclasses which support scrolling the image. Used by the associated PaintAlgorithmThread.

Parameters:
x - an int value
y - an int value

setOffscreenImage

public abstract void setOffscreenImage(java.awt.image.BufferedImage bi)
If the subclasses support offscreen image this method sets it.

Parameters:
bi - a BufferedImage value
See Also:
GraphicsPanel.setOffscreenImage( BufferedImage )

setOffscreenImage

public abstract void setOffscreenImage(int[] offscreenPixels)
If the subclasses support offscreen image this method sets it.

Parameters:
offscreenPixels - an int[] value
See Also:
GraphicsPanel.setOffscreenImage( int[] )

recalculateAndRepaint

public abstract void recalculateAndRepaint()
Similar to repaint() but with recalculation of the whole image.


getPopUp

public abstract javax.swing.JPopupMenu getPopUp()
Returns the associated popup menu (if any).

Returns:
a JPopupMenu value

destroy

protected abstract void destroy()
Called by the owning containers to perform any meaningful clenup when leaving.



Fraid (system and language). (C) 2003-2007 Ivaylo Iliev
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.