scheduler.view
Class ViewMode

java.lang.Object
  extended by java.util.Observable
      extended by scheduler.view.ViewMode

public class ViewMode
extends java.util.Observable

Class ViewMode specifies two ways to view a schedule: as a calendar, as a list.

Author:
Jason Mak (jamak3@gmail.com)

Nested Class Summary
static class ViewMode.Mode
          Enums to represent the two different view modes.
 
Field Summary
protected  ViewMode.Mode mode
          The mode value of this object.
protected  ViewModeUI viewModeUI
          The companion view.
 
Constructor Summary
ViewMode(View view, ViewMode.Mode mode)
          Construct this my setting the current mode to the parameter.
 
Method Summary
 ViewMode.Mode getMode()
          Return the current mode.
 ViewModeUI getViewModeUI()
          Return the companion view.
 void setMode(ViewMode.Mode mode)
          Set the current mode.
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mode

protected ViewMode.Mode mode
The mode value of this object.


viewModeUI

protected ViewModeUI viewModeUI
The companion view.

Constructor Detail

ViewMode

public ViewMode(View view,
                ViewMode.Mode mode)
Construct this my setting the current mode to the parameter. Instantiate a new companion view for the new ViewMode.
 pre: ;

 post: this.mode' == mode && this.viewModeUI' == viewModeUI
       && countObservers() > 0;
                                                                

Parameters:
mode - the mode after instantiation
Method Detail

setMode

public void setMode(ViewMode.Mode mode)
Set the current mode. Notifies the schedule view to switch to calendar or list mode.
 pre: ;

 post: this.mode' == mode;
                                                                

Parameters:
mode - the new view mode

getMode

public ViewMode.Mode getMode()
Return the current mode.
 post: return == mode;
                                                                

Returns:
the current view mode

getViewModeUI

public ViewModeUI getViewModeUI()
Return the companion view.
 post: return == viewModeUI;
                                                                

Returns:
the companion view