gvprojects.igel.view
Class IgelViewKurmas

java.lang.Object
  extended by gvprojects.igel.view.IgelViewKurmas
All Implemented Interfaces:
IIgelView

public class IgelViewKurmas
extends java.lang.Object
implements IIgelView

Example view for IgelArgern

Author:
Zachary Kurmas

Constructor Summary
IgelViewKurmas(IGameState gameState)
          Constructor that uses a default artist map.
IgelViewKurmas(IGameState gameState, java.util.Map<java.lang.String,Artist> map)
          Constructor
 
Method Summary
 void addCellActionListener(CellActionListener cellActionListener)
          Add the specified listener to each cell in the board.
 void addMenu(javax.swing.JMenuBar menu)
          Add a menu
 void addMouseListener(int row, int col, java.awt.event.MouseListener listener)
          Add the specified mouse listener to the sell at location [row, col]
 void addPassSidewaysMovePressedListener(java.awt.event.ActionListener actionListener)
          Add a listener to respond when the user presses the "passSidewaysMove" button.
 void clearProposedMove()
          Cancels any currently displayed proposed moves.
 void close()
          Close the view (i.e., dispose of the underlying JFrame.
static java.util.Map<java.lang.String,Artist> defaultArtistMap()
          Return the default mapping of cell types to Artists.
 void displayDialogMessage(java.lang.String message, java.lang.String title)
          Display a message in a dialog box
 void enableSidewaysViewButton(boolean enable)
          Enable or disable the "Pass Sideways Move" button
 void setProposedMoveSource(int row, int column)
          Mark this cell as the starting point of a proposed move and suppress the drawing of this piece (because it is drawn translucently in the proposed target square).
 void setProposedMoveTarget(int row, int column, int player)
          Specify that the user has proposed moving a hedgehog into the given cell and draw a translucent piece in the specified square.
 void update(IGameState state)
          Update the view to reflect the current game state.
 void updateDie(int newValue)
          Update the die to show the results of a recent roll
 void updateMessage(java.lang.String newMessage)
          Updates the message that is displayed.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IgelViewKurmas

public IgelViewKurmas(IGameState gameState,
                      java.util.Map<java.lang.String,Artist> map)
Constructor

Parameters:
gameState - object describing the state of the game (The IGameState object describes the game configuration: board size, location of obstacles, obstacle type, etc.)
map - a map of Strings to the Artists that handle Cells of the specified type.

IgelViewKurmas

public IgelViewKurmas(IGameState gameState)
Constructor that uses a default artist map.

Parameters:
gameState - object describing the state of the game
Method Detail

addCellActionListener

public void addCellActionListener(CellActionListener cellActionListener)
Description copied from interface: IIgelView
Add the specified listener to each cell in the board.

Specified by:
addCellActionListener in interface IIgelView
Parameters:
cellActionListener - the listener

addMouseListener

public void addMouseListener(int row,
                             int col,
                             java.awt.event.MouseListener listener)
Description copied from interface: IIgelView
Add the specified mouse listener to the sell at location [row, col]

Specified by:
addMouseListener in interface IIgelView
Parameters:
row - the row
col - the column
listener - a MouseListener

update

public void update(IGameState state)
Description copied from interface: IIgelView
Update the view to reflect the current game state.

Specified by:
update in interface IIgelView
Parameters:
state - the current game state

addPassSidewaysMovePressedListener

public void addPassSidewaysMovePressedListener(java.awt.event.ActionListener actionListener)
Description copied from interface: IIgelView
Add a listener to respond when the user presses the "passSidewaysMove" button.

Specified by:
addPassSidewaysMovePressedListener in interface IIgelView
Parameters:
actionListener - a listener to respond when the user presses the "passSidewaysMove" button.

enableSidewaysViewButton

public void enableSidewaysViewButton(boolean enable)
Description copied from interface: IIgelView
Enable or disable the "Pass Sideways Move" button

Specified by:
enableSidewaysViewButton in interface IIgelView
Parameters:
enable - true if the button is to be enabled, false if the button is to be disabled.

displayDialogMessage

public void displayDialogMessage(java.lang.String message,
                                 java.lang.String title)
Description copied from interface: IIgelView
Display a message in a dialog box

Specified by:
displayDialogMessage in interface IIgelView
Parameters:
message - the main message (the one that appears in the center of the box)
title - the title of the dialog box

close

public void close()
Close the view (i.e., dispose of the underlying JFrame.

Specified by:
close in interface IIgelView

addMenu

public void addMenu(javax.swing.JMenuBar menu)
Description copied from interface: IIgelView
Add a menu

Specified by:
addMenu in interface IIgelView
Parameters:
menu - the menu

setProposedMoveSource

public void setProposedMoveSource(int row,
                                  int column)
Mark this cell as the starting point of a proposed move and suppress the drawing of this piece (because it is drawn translucently in the proposed target square).

Specified by:
setProposedMoveSource in interface IIgelView
Parameters:
row - the row
column - the column
Throws:
java.lang.IllegalArgumentException - if either row or column is not valid

setProposedMoveTarget

public void setProposedMoveTarget(int row,
                                  int column,
                                  int player)
Specify that the user has proposed moving a hedgehog into the given cell and draw a translucent piece in the specified square.

Specified by:
setProposedMoveTarget in interface IIgelView
Parameters:
row - the row
column - the column
player - the player number
Throws:
java.lang.IllegalArgumentException - if either row or column are out of range.

clearProposedMove

public void clearProposedMove()
Description copied from interface: IIgelView
Cancels any currently displayed proposed moves.

Specified by:
clearProposedMove in interface IIgelView

updateMessage

public void updateMessage(java.lang.String newMessage)
Description copied from interface: IIgelView
Updates the message that is displayed.

Specified by:
updateMessage in interface IIgelView
Parameters:
newMessage - the new message to display

updateDie

public void updateDie(int newValue)
Description copied from interface: IIgelView
Update the die to show the results of a recent roll

Specified by:
updateDie in interface IIgelView
Parameters:
newValue - the new value for the die

defaultArtistMap

public static java.util.Map<java.lang.String,Artist> defaultArtistMap()
Return the default mapping of cell types to Artists.

Returns:
the default mapping of cell types to Artists.