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.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA factory for list builders. -
Constructor Summary
ConstructorsConstructorDescriptionEntityComponents(is.codion.framework.domain.entity.EntityDefinition entityDefinition) -
Method Summary
Modifier and TypeMethodDescriptionfinal is.codion.swing.common.ui.component.text.NumberField.Builder<BigDecimal>bigDecimalField(is.codion.framework.domain.entity.attribute.Attribute<BigDecimal> attribute) Creates aNumberFieldbuilder based on the given attribute.final is.codion.swing.common.ui.component.combobox.ItemComboBoxBuilder<Boolean>booleanComboBox(is.codion.framework.domain.entity.attribute.Attribute<Boolean> attribute) Creates a boolean ComboBox builder based on the given attribute.final is.codion.swing.common.ui.component.button.CheckBoxBuilderCreates a CheckBox builder based on the given attribute.final <T,C extends JComboBox<T>, B extends is.codion.swing.common.ui.component.combobox.ComboBoxBuilder<T, C, B>>
is.codion.swing.common.ui.component.combobox.ComboBoxBuilder<T,C, B> comboBox(is.codion.framework.domain.entity.attribute.Attribute<T> attribute, ComboBoxModel<T> comboBoxModel) Creates a JComboBox builder based on the given attribute.<T,C extends JComponent, B extends is.codion.swing.common.ui.component.builder.ComponentBuilder<T, C, B>>
is.codion.swing.common.ui.component.builder.ComponentBuilder<T,C, B> component(is.codion.framework.domain.entity.attribute.Attribute<T> attribute) Returns aComponentBuilderinstance for a default input component for the given attribute.final is.codion.swing.common.ui.component.text.NumberField.Builder<Double>doubleField(is.codion.framework.domain.entity.attribute.Attribute<Double> attribute) Creates aNumberFieldbuilder based on the given attribute.final is.codion.swing.common.ui.component.spinner.NumberSpinnerBuilder<Double>doubleSpinner(is.codion.framework.domain.entity.attribute.Attribute<Double> attribute) Creates aJSpinnerbuilder based on the given attribute.final is.codion.framework.domain.entity.EntityDefinitionfinal EntityComboBox.BuilderforeignKeyComboBox(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey, is.codion.swing.framework.model.component.EntityComboBoxModel comboBoxModel) Creates a foreign key ComboBox builder based on the given foreign key.foreignKeyComboBoxPanel(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey, is.codion.swing.framework.model.component.EntityComboBoxModel comboBoxModel, Supplier<EntityEditPanel> editPanel) Creates a builder for a foreign key combo box panel with optional buttons for adding and editing items.final is.codion.swing.common.ui.component.label.LabelBuilder<is.codion.framework.domain.entity.Entity>foreignKeyLabel(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey) Creates a foreign key label builder based on the given foreign key.foreignKeySearchField(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey, is.codion.framework.model.EntitySearchModel searchModel) Creates a foreign key search field builder based on the given foreign key.foreignKeySearchFieldPanel(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey, is.codion.framework.model.EntitySearchModel searchModel) Creates a builder for a foreign key search field panel with an optional button for performing a search.foreignKeySearchFieldPanel(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey, is.codion.framework.model.EntitySearchModel searchModel, Supplier<EntityEditPanel> editPanel) Creates a builder for a foreign key search field panel with optional buttons for adding and editing items.final <B extends is.codion.swing.common.ui.component.text.TextFieldBuilder<is.codion.framework.domain.entity.Entity,JTextField, B>>
is.codion.swing.common.ui.component.text.TextFieldBuilder<is.codion.framework.domain.entity.Entity,JTextField, B> foreignKeyTextField(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey) Creates foreign key text field builder for the given foreign key, read-only and non-focusable.final is.codion.swing.common.ui.component.text.NumberField.Builder<Integer>integerField(is.codion.framework.domain.entity.attribute.Attribute<Integer> attribute) Creates aNumberFieldbuilder based on the given attribute.final is.codion.swing.common.ui.component.spinner.NumberSpinnerBuilder<Integer>integerSpinner(is.codion.framework.domain.entity.attribute.Attribute<Integer> attribute) Creates aJSpinnerbuilder based on the given attribute.final <T> is.codion.swing.common.ui.component.combobox.ItemComboBoxBuilder<T>itemComboBox(is.codion.framework.domain.entity.attribute.Attribute<T> attribute) Creates a JComboBox builder based on the given attribute.final <T> is.codion.swing.common.ui.component.spinner.ItemSpinnerBuilder<T>itemSpinner(is.codion.framework.domain.entity.attribute.Attribute<T> attribute) Creates aJSpinnerbuilder based on the given attribute.final <T> EntityComponents.EntityListBuilderFactory<T>final <T> is.codion.swing.common.ui.component.spinner.ListSpinnerBuilder<T>listSpinner(is.codion.framework.domain.entity.attribute.Attribute<T> attribute, SpinnerListModel listModel) Creates aJSpinnerbuilder based on the given attribute.final is.codion.swing.common.ui.component.text.NumberField.Builder<Long>Creates aNumberFieldbuilder based on the given attribute.final is.codion.swing.common.ui.component.text.MaskedTextFieldBuildermaskedTextField(is.codion.framework.domain.entity.attribute.Attribute<String> attribute) Creates a masked text field builder based on the given attribute.final is.codion.swing.common.ui.component.text.NumberField.Builder<Short>shortField(is.codion.framework.domain.entity.attribute.Attribute<Short> attribute) Creates aNumberFieldbuilder based on the given attribute.final is.codion.swing.common.ui.component.slider.SliderBuilderCreates aJSliderbuilder based on the given attribute, with a bounded range model based on the min/max values of the associated attribute.final is.codion.swing.common.ui.component.slider.SliderBuilderslider(is.codion.framework.domain.entity.attribute.Attribute<Integer> attribute, BoundedRangeModel boundedRangeModel) Creates aJSliderbuilder based on the given attribute.booleansupports(is.codion.framework.domain.entity.attribute.Attribute<?> attribute) final <T extends Temporal>
is.codion.swing.common.ui.component.text.TemporalField.Builder<T>temporalField(is.codion.framework.domain.entity.attribute.Attribute<T> attribute) Creates aTemporalFieldbuilder based on the given attribute.final <T extends Temporal>
is.codion.swing.common.ui.component.text.TemporalField.Builder<T>temporalField(is.codion.framework.domain.entity.attribute.Attribute<T> attribute, String dateTimePattern) Creates aTemporalFieldbuilder based on the given attribute.final <T extends Temporal>
is.codion.swing.common.ui.component.text.TemporalFieldPanel.Builder<T>temporalFieldPanel(is.codion.framework.domain.entity.attribute.Attribute<T> attribute) Creates aTemporalFieldPanelbuilder based on the given attribute.final <T extends Temporal>
is.codion.swing.common.ui.component.text.TemporalFieldPanel.Builder<T>temporalFieldPanel(is.codion.framework.domain.entity.attribute.Attribute<T> attribute, String dateTimePattern) Creates aTemporalFieldPanelbuilder based on the given attribute.final is.codion.swing.common.ui.component.text.TextAreaBuilderCreates a TextArea builder based on the given attribute.final <T,C extends JTextField, B extends is.codion.swing.common.ui.component.text.TextFieldBuilder<T, C, B>>
is.codion.swing.common.ui.component.text.TextFieldBuilder<T,C, B> textField(is.codion.framework.domain.entity.attribute.Attribute<T> attribute) Creates a text field builder based on the given attribute.final is.codion.swing.common.ui.component.text.TextFieldPanel.BuildertextFieldPanel(is.codion.framework.domain.entity.attribute.Attribute<String> attribute) Creates aTextFieldPanelbuilder based on the given attribute.final <B extends is.codion.swing.common.ui.component.button.ButtonBuilder<Boolean,JToggleButton, B>>
is.codion.swing.common.ui.component.button.ButtonBuilder<Boolean,JToggleButton, B> toggleButton(is.codion.framework.domain.entity.attribute.Attribute<Boolean> attribute) Creates a ToggleButton builder based on the given attribute.
-
Constructor Details
-
EntityComponents
public EntityComponents(is.codion.framework.domain.entity.EntityDefinition entityDefinition) - Parameters:
entityDefinition- the entity definition
-
-
Method Details
-
entityDefinition
public final is.codion.framework.domain.entity.EntityDefinition entityDefinition()- Returns:
- the underlying entity definition
-
supports
public boolean supports(is.codion.framework.domain.entity.attribute.Attribute<?> attribute) - Parameters:
attribute- the attribute- Returns:
- true if
component(Attribute)supports the given attribute
-
component
public <T,C extends JComponent, is.codion.swing.common.ui.component.builder.ComponentBuilder<T,B extends is.codion.swing.common.ui.component.builder.ComponentBuilder<T, C, B>> C, componentB> (is.codion.framework.domain.entity.attribute.Attribute<T> attribute) Returns aComponentBuilderinstance 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
public final is.codion.swing.common.ui.component.button.CheckBoxBuilder checkBox(is.codion.framework.domain.entity.attribute.Attribute<Boolean> attribute) Creates a CheckBox builder based on the given attribute.- Parameters:
attribute- the attribute- Returns:
- a JCheckBox builder
-
toggleButton
public final <B extends is.codion.swing.common.ui.component.button.ButtonBuilder<Boolean,JToggleButton, is.codion.swing.common.ui.component.button.ButtonBuilder<Boolean,B>> JToggleButton, toggleButtonB> (is.codion.framework.domain.entity.attribute.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
public final is.codion.swing.common.ui.component.combobox.ItemComboBoxBuilder<Boolean> booleanComboBox(is.codion.framework.domain.entity.attribute.Attribute<Boolean> attribute) Creates a boolean ComboBox builder based on the given attribute.- Parameters:
attribute- the attribute- Returns:
- a boolean JComboBox builder
-
foreignKeyComboBox
public final EntityComboBox.Builder foreignKeyComboBox(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey, is.codion.swing.framework.model.component.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 final EntityComboBoxPanel.Builder foreignKeyComboBoxPanel(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey, is.codion.swing.framework.model.component.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 final EntitySearchField.Builder foreignKeySearchField(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey, is.codion.framework.model.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
EntitySearchFieldbuilder
-
foreignKeySearchFieldPanel
public final EntitySearchFieldPanel.Builder foreignKeySearchFieldPanel(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey, is.codion.framework.model.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 final EntitySearchFieldPanel.Builder foreignKeySearchFieldPanel(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey, is.codion.framework.model.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 final <B extends is.codion.swing.common.ui.component.text.TextFieldBuilder<is.codion.framework.domain.entity.Entity,JTextField, is.codion.swing.common.ui.component.text.TextFieldBuilder<is.codion.framework.domain.entity.Entity,B>> JTextField, foreignKeyTextFieldB> (is.codion.framework.domain.entity.attribute.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
public final is.codion.swing.common.ui.component.label.LabelBuilder<is.codion.framework.domain.entity.Entity> foreignKeyLabel(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey) Creates a foreign key label builder based on the given foreign key.- Parameters:
foreignKey- the foreign key- Returns:
- a foreign key JLabel builder
-
itemComboBox
public final <T> is.codion.swing.common.ui.component.combobox.ItemComboBoxBuilder<T> itemComboBox(is.codion.framework.domain.entity.attribute.Attribute<T> attribute) 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
Itembased JComboBox builder - Throws:
IllegalArgumentException- in case the given attribute has no associated items
-
comboBox
public final <T,C extends JComboBox<T>, is.codion.swing.common.ui.component.combobox.ComboBoxBuilder<T,B extends is.codion.swing.common.ui.component.combobox.ComboBoxBuilder<T, C, B>> C, comboBoxB> (is.codion.framework.domain.entity.attribute.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 final <T extends Temporal> is.codion.swing.common.ui.component.text.TemporalFieldPanel.Builder<T> temporalFieldPanel(is.codion.framework.domain.entity.attribute.Attribute<T> attribute) Creates aTemporalFieldPanelbuilder based on the given attribute.- Type Parameters:
T- the attribute type- Parameters:
attribute- the attribute- Returns:
- a
TemporalFieldPanelbuilder
-
temporalFieldPanel
public final <T extends Temporal> is.codion.swing.common.ui.component.text.TemporalFieldPanel.Builder<T> temporalFieldPanel(is.codion.framework.domain.entity.attribute.Attribute<T> attribute, String dateTimePattern) Creates aTemporalFieldPanelbuilder based on the given attribute.- Type Parameters:
T- the attribute type- Parameters:
attribute- the attributedateTimePattern- the date time pattern- Returns:
- a
TemporalFieldPanelbuilder
-
textFieldPanel
public final is.codion.swing.common.ui.component.text.TextFieldPanel.Builder textFieldPanel(is.codion.framework.domain.entity.attribute.Attribute<String> attribute) Creates aTextFieldPanelbuilder based on the given attribute.- Parameters:
attribute- the attribute- Returns:
- a
TextFieldPanelbuilder
-
textArea
public final is.codion.swing.common.ui.component.text.TextAreaBuilder textArea(is.codion.framework.domain.entity.attribute.Attribute<String> attribute) Creates a TextArea builder based on the given attribute.- Parameters:
attribute- the attribute- Returns:
- a JTextArea builder
-
textField
public final <T,C extends JTextField, is.codion.swing.common.ui.component.text.TextFieldBuilder<T,B extends is.codion.swing.common.ui.component.text.TextFieldBuilder<T, C, B>> C, textFieldB> (is.codion.framework.domain.entity.attribute.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
public final <T extends Temporal> is.codion.swing.common.ui.component.text.TemporalField.Builder<T> temporalField(is.codion.framework.domain.entity.attribute.Attribute<T> attribute) Creates aTemporalFieldbuilder based on the given attribute.- Type Parameters:
T- the temporal type- Parameters:
attribute- the attribute- Returns:
- a
TemporalFieldbuilder
-
temporalField
public final <T extends Temporal> is.codion.swing.common.ui.component.text.TemporalField.Builder<T> temporalField(is.codion.framework.domain.entity.attribute.Attribute<T> attribute, String dateTimePattern) Creates aTemporalFieldbuilder based on the given attribute.- Type Parameters:
T- the temporal type- Parameters:
attribute- the attributedateTimePattern- the date time pattern- Returns:
- a
TemporalFieldbuilder
-
shortField
public final is.codion.swing.common.ui.component.text.NumberField.Builder<Short> shortField(is.codion.framework.domain.entity.attribute.Attribute<Short> attribute) Creates aNumberFieldbuilder based on the given attribute.- Parameters:
attribute- the attribute- Returns:
- a
NumberFieldbuilder
-
integerField
public final is.codion.swing.common.ui.component.text.NumberField.Builder<Integer> integerField(is.codion.framework.domain.entity.attribute.Attribute<Integer> attribute) Creates aNumberFieldbuilder based on the given attribute.- Parameters:
attribute- the attribute- Returns:
- a
NumberFieldbuilder
-
longField
public final is.codion.swing.common.ui.component.text.NumberField.Builder<Long> longField(is.codion.framework.domain.entity.attribute.Attribute<Long> attribute) Creates aNumberFieldbuilder based on the given attribute.- Parameters:
attribute- the attribute- Returns:
- a
NumberFieldbuilder
-
doubleField
public final is.codion.swing.common.ui.component.text.NumberField.Builder<Double> doubleField(is.codion.framework.domain.entity.attribute.Attribute<Double> attribute) Creates aNumberFieldbuilder based on the given attribute.- Parameters:
attribute- the attribute- Returns:
- a
NumberFieldbuilder
-
bigDecimalField
public final is.codion.swing.common.ui.component.text.NumberField.Builder<BigDecimal> bigDecimalField(is.codion.framework.domain.entity.attribute.Attribute<BigDecimal> attribute) Creates aNumberFieldbuilder based on the given attribute.- Parameters:
attribute- the attribute- Returns:
- a
NumberFieldbuilder
-
slider
public final is.codion.swing.common.ui.component.slider.SliderBuilder slider(is.codion.framework.domain.entity.attribute.Attribute<Integer> attribute) Creates aJSliderbuilder 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
JSliderbuilder
-
slider
public final is.codion.swing.common.ui.component.slider.SliderBuilder slider(is.codion.framework.domain.entity.attribute.Attribute<Integer> attribute, BoundedRangeModel boundedRangeModel) Creates aJSliderbuilder based on the given attribute.- Parameters:
attribute- the attributeboundedRangeModel- the bounded range model- Returns:
- a
JSliderbuilder
-
integerSpinner
public final is.codion.swing.common.ui.component.spinner.NumberSpinnerBuilder<Integer> integerSpinner(is.codion.framework.domain.entity.attribute.Attribute<Integer> attribute) Creates aJSpinnerbuilder based on the given attribute.- Parameters:
attribute- the attribute- Returns:
- a
JSpinnerbuilder
-
doubleSpinner
public final is.codion.swing.common.ui.component.spinner.NumberSpinnerBuilder<Double> doubleSpinner(is.codion.framework.domain.entity.attribute.Attribute<Double> attribute) Creates aJSpinnerbuilder based on the given attribute.- Parameters:
attribute- the attribute- Returns:
- a
JSpinnerbuilder
-
listSpinner
public final <T> is.codion.swing.common.ui.component.spinner.ListSpinnerBuilder<T> listSpinner(is.codion.framework.domain.entity.attribute.Attribute<T> attribute, SpinnerListModel listModel) Creates aJSpinnerbuilder based on the given attribute.- Type Parameters:
T- the value type- Parameters:
attribute- the attributelistModel- the spinner model- Returns:
- a
JSpinnerbuilder
-
itemSpinner
public final <T> is.codion.swing.common.ui.component.spinner.ItemSpinnerBuilder<T> itemSpinner(is.codion.framework.domain.entity.attribute.Attribute<T> attribute) Creates aJSpinnerbuilder based on the given attribute.- Type Parameters:
T- the value type- Parameters:
attribute- the attribute- Returns:
- a
JSpinnerbuilder
-
maskedTextField
public final is.codion.swing.common.ui.component.text.MaskedTextFieldBuilder maskedTextField(is.codion.framework.domain.entity.attribute.Attribute<String> attribute) 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
-