lu.tudor.santec.jtimechooser
Class TimeChooserModel

java.lang.Object
  extended by lu.tudor.santec.jtimechooser.TimeChooserModel

public class TimeChooserModel
extends java.lang.Object

Author:
jens.ferring(at)tudor.lu This is the model in the MVC-patter of the JTimeChooser. All data is hold and spread from here.

Constructor Summary
TimeChooserModel(JTimeChooser timeChooser)
           
 
Method Summary
 void addTimeChangedListener(TimeChangedListener listener)
          Adds the listener to the list of listener.
 void callListener(int reason)
          Calls the timeChanged-method of all listener.
 java.text.DateFormat getFormat()
           
 javax.swing.text.Highlighter.HighlightPainter getPainter()
           
 java.util.regex.Pattern getPattern()
           
 int getPixelPerHour()
           
 int getPixelPerMinute()
           
 int getPixelPerSecond()
           
 int getScrollsPerHour()
           
 int getScrollsPerMinute()
           
 int getScrollsPerSecond()
           
 java.util.Calendar getTime()
           
 int getTime(int field)
          Like the method get(int) of the class Calendar.
 TimeUnit getTimeUnit()
           
 void removeTimeChangedListener(TimeChangedListener listener)
          Removes the listener of the list of listener
 void setFormat()
          If the format was changed or needs to be initialised, call this method.
 void setPainter(javax.swing.text.Highlighter.HighlightPainter painter)
           
 void setPixelPerHour(int pixelPerHour)
          Sets how many pixels must be dragged to change the hours by 1.
 void setPixelPerMinute(int pixelPerMinute)
          Sets how many pixels must be dragged to change the minutes by 1.
 void setPixelPerSecond(int pixelPerSecond)
          Sets how many pixels must be dragged to change the seconds by 1.
 void setScrollsPerHour(int scrollsPerHour)
           
 void setScrollsPerMinute(int scrollsPerMinute)
           
 void setScrollsPerSecond(int scrollsPerSecond)
           
 void setTime(java.util.Date time)
          You can manually set a new date / time
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimeChooserModel

public TimeChooserModel(JTimeChooser timeChooser)
Method Detail

getTimeUnit

public TimeUnit getTimeUnit()
Returns:
The TimeUnit that keeps the data needed for dragging

getTime

public java.util.Calendar getTime()
Returns:
The Calendar that keeps the time data

getTime

public int getTime(int field)
Like the method get(int) of the class Calendar.

Parameters:
field - A field of the class Calendar.
Normally it should be HOUR_OF_DAY, MINUTE or SECOND.
Returns:
The int value of the time unit, specified by the field.

setTime

public void setTime(java.util.Date time)
You can manually set a new date / time

Parameters:
time - The new date

getPixelPerHour

public int getPixelPerHour()
Returns:
Defines how many pixels must be dragged, to change the hours by 1.

setPixelPerHour

public void setPixelPerHour(int pixelPerHour)
Sets how many pixels must be dragged to change the hours by 1.

Parameters:
pixelPerHour -

getPixelPerMinute

public int getPixelPerMinute()
Returns:
Defines how many pixels must be dragged, to change the minutes by 1.

setPixelPerMinute

public void setPixelPerMinute(int pixelPerMinute)
Sets how many pixels must be dragged to change the minutes by 1.

Parameters:
pixelPerMinute -

getPixelPerSecond

public int getPixelPerSecond()
Returns:
Defines how many pixels must be dragged, to change the seconds by 1.

setPixelPerSecond

public void setPixelPerSecond(int pixelPerSecond)
Sets how many pixels must be dragged to change the seconds by 1.

Parameters:
pixelPerSecond -

getScrollsPerHour

public int getScrollsPerHour()
Returns:
Defines by what value the hours are in- / decreased, if the mouse wheel is rotated.

setScrollsPerHour

public void setScrollsPerHour(int scrollsPerHour)
Parameters:
scrollsPerHour - The value the hours are in- / decreased, if the mouse wheel is rotated.

getScrollsPerMinute

public int getScrollsPerMinute()
Returns:
Defines by what value the minutes are in- / decreased, if the mouse wheel is rotated.

setScrollsPerMinute

public void setScrollsPerMinute(int scrollsPerMinute)
Parameters:
scrollsPerMinute - The value the minutes are in- / decreased, if the mouse wheel is rotated.

getScrollsPerSecond

public int getScrollsPerSecond()
Returns:
Defines by what value the seconds are in- / decreased, if the mouse wheel is rotated.

setScrollsPerSecond

public void setScrollsPerSecond(int scrollsPerSecond)
Parameters:
scrollsPerSecond - The value the seconds are in- / decreased, if the mouse wheel is rotated.

getPattern

public java.util.regex.Pattern getPattern()
Returns:
The Pattern that defines, which characters are allowed in the text field.

getFormat

public java.text.DateFormat getFormat()
Returns:
The Format that defines which characters are fix and which may be edited.

setFormat

public void setFormat()
If the format was changed or needs to be initialised, call this method.


getPainter

public javax.swing.text.Highlighter.HighlightPainter getPainter()
Returns:
The Painter that defines the highlighting colour.

setPainter

public void setPainter(javax.swing.text.Highlighter.HighlightPainter painter)
Parameters:
painter - The Painter that defines the highlighting colour.

addTimeChangedListener

public void addTimeChangedListener(TimeChangedListener listener)
Adds the listener to the list of listener.
The listener are called whenever the time might be changed.

Parameters:
listener - The TimeChangedListener

removeTimeChangedListener

public void removeTimeChangedListener(TimeChangedListener listener)
Removes the listener of the list of listener

Parameters:
listener -

callListener

public void callListener(int reason)
Calls the timeChanged-method of all listener.

Parameters:
reason - The reason, why the listener are called.