org.openpermis.editor.policy.gui.component
Class TimeStampModel

java.lang.Object
  extended by org.openpermis.editor.policy.gui.component.TimeStampModel

public class TimeStampModel
extends Object

Since:
0.3.0

Field Summary
private  PropertyChangeSupport changeSupport
           
private static int MILLIS_PER_SECOND
           
private static int MINUTES_PER_HOUR
           
private static int SECONDS_PER_MINUTE
           
private  org.openpermis.policy.TimeStamp timeStamp
           
 
Constructor Summary
TimeStampModel(org.openpermis.policy.TimeStamp timeStamp)
          Creates a model for a time stamp.
 
Method Summary
 void addPropertyChangeListener(String property, PropertyChangeListener listener)
          Registers a property change listener on this model.
private  void clearTimeOfDay(Calendar cal)
           
protected  void firePropertyChanged(String property, Object oldValue, Object newValue)
          Notifies listeners that a property changed its value.
private  Calendar getCalendar()
           
private  Calendar getCalendar(Date date)
           
 Date getDate()
          Gets the date part of the current time stamp.
 long getTimeOfDay()
          Gets the current time of day in milliseconds.
private  long getTimeOfDay(Calendar cal)
           
 org.openpermis.policy.TimeStamp getTimeStamp()
          Gets the current time stamp value.
 void removePropertyChangeListener(String property, PropertyChangeListener listener)
          Deregisters a property change listener on this model.
 void setDate(Date date)
          Sets the date part of the current time stamp.
private  void setDate(Date newDate, boolean propagate)
           
 void setTimeOfDay(long timeOfDay)
          Sets the current time of day in milliseconds.
private  void setTimeOfDay(long timeOfDay, boolean propagate)
           
 void setTimeStamp(org.openpermis.policy.TimeStamp timeStamp)
          Sets the current time stamp value.
private  void setTimeStamp(org.openpermis.policy.TimeStamp newValue, boolean propagate)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MILLIS_PER_SECOND

private static final int MILLIS_PER_SECOND
Constant Field Value:
1000
Since:
0.3.0

SECONDS_PER_MINUTE

private static final int SECONDS_PER_MINUTE
Constant Field Value:
60
Since:
0.3.0

MINUTES_PER_HOUR

private static final int MINUTES_PER_HOUR
Constant Field Value:
60
Since:
0.3.0

changeSupport

private final PropertyChangeSupport changeSupport
Since:
0.3.0

timeStamp

private org.openpermis.policy.TimeStamp timeStamp
Since:
0.3.0
Constructor Detail

TimeStampModel

public TimeStampModel(org.openpermis.policy.TimeStamp timeStamp)
Creates a model for a time stamp.

Parameters:
timeStamp - the initial time stamp value for the model.
Since:
0.3.0
Method Detail

getTimeStamp

public org.openpermis.policy.TimeStamp getTimeStamp()
Gets the current time stamp value.

Returns:
the current time stamp.
Since:
0.3.0

setTimeStamp

public void setTimeStamp(org.openpermis.policy.TimeStamp timeStamp)
Sets the current time stamp value.

Parameters:
timeStamp - the new time stamp value.
Since:
0.3.0

setTimeStamp

private void setTimeStamp(org.openpermis.policy.TimeStamp newValue,
                          boolean propagate)
Since:
0.3.0

getDate

public Date getDate()
Gets the date part of the current time stamp.

Returns:
a date with time of day set to midnight.
Since:
0.3.0

clearTimeOfDay

private void clearTimeOfDay(Calendar cal)
Since:
0.3.0

setDate

public void setDate(Date date)
Sets the date part of the current time stamp.

Parameters:
date - the date to set. Its time of day will be replaced by the current time of day.
Since:
0.3.0

setDate

private void setDate(Date newDate,
                     boolean propagate)
Since:
0.3.0

getTimeOfDay

public long getTimeOfDay()
Gets the current time of day in milliseconds.

Returns:
the number of milliseconds that have passed since last midnight.
Since:
0.3.0

getTimeOfDay

private long getTimeOfDay(Calendar cal)
Since:
0.3.0

setTimeOfDay

public void setTimeOfDay(long timeOfDay)
Sets the current time of day in milliseconds.

Parameters:
timeOfDay - the number of milliseconds since midnight. Date information will be ignored.
Since:
0.3.0

setTimeOfDay

private void setTimeOfDay(long timeOfDay,
                          boolean propagate)
Since:
0.3.0

getCalendar

private Calendar getCalendar()
Since:
0.3.0

getCalendar

private Calendar getCalendar(Date date)
Since:
0.3.0

addPropertyChangeListener

public void addPropertyChangeListener(String property,
                                      PropertyChangeListener listener)
Registers a property change listener on this model.

Parameters:
property - the property whose changes to observe.
listener - the listener to register.
Since:
0.3.0

removePropertyChangeListener

public void removePropertyChangeListener(String property,
                                         PropertyChangeListener listener)
Deregisters a property change listener on this model.

Parameters:
property - the property whose changes to no longer observe.
listener - the listener to deregister.
Since:
0.3.0

firePropertyChanged

protected void firePropertyChanged(String property,
                                   Object oldValue,
                                   Object newValue)
Notifies listeners that a property changed its value.

Parameters:
property - the property whose value was changed.
oldValue - the previous value of the property.
newValue - the new value of the property.
Since:
0.3.0


PERMIS Role Based Access Control 0.3.0 (Build 14)
2009/05/08 09:06:48
Copyright (c) 2002-2007 Ergon Informatik AG