org.ascape.view.vis
Interface ComponentView

All Superinterfaces:
java.lang.Cloneable, java.util.EventListener, HasName, ScapeListener
All Known Implementing Classes:
AgentCustomizer, AgentSelectionView, AgentSizedView, AgentView, AntChartViewElement, AutoCustomizer, AutoCustomizerSwing, BaseCustomizer, BatchView, BufferView, CellView, ChartCustomizer, ChartView, ControlActionView, ControlBarView, EntityRelationView, ERVViewCustomizer, FixedAgentStretchyView, FixedStretchyView, HostedAgentView, MapView, MenuBarView, ModelCustomizer, ModelCustomizerSwing, MovingStretchyView, Navigator, Overhead2DContinuousView, Overhead2DView, OverheadRelative2DView, PanelView, Plot2DView, ScapeTransitionPanelView, Scrolling1DView, SearchView, SimpleControlView, SimplexView, SpeedSliderView, StretchyView, ViewCustomizer

public interface ComponentView
extends ScapeListener

A view which listens to (is an observer of) an agent scape. The view must be a sublclass of java.awt.component. May be depreated, as Canvas can be replaced with Panel in Swing.

Since:
1.0
Version:
2.9
Author:
Miles Parker

Method Summary
 void build()
          Prepare the component view, once the view's scape has been created.
 void forceScapeNotify()
          Forces the view to notify its scape.
 javax.swing.ImageIcon getIcon()
          Return an icon that can be used to represent this frame.
 int getIterationsPerRedraw()
          Returns the number of iterations this compenent will wait before redrawing, that is, calling updateScapeGraphics.
 java.awt.Dimension getPreferredSizeWithin(java.awt.Dimension d)
          Sets the size this component would be if it had to fit within the allowed dimensions.
 Scape getScape()
          Returns the Scape being viewed.
 ViewFrameBridge getViewFrame()
          Return the view frame this component is being displayed within.
 void iconUpdated()
          Should be called when the view has updated itself in a way that changes icon.
 void onChangeIterationsPerRedraw()
          Called when the scape requests a change to iterations per redraw.
 void setIterationsPerRedraw(int iterations)
          Sets the number of iterations this compenent will wait before redrawing, that is, calling updateScapeGraphics.
 void setMovieRecorder(MovieRecorder recorder)
          Sets the recorder that can be used to record this view.
 void setViewFrame(ViewFrameBridge frame)
          Sets the view frame this component is being displayed within.
 void updateScapeGraphics()
          Called when scape has been updated and requires a redraw.
 
Methods inherited from interface org.ascape.model.event.ScapeListener
clone, environmentQuiting, isGraphic, isLifeOfScape, scapeAdded, scapeClosing, scapeDeserialized, scapeInitialized, scapeIterated, scapeNotification, scapeRemoved, scapeSetup, scapeStarted, scapeStopped
 
Methods inherited from interface org.ascape.util.HasName
getName
 

Method Detail

build

void build()
Prepare the component view, once the view's scape has been created.


getViewFrame

ViewFrameBridge getViewFrame()
Return the view frame this component is being displayed within.

Returns:
the view frame

setViewFrame

void setViewFrame(ViewFrameBridge frame)
Sets the view frame this component is being displayed within.

Parameters:
frame - the frame

setMovieRecorder

void setMovieRecorder(MovieRecorder recorder)
Sets the recorder that can be used to record this view. If null, do not record.

Parameters:
recorder - the recorder

updateScapeGraphics

void updateScapeGraphics()
Called when scape has been updated and requires a redraw. Depending on the setting for iterations per redraw, this may not be called for every scape update event.


getIterationsPerRedraw

int getIterationsPerRedraw()
Returns the number of iterations this compenent will wait before redrawing, that is, calling updateScapeGraphics.

Returns:
the iterations per redraw

setIterationsPerRedraw

void setIterationsPerRedraw(int iterations)
Sets the number of iterations this compenent will wait before redrawing, that is, calling updateScapeGraphics.

Parameters:
iterations - the iterations

onChangeIterationsPerRedraw

void onChangeIterationsPerRedraw()
Called when the scape requests a change to iterations per redraw. He component may choose to ignore the request.


getScape

Scape getScape()
Returns the Scape being viewed.

Specified by:
getScape in interface ScapeListener
Returns:
the scape

forceScapeNotify

void forceScapeNotify()
Forces the view to notify its scape. Neccessary if the view suddenly (say by being iconfied) becomes unable to repaint itself.


getPreferredSizeWithin

java.awt.Dimension getPreferredSizeWithin(java.awt.Dimension d)
Sets the size this component would be if it had to fit within the allowed dimensions. For example, a component that wanted to be square and was given a dimension of 30 x 40 would return 30 x 30.

Parameters:
d - the d
Returns:
the preferred size within

getIcon

javax.swing.ImageIcon getIcon()
Return an icon that can be used to represent this frame. May return null, in which case a default icon will be used.

Returns:
the icon

iconUpdated

void iconUpdated()
Should be called when the view has updated itself in a way that changes icon. Implementations need to inform the frame of the update as approriate. Normally this will not need to be overriden as panel view and canvas view implement properly. Any other implementations should simply call getViewFrame().iconUpdated().



Copyright © 1998-2008 The Brookings Institution, NuTech Solutions, Metascape, LLC All Rights Reserved.