edu.brook.ascape.view
Class ControlBarView

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.ControlBarView

public class ControlBarView
extends PanelView

A class providing a control bar for controlling a simulation. Provides start, stop, restart, pause, resume, quit, info, status, and new charts. Control views can be attached to any scape, and controls will typically affect the model (entire collection of scapes) as a whole. Use SimpleControlView if Swing is not available or if simple buttons are preferred to image buttons with tool-tips. Requires Swing.

Since:
1.0
Version:
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  edu.brook.ascape.view.ControlBarView.ScapeControlAction addHistAction
          Scape control for creating a new histogram.
protected  javax.swing.JButton addHistButton
           
protected  edu.brook.ascape.view.ControlBarView.ScapeControlAction addPieAction
          Scape control for creating a new pie chart.
protected  javax.swing.JButton addPieButton
           
protected  edu.brook.ascape.view.ControlBarView.ScapeControlAction addTSAction
          Scape control for creating a new time series graph.
protected  javax.swing.JButton addTSButton
           
protected  javax.swing.JLabel delayIcon
           
protected  javax.swing.JPanel delayPanel
           
protected  int delayScale
           
protected  javax.swing.JSlider delaySlider
           
protected  javax.swing.JComboBox frameList
           
protected  edu.brook.ascape.view.ControlBarView.ScapeControlAction infoAction
          Scape control for getting information about a scape.
protected  javax.swing.JButton infoButton
           
protected  boolean lastScapeAppearsPaused
          Did the scape appear to be paused last iteration?
protected  boolean lastScapeAppearsRunning
          Did the scape appear to be running last iteration?
protected  float maxDelayInSecs
           
protected  edu.brook.ascape.view.ControlBarView.ScapeControlAction openAction
          Scape control for opening a new scape.
protected  javax.swing.JButton openButton
           
protected  edu.brook.ascape.view.ControlBarView.ScapeControlAction pauseToggleAction
          Scape control for pausing a scape.
protected  javax.swing.JButton pauseToggleButton
           
protected  javax.swing.JLabel periodLabel
           
protected  edu.brook.ascape.view.ControlBarView.ScapeControlAction quitAction
          Scape control for quiting the model.
protected  javax.swing.JButton quitButton
           
protected  edu.brook.ascape.view.ControlBarView.ScapeControlAction recordAction
          Scape control for starting and stopping a scape recording session.
protected  javax.swing.JButton recordButton
           
protected  javax.swing.JDialog recordDialog
           
protected  GraphicsRecorder recorder
           
protected  ViewFrameBridge recordFrame
           
protected  boolean recording
           
protected  edu.brook.ascape.view.ControlBarView.ScapeControlAction saveAction
          Scape control for saving a scape.
protected  javax.swing.JButton saveButton
           
protected  boolean scapeAppearsPaused
          Does the scape appear to be paused?
protected  boolean scapeAppearsRunning
          Does the scape appear to be running?
protected  edu.brook.ascape.view.ControlBarView.ScapeControlAction settingsAction
          Scape control for starting a scape.
protected  javax.swing.JButton settingsButton
           
protected  edu.brook.ascape.view.ControlBarView.ScapeControlAction startAction
          Scape control for starting a scape.
protected  javax.swing.JButton startButton
           
protected  javax.swing.JLabel statusLabel
           
protected  edu.brook.ascape.view.ControlBarView.ScapeControlAction stepAction
          Scape control for stepping a scape one iteration.
protected  javax.swing.JButton stepButton
           
protected  edu.brook.ascape.view.ControlBarView.ScapeControlAction stopAction
          Scape control for stoping a scape.
protected  javax.swing.JButton stopButton
           
protected  javax.swing.JToolBar toolBar
           
protected  boolean waitingForRecordSelection
           
 
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
ControlBarView()
          Constructs the control view, creating and laying out its components.
ControlBarView(java.lang.String name)
          Constructs the control view, creating and laying out its components.
 
Method Summary
 void build()
          Constructs the tool bar buttons and actions, and places them within the toolbar.
 float getMaxDelayInSecs()
          Returns the maximum delay that the control bar delay slider can cause.
 java.lang.String getName()
          Returns a name for the view as defined by set name.
protected  void newChart(int chartType)
           
 void onIterate()
          Called on interation; delays models return by delay slider setting.
 void onUpdate()
          Update the components.
protected  void recordingCancelStop()
          Called to stop or cancel recording.
protected  void recordingCreate()
          Called to create recording session and setup control dialog.
protected  void recordingStart(ViewFrameBridge frame)
          Called to start recording.
protected  void recordingStatusUpdate()
          Called to update recording.
 void setFrameSelection(java.lang.Object o)
           
 void setIgnoreFrameSelection(boolean ignore)
           
 void setMaxDelayInSecs(float name)
          Sets the maximum delay that the control bar delay slider can cause.
 void setName(java.lang.String name)
          Sets the name of this view.
 java.lang.String toString()
          Returns a short description of this view.
 
Methods inherited from class edu.brook.ascape.view.PanelView
addScape, getGraphicsRecorder, getScape, getViewFrame, onSetup, onStart, onStop, paint, removeScape, scapeUpdated, setGraphicsRecorder, 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, getPreferredSize, 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

toolBar

protected javax.swing.JToolBar toolBar

periodLabel

protected javax.swing.JLabel periodLabel

statusLabel

protected javax.swing.JLabel statusLabel

frameList

protected javax.swing.JComboBox frameList

delayPanel

