edu.brook.ascape.view
Class SimpleControlView

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--edu.brook.ascape.view.PanelImp
                                |
                                +--edu.brook.ascape.view.PanelView
                                      |
                                      +--edu.brook.ascape.view.SimpleControlView

public class SimpleControlView
extends PanelView
implements java.awt.event.ActionListener

A class providing a simple control panel for a running model that does not require Swing. Control views can be attached to any scape, and controls will typically affect the model (entire collection of scapes) as a whole. This class should be used when swing isn't available, but otherwise use ControlBarView.

Since:
1.0
Version:
1.1.2
See Also:
Serialized Form

Inner classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Field Summary
protected  boolean allowQuit
           
protected  java.awt.Label iterationText
           
protected  java.awt.Button pauseToggleButton
           
protected  java.awt.Button quitButton
           
protected  boolean scapeAppearsPaused
           
protected  boolean scapeAppearsRunning
           
protected  java.awt.Button settingsButton
           
protected  boolean showIterations
           
protected  java.awt.Button startButton
           
protected  java.awt.Button stepButton
           
protected  java.awt.Button stopButton
           
 
Fields inherited from class edu.brook.ascape.view.PanelView
awaitingUpdate, frame, name, recorder, recordNext, scape
 
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
 
Constructor Summary
SimpleControlView()
          Constructs the conrtol view, creating any laying out its components.
SimpleControlView(boolean allowQuit, boolean showIterations)
          Constructs the control view, creating any laying out its components.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
          Responds to actions perfromed by components upon this view.
 void build()
          Create components and lay them out.
 java.awt.Dimension getPreferredSize()
          Returns the preferred size of the control view, whcih is width 280 and height 30.
 boolean isAllowQuit()
          Does the view display a quit button, allowing the user to quit? Typically false for applets, true otherwise
 boolean isShowIterations()
          Does the view display the current iteration? Typically false for applets, true otherwise
 void onUpdate()
          Update the components.
 void setAllowQuit(boolean allowQuit)
          Should the view display a quit button, allowing the user to quit? Typically false for applets, true otherwise
 void setShowIterations(boolean showIterations)
          Should the view display the current iteration?
 java.lang.String toString()
          Retruns a short description of this view.
 
Methods inherited from class edu.brook.ascape.view.PanelView
addScape, getGraphicsRecorder, getName, getScape, getViewFrame, onIterate, onSetup, onStart, onStop, paint, removeScape, scapeUpdated, setGraphicsRecorder, setName, setViewFrame, updated
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUIClassID, paramString, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInsets, getInsets, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, processComponentKeyEvent, processFocusEvent, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hide, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setSize, setSize, show, show, size, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

allowQuit

protected boolean allowQuit

showIterations

protected boolean showIterations

startButton

protected java.awt.Button startButton

stopButton

protected java.awt.Button stopButton

pauseToggleButton

protected java.awt.Button pauseToggleButton

stepButton

protected java.awt.Button stepButton

settingsButton

protected java.awt.Button settingsButton

quitButton

protected java.awt.Button quitButton

iterationText

protected java.awt.Label iterationText

scapeAppearsRunning

protected boolean scapeAppearsRunning

scapeAppearsPaused

protected boolean scapeAppearsPaused
Constructor Detail

SimpleControlView

public SimpleControlView()
Constructs the conrtol view, creating any laying out its components.

SimpleControlView

public SimpleControlView(boolean allowQuit,
                         boolean showIterations)
Constructs the control view, creating any laying out its components.
Parameters:
allowQuit - should the quit button be included?
showIterations - include a label showing the current iteration?
Method Detail

build

public void build()
Create components and lay them out.
Overrides:
build in class PanelView

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent event)
Responds to actions perfromed by components upon this view. For the control view, these include, start, top, step, pause, resume, and restart actions.
Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
event - the component event beign handled

onUpdate

public void onUpdate()
Update the components. Ensures that the state of all buttons matchhes the state of the observed scape.
Overrides:
onUpdate in class PanelView

isAllowQuit

public boolean isAllowQuit()
Does the view display a quit button, allowing the user to quit? Typically false for applets, true otherwise

setAllowQuit

public void setAllowQuit(boolean allowQuit)
Should the view display a quit button, allowing the user to quit? Typically false for applets, true otherwise
Parameters:
allowQuit - true to allow user to quit

isShowIterations

public boolean isShowIterations()
Does the view display the current iteration? Typically false for applets, true otherwise

setShowIterations

public void setShowIterations(boolean showIterations)
Should the view display the current iteration?
Parameters:
showIterations - true to include a label showing the current iterations

getPreferredSize

public java.awt.Dimension getPreferredSize()
Returns the preferred size of the control view, whcih is width 280 and height 30.
Overrides:
getPreferredSize in class javax.swing.JComponent

toString

public java.lang.String toString()
Retruns a short description of this view.
Overrides:
toString in class PanelView

(c) 1998-2000 The Brookings Insitution
Webpage