com.rubecula.darwin.visualization.swing
Class VisualizingEvolutionaryApplet

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Panel
              extended by java.applet.Applet
                  extended by javax.swing.JApplet
                      extended by com.rubecula.darwin.visualization.swing.EvolutionaryApplet
                          extended by com.rubecula.darwin.visualization.swing.VisualizingEvolutionaryApplet
All Implemented Interfaces:
GenerationListener, Evolutionary, ControlAction, Interacter, Paints, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer
Direct Known Subclasses:
Applet_PepperedMoth

public abstract class VisualizingEvolutionaryApplet
extends EvolutionaryApplet
implements Interacter

This subclass of EvolutionaryApplet additionally knows how to paint the changes to the visualization model. TODO fix the issue where we add (for Applet) (for each visualization model) !VisualizationModelXXX and (for each visualization model) !Applet

Author:
Robin Hillyard
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JApplet
javax.swing.JApplet.AccessibleJApplet
 
Nested classes/interfaces inherited from class java.applet.Applet
java.applet.Applet.AccessibleApplet
 
Nested classes/interfaces inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
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.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class com.rubecula.darwin.visualization.swing.EvolutionaryApplet
_title, APPLET_PARAM_ENABLE_SLIDER, controlPanel, DEFAULT_PROPERTIES_URL, evolution, LBL_VERSION, LOG, P_TITLE_APPLICATION, PROPERTIES_URL
 
Fields inherited from class javax.swing.JApplet
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface com.rubecula.darwin.visualization.ControlAction
NEXT, QUIT, START, STOP, TIME_DELAY
 
Fields inherited from interface com.rubecula.darwin.domain.helper.GenerationListener
$1_SECOND
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
protected VisualizingEvolutionaryApplet()
           
 
Method Summary
 void addVisualizationModel(VisualizationModel visualizationModel)
          Method to add a visualization model to this applet.
protected  void addVisualizer(java.lang.String key, VisualizationModel visualizationModel)
           
protected  void addVisualizer(java.lang.String key, VisualizationModel visualizationModel, javax.swing.Icon icon, java.lang.String tip)
           
protected  void addVisualizer(java.lang.String key, VisualizationModel visualizationModel, java.lang.String tip)
           
protected  void addVisualizers()
          Method to add visualizers to this applet's visualizer tabs.
protected  java.util.Map<java.lang.String,java.awt.Component> createOptionsComponentMap()
          Needs to be overridden by extenders.
protected  OptionsPanel getOptionsPanel()
           
 Painter getPainter()
           
protected  VisualizationFactory getVisualizationFactory()
           
protected  VisualizerTabs getVisualizerTabs()
          XXX consider defining this public in interface
 void setOptionsPanel(OptionsPanel optionsPanel)
           
protected  void setup()
          Do nothing.
 void setVisualizationFactory(VisualizationFactory visualizationFactory)
           
 void setVisualizerTabs(VisualizerTabs visualizerTabs)
           
protected  void updateModel(java.lang.String name, java.lang.Object value)
          As always when a user-interface action causes a change to the model which backs a widget, two things must happen: we must fire a change event so that other parts of the system know that the property has changed.
 
Methods inherited from class com.rubecula.darwin.visualization.swing.EvolutionaryApplet
createControlPanel, createEastPanel, createNorthPanel, createSouthPanel, createWestPanel, destroy, getBooleanParameter, getControlPanel, getDefaultBeansFilename, getEvolution, getParameter, getTitle, init, onGeneration, setAppletTitle, setControlPanel, setEvolution, setProperty, setState, settable, setupLayout, start, stop, update
 
Methods inherited from class javax.swing.JApplet
addImpl, createRootPane, getAccessibleContext, getContentPane, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isRootPaneCheckingEnabled, paramString, remove, repaint, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler
 
Methods inherited from class java.applet.Applet
getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, 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 com.rubecula.darwin.visualization.ControlAction
setProperty, setState, settable
 

Constructor Detail

VisualizingEvolutionaryApplet

protected VisualizingEvolutionaryApplet()
                                 throws java.awt.HeadlessException
