Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.jgoodies.validation.tutorial.util
Class ExampleComponentFactory  view ExampleComponentFactory download ExampleComponentFactory.java

java.lang.Object
  extended byBasicComponentFactory
      extended bycom.jgoodies.validation.tutorial.util.ExampleComponentFactory

public final class ExampleComponentFactory
extends BasicComponentFactory

Consists only of static methods that vend formatted text fields used to edit dates that are bound to an underlying ValueModel. Extends the Binding library's BasicComponentFactory to inherit all factory metods from that class.

Version:
$Revision: 1.5 $

Constructor Summary
private ExampleComponentFactory()
           
 
Method Summary
static javax.swing.JFormattedTextField createDateField(ValueModel valueModel)
          Creates and returns a formatted text field that is bound to the Date value of the given ValueModel.
static javax.swing.JFormattedTextField createDateField(ValueModel valueModel, boolean enableShortcuts)
          Creates and returns a formatted text field that is bound to the Date value of the given ValueModel.
static javax.swing.JFormattedTextField createDateField(ValueModel valueModel, boolean enableShortcuts, boolean commitsOnValidEdit)
          Creates and returns a formatted text field that is bound to the Date value of the given ValueModel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExampleComponentFactory

private ExampleComponentFactory()
Method Detail

createDateField

public static javax.swing.JFormattedTextField createDateField(ValueModel valueModel)
Creates and returns a formatted text field that is bound to the Date value of the given ValueModel.

The JFormattedTextField is configured with an AbstractFormatter that uses two different DateFormats to edit and display the Date. A SHORT DateFormat with strict checking is used to edit (parse) a date; the DateFormatter's default DateFormat is used to display (format) a date. In both cases null Dates are mapped to the empty String.

In addition to formatted Dates, the parser accepts positive and negative integers and interprets them as Dates relative to today. For example -1 is yesterday, 1 is tomorrow, and 7 is "in a week".

Yesterday, today, and tomorrow are displayed as these Strings, not as formatted Dates.


createDateField

public static javax.swing.JFormattedTextField createDateField(ValueModel valueModel,
                                                              boolean enableShortcuts)
Creates and returns a formatted text field that is bound to the Date value of the given ValueModel.

The JFormattedTextField is configured with an AbstractFormatter that uses two different DateFormats to edit and display the Date. A SHORT DateFormat with strict checking is used to edit (parse) a date; the DateFormatter's default DateFormat is used to display (format) a date. In both cases null Dates are mapped to the empty String.

In addition to formatted Dates, the parser accepts positive and negative integers and interprets them as Dates relative to today. For example -1 is yesterday, 1 is tomorrow, and 7 is "in a week".

If enableShortcuts is set to true, yesterday, today, and tomorrow are displayed as these Strings, not as formatted Dates.


createDateField

public static javax.swing.JFormattedTextField createDateField(ValueModel valueModel,
                                                              boolean enableShortcuts,
                                                              boolean commitsOnValidEdit)
Creates and returns a formatted text field that is bound to the Date value of the given ValueModel.

The JFormattedTextField is configured with an AbstractFormatter that uses two different DateFormats to edit and display the Date. A SHORT DateFormat with strict checking is used to edit (parse) a date; the DateFormatter's default DateFormat is used to display (format) a date. In both cases null Dates are mapped to the empty String.

In addition to formatted Dates, the parser accepts positive and negative integers and interprets them as Dates relative to today. For example -1 is yesterday, 1 is tomorrow, and 7 is "in a week".

If enableShortcuts is set to true, yesterday, today, and tomorrow are displayed as these Strings, not as formatted Dates.