MDateSelector

mseries.Calendar
Class MMonth

java.lang.Object
  extended by mseries.Calendar.MMonth

public class MMonth
extends Object

The business end of the DateSelector component. This class maintains the state of the the component


Field Summary
protected  Vector<MMonthListener> listeners
           
 
Constructor Summary
MMonth()
           
MMonth(Date min, Date max)
           
 
Method Summary
 void addMMonthListener(MMonthListener listener)
          Registers the listeners of the table changes
 void addToMin(int increment)
          Adds a number of months to the minimum date
protected static int compDates(Date d1, Calendar c2)
           
 void exitEvent()
           
protected  Date getAsDate(int r, int c)
           
 int getColumnCount()
           
 Date getCurrentDate()
          Returns the current date in the calendar.
 Point getCurrentPoint()
           
 int getFirstDay()
           
 Date getMaximum()
          Returns the latest possible date the model can be set to
 Date getMinimum()
          Returns the earliest possible date the model can be set to
 int getMonth()
          returns the month index of the current calendar
 int getRowCount()
           
 Object getValueAt(int r, int c)
          calculates the date in a particular cell based on the date at 0,0 (the start of the displayed calendar) and the cell being returned
 boolean isCellEditable(int r, int c)
           
 boolean isCurrentDate(int d, int w)
           
 boolean isInRange(Calendar date)
           
 boolean isInRange(Date date)
           
 void lostFocus()
           
 void removeMMonthListener(MMonthListener listener)
          Removes the listener from the registered list of listeners
 void setCurrentDate(int row, int col)
          Sets the current date in the model
 void setDate(Date inDate)
           
protected  void setDMY(Date inDate)
          Sets the date and preserves the time that the model previously has
 void setFirstDay(int first)
          The first column on the calendar grid shows the dates for the day passed here.
 void setMaximum(Date max)
          Sets the latest possible date for the calendar
 void setMinimum(Date min)
          Sets the earliest possible date for the calendar
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listeners

protected Vector<MMonthListener> listeners
Constructor Detail

MMonth

public MMonth(Date min,
              Date max)

MMonth

public MMonth()
Method Detail

setFirstDay

public void setFirstDay(int first)
The first column on the calendar grid shows the dates for the day passed here.

Parameters:
first - a day constant from java.util.Calendar such as Calendar.SUNDAY

getFirstDay

public int getFirstDay()
Returns:
the first day on display

setDMY

protected void setDMY(Date inDate)
               throws MDateOutOfRangeException
Sets the date and preserves the time that the model previously has

Parameters:
inDate - the new value whose Hour, Minute and Second elements are ignored
Throws:
MDateOutOfRangeException

setDate

public void setDate(Date inDate)
             throws MDateOutOfRangeException
Throws:
MDateOutOfRangeException

setMinimum

public void setMinimum(Date min)
Sets the earliest possible date for the calendar

Parameters:
min - the earliest possible date

getMinimum

public Date getMinimum()
Returns the earliest possible date the model can be set to

Returns:
earliest date

setMaximum

public void setMaximum(Date max)
Sets the latest possible date for the calendar

Parameters:
max - the latest possible date

getMaximum

public Date getMaximum()
Returns the latest possible date the model can be set to

Returns:
latest date

addToMin

public void addToMin(int increment)
              throws MDateOutOfRangeException
Adds a number of months to the minimum date

Parameters:
increment - the number of months to add
Throws:
MDateOutOfRangeException

getCurrentDate

public Date getCurrentDate()
Returns the current date in the calendar. This gets set as the calendar is clicked on

Returns:
the currently selected date

getCurrentPoint

public Point getCurrentPoint()

setCurrentDate

public void setCurrentDate(int row,
                           int col)
                    throws MDateOutOfRangeException
Sets the current date in the model

Throws:
MDateOutOfRangeException

getMonth

public int getMonth()
returns the month index of the current calendar


getColumnCount

public int getColumnCount()

getRowCount

public int getRowCount()

getValueAt

public Object getValueAt(int r,
                         int c)
calculates the date in a particular cell based on the date at 0,0 (the start of the displayed calendar) and the cell being returned


getAsDate

protected Date getAsDate(int r,
                         int c)

addMMonthListener

public void addMMonthListener(MMonthListener listener)
Registers the listeners of the table changes

Parameters:
listener - - MMonthListener

removeMMonthListener

public void removeMMonthListener(MMonthListener listener)
Removes the listener from the registered list of listeners

Parameters:
listener - - MMonthListener

isInRange

public boolean isInRange(Date date)

isInRange

public boolean isInRange(Calendar date)

exitEvent

public void exitEvent()

lostFocus

public void lostFocus()

isCellEditable

public boolean isCellEditable(int r,
                              int c)

compDates

protected static int compDates(Date d1,
                               Calendar c2)

isCurrentDate

public boolean isCurrentDate(int d,
                             int w)

MDateSelector

Copyright © 2001-2007 M Newstead. All Rights Reserved.