gvprojects.igel.view
Interface IIgelView

All Known Implementing Classes:
IgelViewKurmas

public interface IIgelView

The GUI for a game of Igel Argern

Author:
Zachary Kurmas

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., close and dispose of the underlying JFrame).
 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.
 void setProposedMoveTarget(int row, int column, int player)
          Specify that the user has proposed moving a hedgehog into the given cell.
 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.
 

Method Detail

addCellActionListener

void addCellActionListener(CellActionListener cellActionListener)
Add the specified listener to each cell in the board.

Parameters:
cellActionListener - the listener

addMouseListener

void addMouseListener(int row,
                      int col,
                      java.awt.event.MouseListener listener)
Add the specified mouse listener to the sell at location [row, col]

Parameters:
row - the row
col - the column
listener - a MouseListener

update

void update(IGameState state)
Update the view to reflect the current game state.

Parameters:
state - the current game state

setProposedMoveTarget

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

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

void clearProposedMove()
Cancels any currently displayed proposed moves.


updateMessage

void updateMessage(java.lang.String newMessage)
Updates the message that is displayed.

Parameters:
newMessage - the new message to display

updateDie

void updateDie(int newValue)
Update the die to show the results of a recent roll

Parameters:
newValue - the new value for the die

setProposedMoveSource

void setProposedMoveSource(int row,
                           int column)
Mark this cell as the starting point of a proposed move. (An implementation may, for example, choose not to display a piece that the user has selected to move elsewhere.)

Parameters:
row - the row
column - the column
Throws:
java.lang.IllegalArgumentException - if either row or column is not valid

addPassSidewaysMovePressedListener

void addPassSidewaysMovePressedListener(java.awt.event.ActionListener actionListener)
Add a listener to respond when the user presses the "passSidewaysMove" button.

Parameters:
actionListener - a listener to respond when the user presses the "passSidewaysMove" button.

enableSidewaysViewButton

void enableSidewaysViewButton(boolean enable)
Enable or disable the "Pass Sideways Move" button

Parameters:
enable - true if the button is to be enabled, false if the button is to be disabled.

displayDialogMessage

void displayDialogMessage(java.lang.String message,
                          java.lang.String title)
Display a message in a dialog box

Parameters:
message - the main message (the one that appears in the center of the box)
title - the title of the dialog box

close

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


addMenu

void addMenu(javax.swing.JMenuBar menu)
Add a menu

Parameters:
menu - the menu