Class GridPanel
raft.kilavuz.grid
java.lang.Object
  java.awt.Component
      java.awt.Container
          javax.swing.JComponent
              javax.swing.JPanel
                  raft.kilavuz.grid.GridPanel
All Implemented Interfaces:

public class GridPanel
extends javax.swing.JPanel
swing panel to display various information in a grid. also visualizes path find results. can be used as a standalone application or in another container

Nested Class Summary
static interface
GridPanel.Listener
callback interface to notify about information cells mouse is over
Constructor Summary
GridPanel(int cellSize)
creates a new GridPanel with no Grid information
GridPanel(Grid grid, int cellSize)
creates a new GridPanel
Method Summary
void
addListener(GridPanel.Listener listener)
adds given listener to set of listeners.
void
findPath(Grid.Cell from, Grid.Cell to)
finds path between given cells and displays it
void
findPath(Land.Point first, Land.Point last)
finds path between given points and displays it
void
findPath(Land.Sector from, Land.Sector to)
finds path between given sectors and displays it
void
findPathCellToCell()
asks user for cell id's in a dialog and finds path between
void
findPathSectorToSector()
asks user for sector id's in a dialog and finds path between
void
findPathVectorToVector()
asks user for two vectors in world space in a dialog and finds path between
getMenuBar()
returns the menubar to control this GridPanel
boolean
isGridDisplayed()
check if grid are displayed
boolean
isPortalsDisplayed()
check if portals are displayed
boolean
isSectorNumbersDisplayed()
check if sectors numbers are displayed
boolean
isSectorsDisplayed()
check if sectors are displayed
boolean
isTransitionsDisplayed()
check if transition between cells are displayed
static void
main(String[] args)
main method to run GridPanel as a standalone application
protected void
paintComponent(java.awt.Graphics g)
paints GridPanel on given graphics
void
removeListener(GridPanel.Listener listener)
remoevs given listener from set of listeners.
void
setCellSize(int cellSize)
sets cell size.
void
setGrid(Grid grid)
sets the grid to display
void
setGridDisplayed(boolean display)
sets if grid are displayed
void
setPortalsDisplayed(boolean display)
sets if portals are displayed
void
setSectorNumbersDisplayed(boolean display)
sets if sectors numbers are displayed
void
setSectorsDisplayed(boolean display)
sets if sectors are displayed
void
setTransitionsDisplayed(boolean display)
sets if transition between cells are displayed
Constructor Detail
GridPanel
public GridPanel(int cellSize)
creates a new GridPanel with no Grid information
Parameters:
cellSize - number of pixels on screen to display a grid cell

GridPanel
public GridPanel(Grid grid,
                 int cellSize)
creates a new GridPanel
Parameters:
grid - the grid to display
cellSize - number of pixels on screen to display a grid cell
Method Detail
setGrid
public void setGrid(Grid grid)
sets the grid to display

addListener
public void addListener(GridPanel.Listener listener)
adds given listener to set of listeners. does nothing if listener is already in set or listener is null

removeListener
public void removeListener(GridPanel.Listener listener)
remoevs given listener from set of listeners. does nothing if listener is not in set

isTransitionsDisplayed
public boolean isTransitionsDisplayed()
check if transition between cells are displayed

setTransitionsDisplayed
public void setTransitionsDisplayed(boolean display)
sets if transition between cells are displayed

isSectorsDisplayed
public boolean isSectorsDisplayed()
check if sectors are displayed

setSectorsDisplayed
public void setSectorsDisplayed(boolean display)
sets if sectors are displayed

isSectorNumbersDisplayed
public boolean isSectorNumbersDisplayed()
check if sectors numbers are displayed

setSectorNumbersDisplayed
public void setSectorNumbersDisplayed(boolean display)
sets if sectors numbers are displayed

isPortalsDisplayed
public boolean isPortalsDisplayed()
check if portals are displayed

setPortalsDisplayed
public void setPortalsDisplayed(boolean display)
sets if portals are displayed

isGridDisplayed
public boolean isGridDisplayed()
check if grid are displayed

setGridDisplayed
public void setGridDisplayed(boolean display)
sets if grid are displayed

setCellSize
public void setCellSize(int cellSize)
sets cell size. ie how many pixels a cell occupies on screen

findPathSectorToSector
public void findPathSectorToSector()
asks user for sector id's in a dialog and finds path between

findPathCellToCell
public void findPathCellToCell()
asks user for cell id's in a dialog and finds path between

findPathVectorToVector
public void findPathVectorToVector()
asks user for two vectors in world space in a dialog and finds path between

findPath
public void findPath(Grid.Cell from,
                     Grid.Cell to)
finds path between given cells and displays it

findPath
public void findPath(Land.Sector from,
                     Land.Sector to)
finds path between given sectors and displays it

findPath
public void findPath(Land.Point first,
                     Land.Point last)
finds path between given points and displays it

paintComponent
protected void paintComponent(java.awt.Graphics g)
paints GridPanel on given graphics
Overrides:

getMenuBar
public javax.swing.JMenuBar getMenuBar()
returns the menubar to control this GridPanel

main
public static void main(String[] args)
                 throws Exception
main method to run GridPanel as a standalone application
Throws:
Java API documentation generated with DocFlex/Doclet v1.5.2
DocFlex/Doclet is both a multi-format Javadoc doclet and a free edition of DocFlex/Javadoc. If you need to customize your Javadoc without writing a full-blown doclet from scratch, DocFlex/Javadoc may be the only tool able to help you! Find out more at www.docflex.com