org.ascape.view.vis
Class Scrolling1DView

java.lang.Object
  extended by org.ascape.model.event.DefaultScapeListener
      extended by org.eclipse.amp.escape.ascape.view.ModelScapeView
          extended by org.eclipse.amp.escape.ascape.view.EditPartFactoryScapeView
              extended by org.eclipse.amp.escape.ascape.view.EditPartScapeView
                  extended by org.ascape.view.vis.GraphicsView
                      extended by org.ascape.view.vis.AgentView
                          extended by org.ascape.view.vis.CellView
                              extended by org.ascape.view.vis.Scrolling1DView
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.EventListener, java.util.Observer, ScapeListener, HasName, IDrawSelection, org.eclipse.core.runtime.IAdaptable, org.eclipse.gef.EditPartFactory, org.eclipse.jface.viewers.ISelectionProvider

public class Scrolling1DView
extends CellView

A view that provides a vertically scrolling view appropriate for dispalying a simple one-dimensional collection of agents; i.e. a 1DCA. To Do: Support color features ala Overhead2DView.

Since:
1.0
Version:
1.9.2
Author:
Miles Parker
See Also:
Serialized Form

Field Summary
protected  int maxAgentWidth
          The max agent width.
 
Fields inherited from class org.ascape.view.vis.CellView
borderSize, cells_fill_draw_feature, cells_fill_draw_inset_feature
 
Fields inherited from class org.ascape.view.vis.AgentView
agentColorFeature, drawSelection
 
Fields inherited from class org.ascape.view.vis.GraphicsView
agentSize, image, imageFigure, imageGC, imageGraphics
 
Fields inherited from class org.ascape.model.event.DefaultScapeListener
listeningToScape, scape
 
Constructor Summary
Scrolling1DView()
          Constructs a new scrolling view, setting its initial cell size to 2.
Scrolling1DView(java.lang.String name)
          Constructs a new scrolling view, setting its initial cell size to 2.
 
Method Summary
 int calculateAgentSizeForViewSize(org.eclipse.draw2d.geometry.Dimension d)
          Calculate agent size for view size.
 org.eclipse.draw2d.geometry.Dimension calculateViewSizeForAgentSize(org.eclipse.draw2d.geometry.Dimension availableSize, int cellSize)
          Calculate view size for agent size.
 void createImage()
           
 void drawSelectedAgent(org.eclipse.draw2d.Graphics g, LocatedAgent a)
          Draws a marker for the provided selected agent.
 Agent getAgentAtPixel(int x, int y)
          Returns the cell at the given pixel in this view.
 void updateScapeGraphics(org.eclipse.draw2d.Graphics g)
          On notification of a scape update, draws the next line of the view, and copies the buffer upwards to scroll the view.
 
Methods inherited from class org.ascape.view.vis.CellView
createFeatures, getBorderSize, getCellColorFeature, getCellSize, getPrimaryAgentColorFeature, setBorderSize, setCellColorFeature, setCellSize, setPrimaryAgentColorFeature
 
Methods inherited from class org.ascape.view.vis.AgentView
addDrawFeature, getAgentColorFeature, getAgentSize, getDrawFeatures, getDrawFeaturesObservable, getDrawSelection, getMiniumSizeWithin, getPreferredSizeWithin, removeDrawFeature, setAgentColorFeature, setAgentSize, update
 
Methods inherited from class org.ascape.view.vis.GraphicsView
addSelectionChangedListener, createEditPart, createImageFigure, getImage, getImageFigure, getMinimumSizeWithin, getSelection, getSize, refresh, removeSelectionChangedListener, scapeAdded, scapeIterated, setSelection
 
Methods inherited from class org.eclipse.amp.escape.ascape.view.EditPartScapeView
createInput
 
Methods inherited from class org.eclipse.amp.escape.ascape.view.EditPartFactoryScapeView
getAdapter, getRootPart
 
Methods inherited from class org.eclipse.amp.escape.ascape.view.ModelScapeView
getModel, getName, toString
 
Methods inherited from class org.ascape.model.event.DefaultScapeListener
clone, environmentQuiting, getScape, isGraphic, isLifeOfScape, isNotifyScapeAutomatically, notifyScapeUpdated, scapeClosing, scapeDeserialized, scapeInitialized, scapeNotification, scapeRemoved, scapeSetup, scapeStarted, scapeStopped, setName, setNotifyScapeAutomatically
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

maxAgentWidth

protected int maxAgentWidth
The max agent width.

Constructor Detail

Scrolling1DView

public Scrolling1DView()
Constructs a new scrolling view, setting its initial cell size to 2.


Scrolling1DView

public Scrolling1DView(java.lang.String name)
Constructs a new scrolling view, setting its initial cell size to 2.

Parameters:
name - a user relevant name for this view
Method Detail

createImage

public void createImage()
Overrides:
createImage in class GraphicsView

calculateViewSizeForAgentSize

public org.eclipse.draw2d.geometry.Dimension calculateViewSizeForAgentSize(org.eclipse.draw2d.geometry.Dimension availableSize,
                                                                           int cellSize)
Description copied from class: AgentView
Calculate view size for agent size.

Overrides:
calculateViewSizeForAgentSize in class AgentView
Parameters:
availableSize - TODO
cellSize - the agent size
Returns:
the dimension

calculateAgentSizeForViewSize

public int calculateAgentSizeForViewSize(org.eclipse.draw2d.geometry.Dimension d)
Description copied from class: AgentView
Calculate agent size for view size.

Overrides:
calculateAgentSizeForViewSize in class AgentView
Parameters:
d - the d
Returns:
the int

getAgentAtPixel

public Agent getAgentAtPixel(int x,
                             int y)
Description copied from class: AgentView
Returns the cell at the given pixel in this view.

Overrides:
getAgentAtPixel in class AgentView
Parameters:
x - the horizontal pixel location
y - the vertical pixel location
Returns:
the agent at pixel

drawSelectedAgent

public void drawSelectedAgent(org.eclipse.draw2d.Graphics g,
                              LocatedAgent a)
Description copied from class: AgentView
Draws a marker for the provided selected agent.

Overrides:
drawSelectedAgent in class AgentView
a - the agent to draw

updateScapeGraphics

public void updateScapeGraphics(org.eclipse.draw2d.Graphics g)
On notification of a scape update, draws the next line of the view, and copies the buffer upwards to scroll the view.

Overrides:
updateScapeGraphics in class GraphicsView