|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectjas.plot.LayerMultiObjectGridDrawer
public class LayerMultiObjectGridDrawer
It is able to draw objects contained by a MultiObjGrid on a LayeredSurfaceFrame.
When on a cell there is at least one object it is represented by a circle.
The objects are drawn using one given color.
Title: JAS
Description: Java Agent-based Simulation library
Copyright (C) 2002 Michele Sonnessa
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
| Constructor Summary | |
|---|---|
LayerMultiObjectGridDrawer(java.lang.String name,
MultiObjGrid matrix)
Create a new object drawer based on a given MultiObjGrid object. |
|
LayerMultiObjectGridDrawer(java.lang.String name,
MultiObjGrid matrix,
java.awt.Color color)
Create a new object drawer based on a given MultiObjGrid object. |
|
| Method Summary | |
|---|---|
java.lang.String |
getDescription()
Return the name of the layer. |
boolean |
isDisplayed()
Return if the layer is currently displayed on the LayeredSurfaceFrame. |
void |
paint(java.awt.Graphics g,
int cellLen)
Draw the layer using the given cell length. |
boolean |
performDblClickActionAt(int atX,
int atY)
If a mouse listener has been defined the double-click event, it is passed to it, otherwise it is shown a CellObjectChooser that allows the user to choose which object to be probed. |
boolean |
performMouseMovedFromTo(int fromX,
int fromY,
int toX,
int toY)
If a mouse listener has been defined the mouse dragging event, it is passed to it, otherwise it is returned false. |
boolean |
performRightClickActionAt(int atX,
int atY)
If a mouse listener has been defined the right-click event, it is passed to it, otherwise it is returned false. |
void |
setDisplay(boolean display)
Decide if layer has to be painted or not. |
void |
setMouseListener(ILayerMouseListener listener)
Set a manager for mouse events. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LayerMultiObjectGridDrawer(java.lang.String name,
MultiObjGrid matrix)
name - The string describing the layer.matrix - A MultiObjGrid object.
public LayerMultiObjectGridDrawer(java.lang.String name,
MultiObjGrid matrix,
java.awt.Color color)
name - The string describing the layer.matrix - A MultiObjGrid object.color - The default color used to plot objects.| Method Detail |
|---|
public java.lang.String getDescription()
getDescription in interface ILayerDrawerpublic boolean isDisplayed()
isDisplayed in interface ILayerDrawer
public void paint(java.awt.Graphics g,
int cellLen)
paint in interface ILayerDrawerg - The graphic context passed by container.cellLen - The length of a cell in pixels.
public boolean performDblClickActionAt(int atX,
int atY)
performDblClickActionAt in interface ILayerMouseListeneratX - The x coordinate of the clicked cell.atY - The y coordinate of the clicked cell.
public boolean performMouseMovedFromTo(int fromX,
int fromY,
int toX,
int toY)
performMouseMovedFromTo in interface ILayerMouseListenerfromX - The x coordinate of the starting cell.fromY - The y coordinate of the starting cell.toX - The x coordinate of the last dragged cell.toY - The y coordinate of the last dragged cell.
public boolean performRightClickActionAt(int atX,
int atY)
performRightClickActionAt in interface ILayerMouseListeneratX - The x coordinate of the clicked cell.atY - The y coordinate of the clicked cell.
public void setDisplay(boolean display)
setDisplay in interface ILayerDrawerdisplay - True if you want the layer to be painted, false otherwise.public void setMouseListener(ILayerMouseListener listener)
listener - A ILayerMouseListener object.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||