dsto.dfc.swing.text.selection
Class DateSelector

java.lang.Object
  extended by dsto.dfc.swing.text.selection.DateSelector
All Implemented Interfaces:
Convertable, PatternSelector, Selector, Serializable

public class DateSelector
extends Object
implements PatternSelector, Serializable

A basic selector for java.util.Date objects. Currently allows "*" or an ISO date (yyyy-mm-dd hh:mm:ss timezone or shortened versions of the same) as a selector. Multiple dates can OR'd with ",". Ranges (inclusive) can be specified using syntax like "date1 > date2".

Examples:

   "*"
   "2001"
   "2001-01-02"
   "2001-01-02 10:14:01" (uses local timezone)
   "2001-01-02 10:14:01 UTC+9:30"
   "2001>2002,2004>2005"
 

Author:
Matthew Phillips
See Also:
IsoDateFormat, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface dsto.dfc.swing.text.selection.PatternSelector
PatternSelector.SelectAllSelector
 
Field Summary
static ValueConverter CONVERTER
          ValueConverter for this class: converts to/from String.
protected  long[] dateRanges
          A set of time (Date.getTime ()) [lower, upper] pairs.
protected  String expression
           
 
Fields inherited from interface dsto.dfc.swing.text.selection.PatternSelector
SELECT_ALL
 
Constructor Summary
DateSelector()
          Create a default "select all" selector.
DateSelector(String expression)
          Create an instance using an expression.
 
Method Summary
 ValueConverter getConverter()
          Return a converter that at least supports conversion to and from String.
 String getExpression()
           
 boolean matches(Object value)
          True if this pattern selector matches the given value.
 void setExpression(String expression)
          Set the value of the pattern used to match against.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CONVERTER

public static final ValueConverter CONVERTER
ValueConverter for this class: converts to/from String.


expression

protected String expression

dateRanges

protected transient long[] dateRanges
A set of time (Date.getTime ()) [lower, upper] pairs. Null if expression == "*".

Constructor Detail

DateSelector

public DateSelector()
Create a default "select all" selector.


DateSelector

public DateSelector(String expression)
             throws IllegalArgumentException
Create an instance using an expression. See class doc for format.

Throws:
IllegalArgumentException
Method Detail

matches

public boolean matches(Object value)
Description copied from interface: PatternSelector
True if this pattern selector matches the given value.

Specified by:
matches in interface PatternSelector
Specified by:
matches in interface Selector

setExpression

public void setExpression(String expression)
                   throws IllegalArgumentException
Description copied from interface: PatternSelector
Set the value of the pattern used to match against.

Specified by:
setExpression in interface PatternSelector
Parameters:
expression - String value
Throws:
IllegalArgumentException

getExpression

public String getExpression()
Specified by:
getExpression in interface PatternSelector

getConverter

public ValueConverter getConverter()
Description copied from interface: PatternSelector
Return a converter that at least supports conversion to and from String.

Specified by:
getConverter in interface Convertable
Specified by:
getConverter in interface PatternSelector

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2008 Commonwealth of Australia