protected javax.swing.JPanel delayPanel

delaySlider

protected javax.swing.JSlider delaySlider

delayIcon

protected javax.swing.JLabel delayIcon

delayScale

protected int delayScale

maxDelayInSecs

protected float maxDelayInSecs

openAction

protected edu.brook.ascape.view.ControlBarView.ScapeControlAction openAction
Scape control for opening a new scape.

openButton

protected javax.swing.JButton openButton

saveAction

protected edu.brook.ascape.view.ControlBarView.ScapeControlAction saveAction
Scape control for saving a scape.

saveButton

protected javax.swing.JButton saveButton

startAction

protected edu.brook.ascape.view.ControlBarView.ScapeControlAction startAction
Scape control for starting a scape.

startButton

protected javax.swing.JButton startButton

stopAction

protected edu.brook.ascape.view.ControlBarView.ScapeControlAction stopAction
Scape control for stoping a scape.

stopButton

protected javax.swing.JButton stopButton

pauseToggleAction

protected edu.brook.ascape.view.ControlBarView.ScapeControlAction pauseToggleAction
Scape control for pausing a scape.

pauseToggleButton

protected javax.swing.JButton pauseToggleButton

stepAction

protected edu.brook.ascape.view.ControlBarView.ScapeControlAction stepAction
Scape control for stepping a scape one iteration.

stepButton

protected javax.swing.JButton stepButton

settingsAction

protected edu.brook.ascape.view.ControlBarView.ScapeControlAction settingsAction
Scape control for starting a scape.

settingsButton

protected javax.swing.JButton settingsButton

recordAction

protected edu.brook.ascape.view.ControlBarView.ScapeControlAction recordAction
Scape control for starting and stopping a scape recording session. Note that all of the following variables and their associated behavior will be eventually moved to a seperate class.

recordButton

protected javax.swing.JButton recordButton

waitingForRecordSelection

protected boolean waitingForRecordSelection

recording

protected boolean recording

recorder

protected GraphicsRecorder recorder

recordFrame

protected ViewFrameBridge recordFrame

recordDialog

protected javax.swing.JDialog recordDialog

infoAction

protected edu.brook.ascape.view.ControlBarView.ScapeControlAction infoAction
Scape control for getting information about a scape.

infoButton

protected javax.swing.JButton infoButton

quitAction

protected edu.brook.ascape.view.ControlBarView.ScapeControlAction quitAction
Scape control for quiting the model.

quitButton

protected javax.swing.JButton quitButton

addTSAction

protected edu.brook.ascape.view.ControlBarView.ScapeControlAction addTSAction
Scape control for creating a new time series graph.

addTSButton

protected javax.swing.JButton addTSButton

addHistAction

protected edu.brook.ascape.view.ControlBarView.ScapeControlAction addHistAction
Scape control for creating a new histogram.

addHistButton

protected javax.swing.JButton addHistButton

addPieAction

protected edu.brook.ascape.view.ControlBarView.ScapeControlAction addPieAction
Scape control for creating a new pie chart.

addPieButton

protected javax.swing.JButton addPieButton

scapeAppearsRunning

protected boolean scapeAppearsRunning
Does the scape appear to be running?

lastScapeAppearsRunning

protected boolean lastScapeAppearsRunning
Did the scape appear to be running last iteration?

scapeAppearsPaused

protected boolean scapeAppearsPaused
Does the scape appear to be paused?

lastScapeAppearsPaused

protected boolean lastScapeAppearsPaused
Did the scape appear to be paused last iteration?
Constructor Detail

ControlBarView

public ControlBarView()
Constructs the control view, creating and laying out its components.

ControlBarView

public ControlBarView(java.lang.String name)
Constructs the control view, creating and laying out its components.
Parameters:
name - a user relevant name for this view
Method Detail

build

public void build()
Constructs the tool bar buttons and actions, and places them within the toolbar.
Overrides:
build in class PanelView

newChart

protected void newChart(int chartType)

recordingCancelStop

protected void recordingCancelStop()
Called to stop or cancel recording. To be moved to seperate class.

recordingStart

protected void recordingStart(ViewFrameBridge frame)
Called to start recording. To be moved to seperate class.

recordingCreate

protected void recordingCreate()
Called to create recording session and setup control dialog. To be moved to seperate class.

recordingStatusUpdate

protected void recordingStatusUpdate()
Called to update recording. To be moved to seperate class.

setFrameSelection

public void setFrameSelection(java.lang.Object o)

setIgnoreFrameSelection

public void setIgnoreFrameSelection(boolean ignore)

onIterate

public void onIterate()
Called on interation; delays models return by delay slider setting.
Overrides:
onIterate in class PanelView

onUpdate

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

getName

public java.lang.String getName()
Returns a name for the view as defined by set name.
Overrides:
getName in class PanelView

setName

public void setName(java.lang.String name)
Sets the name of this view.
Parameters:
name - a user relevant name for this view
Overrides:
setName in class PanelView

getMaxDelayInSecs

public float getMaxDelayInSecs()
Returns the maximum delay that the control bar delay slider can cause.

setMaxDelayInSecs

public void setMaxDelayInSecs(float name)
Sets the maximum delay that the control bar delay slider can cause.
Parameters:
maxDelayInSecs - the maximum time in seconds that the control bar can cause frames to delay

toString

public java.lang.String toString()
Returns a short description of this view. Sames as name unless overridden.
Overrides:
toString in class PanelView

(c) 1998-2000 The Brookings Insitution
Webpage