ViewGrid
Interactive grid view composed of ViewGridCell panels. Features:
- Displays a square grid of size
gridSize x gridSize. - Supports click-and-drag painting to set the current floodsim.model.cell.CellType on cells.
- Delegates cell updates to an optional floodsim.controller.SimulationListener.
- Can overlay weather imagery and arbitrary color overlays per cell. Image resources:
- Requires given floodsim.view.util.resource.ImageCache instances for floodsim.model.cell.CellType and floodsim.model.weather.Weather. Coordinates:
- When notifying the listener, the position is provided as
Coordinate(col, row).
Attributes
- Graph
-
- Supertypes
Members list
Value members
Concrete methods
Returns the underlying Swing component.
Returns the underlying Swing component.
Attributes
Sets a color overlay on the cell at the specified position with given intensity.
Sets a color overlay on the cell at the specified position with given intensity.
Value parameters
- col
-
the column index of the cell
- color
-
the Color of the overlay
- intensity
-
the intensity of the overlay (0.0 to 1.0)
- row
-
the row index of the cell
Attributes
Sets the listener to be notified when a cell's type is changed by user interaction.
Sets the listener to be notified when a cell's type is changed by user interaction.
Value parameters
- listener
-
the SimulationListener to notify
Attributes
Sets the current CellType to be applied when cells are clicked or dragged over.
Sets the current CellType to be applied when cells are clicked or dragged over.
Value parameters
- cellType
-
the CellType to set
Attributes
Enables or disables user interaction with the grid.
Enables or disables user interaction with the grid.
Value parameters
- enabled
-
true to enable interaction, false to disable
Attributes
Shows or hides the weather overlay on all cells.
Shows or hides the weather overlay on all cells.
Value parameters
- show
-
true to show weather, false to hide
Attributes
Shows a text label on the cell at the specified position.
Shows a text label on the cell at the specified position.
Value parameters
- col
-
the column index of the cell
- row
-
the row index of the cell
- text
-
the text to display
Attributes
Updates the CellType of the cell at the specified position.
Updates the CellType of the cell at the specified position.
Value parameters
- cellType
-
the new CellType to set
- col
-
the column index of the cell
- row
-
the row index of the cell
Attributes
Updates the Weather overlay of the cell at the specified position.
Updates the Weather overlay of the cell at the specified position.
Value parameters
- col
-
the column index of the cell
- row
-
the row index of the cell
- weather
-
the new Weather to set