org.moyoman.client.reference
Class StartGameSwingWorker

java.lang.Object
  |
  +--org.moyoman.client.reference.util.SwingWorker
        |
        +--org.moyoman.client.reference.StartGameSwingWorker
Direct Known Subclasses:
NewGameSwingWorker, OpenGameSwingWorker, ResumeGameSwingWorker

public abstract class StartGameSwingWorker
extends SwingWorker

Provides a base implementation of SwingWorker to perform the new, open, or resume game action in a separate thread.

Since:
v0.02
Version:
v0.03
Author:
Jeffrey M. Thompson

Nested Class Summary
 
Nested classes inherited from class org.moyoman.client.reference.util.SwingWorker
 
Field Summary
private  CommandExecutor _commandExecutor
          Command executor.
private  GameRecord _gameRecord
          Game record.
private  IMoyoman _owner
          The owner.
private  PlayerManager _playerManager
          Player manager.
 
Fields inherited from class org.moyoman.client.reference.util.SwingWorker
 
Constructor Summary
protected StartGameSwingWorker(IMoyoman owner, CommandExecutor commandExecutor, GameRecord gameRecord)
          Construct this object.
protected StartGameSwingWorker(IMoyoman owner, CommandExecutor commandExecutor, GameRecord gameRecord, PlayerManager playerManager)
          Construct this object.
 
Method Summary
protected  void addBoardListeners()
          Add the mouse players as listeners to the board.
 Object construct()
          Execute time-consuming code.
protected abstract  PlayerManager constructHelper()
          Perform task specific construction.
 void finished()
          Perform final actions on the event-dispatching thread.
protected abstract  void finishedHelper()
          Perform task specific finish.
protected  Player getBlackPlayer()
          Return the black player.
protected  CommandExecutor getCommandExecutor()
          Return the command executor.
protected abstract  String getFinishedMessageKey()
          Return the finished message key.
protected  GameRecord getGameRecord()
          Return the game record.
protected  IMoyoman getOwner()
          Return the owner.
protected  Player getWhitePlayer()
          Return the white player.
protected  void removeBoardListeners()
          Remove the mouse players as listeners to the board.
protected  void removeListeners(Player player)
          Remove the listeners associated with the given player.
 
Methods inherited from class org.moyoman.client.reference.util.SwingWorker
get, getValue, interrupt, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_commandExecutor

private CommandExecutor _commandExecutor
Command executor.


_gameRecord

private GameRecord _gameRecord
Game record.


_owner

private IMoyoman _owner
The owner.


_playerManager

private PlayerManager _playerManager
Player manager.

Constructor Detail

StartGameSwingWorker

protected StartGameSwingWorker(IMoyoman owner,
                               CommandExecutor commandExecutor,
                               GameRecord gameRecord)
Construct this object.

Parameters:
owner - Moyoman owner.
commandExecutor - Command executor.
gameRecord - Game record. (optional)
Since:
v0.02

StartGameSwingWorker

protected StartGameSwingWorker(IMoyoman owner,
                               CommandExecutor commandExecutor,
                               GameRecord gameRecord,
                               PlayerManager playerManager)
Construct this object.

Parameters:
owner - Moyoman owner.
commandExecutor - Command executor.
gameRecord - Game record.
Since:
v0.03
Method Detail

construct

public Object construct()
Execute time-consuming code.

Specified by:
construct in class SwingWorker
Since:
v0.02

finished

public void finished()
Perform final actions on the event-dispatching thread.

Overrides:
finished in class SwingWorker
Since:
v0.02

getBlackPlayer

protected Player getBlackPlayer()
Return the black player.

Since:
v0.02

getCommandExecutor

protected CommandExecutor getCommandExecutor()
Return the command executor.

Since:
v0.02

getFinishedMessageKey

protected abstract String getFinishedMessageKey()
Return the finished message key.

Since:
v0.02

getGameRecord

protected GameRecord getGameRecord()
Return the game record.

Since:
v0.02

getOwner

protected IMoyoman getOwner()
Return the owner.

Since:
v0.02

getWhitePlayer

protected Player getWhitePlayer()
Return the white player.

Since:
v0.02

constructHelper

protected abstract PlayerManager constructHelper()
                                          throws Exception
Perform task specific construction.

Exception
Since:
v0.02

finishedHelper

protected abstract void finishedHelper()
Perform task specific finish.

Since:
v0.02

addBoardListeners

protected void addBoardListeners()
Add the mouse players as listeners to the board.

Since:
v0.03

removeBoardListeners

protected void removeBoardListeners()
Remove the mouse players as listeners to the board.

Since:
v0.03

removeListeners

protected void removeListeners(Player player)
Remove the listeners associated with the given player.

Since:
v0.02