JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.util.calendar
Class BoundsValidator

java.lang.Object
  |
  +--com.klg.jclass.util.calendar.BoundsValidator
All Implemented Interfaces:
EventListener, JCValueListener, Serializable

public class BoundsValidator
extends Object
implements JCValueListener, Serializable

Class that given a minimum and a maximum date, checks that the date is between the two bounds.

See Also:
Serialized Form

Field Summary
protected  Calendar maximumDate
          The Calendar object containing the maximum date.
protected  Calendar minimumDate
          The Calendar object containing the minimum date.
protected  Component parent
          The parent component requiring the bounds check.
 
Constructor Summary
BoundsValidator()
          Default constructor.
BoundsValidator(Calendar minDate, Calendar maxDate)
          Constructor specifying the minimum and maximum dates.
BoundsValidator(Component c)
          Constructor specifying parent component.
BoundsValidator(Component c, Calendar minDate, Calendar maxDate)
          Constructor specifying the parent component and the minimum and maximum dates.
 
Method Summary
protected  boolean checkDates(Calendar min, Calendar max)
           
 Calendar getMaximumDate()
          Returns the maximum roll date.
 Calendar getMinimumDate()
          Returns the minimum roll date.
 Component getParent()
          Return the parent component.
 boolean isValid(Calendar c)
          Given the minimum and the maximum date, check if the supplied date falls between the dates.
 void setMaximumDate(Calendar maxDate)
          Sets the maximum roll date.
 void setMinimumDate(Calendar minDate)
          Sets the minimum date.
 void setParent(Component c)
          Set the parent component.
 void valueChanged(com.klg.jclass.util.value.JCValueEvent e)
          Nothing done here.
 void valueChanging(com.klg.jclass.util.value.JCValueEvent e)
          Don't allow the change if it is before the minimum or after the maximum.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

minimumDate

protected Calendar minimumDate
The Calendar object containing the minimum date.


maximumDate

protected Calendar maximumDate
The Calendar object containing the maximum date.


parent

protected Component parent
The parent component requiring the bounds check. Can be null.

Constructor Detail

BoundsValidator

public BoundsValidator()
Default constructor. All values are null.


BoundsValidator

public BoundsValidator(Component c)
Constructor specifying parent component.

Parameters:
c - The parent component.

BoundsValidator

public BoundsValidator(Calendar minDate,
                       Calendar maxDate)
Constructor specifying the minimum and maximum dates.

Parameters:
minDate - The minimum date.
maxDate - The maximum date.

BoundsValidator

public BoundsValidator(Component c,
                       Calendar minDate,
                       Calendar maxDate)
Constructor specifying the parent component and the minimum and maximum dates.

Parameters:
c - The parent component.
minDate - The minimum date.
maxDate - The maximum date.
Method Detail

getParent

public Component getParent()
Return the parent component. This may be null.

Returns:
The parent component.

setParent

public void setParent(Component c)
Set the parent component.

Parameters:
c - The new parent component.

checkDates

protected boolean checkDates(Calendar min,
                             Calendar max)

getMinimumDate

public Calendar getMinimumDate()
Returns the minimum roll date. The calendar cannot change before the date.

Returns:
the minimum date
See Also:
Calendar, setMinimumDate(java.util.Calendar), getMaximumDate(), setMaximumDate(java.util.Calendar)

setMinimumDate

public void setMinimumDate(Calendar minDate)
Sets the minimum date. The calendar cannot change to before this date.

Parameters:
minDate - the new minimum date
See Also:
Calendar, getMinimumDate(), getMaximumDate(), setMaximumDate(java.util.Calendar)

getMaximumDate

public Calendar getMaximumDate()
Returns the maximum roll date. The calendar cannot change later than this date.

Returns:
the maximum date
See Also:
Calendar, setMinimumDate(java.util.Calendar), getMinimumDate(), setMaximumDate(java.util.Calendar)

setMaximumDate

public void setMaximumDate(Calendar maxDate)
Sets the maximum roll date. The calendar cannot change later than this date.

Parameters:
maxDate - the new maximum date
See Also:
Calendar, setMinimumDate(java.util.Calendar), getMinimumDate(), getMaximumDate()

isValid

public boolean isValid(Calendar c)
Given the minimum and the maximum date, check if the supplied date falls between the dates. If so, return true.

Parameters:
c - The Calendar object containing the date to check
Returns:
true if the date in the specified object is between the minimum and maximum dates.

valueChanging

public void valueChanging(com.klg.jclass.util.value.JCValueEvent e)
Don't allow the change if it is before the minimum or after the maximum.

Specified by:
valueChanging in interface JCValueListener
Parameters:
e - the event generated by the value change

valueChanged

public void valueChanged(com.klg.jclass.util.value.JCValueEvent e)
Nothing done here.

Specified by:
valueChanged in interface JCValueListener
Parameters:
e - the event generated by the value being changed

Copyright © 2004 Quest Software Inc..
All rights reserved.