|
SRJRCFrames v0.1.296 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.schwarzrot.ui.service.DefaultFormComponentFactory
public class DefaultFormComponentFactory
a factory class like com.jgoodies.binding.adapter.BasicComponentFactory but prepared for dynamic replacement, so no static functions. The dynamic Factory-style helps dependency injection by application-contexts. So this factory can be replaced at runtime.
As JFormattedTextField does not handle FocusListener properly, so it was necessary to subclass JFormattedTextField. Another reason, not to use the factory from jgoodies.
ColorChooser
or
FileChooser
.Nested Class Summary | |
---|---|
protected static class |
DefaultFormComponentFactory.Icons
Provides icons useful for presenting validation feedback. |
protected static class |
DefaultFormComponentFactory.LabelIconChangeHandler
Sets the component visible iff the validation result has errors. |
protected static class |
DefaultFormComponentFactory.MessageTextChangeHandler
Sets a JTextComponent's text to the messages text of a ValidationResult. |
Nested classes/interfaces inherited from interface de.schwarzrot.ui.service.FormComponentFactory |
---|
FormComponentFactory.ButtonType |
Field Summary | |
---|---|
protected static Color |
DEFAULT_REPORT_BACKGROUND
|
protected File |
imageBaseDirectory
|
protected static ImageFactory |
imgFactory
|
protected static Dimension |
MIN_SIZE
|
protected static MessageSource |
msgSource
|
Constructor Summary | |
---|---|
DefaultFormComponentFactory()
|
Method Summary | ||
---|---|---|
JCheckBox |
createCheckBox(com.jgoodies.binding.value.ValueModel model,
String text)
|
|
JButton |
createColorChooser(com.jgoodies.binding.value.ValueModel model,
Component parent)
|
|
JButton |
createColorChooser(com.jgoodies.binding.value.ValueModel model,
Component parent,
String label)
|
|
JComboBox |
createComboBox(ComboBoxModel model)
|
|
JComboBox |
createComboBox(Object[] data)
|
|
JComboBox |
createComboBox(Object[] data,
ListCellRenderer cellRenderer)
|
|
|
createComboBox(com.jgoodies.binding.list.SelectionInList<E> selectionInList)
|
|
|
createComboBox(com.jgoodies.binding.list.SelectionInList<E> selectionInList,
ListCellRenderer cellRenderer)
|
|
|
createComboBox(com.jgoodies.binding.value.ValueModel model,
Collection<E> listData)
|
|
|
createComboBox(com.jgoodies.binding.value.ValueModel model,
Collection<E> listData,
ListCellRenderer cellRenderer)
|
|
|
createComboBox(com.jgoodies.binding.value.ValueModel model,
ListModel listModel,
ListCellRenderer cellRenderer)
|
|
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 . |
|
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 . |
|
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 . |
|
JFormattedTextField |
createDateTimeField(com.jgoodies.binding.value.ValueModel model)
|
|
JButton |
createDialogButton(String applicationId,
FormComponentFactory.ButtonType type)
|
|
JButton |
createDialogButton(String applicationId,
String buttonId)
|
|
JFormattedTextField |
createDoubleField(com.jgoodies.binding.value.ValueModel model)
|
|
JSpinner |
createDoubleSpinner(com.jgoodies.binding.value.ValueModel model,
Double defaultValue,
Double min,
Double max,
Double stepSize)
|
|
JButton |
createFileChooser(com.jgoodies.binding.value.ValueModel model,
Component parent)
|
|
JButton |
createFileChooser(com.jgoodies.binding.value.ValueModel model,
Component parent,
int fileSelectionMode)
|
|
JButton |
createFontChooser(com.jgoodies.binding.value.ValueModel fontNameModel,
com.jgoodies.binding.value.ValueModel fontStyleModel,
com.jgoodies.binding.value.ValueModel fontSizeModel,
Component parent)
|
|
protected JFormattedTextField |
createFormattedTextField(com.jgoodies.binding.value.ValueModel model,
JFormattedTextField.AbstractFormatter formatter)
|
|
protected JFormattedTextField |
createFormattedTextField(com.jgoodies.binding.value.ValueModel model,
JFormattedTextField.AbstractFormatterFactory formatterFactory)
|
|
JButton |
createImageChooser(com.jgoodies.binding.value.ValueModel model,
Component parent)
|
|
JFormattedTextField |
createIntegerField(com.jgoodies.binding.value.ValueModel model)
|
|
JSlider |
createIntegerSlider(BoundedRangeModel m)
|
|
JSlider |
createIntegerSlider(com.jgoodies.binding.value.ValueModel model,
int min,
int max,
int stepSize)
|
|
JSpinner |
createIntegerSpinner(com.jgoodies.binding.value.ValueModel model,
int defaultValue,
int min,
int max,
int stepSize)
|
|
|
createList(ca.odell.glazedlists.EventList<E> list,
ca.odell.glazedlists.swing.DefaultEventSelectionModel<E> selModel)
|
|
|
createList(ca.odell.glazedlists.EventList<E> dataList,
ca.odell.glazedlists.swing.DefaultEventSelectionModel<E> selModel,
ListCellRenderer cellRenderer)
|
|
|
createList(com.jgoodies.binding.list.SelectionInList<E> selectionInList)
|
|
|
createList(com.jgoodies.binding.list.SelectionInList<E> selectionInList,
ListCellRenderer cellRenderer)
|
|
|
createList(com.jgoodies.binding.value.ValueModel model)
|
|
JButton |
createLocalFileChooser(com.jgoodies.binding.value.ValueModel model,
Component parent)
|
|
JButton |
createLocalFileChooser(com.jgoodies.binding.value.ValueModel model,
Component parent,
int fileSelectionMode,
boolean doSave)
|
|
JFormattedTextField |
createLongField(com.jgoodies.binding.value.ValueModel model)
|
|
JSpinner |
createLongSpinner(com.jgoodies.binding.value.ValueModel model,
long defaultValue,
long min,
long max,
long stepSize)
|
|
JRadioButton |
createRadioButton(com.jgoodies.binding.value.ValueModel model,
Object choice,
String text)
Creates and returns a radio button with the specified text label that is bound to the given ValueModel. |
|
JComponent |
createReportIconAndTextPane(com.jgoodies.validation.ValidationResultModel model)
Creates and returns a transparent panel that consists of a report label and a transparent report text area. |
|
protected JLabel |
createReportIconLabel(com.jgoodies.validation.ValidationResultModel model)
Creates and returns an icon label that indicates the validation severity. |
|
JTextArea |
createReportTextArea(com.jgoodies.validation.ValidationResultModel model)
Creates and returns a text area that is intended to show validation messages. |
|
JTextArea |
createReportTextArea(com.jgoodies.validation.ValidationResultModel model,
Color backgroundColor)
Creates and returns a text area that is intended to show validation messages. |
|
JTextArea |
createTextArea(com.jgoodies.binding.value.ValueModel valueModel)
|
|
JTextArea |
createTextArea(com.jgoodies.binding.value.ValueModel valueModel,
boolean commitOnFocusLost)
|
|
JTextField |
createTextField(com.jgoodies.binding.value.ValueModel model)
|
|
JTextField |
createTextField(com.jgoodies.binding.value.ValueModel model,
boolean commitOnFocusLost)
|
|
JFormattedTextField |
createTimeField(com.jgoodies.binding.value.ValueModel vm)
|
|
JButton |
createToolBarButton(String formId,
String buttonId)
|
|
protected static ImageIcon |
getCheckIcon()
Returns a check icon useful to indicate good vs. no good. |
|
File |
getDefaultImageDirectory()
|
|
protected static ImageIcon |
getErrorIcon()
Returns a default error icon useful to indicate validation errors. |
|
protected static Icon |
getIcon(com.jgoodies.validation.Severity severity)
Returns the warning icon for warnings, the error icon for errors and null otherwise. |
|
protected static ImageIcon |
getInfoIcon()
Returns a default information icon useful to indicate input hints. |
|
protected static ImageIcon |
getSmallErrorIcon()
Returns a small default error icon useful to indicate validation errors attached to UI components. |
|
protected static Icon |
getSmallIcon(com.jgoodies.validation.Severity severity)
Returns the small warning icon for warnings, the small error icon for errors and null otherwise. |
|
protected static ImageIcon |
getSmallInfoIcon()
Returns a small default information icon useful to indicate input hints. |
|
protected static ImageIcon |
getSmallWarningIcon()
Returns a small default warning icon useful to indicate validation warnings attached to UI components. |
|
protected static ImageIcon |
getWarningIcon()
Returns a default warnings icon useful to indicate validation warnings. |
|
void |
setDefaultImageDirectory(File imageDirectory)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final Dimension MIN_SIZE
protected static final Color DEFAULT_REPORT_BACKGROUND
protected static MessageSource msgSource
protected static ImageFactory imgFactory
protected File imageBaseDirectory
Constructor Detail |
---|
public DefaultFormComponentFactory()
Method Detail |
---|
public JCheckBox createCheckBox(com.jgoodies.binding.value.ValueModel model, String text)
createCheckBox
in interface FormComponentFactory
public JButton createColorChooser(com.jgoodies.binding.value.ValueModel model, Component parent)
createColorChooser
in interface FormComponentFactory
public JButton createColorChooser(com.jgoodies.binding.value.ValueModel model, Component parent, String label)
createColorChooser
in interface FormComponentFactory
public JComboBox createComboBox(ComboBoxModel model)
createComboBox
in interface FormComponentFactory
public JComboBox createComboBox(Object[] data)
createComboBox
in interface FormComponentFactory
public JComboBox createComboBox(Object[] data, ListCellRenderer cellRenderer)
createComboBox
in interface FormComponentFactory
public <E> JComboBox createComboBox(com.jgoodies.binding.list.SelectionInList<E> selectionInList)
createComboBox
in interface FormComponentFactory
public <E> JComboBox createComboBox(com.jgoodies.binding.list.SelectionInList<E> selectionInList, ListCellRenderer cellRenderer)
createComboBox
in interface FormComponentFactory
public <E> JComboBox createComboBox(com.jgoodies.binding.value.ValueModel model, Collection<E> listData)
createComboBox
in interface FormComponentFactory
public <E> JComboBox createComboBox(com.jgoodies.binding.value.ValueModel model, Collection<E> listData, ListCellRenderer cellRenderer)
createComboBox
in interface FormComponentFactory
public <E> JComboBox createComboBox(com.jgoodies.binding.value.ValueModel model, ListModel listModel, ListCellRenderer cellRenderer)
createComboBox
in interface FormComponentFactory
public JFormattedTextField createDateField(com.jgoodies.binding.value.ValueModel valueModel)
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
in interface FormComponentFactory
valueModel
- the model that holds the value to be edited
NullPointerException
- if the model is null
public JFormattedTextField createDateField(com.jgoodies.binding.value.ValueModel valueModel, boolean enableShortcuts)
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
in interface FormComponentFactory
valueModel
- the model that holds the value to be editedenableShortcuts
- true to display yesterday, today, and tomorrow with natural
language strings
NullPointerException
- if the model is null
public JFormattedTextField createDateField(com.jgoodies.binding.value.ValueModel valueModel, boolean enableShortcuts, boolean commitsOnValidEdit)
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
in interface FormComponentFactory
valueModel
- the model that holds the value to be editedenableShortcuts
- true to display yesterday, today, and tomorrow with natural
language stringscommitsOnValidEdit
- true to commit on valid edit, false to commit on focus lost
NullPointerException
- if the model is null
public JFormattedTextField createDateTimeField(com.jgoodies.binding.value.ValueModel model)
createDateTimeField
in interface FormComponentFactory
public JFormattedTextField createDoubleField(com.jgoodies.binding.value.ValueModel model)
createDoubleField
in interface FormComponentFactory
public JSpinner createDoubleSpinner(com.jgoodies.binding.value.ValueModel model, Double defaultValue, Double min, Double max, Double stepSize)
createDoubleSpinner
in interface FormComponentFactory
public JButton createFileChooser(com.jgoodies.binding.value.ValueModel model, Component parent)
createFileChooser
in interface FormComponentFactory
public JButton createFileChooser(com.jgoodies.binding.value.ValueModel model, Component parent, int fileSelectionMode)
createFileChooser
in interface FormComponentFactory
public JButton createFontChooser(com.jgoodies.binding.value.ValueModel fontNameModel, com.jgoodies.binding.value.ValueModel fontStyleModel, com.jgoodies.binding.value.ValueModel fontSizeModel, Component parent)
createFontChooser
in interface FormComponentFactory
public JButton createImageChooser(com.jgoodies.binding.value.ValueModel model, Component parent)
createImageChooser
in interface FormComponentFactory
public JFormattedTextField createIntegerField(com.jgoodies.binding.value.ValueModel model)
createIntegerField
in interface FormComponentFactory
public JSlider createIntegerSlider(BoundedRangeModel m)
createIntegerSlider
in interface FormComponentFactory
public JSlider createIntegerSlider(com.jgoodies.binding.value.ValueModel model, int min, int max, int stepSize)
createIntegerSlider
in interface FormComponentFactory
public JSpinner createIntegerSpinner(com.jgoodies.binding.value.ValueModel model, int defaultValue, int min, int max, int stepSize)
createIntegerSpinner
in interface FormComponentFactory
public <E> JList createList(ca.odell.glazedlists.EventList<E> list, ca.odell.glazedlists.swing.DefaultEventSelectionModel<E> selModel)
createList
in interface FormComponentFactory
public <E> JList createList(ca.odell.glazedlists.EventList<E> dataList, ca.odell.glazedlists.swing.DefaultEventSelectionModel<E> selModel, ListCellRenderer cellRenderer)
createList
in interface FormComponentFactory
public <E> JList createList(com.jgoodies.binding.list.SelectionInList<E> selectionInList)
createList
in interface FormComponentFactory
public <E> JList createList(com.jgoodies.binding.list.SelectionInList<E> selectionInList, ListCellRenderer cellRenderer)
createList
in interface FormComponentFactory
public <E> JList createList(com.jgoodies.binding.value.ValueModel model)
createList
in interface FormComponentFactory
public JButton createLocalFileChooser(com.jgoodies.binding.value.ValueModel model, Component parent)
createLocalFileChooser
in interface FormComponentFactory
public JButton createLocalFileChooser(com.jgoodies.binding.value.ValueModel model, Component parent, int fileSelectionMode, boolean doSave)
createLocalFileChooser
in interface FormComponentFactory
public JFormattedTextField createLongField(com.jgoodies.binding.value.ValueModel model)
createLongField
in interface FormComponentFactory
public JSpinner createLongSpinner(com.jgoodies.binding.value.ValueModel model, long defaultValue, long min, long max, long stepSize)
createLongSpinner
in interface FormComponentFactory
public JRadioButton createRadioButton(com.jgoodies.binding.value.ValueModel model, Object choice, String text)
The model is converted to the required ToggleButton using a RadioButtonAdapter.
createRadioButton
in interface FormComponentFactory
model
- the model that provides the current choicechoice
- this button's valuetext
- the radio buttons' text label
NullPointerException
- if the valueModel is null
public JComponent createReportIconAndTextPane(com.jgoodies.validation.ValidationResultModel model)
createReportIconAndTextPane
in interface FormComponentFactory
model
- the model that provides the observable validation result
public JTextArea createReportTextArea(com.jgoodies.validation.ValidationResultModel model)
ValidationResultModel
:
the text content reflects the validation result message text and the
component is visible if and only if the model has messages.
model
- the model that provides the observable validation result
public JTextArea createReportTextArea(com.jgoodies.validation.ValidationResultModel model, Color backgroundColor)
ValidationResultModel
:
the text content reflects the validation result message text, and the
component is visible if and only if the model has messages.
model
- the model that provides the observable validation resultbackgroundColor
- the color used to paint the area's background
public JTextArea createTextArea(com.jgoodies.binding.value.ValueModel valueModel)
createTextArea
in interface FormComponentFactory
public JTextArea createTextArea(com.jgoodies.binding.value.ValueModel valueModel, boolean commitOnFocusLost)
createTextArea
in interface FormComponentFactory
public JTextField createTextField(com.jgoodies.binding.value.ValueModel model)
createTextField
in interface FormComponentFactory
public JTextField createTextField(com.jgoodies.binding.value.ValueModel model, boolean commitOnFocusLost)
createTextField
in interface FormComponentFactory
public JFormattedTextField createTimeField(com.jgoodies.binding.value.ValueModel vm)
createTimeField
in interface FormComponentFactory
public JButton createToolBarButton(String formId, String buttonId)
createToolBarButton
in interface FormComponentFactory
public File getDefaultImageDirectory()
getDefaultImageDirectory
in interface FormComponentFactory
public void setDefaultImageDirectory(File imageDirectory)
setDefaultImageDirectory
in interface FormComponentFactory
protected JFormattedTextField createFormattedTextField(com.jgoodies.binding.value.ValueModel model, JFormattedTextField.AbstractFormatter formatter)
protected JFormattedTextField createFormattedTextField(com.jgoodies.binding.value.ValueModel model, JFormattedTextField.AbstractFormatterFactory formatterFactory)
protected JLabel createReportIconLabel(com.jgoodies.validation.ValidationResultModel model)
model
- the model that provides the observable validation result
protected static ImageIcon getCheckIcon()
protected static ImageIcon getErrorIcon()
protected static Icon getIcon(com.jgoodies.validation.Severity severity)
null
otherwise.
severity
- the severity used to lookup the icon
null
otherwisegetWarningIcon()
,
getErrorIcon()
,
getSmallIcon(Severity)
protected static ImageIcon getInfoIcon()
protected static ImageIcon getSmallErrorIcon()
protected static Icon getSmallIcon(com.jgoodies.validation.Severity severity)
null
otherwise.
severity
- the severity used to lookup the icon
null
otherwisegetSmallWarningIcon()
,
getSmallErrorIcon()
,
getIcon(Severity)
protected static ImageIcon getSmallInfoIcon()
protected static ImageIcon getSmallWarningIcon()
protected static ImageIcon getWarningIcon()
public JButton createDialogButton(String applicationId, FormComponentFactory.ButtonType type)
createDialogButton
in interface FormComponentFactory
public JButton createDialogButton(String applicationId, String buttonId)
createDialogButton
in interface FormComponentFactory
|
SRJRCFrames v0.1.296 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |