net.codescore.controllers
Class UIController

java.lang.Object
  extended by net.codescore.controllers.UIController
All Implemented Interfaces:
Runnable, Controller
Direct Known Subclasses:
CompController, HomeController, SchoolController, ScoreBoardController

public abstract class UIController
extends Object
implements Controller

A controller class for handling UI events and server push updates.

Author:
Adam Cornett

Field Summary
private  boolean _stopRunning
           
private  Desktop desk
           
protected  org.apache.commons.logging.Log log
           
static int SLEEP_TIME
           
private  AtomicBoolean updatesPending
           
 
Constructor Summary
private UIController()
           
  UIController(Desktop objDesktop)
           
 
Method Summary
abstract  void processUpdates()
          Called by the UI controller thread when there are updates pending
 void run()
           
 void setPendingUpdates()
          Sets the updates pending flag to true, so that when the UI Controller thread checks, it will call the Controller.processUpdates() method.
 void stopRunning()
          Sets the stop running flag, which is checked before the UI Controller thread checks for updates.
 String toString()
           
 void updateDesktop(Desktop objDesktop)
          Set the desktop that is locked and updated during the UI update.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SLEEP_TIME

public static final int SLEEP_TIME
See Also:
Constant Field Values

_stopRunning

private boolean _stopRunning

desk

private Desktop desk

updatesPending

private AtomicBoolean updatesPending

log

protected org.apache.commons.logging.Log log
Constructor Detail

UIController

public UIController(Desktop objDesktop)

UIController

private UIController()
Method Detail

processUpdates

public abstract void processUpdates()
Description copied from interface: Controller
Called by the UI controller thread when there are updates pending

Specified by:
processUpdates in interface Controller

run

public void run()
Specified by:
run in interface Runnable

setPendingUpdates

public void setPendingUpdates()
Description copied from interface: Controller
Sets the updates pending flag to true, so that when the UI Controller thread checks, it will call the Controller.processUpdates() method.

Specified by:
setPendingUpdates in interface Controller

stopRunning

public void stopRunning()
Description copied from interface: Controller
Sets the stop running flag, which is checked before the UI Controller thread checks for updates. This method will not guarantee that the UI Controller thread will stop immediately, but only that the next time it wakes up it will exit the main execution loop.

Specified by:
stopRunning in interface Controller

toString

public String toString()
Overrides:
toString in class Object

updateDesktop

public void updateDesktop(Desktop objDesktop)
Description copied from interface: Controller
Set the desktop that is locked and updated during the UI update.

Specified by:
updateDesktop in interface Controller


Copyright 2008 © Adam Cornett, Andrew Conner All Rights Reserved.