Module is.codion.swing.framework.ui
Class EntityComponents
java.lang.Object
is.codion.swing.framework.ui.component.EntityComponents
A factory for
ComponentBuilder
instances
based on attributes from a given entity definition.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
A factory for list builders. -
Method Summary
Modifier and TypeMethodDescriptionbigDecimalField
(Attribute<BigDecimal> attribute) Creates aNumberField
builder based on the given attribute.booleanComboBox
(Attribute<Boolean> attribute) Creates a boolean ComboBox builder based on the given attribute.Creates a CheckBox builder based on the given attribute.<T,
C extends JComboBox<T>, B extends ComboBoxBuilder<T, C, B>>
ComboBoxBuilder<T,C, B> comboBox
(Attribute<T> attribute, ComboBoxModel<T> comboBoxModel) Creates a JComboBox builder based on the given attribute.<T,
C extends JComponent, B extends ComponentBuilder<T, C, B>>
ComponentBuilder<T,C, B> Returns aComponentBuilder
instance for a default input component for the given attribute.doubleField
(Attribute<Double> attribute) Creates aNumberField
builder based on the given attribute.doubleSpinner
(Attribute<Double> attribute) Creates aJSpinner
builder based on the given attribute.static EntityComponents
entityComponents
(EntityDefinition entityDefinition) foreignKeyComboBox
(ForeignKey foreignKey, EntityComboBoxModel comboBoxModel) Creates a foreign key ComboBox builder based on the given foreign key.foreignKeyComboBoxPanel
(ForeignKey foreignKey, EntityComboBoxModel comboBoxModel, Supplier<EntityEditPanel> editPanel) Creates a builder for a foreign key combo box panel with optional buttons for adding and editing items.foreignKeyLabel
(ForeignKey foreignKey) Creates a foreign key label builder based on the given foreign key.foreignKeySearchField
(ForeignKey foreignKey, EntitySearchModel searchModel) Creates a foreign key search field builder based on the given foreign key.foreignKeySearchFieldPanel
(ForeignKey foreignKey, EntitySearchModel searchModel) Creates a builder for a foreign key search field panel with an optional button for performing a search.foreignKeySearchFieldPanel
(ForeignKey foreignKey, EntitySearchModel searchModel, Supplier<EntityEditPanel> editPanel) Creates a builder for a foreign key search field panel with optional buttons for adding and editing items.<B extends TextFieldBuilder<Entity,
JTextField, B>>
TextFieldBuilder<Entity,JTextField, B> foreignKeyTextField
(ForeignKey foreignKey) Creates foreign key text field builder for the given foreign key, read-only and non-focusable.integerField
(Attribute<Integer> attribute) Creates aNumberField
builder based on the given attribute.integerSpinner
(Attribute<Integer> attribute) Creates aJSpinner
builder based on the given attribute.<T> ItemComboBoxBuilder<T>
itemComboBox
(Attribute<T> attribute) Creates a JComboBox builder based on the given attribute.<T> ItemSpinnerBuilder<T>
itemSpinner
(Attribute<T> attribute) Creates aJSpinner
builder based on the given attribute.<T> ListSpinnerBuilder<T>
listSpinner
(Attribute<T> attribute, SpinnerListModel listModel) Creates aJSpinner
builder based on the given attribute.Creates aNumberField
builder based on the given attribute.maskedTextField
(Attribute<String> attribute) Creates a masked text field builder based on the given attribute.shortField
(Attribute<Short> attribute) Creates aNumberField
builder based on the given attribute.Creates aJSlider
builder based on the given attribute, with a bounded range model based on the min/max values of the associated attribute.slider
(Attribute<Integer> attribute, BoundedRangeModel boundedRangeModel) Creates aJSlider
builder based on the given attribute.boolean
<T extends Temporal>
TemporalField.Builder<T>temporalField
(Attribute<T> attribute) Creates aTemporalField
builder based on the given attribute.<T extends Temporal>
TemporalField.Builder<T>temporalField
(Attribute<T> attribute, String dateTimePattern) Creates aTemporalField
builder based on the given attribute.<T extends Temporal>
TemporalFieldPanel.Builder<T>temporalFieldPanel
(Attribute<T> attribute) Creates aTemporalFieldPanel
builder based on the given attribute.<T extends Temporal>
TemporalFieldPanel.Builder<T>temporalFieldPanel
(Attribute<T> attribute, String dateTimePattern) Creates aTemporalFieldPanel
builder based on the given attribute.Creates a TextArea builder based on the given attribute.<T,
C extends JTextField, B extends TextFieldBuilder<T, C, B>>
TextFieldBuilder<T,C, B> Creates a text field builder based on the given attribute.textFieldPanel
(Attribute<String> attribute) Creates aTextFieldPanel
builder based on the given attribute.<B extends ButtonBuilder<Boolean,
JToggleButton, B>>
ButtonBuilder<Boolean,JToggleButton, B> toggleButton
(Attribute<Boolean> attribute) Creates a ToggleButton builder based on the given attribute.
-
Method Details
-
entityDefinition
- Returns:
- the underlying entity definition
-
supports
- Parameters:
attribute
- the attribute- Returns:
- true if
component(Attribute)
supports the given attribute
-
component
public <T,C extends JComponent, ComponentBuilder<T,B extends ComponentBuilder<T, C, B>> C, componentB> (Attribute<T> attribute) Returns aComponentBuilder
instance for a default input component for the given attribute.- Type Parameters:
T
- the attribute typeC
- the component typeB
- the builder type- Parameters:
attribute
- the attribute for which to create the input component- Returns:
- the component builder handling input for
attribute
- Throws:
IllegalArgumentException
- in case the attribute type is not supported- See Also:
-
checkBox
Creates a CheckBox builder based on the given attribute.- Parameters:
attribute
- the attribute- Returns:
- a JCheckBox builder
-
toggleButton
public <B extends ButtonBuilder<Boolean,JToggleButton, ButtonBuilder<Boolean,B>> JToggleButton, toggleButtonB> (Attribute<Boolean> attribute) Creates a ToggleButton builder based on the given attribute.- Type Parameters:
B
- the builder type- Parameters:
attribute
- the attribute- Returns:
- a JToggleButton builder
-
booleanComboBox
Creates a boolean ComboBox builder based on the given attribute.- Parameters:
attribute
- the attribute- Returns:
- a boolean JComboBox builder
-
foreignKeyComboBox
public EntityComboBox.Builder foreignKeyComboBox(ForeignKey foreignKey, EntityComboBoxModel comboBoxModel) Creates a foreign key ComboBox builder based on the given foreign key.- Parameters:
foreignKey
- the foreign keycomboBoxModel
- the combo box model- Returns:
- a foreign key JComboBox builder
-
foreignKeyComboBoxPanel
public EntityComboBoxPanel.Builder foreignKeyComboBoxPanel(ForeignKey foreignKey, EntityComboBoxModel comboBoxModel, Supplier<EntityEditPanel> editPanel) Creates a builder for a foreign key combo box panel with optional buttons for adding and editing items.- Parameters:
foreignKey
- the foreign keycomboBoxModel
- the combo box modeleditPanel
- supplies the edit panel to use for the add and/or edit buttons- Returns:
- a foreign key combo box panel builder
-
foreignKeySearchField
public EntitySearchField.Builder foreignKeySearchField(ForeignKey foreignKey, EntitySearchModel searchModel) Creates a foreign key search field builder based on the given foreign key.- Parameters:
foreignKey
- the foreign keysearchModel
- the search model- Returns:
- a foreign key
EntitySearchField
builder
-
foreignKeySearchFieldPanel
public EntitySearchFieldPanel.Builder foreignKeySearchFieldPanel(ForeignKey foreignKey, EntitySearchModel searchModel) Creates a builder for a foreign key search field panel with an optional button for performing a search.- Parameters:
foreignKey
- the foreign keysearchModel
- the search model- Returns:
- a foreign key search field panel builder
-
foreignKeySearchFieldPanel
public EntitySearchFieldPanel.Builder foreignKeySearchFieldPanel(ForeignKey foreignKey, EntitySearchModel searchModel, Supplier<EntityEditPanel> editPanel) Creates a builder for a foreign key search field panel with optional buttons for adding and editing items.- Parameters:
foreignKey
- the foreign keysearchModel
- the search modeleditPanel
- supplies the edit panel to use for the add and/or edit buttons- Returns:
- a foreign key search field panel builder
-
foreignKeyTextField
public <B extends TextFieldBuilder<Entity,JTextField, TextFieldBuilder<Entity,B>> JTextField, foreignKeyTextFieldB> (ForeignKey foreignKey) Creates foreign key text field builder for the given foreign key, read-only and non-focusable.- Type Parameters:
B
- the builder type- Parameters:
foreignKey
- the foreign key- Returns:
- a foreign key JTextField builder
-
foreignKeyLabel
Creates a foreign key label builder based on the given foreign key.- Parameters:
foreignKey
- the foreign key- Returns:
- a foreign key JLabel builder
-
itemComboBox
Creates a JComboBox builder based on the given attribute. Note that the attribute must have items associated.- Type Parameters:
T
- the attribute type- Parameters:
attribute
- the attribute- Returns:
- an
Item
based JComboBox builder - Throws:
IllegalArgumentException
- in case the given attribute has no associated items
-
comboBox
public <T,C extends JComboBox<T>, ComboBoxBuilder<T,B extends ComboBoxBuilder<T, C, B>> C, comboBoxB> (Attribute<T> attribute, ComboBoxModel<T> comboBoxModel) Creates a JComboBox builder based on the given attribute.- Type Parameters:
T
- the attribute typeC
- the component typeB
- the builder type- Parameters:
attribute
- the attributecomboBoxModel
- the combo box model- Returns:
- a JComboBox builder
-
temporalFieldPanel
public <T extends Temporal> TemporalFieldPanel.Builder<T> temporalFieldPanel(Attribute<T> attribute) Creates aTemporalFieldPanel
builder based on the given attribute.- Type Parameters:
T
- the attribute type- Parameters:
attribute
- the attribute- Returns:
- a
TemporalFieldPanel
builder
-
temporalFieldPanel
public <T extends Temporal> TemporalFieldPanel.Builder<T> temporalFieldPanel(Attribute<T> attribute, String dateTimePattern) Creates aTemporalFieldPanel
builder based on the given attribute.- Type Parameters:
T
- the attribute type- Parameters:
attribute
- the attributedateTimePattern
- the date time pattern- Returns:
- a
TemporalFieldPanel
builder
-
textFieldPanel
Creates aTextFieldPanel
builder based on the given attribute.- Parameters:
attribute
- the attribute- Returns:
- a
TextFieldPanel
builder
-
textArea
Creates a TextArea builder based on the given attribute.- Parameters:
attribute
- the attribute- Returns:
- a JTextArea builder
-
textField
public <T,C extends JTextField, TextFieldBuilder<T,B extends TextFieldBuilder<T, C, B>> C, textFieldB> (Attribute<T> attribute) Creates a text field builder based on the given attribute.- Type Parameters:
T
- the attribute typeC
- the text field typeB
- the builder type- Parameters:
attribute
- the attribute- Returns:
- a JTextField builder
-
temporalField
Creates aTemporalField
builder based on the given attribute.- Type Parameters:
T
- the temporal type- Parameters:
attribute
- the attribute- Returns:
- a
TemporalField
builder
-
temporalField
public <T extends Temporal> TemporalField.Builder<T> temporalField(Attribute<T> attribute, String dateTimePattern) Creates aTemporalField
builder based on the given attribute.- Type Parameters:
T
- the temporal type- Parameters:
attribute
- the attributedateTimePattern
- the date time pattern- Returns:
- a
TemporalField
builder
-
shortField
Creates aNumberField
builder based on the given attribute.- Parameters:
attribute
- the attribute- Returns:
- a
NumberField
builder
-
integerField
Creates aNumberField
builder based on the given attribute.- Parameters:
attribute
- the attribute- Returns:
- a
NumberField
builder
-
longField
Creates aNumberField
builder based on the given attribute.- Parameters:
attribute
- the attribute- Returns:
- a
NumberField
builder
-
doubleField
Creates aNumberField
builder based on the given attribute.- Parameters:
attribute
- the attribute- Returns:
- a
NumberField
builder
-
bigDecimalField
Creates aNumberField
builder based on the given attribute.- Parameters:
attribute
- the attribute- Returns:
- a
NumberField
builder
-
slider
Creates aJSlider
builder based on the given attribute, with a bounded range model based on the min/max values of the associated attribute.- Parameters:
attribute
- the attribute- Returns:
- a
JSlider
builder
-
slider
Creates aJSlider
builder based on the given attribute.- Parameters:
attribute
- the attributeboundedRangeModel
- the bounded range model- Returns:
- a
JSlider
builder
-
integerSpinner
Creates aJSpinner
builder based on the given attribute.- Parameters:
attribute
- the attribute- Returns:
- a
JSpinner
builder
-
doubleSpinner
Creates aJSpinner
builder based on the given attribute.- Parameters:
attribute
- the attribute- Returns:
- a
JSpinner
builder
-
listSpinner
Creates aJSpinner
builder based on the given attribute.- Type Parameters:
T
- the value type- Parameters:
attribute
- the attributelistModel
- the spinner model- Returns:
- a
JSpinner
builder
-
itemSpinner
Creates aJSpinner
builder based on the given attribute.- Type Parameters:
T
- the value type- Parameters:
attribute
- the attribute- Returns:
- a
JSpinner
builder
-
maskedTextField
Creates a masked text field builder based on the given attribute.- Parameters:
attribute
- the attribute- Returns:
- a JFormattedTextField builder
-
list
- Type Parameters:
T
- the value type- Parameters:
listModel
- the list model to base the list on- Returns:
- a builder factory for a list
-
entityComponents
- Parameters:
entityDefinition
- the entity definition- Returns:
- a new
EntityComponents
instance
-