com.jgoodies.validation.tutorial.util
Class ExampleComponentFactory

java.lang.Object
  extended by com.jgoodies.binding.adapter.BasicComponentFactory
      extended by com.jgoodies.validation.tutorial.util.ExampleComponentFactory

public final class ExampleComponentFactory
extends com.jgoodies.binding.adapter.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 methods from that class.

Version:
$Revision: 1.12 $
Author:
Karsten Lentzsch
See Also:
BasicComponentFactory, Bindings

Method Summary
static JFormattedTextField createDateField(com.jgoodies.binding.value.ValueModel valueModel)
          Creates and returns a formatted text field that is bound to the Date value of the given ValueModel.
static JFormattedTextField createDateField(com.jgoodies.binding.value.ValueModel valueModel, boolean enableShortcuts)
          Creates and returns a formatted text field that is bound to the Date value of the given ValueModel.
static JFormattedTextField createDateField(com.jgoodies.binding.value.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 com.jgoodies.binding.adapter.BasicComponentFactory
createCheckBox, createColorChooser, createColorChooser, createComboBox, createComboBox, createFormattedTextField, createFormattedTextField, createFormattedTextField, createFormattedTextField, createIntegerField, createIntegerField, createIntegerField, createIntegerField, createIntegerField, createLabel, createLabel, createList, createList, createLongField, createLongField, createLongField, createLongField, createLongField, createPasswordField, createPasswordField, createRadioButton, createTextArea, createTextArea, createTextField, createTextField
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createDateField

public static JFormattedTextField createDateField(com.jgoodies.binding.value.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.

Parameters:
valueModel - the model that holds the value to be edited
Returns:
a formatted text field for Date instances that is bound
Throws:
NullPointerException - if the model is null

createDateField

public static JFormattedTextField createDateField(com.jgoodies.binding.value.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.

Parameters:
valueModel - the model that holds the value to be edited
enableShortcuts - true to display yesterday, today, and tomorrow with natural language strings
Returns:
a formatted text field for Date instances that is bound
Throws:
NullPointerException - if the model is null

createDateField

public static JFormattedTextField createDateField(com.jgoodies.binding.value.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.

Parameters:
valueModel - the model that holds the value to be edited
enableShortcuts - true to display yesterday, today, and tomorrow with natural language strings
commitsOnValidEdit - true to commit on valid edit, false to commit on focus lost
Returns:
a formatted text field for Date instances that is bound
Throws:
NullPointerException - if the model is null


Copyright © 2003-2008 JGoodies Karsten Lentzsch. All Rights Reserved.