Throws:
java.awt.HeadlessException
Method Detail

addVisualizationModel

public void addVisualizationModel(VisualizationModel visualizationModel)
Method to add a visualization model to this applet. Note that the visualization models are kept in a list until the visualizer tabs have been set up. At that point, the method addVisualizers() is invoked. As a side-effect, we set the component property of the visualizationModel to be this.

Parameters:
visualizationModel -

getPainter

public Painter getPainter()
Specified by:
getPainter in interface Paints
Returns:
the painter
See Also:
Paints.getPainter()

setOptionsPanel

public void setOptionsPanel(OptionsPanel optionsPanel)
Parameters:
optionsPanel - the optionsPanel to set

setVisualizationFactory

public void setVisualizationFactory(VisualizationFactory visualizationFactory)
Parameters:
visualizationFactory - the visualizationFactory to set

setVisualizerTabs

public void setVisualizerTabs(VisualizerTabs visualizerTabs)
Parameters:
visualizerTabs - the visualizer tabs XXX consider defining this public in interface

addVisualizer

protected void addVisualizer(java.lang.String key,
                             VisualizationModel visualizationModel)
                      throws VisualizationException
Parameters:
key - XXX
visualizationModel - XXX consider defining this public in interface
Throws:
VisualizationException

addVisualizer

protected void addVisualizer(java.lang.String key,
                             VisualizationModel visualizationModel,
                             javax.swing.Icon icon,
                             java.lang.String tip)
                      throws VisualizationException
Parameters:
key - XXX
visualizationModel -
icon -
tip - XXX consider defining this public in interface
Throws:
VisualizationException

addVisualizer

protected void addVisualizer(java.lang.String key,
                             VisualizationModel visualizationModel,
                             java.lang.String tip)
                      throws VisualizationException
Parameters:
key - XXX
visualizationModel -
tip - XXX consider defining this public in interface
Throws:
VisualizationException

addVisualizers

protected void addVisualizers()
                       throws VisualizationException
Method to add visualizers to this applet's visualizer tabs. The default implementation is to iterate through the list of visualization models in _visualizationModels and for each individual visualization model, to take it's title as it's key and add a visualizer based on that key and that model. It's important to note that visualizers are looked up by events which note a change in a Visualizable, by keying on the visualizable's identifier. Therefore, it is expected that the title of the visualizable model corresponds to the identifier of the visualizable. TODO consider that we may not have a 1:1 correspondence between visualizers and visualizable models. May to be overridden by extenders.

Throws:
VisualizationException

createOptionsComponentMap

protected java.util.Map<java.lang.String,java.awt.Component> createOptionsComponentMap()
Description copied from class: EvolutionaryApplet
Needs to be overridden by extenders.

Specified by:
createOptionsComponentMap in class EvolutionaryApplet
Returns:
the newly fabricated options component map
See Also:
EvolutionaryApplet.createOptionsComponentMap()

getOptionsPanel

protected OptionsPanel getOptionsPanel()
Returns:
the optionsPanel

getVisualizationFactory

protected VisualizationFactory getVisualizationFactory()
Returns:
the current value of visualizationFactory.

getVisualizerTabs

protected VisualizerTabs getVisualizerTabs()
XXX consider defining this public in interface

Returns:
the visualizerTabs

setup

protected void setup()
Do nothing.

Specified by:
setup in class EvolutionaryApplet
See Also:
EvolutionaryApplet.setup()

updateModel

protected void updateModel(java.lang.String name,
                           java.lang.Object value)
                    throws VisualizationException
As always when a user-interface action causes a change to the model which backs a widget, two things must happen: we must fire a change event so that other parts of the system know that the property has changed. Finally, we must repaint the user-interface in case something visual has changed. This step, however, is not the responsibility of this method (it is invoked by the method which calls this method).

Specified by:
updateModel in class EvolutionaryApplet
Parameters:
name - the user-interface property that has changed.
value - the new value.
Throws:
VisualizationException


Copyright © 2010 Rubecula Software, LLC. All Rights Reserved.