com.bradrydzewski.gwt.calendar.client
Class AppointmentManager

java.lang.Object
  extended by com.bradrydzewski.gwt.calendar.client.AppointmentManager

public class AppointmentManager
extends Object

Manages operations and state for the entire set of appointments displayed by the GWT calendar.

The key responsibilities of the AppointmentManager are:

Author:
Brad Rydzewski, Carlos D. Morales

Constructor Summary
AppointmentManager()
           
 
Method Summary
 void addAppointment(Appointment appt)
          Adds an appointment to the collection of appointments maintained by this ApplicationManager.
 void addAppointments(ArrayList<Appointment> appointments)
          Adds multiple appointments to the collection maintained by this ApplicationManager.
 void clearAppointments()
          Empties the collection of managed appointments.
 void commit()
           
 ArrayList<Appointment> getAppointments()
          Returns the collection of appointments that this AppointmentManager maintains.
 Appointment getHoveredAppointment()
           
 Appointment getSelectedAppointment()
          Returns the appointment in this manager's collection that is "currently selected".
 boolean hasAppointmentSelected()
          Indicates whether there is a "currently selected" appointment at the moment.
 boolean isTheSelectedAppointment(Appointment appointment)
          Tells whether the passed appointment is the same one as the one that is currently selected in this manager.
 void removeAppointment(Appointment appointment)
          Removes the appointment from this manager's managed collection.
 void removeCurrentlySelectedAppointment()
          Removes the "currently selected" appointment from this manager's collection.
 void resetHoveredAppointment()
           
 void resetSelectedAppointment()
          Resets the "currently selected" appointment of this manager.
 void rollback()
           
 boolean selectNextAppointment()
          Moves the "currently selected" to the next appointment in the managed collection of this AppointmentManager.
 boolean selectPreviousAppointment()
          Moves the "currently selected" to the previous appointment in the managed collection of this AppointmentManager.
 void setCommittedAppointment(Appointment appt)
           
 void setHoveredAppointment(Appointment hoveredAppointment)
           
 void setRollbackAppointment(Appointment appt)
           
 void setSelectedAppointment(Appointment selectedAppointment)
          Sets the appointment that should be considered the "currently selected" appointment.
 void sortAppointments()
          Sorts the collection of appointments by their natural order.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AppointmentManager

public AppointmentManager()
Method Detail

getAppointments

public ArrayList<Appointment> getAppointments()
Returns the collection of appointments that this AppointmentManager maintains. Warning: this method returns a modifiable reference to the internally managed list of appointments; client code might break the invariants that this AppointmentManager enforces if it performs any operations that modify the returned collection.

Returns:
The appointments managed by this AppointmentManager.

addAppointment

public void addAppointment(Appointment appt)
Adds an appointment to the collection of appointments maintained by this ApplicationManager.

Parameters:
appt - The appointment to be made part of this manager's managed collection

addAppointments

public void addAppointments(ArrayList<Appointment> appointments)
Adds multiple appointments to the collection maintained by this ApplicationManager.

Parameters:
appointments - The appointments that will be made part of this manager's managed collection

removeAppointment

public void removeAppointment(Appointment appointment)
Removes the appointment from this manager's managed collection.

Parameters:
appointment - The appointment to remove

removeCurrentlySelectedAppointment

public void removeCurrentlySelectedAppointment()
Removes the "currently selected" appointment from this manager's collection.


clearAppointments

public void clearAppointments()
Empties the collection of managed appointments.


setSelectedAppointment

public void setSelectedAppointment(Appointment selectedAppointment)
Sets the appointment that should be considered the "currently selected" appointment.

Parameters:
selectedAppointment - The appointment to consider "currently selected"

hasAppointmentSelected

public boolean hasAppointmentSelected()
Indicates whether there is a "currently selected" appointment at the moment.

Returns:
true if there is a currently selected appointment for the collection managed by this component, false otherwise

getSelectedAppointment

public Appointment getSelectedAppointment()
Returns the appointment in this manager's collection that is "currently selected".

Returns:
The currently selected appointment

sortAppointments

public void sortAppointments()
Sorts the collection of appointments by their natural order.


selectPreviousAppointment

public boolean selectPreviousAppointment()
Moves the "currently selected" to the previous appointment in the managed collection of this AppointmentManager.
The "previous" appointment will be the appointment before the currently selected appointment in the set of appointments (whether ordered or not).


Because this operation depends on a "currently selected appointment", no previous appointment is considered to exist if there is no "currently selected appointment." or it is the first in the set.

Returns:
true if selecting the previous appointment was successful, false no currently selected appointment is set or the currently selected appointment is the first in the collection.

selectNextAppointment

public boolean selectNextAppointment()
Moves the "currently selected" to the next appointment in the managed collection of this AppointmentManager.
The "next" appointment will be the appointment after the currently selected appointment in the set of appointments (whether ordered or not).


Because this operation depends on a "currently selected appointment", no next appointment is considered to exist if there is no "currently selected appointment or it is the last in the set."

Returns:
true if selecting the previous appointment was successful, false no currently selected appointment is set or the currently selected appointment is the last in the collection.

resetSelectedAppointment

public void resetSelectedAppointment()
Resets the "currently selected" appointment of this manager.

If this manager has a currently selected appointment, the appointment selected property will be set to false and this manager's selectedAppointment property will be set to null.


isTheSelectedAppointment

public boolean isTheSelectedAppointment(Appointment appointment)
Tells whether the passed appointment is the same one as the one that is currently selected in this manager.

Parameters:
appointment - The appointment to test to be the same as the currently selected
Returns:
true if there is a currently selected appointment and it is equal to the passed appointment

commit

public void commit()

rollback

public void rollback()

setRollbackAppointment

public void setRollbackAppointment(Appointment appt)

setCommittedAppointment

public void setCommittedAppointment(Appointment appt)

resetHoveredAppointment

public void resetHoveredAppointment()

setHoveredAppointment

public void setHoveredAppointment(Appointment hoveredAppointment)

getHoveredAppointment

public Appointment getHoveredAppointment()


Copyright © 2012. All Rights Reserved.