Module is.codion.swing.framework.ui
Class DefaultEditComponentFactory<T,C extends JComponent>
java.lang.Object
is.codion.swing.framework.ui.component.DefaultEditComponentFactory<T,C>
- Type Parameters:
T
- the attribute typeC
- the component type
- All Implemented Interfaces:
EditComponentFactory<T,
C>
public class DefaultEditComponentFactory<T,C extends JComponent>
extends Object
implements EditComponentFactory<T,C>
A default
EditComponentFactory
implementation.-
Field Summary
Modifier and TypeFieldDescriptionstatic final PropertyValue<Integer>
The maximum length a String attribute must exceed in order for aTextFieldPanel
to be returned instead of aJTextField
. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected EntityComboBox.Builder
comboBox
(ForeignKey foreignKey, EntityDefinition entityDefinition, EntityComboBoxModel comboBoxModel) componentValue
(SwingEntityEditModel editModel, T value) Provides an inputComponentValue
for editing a single attribute value for one or more entities.protected EntitySearchField.SingleSelectionBuilder
searchField
(ForeignKey foreignKey, EntityDefinition entityDefinition, EntitySearchModel searchModel) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface is.codion.swing.framework.ui.component.EditComponentFactory
caption
-
Field Details
-
MAXIMUM_TEXT_FIELD_LENGTH
The maximum length a String attribute must exceed in order for aTextFieldPanel
to be returned instead of aJTextField
.- Value type: Integer
- Default value: 30
-
-
Constructor Details
-
DefaultEditComponentFactory
- Parameters:
attribute
- the attribute for which this factory creates aComponentValue
-
-
Method Details
-
componentValue
Description copied from interface:EditComponentFactory
Provides an inputComponentValue
for editing a single attribute value for one or more entities.- Specified by:
componentValue
in interfaceEditComponentFactory<T,
C extends JComponent> - Parameters:
editModel
- the edit model used to create foreign key input modelsvalue
- the initial value to display- Returns:
- a new
ComponentValue
instance handling input forattribute
-
attribute
- Returns:
- the attribute
-
comboBox
protected EntityComboBox.Builder comboBox(ForeignKey foreignKey, EntityDefinition entityDefinition, EntityComboBoxModel comboBoxModel) - Parameters:
foreignKey
- the foreign keyentityDefinition
- the entity definitioncomboBoxModel
- theEntityComboBoxModel
to base the combo box on- Returns:
- a
EntityComboBox.Builder
instance
-
searchField
protected EntitySearchField.SingleSelectionBuilder searchField(ForeignKey foreignKey, EntityDefinition entityDefinition, EntitySearchModel searchModel) - Parameters:
foreignKey
- the foreign keyentityDefinition
- the entity definitionsearchModel
- theEntitySearchModel
to base the search field on- Returns:
- a
EntitySearchField.SingleSelectionBuilder
instance - Throws:
IllegalArgumentException
- in casesearchModel
is not configured for single selection
-