java.lang.Object
is.codion.swing.framework.ui.EntityPanel.Config
- Enclosing class:
- EntityPanel
Contains configuration settings for a
EntityPanel
which must be set before the panel is initialized.-
Field Summary
Modifier and TypeFieldDescriptionstatic final PropertyValue<String>
Specifies where the control panel should be placed in a BorderLayout Value type: String Default value:BorderLayout.EAST
static final PropertyValue<String>
Specifies where the control toolbar should be placed in a BorderLayout Value type: String Default value: BorderLayout.WESTstatic final PropertyValue<Boolean>
Indicates whether entity edit panel dialogs should be closed on escape Value type: Boolean Default value: truestatic final PropertyValue<String>
Specifies where the edit panel should be placed in a BorderLayout Value type: Boolean Default value: BorderLayout.NORTHstatic final PropertyValue<Boolean>
Specifies whether entity panels should include controls by default Value type: Boolean Default value: truestatic final PropertyValue<Boolean>
Specifies whether a control for toggling the edit panel is available to the user Value type: Boolean Default value: truestatic final PropertyValue<Boolean>
Specifies whether the edit controls (Save, update, delete, clear, refresh) should be on a toolbar instead of a button panel Value type: Boolean Default value: falsestatic final PropertyValue<Boolean>
Indicates whether keyboard navigation will be enabled Value type: Boolean Default value: truestatic final PropertyValue<EntityPanel.WindowType>
Specifies how detail and edit panels should be displayed. -
Method Summary
Modifier and TypeMethodDescriptioncontrolComponent
(Function<Controls, JComponent> controlComponent) Creates the component to place next to the edit panel, containing the available controls, such as insert, update, delete, clear and refresh.controlComponentConstraints
(String controlComponentConstraints) Sets the layout constraints to use for the control panel.description
(String description) detailLayout
(Function<EntityPanel, EntityPanel.DetailLayout> detailLayout) disposeEditDialogOnEscape
(boolean disposeEditDialogOnEscape) editBasePanel
(Function<EntityEditPanel, JPanel> editBasePanel) Creates a base panel containing the given edit panel.editPanelConstraints
(String editPanelConstraints) enabledEditStates
(EntityPanel.PanelState... editStates) Sets the enabled edit panel states.<T extends EntityPanel>
TincludeControls
(boolean includeControls) includeToggleEditPanelControl
(boolean includeToggleEditPanelControl) initialEditState
(EntityPanel.PanelState initialState) DefaultEntityPanel.PanelState.EMBEDDED
keyStroke
(ControlKey<?> controlKey, Consumer<Value<KeyStroke>> keyStroke) toolbarControls
(boolean toolbarControls) Overridden bycontrolComponent(Function)
.useKeyboardNavigation
(boolean useKeyboardNavigation) windowType
(EntityPanel.WindowType windowType)
-
Field Details
-
USE_KEYBOARD_NAVIGATION
Indicates whether keyboard navigation will be enabled- Value type: Boolean
- Default value: true
-
DISPOSE_EDIT_DIALOG_ON_ESCAPE
Indicates whether entity edit panel dialogs should be closed on escape- Value type: Boolean
- Default value: true
-
INCLUDE_TOGGLE_EDIT_PANEL_CONTROL
Specifies whether a control for toggling the edit panel is available to the user- Value type: Boolean
- Default value: true
-
TOOLBAR_CONTROLS
Specifies whether the edit controls (Save, update, delete, clear, refresh) should be on a toolbar instead of a button panel- Value type: Boolean
- Default value: false
-
WINDOW_TYPE
Specifies how detail and edit panels should be displayed.- Value type:
EntityPanel.WindowType
- Default value:
EntityPanel.WindowType.DIALOG
- Value type:
-
CONTROL_PANEL_CONSTRAINTS
Specifies where the control panel should be placed in a BorderLayout- Value type: String
- Default value:
BorderLayout.EAST
- See Also:
-
CONTROL_TOOLBAR_CONSTRAINTS
Specifies where the control toolbar should be placed in a BorderLayout- Value type: String
- Default value: BorderLayout.WEST
- See Also:
-
EDIT_PANEL_CONSTRAINTS
Specifies where the edit panel should be placed in a BorderLayout- Value type: Boolean
- Default value: BorderLayout.NORTH
-
INCLUDE_CONTROLS
Specifies whether entity panels should include controls by default- Value type: Boolean
- Default value: true
-
-
Method Details
-
entityPanel
- Type Parameters:
T
- the panel type- Returns:
- the entity panel
-
description
- Parameters:
description
- the description to use when presenting this panel- Returns:
- this Config instance
-
icon
- Parameters:
icon
- the icon to use when presenting this panel- Returns:
- this Config instance
-
detailLayout
- Parameters:
detailLayout
- provides the detail panel layout- Returns:
- this Config instance
-
controlComponent
Creates the component to place next to the edit panel, containing the available controls, such as insert, update, delete, clear and refresh.- Parameters:
controlComponent
- creates the controls panel- Returns:
- this Config instance
- See Also:
-
editBasePanel
Creates a base panel containing the given edit panel. The default layout is aFlowLayout
with the alignment depending oncontrolComponentConstraints(String)
.- Parameters:
editBasePanel
- creates the edit base panel- Returns:
- this Config instance
- See Also:
-
toolbarControls
Overridden bycontrolComponent(Function)
.- Parameters:
toolbarControls
- true if the edit controls should be on a toolbar instead of a button panel- Returns:
- this Config instance
- See Also:
-
controlComponentConstraints
Sets the layout constraints to use for the control panel.The default layout is as follows (BorderLayout.WEST): __________________________________ | edit panel |control| | (EntityEditPanel) | panel | } editControlPanel |________________________|_______| With (BorderLayout.SOUTH): __________________________ | edit | | panel | |________________________| } editControlPanel | control panel | |________________________| etc.
- Parameters:
controlComponentConstraints
- the controls component layout constraints (BorderLayout constraints)- Returns:
- this Config instance
- Throws:
IllegalArgumentException
- in case the given constraint is not one of BorderLayout.SOUTH, NORTH, EAST or WEST
-
editPanelConstraints
- Parameters:
editPanelConstraints
- the edit panel constraints- Returns:
- this Config instance
- Throws:
IllegalArgumentException
- in case the given constraint is not one of BorderLayout.SOUTH, NORTH, EAST or WEST
-
includeToggleEditPanelControl
- Parameters:
includeToggleEditPanelControl
- true if a control for toggling the edit panel should be included- Returns:
- this Config instance
-
includeControls
- Parameters:
includeControls
- true if the edit and table panel controls should be included- Returns:
- this Config instance
-
windowType
- Parameters:
windowType
- the window type to use when presenting panels- Returns:
- this Config instance
- See Also:
-
keyStroke
- Parameters:
controlKey
- the control keykeyStroke
- provides access to theValue
controlling the key stroke for the given control- Returns:
- this Config instance
-
initialEditState
DefaultEntityPanel.PanelState.EMBEDDED
- Parameters:
initialState
- the initial edit panel state- Returns:
- this Config instance
- Throws:
IllegalArgumentException
- in case the given state isEntityPanel.PanelState.WINDOW
IllegalArgumentException
- in case the given state is not enabled- See Also:
-
enabledEditStates
Sets the enabled edit panel states.- Parameters:
editStates
- the enabled states- Returns:
- this Config instance
- Throws:
IllegalArgumentException
- in case the given states do not include the initial stateIllegalArgumentException
- in case noeditStates
are specified- See Also:
-
disposeEditDialogOnEscape
- Parameters:
disposeEditDialogOnEscape
- specifies whether entity edit panel dialogs should be closed on escape- Returns:
- this Config instance
-