cz.cvut.agents.rph.reversi
Class ReversiView

java.lang.Object
  extended by cz.cvut.agents.rph.core.GameView
      extended by cz.cvut.agents.rph.reversi.ReversiView
All Implemented Interfaces:
DelayChanger, java.awt.event.ActionListener, java.util.EventListener, javax.swing.event.ChangeListener

public class ReversiView
extends GameView
implements java.awt.event.ActionListener, javax.swing.event.ChangeListener, DelayChanger

Specific view for the Reversi game. Author: Ondrej Vanek Date: 10/3/12 Time: 10:04 AM


Field Summary
private  javax.swing.JPanel buttonPanel
           
private  javax.swing.JPanel infoPanel
           
private  javax.swing.JLabel jLabel3
           
private  javax.swing.JLabel jLabel6
           
private  ReversiModel model
          Reversi game model.
private  javax.swing.JLabel p1MaxTimeLabel
           
private  javax.swing.JLabel p1NameLabel
           
private  javax.swing.JLabel p1StonesLabel
           
private  javax.swing.JLabel p1TotalStonesLabel
           
private  javax.swing.JLabel p2MaxTimeLabel
           
private  javax.swing.JLabel p2NameLabel
           
private  javax.swing.JLabel p2StonesLabel
           
private  javax.swing.JLabel p2TotalStonesLabel
           
private  PlaygroundPanel playgroundPanel
          Panel depicting the playground.
private  javax.swing.JButton playPauseButton
           
private  javax.swing.JSlider slider
           
static int SLIDER_MAX
           
static int SLIDER_MIN
           
static int SLIDER_VALUE
           
private  javax.swing.JLabel statusLabel
           
private  javax.swing.JPanel viewPanel
          Viewpanel holding all the visualization
 
Constructor Summary
ReversiView(ReversiModel model)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          
private  void constructViewPanel()
          author Premysl Volf
private  void createSlider()
           
 int getDelayInMiliseconds()
          Gets the delay between moves in miliseconds.
 java.awt.Component getPanel()
           
private  void showEndGame()
          Shows the end of the game dialog with some info about the result.
 void stateChanged(javax.swing.event.ChangeEvent e)
           
 void update()
          Updates view based on the call from the GameModel - the model was changed.
private  void updateButton(GameModel.GameStatus playing)
          Update the button status.
 
Methods inherited from class cz.cvut.agents.rph.core.GameView
addActionListener, notifyListeners, removeActionListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

model

private ReversiModel model
Reversi game model.


viewPanel

private javax.swing.JPanel viewPanel
Viewpanel holding all the visualization


playgroundPanel

private PlaygroundPanel playgroundPanel
Panel depicting the playground.


infoPanel

private javax.swing.JPanel infoPanel

buttonPanel

private javax.swing.JPanel buttonPanel

statusLabel

private javax.swing.JLabel statusLabel

jLabel3

private javax.swing.JLabel jLabel3

jLabel6

private javax.swing.JLabel jLabel6

p1NameLabel

private javax.swing.JLabel p1NameLabel

p1StonesLabel

private javax.swing.JLabel p1StonesLabel

p1TotalStonesLabel

private javax.swing.JLabel p1TotalStonesLabel

p1MaxTimeLabel

private javax.swing.JLabel p1MaxTimeLabel

p2NameLabel

private javax.swing.JLabel p2NameLabel

p2StonesLabel

private javax.swing.JLabel p2StonesLabel

p2TotalStonesLabel

private javax.swing.JLabel p2TotalStonesLabel

p2MaxTimeLabel

private javax.swing.JLabel p2MaxTimeLabel

playPauseButton

private javax.swing.JButton playPauseButton

SLIDER_MIN

public static final int SLIDER_MIN
See Also:
Constant Field Values

SLIDER_MAX

public static final int SLIDER_MAX
See Also:
Constant Field Values

SLIDER_VALUE

public static final int SLIDER_VALUE
See Also:
Constant Field Values

slider

private javax.swing.JSlider slider
Constructor Detail

ReversiView

public ReversiView(ReversiModel model)
Method Detail

constructViewPanel

private void constructViewPanel()
author Premysl Volf


createSlider

private void createSlider()

update

public void update()
Description copied from class: GameView
Updates view based on the call from the GameModel - the model was changed.

Specified by:
update in class GameView

showEndGame

private void showEndGame()
Shows the end of the game dialog with some info about the result.


updateButton

private void updateButton(GameModel.GameStatus playing)
Update the button status.

Parameters:
playing - are we playing or what?

getPanel

public java.awt.Component getPanel()

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
e -

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent e)
Specified by:
stateChanged in interface javax.swing.event.ChangeListener

getDelayInMiliseconds

public int getDelayInMiliseconds()
Description copied from interface: DelayChanger
Gets the delay between moves in miliseconds.

Specified by:
getDelayInMiliseconds in interface DelayChanger
Returns:
delay between moves in miliseconds.