Skip to content

Quick Reference: Swing

padrig64 edited this page Nov 30, 2014 · 15 revisions

This page gives a quick overview and description of all entities of the ValidationFramework.

Triggers

Triggers start the validation process when validation is needed.

Here is a list of all concrete triggers available in the [validationframework-swing] (https://github.com/padrig64/ValidationFramework/tree/master/validationframework-swing/src/main/java/com/google/code/validationframework/swing) module:

Component Trigger Description
  •               | ActionTrigger                             | Triggered whenever the Action (and therefore ActionListener) is performed.
    
  •               | InvokeLaterTrigger                        | Trigger wrapper to re-schedule later on the Event Dispatch Thread.
    

Component | ComponentKeyStrokeTrigger | Triggered whenever registered key strokes happen on the specified component. Component | ComponentPropertyChangedTrigger | Triggered whenever any of the specified component property is changed. JComponent | JComponentFocusGainedTrigger | Triggered whenever the component gains the focus. JComponent | JComponentFocusLostTrigger | Triggered whenever the component loses the focus. JButton | JButtonActionTrigger | Triggered whenever the button is actioned. JCheckBox | JCheckBoxModelChangedTrigger | Same as JToggleButtonModelChangedTrigger and provided for convenience. JComboBox | JComboBoxCanceledTrigger | Triggered whenever the combobox is closed by cancelation. JComboBox | JComboBoxClosedTrigger | Triggered whenever the combobox is closed without cancelation. JComboBox | JComboBoxModelChangedTrigger | Triggered whenever the combobox value changes. JComboBox | JComboBoxOpenedTrigger | Triggered whenever the combobox is opened. JEditorPane | JEditorPaneDocumentChangedTrigger | Same as JTextComponentDocumentChangedTrigger and provided for convenience. JFormattedTextField | JFormattedTextFieldDocumentChangedTrigger | Same as JTextComponentDocumentChangedTrigger and provided for convenience. JFormattedTextField | JFormattedTextFieldFocusGainedTrigger | Same as JComponentFocusGainedTrigger and provided for convenience. JFormattedTextField | JFormattedTextFieldFocusLostTrigger | Same as JComponentFocusLostTrigger and provided for convenience. JFormattedTextField | JFormattedTextFieldKeyStrokeTrigger | Same as ComponentKeyStrokeTrigger and provided for convenience. JList | JListModelChangedTrigger | Triggered whenever the content of the list changes. JList | JListSelectionChangedTrigger | Triggered whenever the selection in the list changes. JPasswordField | JPasswordFieldDocumentChangedTrigger | Same as JTextComponentDocumentChangedTrigger and provided for convenience. JRadioButton | JRadioButtonModelChangedTrigger | Same as JToggleButtonModelChangedTrigger and provided for convenience. JSlider | JSliderModelChangedTrigger | Triggered whenever the slider value changes. JSpinner | JSpinnerEditorModelChangedTrigger | Triggered whenever the content of the text editor in the spinner changes. JSpinner | JSpinnerModelChangedTrigger | Triggered whenever the value of the spinner changes. JTable | JTableComboBoxEditorModelChangedTrigger | Triggered whenever the value of combobox editor for a specified cell in the table changes. JTable | JTableTextEditorModelChangedTrigger | Triggered whenever the content of the text editor for a specified cell in the table changes. JTextArea | JTextAreaDocumentChangedTrigger | Same as JTextComponentDocumentChangedTrigger and provided for convenience. JTextArea | JTextFieldAreaKeyStrokeTrigger | Same as ComponentKeyStrokeTrigger and provided for convenience. JTextComponent | JTextComponentDocumentChangedTrigger | Triggered whenever the content of the text component changes. JTextField | JTextFieldDocumentChangedTrigger | Same as JTextComponentDocumentChangedTrigger and provided for convenience. JTextField | JTextFieldFocusGainedTrigger | Same as JComponentFocusGainedTrigger and provided for convenience. JTextField | JTextFieldFocusLostTrigger | Same as JComponentFocusLostTrigger and provided for convenience. JTextField | JTextFieldKeyStrokeTrigger | Same as ComponentKeyStrokeTrigger and provided for convenience. JTextPane | JTextPaneDocumentChangedTrigger | Same as JTextComponentDocumentChangedTrigger and provided for convenience. JToggleButton | JToggleButtonModelChangedTrigger | Triggered whenever the toggle button is selected/de-selected.

Data providers

Data provides retrieve the data to be validation the triggers are initiated.

Here is a list of all concrete data providers available in the [validationframework-swing] (https://github.com/padrig64/ValidationFramework/tree/master/validationframework-swing/src/main/java/com/google/code/validationframework/swing) module:

Component Data provider Output Description
ButtonGroup ButtonGroupSelectedIndexProvider Integer Provides the index of the selected checkbox, radio button or toggle button in the button group.
ButtonGroup ButtonGroupSelectedButtonModelProvider ButtonModel Provides the return value of ButtonGroup#getSelection().
JCheckBox JCheckBoxValueProvider Boolean Same as JToggleButtonValueProvider and provided for convenience.
JComboBox JComboBoxSelectedIndexProvider Integer Provides the return value of JComboBox#getSelectedIndex().
JComboBox JComboBoxSelectedValueProvider Object Provides the return value of JComboBox#getSelectedItem() after transforming it.
JEditorPane JEditorPaneTextProvider String Same as JTextComponentTextProvider and provided for convenience.
JFormattedTextField JFormattedTextFieldLastValidValueProvider Object Provides the return value of JFormattedTextField#getValue() after transforming it.
JFormattedTextField JFormattedTextFieldTextProvider String Same as JTextComponentTextProvider and provided for convenience.
JFormattedTextField JFormattedTextFieldValueProvider Object Uses the formatted textfield's formatter to parse the current text and transforms the parsed object before returning it.
JList JListSelectedIndexProvider Integer Provides the return value of JList#getSelectedIndex().
JList JListSelectedIndicesProvider Collection<Integer> Provides the return values of JList#getSelectedIndices() in a collection.
JList JListSelectedValueProvider Object Provides the return value of JList#getSelectedValue() after transforming it.
JList JListSelectedValuesProvider Collection<Object> Provides the return values of JList#getSelectedValues() after transforming them, in a collection.
JPasswordField JPasswordFieldPasswordProvider char[] Provides the return value of JPasswordField#getPassword().
JRadioButton JRadioButtonValueProvider Boolean Same as JToggleButtonValueProvider and provided for convenience.
JSlider JSliderValueProvider Integer Provides the return value of JSlider#getValue().
JSpinner JSpinnerEditorTextProvider String Provides the text of the text editor in the spinner.
JSpinner JSpinnerEditorValueProvider Object Uses the formatted textfield's formatter inside the spinner to parse the current text in the spinner and transforms the parsed object before returning it.
JSpinner JSpinnerModelValueProvider <DPO> Provides the return value of JSpinner#getValue() after transforming it.
JTable JTableComboBoxEditorSelectedIndexProvider Integer Provides the selected index of the combobox editor for a specific cell.
JTable JTableComboBoxEditorSelectedValueProvider Object Provides the selected value of the combobox editor for a specific cell, after transforming the value.
JTable JTableTextEditorTextProvider String Provides the text of the text editor for a specific cell.
JTable JTableTextEditorValueProvider Object Uses the formatted textfield's formatter inside editor of a specific cell to parse the current text in the editor and transforms the parsed object before returning it.
JTextArea JTextAreaTextProvider String Same as JTextComponentTextProvider and provided for convenience.
JTextComponent JTextComponentTextProvider String Provides the return value of JTextComponent#getText().
JTextField JTextFieldTextProvider String Same as JTextComponentTextProvider and provided for convenience.
JTextPane JTextPaneTextProvider String Same as JTextComponentTextProvider and provided for convenience.
JToggleButton JToggleButtonValueProvider Boolean Provides the return value of JToggleButton#isSelected().

Rules

Rules validate the data from the data providers and produce results.

Here is a list of all concrete rules available in the [validationframework-swing] (https://github.com/padrig64/ValidationFramework/tree/master/validationframework-swing/src/main/java/com/google/code/validationframework/swing) module:

Rule Input Output Description
JFormattedTextFieldFormatterRule String Boolean Checks that the String can be successfully parsed using the Formatter object of a JFormattedTextField.
JSpinnerFormatterRule String Boolean Checks that the String can be successfully parsed using the Formatter object of the JFormattedTextField editor of a JSpinner.

Result handlers

Result handlers process the results of the rules.

Here is a list of all concrete result handlers available in the [validationframework-swing] (https://github.com/padrig64/ValidationFramework/tree/master/validationframework-swing/src/main/java/com/google/code/validationframework/swing) module:

Result handler Input Description
CellIconBooleanFeedback Boolean Shows an icon decoration/overlay with tooltip on a table cell.
ComponentDisablingBooleanResultHandler Boolean Disables (respectively enables) some components when the result is valid (respectively invalid).
ComponentEnablingBooleanResultHandler Boolean Enables (respectively disables) some components when the result is valid (respectively invalid).
ComponentInvisibilityBooleanResultHandler Boolean Hides (respectively shows) some components when the result is valid (respectively invalid).
ComponentVisibilityBooleanResultHandler Boolean Shows (respectively hides) some components when the result is valid (respectively invalid).
IconBooleanFeedback Boolean Shows an icon decoration/overlay with tooltip on a component.
TabIconBooleanFeedback Boolean Shows an icon decoration with tooltip on a tab.
InvokeLaterResultHandler <RHI> Result handler wrapper to re-schedule later on the Event Dispatch Thread.

Validators

Validators glue all triggers, data providers, rules and result handlers together.

There are no specific validator for Swing yet. Refer to the Quick Reference: Core page.

Properties

Properties can be used for many purposes, including the implementation of conditional logic.

Here is a list of all concrete properties available in the [validationframework-swing] (https://github.com/padrig64/ValidationFramework/tree/master/validationframework-swing/src/main/java/com/google/code/validationframework/swing) module:

Property Read Write Description
AbstractComponentProperty Abstraction of a property representing a bean property of a component that can be monitored using a PropertyChangeListener.
ActionProperty Represents a specified bean property of an action that can be monitored using a PropertyChangeListener.
ButtonPressedProperty Boolean - Represents the "pressed" state of an AbstractButton.
ComponentBackgroundProperty Color Color Represents the "background" bean property of a Component.
ComponentEnabledProperty Boolean Boolean Represents the "enabled" bean property of a Component.
ComponentFocusedProperty Boolean - Represents the focused state of a Component.
ComponentForegroundProperty Color Color Represents the "foreground" bean property of a Component.
ComponentLocationProperty Point - Represents the location of a Component relatively to its parent.
ComponentMaximumSizeProperty Dimension Dimension Represents the maximum size of a Component.
ComponentMinimumSizeProperty Dimension Dimension Represents the minimum size of a Component.
ComponentPreferredSizeProperty Dimension Dimension Represents the preferred size of a Component.
ComponentRolloverProperty Boolean - Represents the (mouse) rollover state of a Component.
ComponentSizeProperty Dimension Dimension Represents the current size of a Component.
ComponentVisibleProperty Boolean Boolean Represents the "visible" bean property of a Component.
JButtonIconProperty Icon Icon Represents the "icon" bean property of a JButton.
JButtonMnemonicProperty Integer Integer Represents the "mnemonic" bean property of a JButton.
JButtonPressedProperty Boolean - Same as ButtonPressedProperty and provided for convenience.
JButtonTextProperty String String Represents the "text" bean property of a JButton.
JComboBoxSelectedIndexProperty Integer Integer Represents the selected index of a JComboBox.
JComboBoxSelectedValueProperty Integer Integer Represents the selected value/item of a JComboBox.
JDialogTitleProperty String String Represents the "title" bean property of a JDialog.
JFormattedTextFieldProperty Object Object Represents the "value" bean property of a JFormattedTextField.
JFrameTitleProperty String String Represents the "title" bean property of a JFrame.
JLabelIconProperty Icon Icon Represents the "icon" bean property of a JLabel.
JLabelDisplayedMnemonicProperty Integer Integer Represents the "displayedMnemonic" bean property of a JLabel.
JLabelTextProperty String String Represents the "text" bean property of a JLabel.
JListSelectedItemCountProperty Integer - Represents the number of selected items in a JList.
JMenuItemPressedProperty Boolean - Same as ButtonPressedProperty and provided for convenience.
JTableRowCountProperty Integer - Represents the number of (view) rows in a JTable.
JTableSelectedRowCountProperty Integer - Represents the number of selected rows in a JTable.
JTableSelectedRowIndexProperty Integer - Represents the view index of the selected row in a JTable.
JTextComponentEditableProperty Boolean Boolean Represents the "editable" bean property of a text component (or a textfield, text area, etc.).
JTextComponentTextProperty String String Represents the contents of the document of a text component (or a textfield, text area, etc.).
JToggleButtonPressedProperty Boolean - Same as ButtonPressedProperty and provided for convenience.
JToggleButtonSelectedProperty Boolean Boolean Represents the "selected" bean property of a toggle button (or a JCheckBox, JRadioButton, JToggleButton).
JComponentToolTipTextProperty String String Represents the "toolTipText" bean property of a JComponent.
SimpleColorProperty Color Color SimpleProperty having a Color value.
SimpleFontProperty Font Font SimpleProperty having a Font value.
SimpleIconProperty Icon Icon SimpleProperty having a Icon value.
WindowResizableProperty Boolean Boolean Represents the "resizable" bean property of a Window.

Transformers

Transformers can be used in some data providers, rules, result handlers and validators to convert or aggregate the manipulated data.

Here is a list of all concrete transformers available in the [validationframework-swing] (https://github.com/padrig64/ValidationFramework/tree/master/validationframework-swing/src/main/java/com/google/code/validationframework/swing) module:

Transformer Input Output Description
JTableRowIndexToModelTransformer Integer Integer Converts a view row index input to a model row index.
JTableRowIndexToViewTransformer Integer Integer Converts a model row index input to a view row index.
JTableColumnIndexToModelTransformer Integer Integer Converts a view column index input to a model column index.
JTableColumnIndexToViewTransformer Integer Integer Converts a model column index input to a view column index.