- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- is.codion.swing.framework.ui.EntityPanel
-
- All Implemented Interfaces:
HierarchyPanel
,ImageObserver
,MenuContainer
,Serializable
,Accessible
public class EntityPanel extends JPanel implements HierarchyPanel
A panel representing an Entity via a EntityModel, which facilitates browsing and editing of records.EntityType entityType = ...; EntityConnectionProvider connectionProvider = ...; SwingEntityModel entityModel = new SwingEntityModel(entityType, connectionProvider); EntityPanel entityPanel = new EntityPanel(entityModel); entityPanel.initializePanel(); JFrame frame = new JFrame(); frame.add(entityPanel); frame.pack(); frame.setVisible(true);
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
EntityPanel.Builder
A class providing EntityPanel instances.static class
EntityPanel.Direction
The navigation and resizing directions.static class
EntityPanel.PanelState
The possible states of a detail or edit panel.-
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
-
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
-
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
-
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
-
Field Summary
Fields Modifier and Type Field Description static PropertyValue<Boolean>
DISPOSE_EDIT_DIALOG_ON_ESCAPE
Indicates whether entity edit panel dialogs should be closed on escape
Value type: Boolean
Default value: truestatic PropertyValue<Boolean>
SHOW_DETAIL_PANEL_CONTROLS
Specifies whether actions to hide detail panels or show them in a dialog are available to the user
Value type: Boolean
Default value: truestatic PropertyValue<Boolean>
SHOW_TOGGLE_EDIT_PANEL_CONTROL
Specifies whether a control for toggling the edit panel is available to the user
Value type: Boolean
Default value: truestatic PropertyValue<Integer>
SPLIT_PANE_DIVIDER_SIZE
Specifies the default size of the divider for detail panel split panes.
Value type: Integer
Default value: 18static PropertyValue<Boolean>
TOOLBAR_BUTTONS
Specifies whether the action buttons (Save, update, delete, clear, refresh) should be on a toolbar
Value type: Boolean
Default value: falsestatic PropertyValue<Boolean>
USE_FRAME_PANEL_DISPLAY
Specifies whether detail and edit panels should be displayed in a frame instead of the default dialog
Value type: Boolean
Default value: falsestatic PropertyValue<Boolean>
USE_KEYBOARD_NAVIGATION
Indicates whether keyboard navigation will be enabled
Value type: Boolean
Default value: true-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
-
Constructor Summary
Constructors Constructor Description EntityPanel(SwingEntityModel entityModel)
Instantiates a new EntityPanel instance.EntityPanel(SwingEntityModel entityModel, EntityEditPanel editPanel)
Instantiates a new EntityPanel instance.EntityPanel(SwingEntityModel entityModel, EntityEditPanel editPanel, EntityTablePanel tablePanel)
Instantiates a new EntityPanel instance.EntityPanel(SwingEntityModel entityModel, EntityTablePanel tablePanel)
Instantiates a new EntityPanel instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activatePanel()
Activates this panel, showing it and preparing it for inputCollection<EntityPanel>
activeDetailPanels()
void
addDetailPanel(EntityPanel detailPanel)
Adds the given detail panel, and adds the detail model to the underlying model if it does not contain it already, and then setsincludeDetailPanelTabPane
to truevoid
addDetailPanels(EntityPanel... detailPanels)
static EntityPanel.Builder
builder(EntityType entityType)
Instantiates a new EntityPanel.Builderstatic EntityPanel.Builder
builder(SwingEntityModel model)
Instantiates a new EntityPanel.Builderstatic EntityPanel.Builder
builder(SwingEntityModel.Builder modelBuilder)
Instantiates a new EntityPanel.BuilderList<? extends HierarchyPanel>
childPanels()
boolean
containsDetailPanel(EntityType entityType)
Returns true if this panel contains a detail panel for the givenentityType
boolean
containsEditPanel()
boolean
containsTablePanel()
String
controlPanelConstraints()
protected JPanel
createEditBasePanel(EntityEditPanel editPanel)
Creates a base panel for the edit panel.protected JComponent
createEditControlPanel()
Creates the control panel or component to place next to the edit panel, containing controls for managing records, such as insert, update and delete.EntityPanel
detailPanel(EntityType entityType)
Returns the detail panel for the givenentityType
, if one is availableCollection<EntityPanel>
detailPanels()
Returns all detail panels.void
displayException(Throwable exception)
Displays the exception in a dialogJPanel
editControlPanel()
Returns the panel containing the edit panel and the edit controls panel.protected JPanel
editControlTablePanel()
Returns the base panel containing the edit and table panels (north, center).SwingEntityEditModel
editModel()
EntityEditPanel
editPanel()
String
getCaption()
String
getDescription()
EntityPanel.PanelState
getDetailPanelState()
double
getDetailSplitPaneResizeWeight()
EntityPanel.PanelState
getEditPanelState()
protected void
initialize()
Override to add code that should be called during the initialization routine after the panel has been initializedprotected void
initializeAssociatedPanels()
Called during initialization, before controls have been initializedprotected void
initializeControlPanels()
Called during initialization, after controls have been initialized, use this method to initialize any application panels that rely on controls having been initializedprotected void
initializeEditControlPanel()
EntityPanel
initializePanel()
Initializes this EntityPanels UI, in case of some specific initialization code you can override theinitialize()
method and add your code there.protected void
initializeUI()
Initializes this EntityPanels UI.boolean
isDisposeEditDialogOnEscape()
boolean
isIncludeControlPanel()
boolean
isIncludeDetailTabPane()
boolean
isPanelInitialized()
boolean
isShowDetailPanelControls()
boolean
isShowToggleEditPanelControl()
boolean
isUseKeyboardNavigation()
SwingEntityModel
model()
Optional<HierarchyPanel>
nextSiblingPanel()
Optional<HierarchyPanel>
parentPanel()
Optional<HierarchyPanel>
previousSiblingPanel()
void
requestInitialFocus()
Requests focus for this panel.void
resizePanel(EntityPanel.Direction direction, int pixelAmount)
Resizes this panel in the given directionvoid
savePreferences()
Saves any user preferences for all entity panels and associated elementsvoid
selectChildPanel(HierarchyPanel childPanel)
Activates (and shows) the given child panelOptional<HierarchyPanel>
selectedChildPanel()
void
setCaption(String caption)
Sets the caption to use when this panel is displayed.void
setControlPanelConstraints(String controlPanelConstraints)
Sets the layout constraints to use for the control panelvoid
setDescription(String description)
Sets the description text to use in f.ex.void
setDetailPanelState(EntityPanel.PanelState state)
void
setDetailSplitPanelResizeWeight(double detailSplitPanelResizeWeight)
void
setDisposeEditDialogOnEscape(boolean disposeEditDialogOnEscape)
void
setEditPanelState(EntityPanel.PanelState state)
void
setFilterPanelsVisible(boolean visible)
Hides or shows the active filter panel dialogs for this panel and all its child panels (detail panels and their detail panels etc.)void
setFocusCycleRoot(boolean focusCycleRoot)
void
setIncludeControlPanel(boolean includeControlPanel)
void
setIncludeDetailTabPane(boolean includeDetailTabPane)
protected void
setParentPanel(EntityPanel parentPanel)
void
setShowDetailPanelControls(boolean showDetailPanelControls)
void
setShowToggleEditPanelControl(boolean showToggleEditPanelControl)
protected void
setupKeyboardActions()
Sets up the keyboard navigation actions.protected void
setupNavigation()
protected void
setupResizing()
void
setUseKeyboardNavigation(boolean useKeyboardNavigation)
SwingEntityTableModel
tableModel()
EntityTablePanel
tablePanel()
void
toggleDetailPanelState()
Toggles the detail panel state between WINDOW, HIDDEN and EMBEDDEDvoid
toggleEditPanelState()
Toggles the edit panel state between WINDOW, HIDDEN and EMBEDDEDString
toString()
void
updateUI()
-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
USE_KEYBOARD_NAVIGATION
public static final PropertyValue<Boolean> USE_KEYBOARD_NAVIGATION
Indicates whether keyboard navigation will be enabled
Value type: Boolean
Default value: true
-
DISPOSE_EDIT_DIALOG_ON_ESCAPE
public static final PropertyValue<Boolean> DISPOSE_EDIT_DIALOG_ON_ESCAPE
Indicates whether entity edit panel dialogs should be closed on escape
Value type: Boolean
Default value: true
-
SHOW_TOGGLE_EDIT_PANEL_CONTROL
public static final PropertyValue<Boolean> SHOW_TOGGLE_EDIT_PANEL_CONTROL
Specifies whether a control for toggling the edit panel is available to the user
Value type: Boolean
Default value: true
-
SHOW_DETAIL_PANEL_CONTROLS
public static final PropertyValue<Boolean> SHOW_DETAIL_PANEL_CONTROLS
Specifies whether actions to hide detail panels or show them in a dialog are available to the user
Value type: Boolean
Default value: true
-
SPLIT_PANE_DIVIDER_SIZE
public static final PropertyValue<Integer> SPLIT_PANE_DIVIDER_SIZE
Specifies the default size of the divider for detail panel split panes.
Value type: Integer
Default value: 18
-
TOOLBAR_BUTTONS
public static final PropertyValue<Boolean> TOOLBAR_BUTTONS
Specifies whether the action buttons (Save, update, delete, clear, refresh) should be on a toolbar
Value type: Boolean
Default value: false
-
USE_FRAME_PANEL_DISPLAY
public static final PropertyValue<Boolean> USE_FRAME_PANEL_DISPLAY
Specifies whether detail and edit panels should be displayed in a frame instead of the default dialog
Value type: Boolean
Default value: false
-
-
Constructor Detail
-
EntityPanel
public EntityPanel(SwingEntityModel entityModel)
Instantiates a new EntityPanel instance. The panel is not laid out and initialized untilinitializePanel()
is called.- Parameters:
entityModel
- the EntityModel
-
EntityPanel
public EntityPanel(SwingEntityModel entityModel, EntityEditPanel editPanel)
Instantiates a new EntityPanel instance. The panel is not laid out and initialized untilinitializePanel()
is called.- Parameters:
entityModel
- the EntityModeleditPanel
- the edit panel
-
EntityPanel
public EntityPanel(SwingEntityModel entityModel, EntityTablePanel tablePanel)
Instantiates a new EntityPanel instance. The panel is not laid out and initialized untilinitializePanel()
is called.- Parameters:
entityModel
- the EntityModeltablePanel
- the table panel
-
EntityPanel
public EntityPanel(SwingEntityModel entityModel, EntityEditPanel editPanel, EntityTablePanel tablePanel)
Instantiates a new EntityPanel instance. The panel is not laid out and initialized untilinitializePanel()
is called.- Parameters:
entityModel
- the EntityModeleditPanel
- the edit paneltablePanel
- the table panel
-
-
Method Detail
-
model
public final SwingEntityModel model()
- Returns:
- the EntityModel
-
editModel
public final SwingEntityEditModel editModel()
- Returns:
- the EntityEditModel
-
tableModel
public final SwingEntityTableModel tableModel()
- Returns:
- the EntityTableModel, null if none is available
-
controlPanelConstraints
public final String controlPanelConstraints()
- Returns:
- the control panel layout constraints (BorderLayout constraints)
-
setControlPanelConstraints
public final void setControlPanelConstraints(String controlPanelConstraints)
Sets the layout constraints to use for the control panelThe default layout is as follows (BorderLayout.WEST): __________________________________ | edit panel |control| | (EntityEditPanel) | panel | } edit control panel |________________________|_______| With (BorderLayout.SOUTH): __________________________ | edit | | panel | |________________________| } edit control panel | control panel | |________________________| etc.
- Parameters:
controlPanelConstraints
- the control panel layout constraints (BorderLayout constraints)- Throws:
IllegalStateException
- if the panel has been initializedIllegalArgumentException
- in case the given constraint is not one of BorderLayout.SOUTH, NORTH, EAST or WEST
-
addDetailPanels
public final void addDetailPanels(EntityPanel... detailPanels)
- Parameters:
detailPanels
- the detail panels
-
addDetailPanel
public final void addDetailPanel(EntityPanel detailPanel)
Adds the given detail panel, and adds the detail model to the underlying model if it does not contain it already, and then setsincludeDetailPanelTabPane
to true- Parameters:
detailPanel
- the detail panel to add- Throws:
IllegalStateException
- if the panel has been initialized
-
initializePanel
public final EntityPanel initializePanel()
Initializes this EntityPanels UI, in case of some specific initialization code you can override theinitialize()
method and add your code there. This method marks this panel as initialized which prevents it from running again, whether an exception occurs or not.- Returns:
- this EntityPanel instance
- See Also:
initialize()
,isPanelInitialized()
-
isPanelInitialized
public final boolean isPanelInitialized()
- Returns:
- true if the method initializePanel() has been called on this EntityPanel instance
- See Also:
initializePanel()
-
editPanel
public final EntityEditPanel editPanel()
- Returns:
- the edit panel
-
containsEditPanel
public final boolean containsEditPanel()
- Returns:
- true if this panel contains a edit panel.
-
tablePanel
public final EntityTablePanel tablePanel()
- Returns:
- the EntityTablePanel used by this EntityPanel
-
containsTablePanel
public final boolean containsTablePanel()
- Returns:
- true if this panel contains a table panel.
-
editControlPanel
public final JPanel editControlPanel()
Returns the panel containing the edit panel and the edit controls panel.- Returns:
- the edit control panel
-
activeDetailPanels
public final Collection<EntityPanel> activeDetailPanels()
- Returns:
- the currently visible/active detail EntityPanels, if any
-
detailPanel
public final EntityPanel detailPanel(EntityType entityType)
Returns the detail panel for the givenentityType
, if one is available- Parameters:
entityType
- the entityType of the detail panel to retrieve- Returns:
- the detail panel of the given type
- Throws:
IllegalArgumentException
- in case the panel was not found
-
detailPanels
public final Collection<EntityPanel> detailPanels()
Returns all detail panels.- Returns:
- the detail panels
-
containsDetailPanel
public final boolean containsDetailPanel(EntityType entityType)
Returns true if this panel contains a detail panel for the givenentityType
- Parameters:
entityType
- the entityType- Returns:
- true if a detail panel for the given entityType is found
-
setCaption
public final void setCaption(String caption)
Sets the caption to use when this panel is displayed.- Parameters:
caption
- the caption
-
getCaption
public final String getCaption()
- Returns:
- the caption to use when presenting this entity panel
-
setDescription
public void setDescription(String description)
Sets the description text to use in f.ex. tool tips for tabbed panes- Parameters:
description
- the description
-
getDescription
public String getDescription()
- Returns:
- the description
-
activatePanel
public final void activatePanel()
Description copied from interface:HierarchyPanel
Activates this panel, showing it and preparing it for input- Specified by:
activatePanel
in interfaceHierarchyPanel
-
parentPanel
public final Optional<HierarchyPanel> parentPanel()
- Specified by:
parentPanel
in interfaceHierarchyPanel
- Returns:
- the parent panel, an empty Optional if none exists
-
selectedChildPanel
public final Optional<HierarchyPanel> selectedChildPanel()
- Specified by:
selectedChildPanel
in interfaceHierarchyPanel
- Returns:
- a child panel, if one exists, which child panel exactly is up the implementation
-
selectChildPanel
public final void selectChildPanel(HierarchyPanel childPanel)
Description copied from interface:HierarchyPanel
Activates (and shows) the given child panel- Specified by:
selectChildPanel
in interfaceHierarchyPanel
- Parameters:
childPanel
- the child panel to activate and show
-
previousSiblingPanel
public final Optional<HierarchyPanel> previousSiblingPanel()
- Specified by:
previousSiblingPanel
in interfaceHierarchyPanel
- Returns:
- the previous sibling panel, if one exists, with wrap around
-
nextSiblingPanel
public final Optional<HierarchyPanel> nextSiblingPanel()
- Specified by:
nextSiblingPanel
in interfaceHierarchyPanel
- Returns:
- the next sibling panel, if one exists, with wrap around
-
childPanels
public final List<? extends HierarchyPanel> childPanels()
- Specified by:
childPanels
in interfaceHierarchyPanel
- Returns:
- the child panels, an empty list if no child panels exist
-
displayException
public final void displayException(Throwable exception)
Displays the exception in a dialog- Parameters:
exception
- the exception to display
-
getDetailSplitPaneResizeWeight
public final double getDetailSplitPaneResizeWeight()
- Returns:
- the resize weight value to use when initializing the left/right split pane, which controls the initial divider placement (0 - 1). Override to control the initial divider placement
-
setDetailSplitPanelResizeWeight
public final void setDetailSplitPanelResizeWeight(double detailSplitPanelResizeWeight)
- Parameters:
detailSplitPanelResizeWeight
- the detail panel split size weight- Throws:
IllegalStateException
- if the panel has been initialized
-
isIncludeDetailTabPane
public final boolean isIncludeDetailTabPane()
- Returns:
- true if the detail panel tab pane should be included
-
setIncludeDetailTabPane
public final void setIncludeDetailTabPane(boolean includeDetailTabPane)
- Parameters:
includeDetailTabPane
- true if the detail panel tab pane should be included- Throws:
IllegalStateException
- if the panel has been initialized
-
isShowToggleEditPanelControl
public final boolean isShowToggleEditPanelControl()
- Returns:
- true if the edit panel control should be shown
- See Also:
SHOW_TOGGLE_EDIT_PANEL_CONTROL
-
setShowToggleEditPanelControl
public final void setShowToggleEditPanelControl(boolean showToggleEditPanelControl)
- Parameters:
showToggleEditPanelControl
- true if a control for toggling the edit panel should be shown- Throws:
IllegalStateException
- if the panel has been initialized
-
isShowDetailPanelControls
public final boolean isShowDetailPanelControls()
- Returns:
- true if detail panel controls should be shown
- See Also:
SHOW_DETAIL_PANEL_CONTROLS
-
setShowDetailPanelControls
public final void setShowDetailPanelControls(boolean showDetailPanelControls)
- Parameters:
showDetailPanelControls
- true if detail panel controls should be shown- Throws:
IllegalStateException
- if the panel has been initialized
-
isIncludeControlPanel
public final boolean isIncludeControlPanel()
- Returns:
- true if the control panel should be included
-
setIncludeControlPanel
public final void setIncludeControlPanel(boolean includeControlPanel)
- Parameters:
includeControlPanel
- true if the control panel should be included- Throws:
IllegalStateException
- if the panel has been initialized
-
isDisposeEditDialogOnEscape
public final boolean isDisposeEditDialogOnEscape()
- Returns:
- true if the edit dialog is disposed of on ESC
- See Also:
DISPOSE_EDIT_DIALOG_ON_ESCAPE
-
setDisposeEditDialogOnEscape
public final void setDisposeEditDialogOnEscape(boolean disposeEditDialogOnEscape)
- Parameters:
disposeEditDialogOnEscape
- if true then the edit dialog is disposed of on ESC- See Also:
DISPOSE_EDIT_DIALOG_ON_ESCAPE
-
isUseKeyboardNavigation
public final boolean isUseKeyboardNavigation()
- Returns:
- true if keyboard navigation is enabled
-
setUseKeyboardNavigation
public final void setUseKeyboardNavigation(boolean useKeyboardNavigation)
- Parameters:
useKeyboardNavigation
- true if keyboard navigation should be enabled
-
toggleDetailPanelState
public final void toggleDetailPanelState()
Toggles the detail panel state between WINDOW, HIDDEN and EMBEDDED
-
toggleEditPanelState
public final void toggleEditPanelState()
Toggles the edit panel state between WINDOW, HIDDEN and EMBEDDED
-
getDetailPanelState
public final EntityPanel.PanelState getDetailPanelState()
- Returns:
- the detail panel state, either HIDDEN, EMBEDDED or WINDOW
-
getEditPanelState
public final EntityPanel.PanelState getEditPanelState()
- Returns:
- the edit panel state, either HIDDEN, EMBEDDED or WINDOW
-
setDetailPanelState
public final void setDetailPanelState(EntityPanel.PanelState state)
- Parameters:
state
- the detail panel state (HIDDEN, EMBEDDED or WINDOW)
-
setEditPanelState
public final void setEditPanelState(EntityPanel.PanelState state)
- Parameters:
state
- the edit panel state, either HIDDEN, EMBEDDED or DIALOG
-
setFilterPanelsVisible
public final void setFilterPanelsVisible(boolean visible)
Hides or shows the active filter panel dialogs for this panel and all its child panels (detail panels and their detail panels etc.)- Parameters:
visible
- true if the active filter panel dialogs should be shown, false if they should be hidden
-
resizePanel
public final void resizePanel(EntityPanel.Direction direction, int pixelAmount)
Resizes this panel in the given direction- Parameters:
direction
- the resize directionpixelAmount
- the resize amount
-
requestInitialFocus
public final void requestInitialFocus()
Requests focus for this panel. If an edit panel is available and not hidden, the component defined as the initialFocusComponent gets the input focus. If no edit panel is available the table panel gets the focus, otherwise the first child component of this EntityPanel is used.
-
savePreferences
public void savePreferences()
Saves any user preferences for all entity panels and associated elements
-
setFocusCycleRoot
public final void setFocusCycleRoot(boolean focusCycleRoot)
- Overrides:
setFocusCycleRoot
in classContainer
-
builder
public static EntityPanel.Builder builder(EntityType entityType)
Instantiates a new EntityPanel.Builder- Parameters:
entityType
- the entity type to base this panel builder on- Returns:
- a panel builder
-
builder
public static EntityPanel.Builder builder(SwingEntityModel.Builder modelBuilder)
Instantiates a new EntityPanel.Builder- Parameters:
modelBuilder
- the SwingEntityModel.Builder to base this panel builder on- Returns:
- a panel builder
-
builder
public static EntityPanel.Builder builder(SwingEntityModel model)
Instantiates a new EntityPanel.Builder- Parameters:
model
- the SwingEntityModel to base this panel builder on- Returns:
- a panel builder
-
initializeUI
protected void initializeUI()
Initializes this EntityPanels UI.The default layout is as follows: __________________________________ | edit |control| | | panel | panel | | |__________|_______| detail | | | panel | | table panel | | |(EntityTablePanel)| | | | | |__________________|_____________|
- See Also:
editControlPanel()
,editControlTablePanel()
-
initializeAssociatedPanels
protected void initializeAssociatedPanels()
Called during initialization, before controls have been initialized- See Also:
initializePanel()
-
initializeControlPanels
protected void initializeControlPanels()
Called during initialization, after controls have been initialized, use this method to initialize any application panels that rely on controls having been initialized- See Also:
initializePanel()
-
initialize
protected void initialize()
Override to add code that should be called during the initialization routine after the panel has been initialized- See Also:
initializePanel()
-
createEditBasePanel
protected JPanel createEditBasePanel(EntityEditPanel editPanel)
Creates a base panel for the edit panel. The default layout is aFlowLayout
with the alignment depending on thecontrolPanelConstraints()
. The resulting panel is added atBorderLayout.CENTER
on theeditControlPanel()
- Parameters:
editPanel
- the initialized edit panel- Returns:
- a base panel for the edit panel
-
createEditControlPanel
protected JComponent createEditControlPanel()
Creates the control panel or component to place next to the edit panel, containing controls for managing records, such as insert, update and delete. Only called ifisIncludeControlPanel()
returns true. By default, the control panel provided by the edit panel is returned.- Returns:
- the control panel for managing records
- See Also:
EntityEditPanel.createHorizontalControlPanel()
,EntityEditPanel.createVerticalControlPanel()
,TOOLBAR_BUTTONS
-
editControlTablePanel
protected final JPanel editControlTablePanel()
Returns the base panel containing the edit and table panels (north, center).- Returns:
- the edit and table base panel
-
setParentPanel
protected final void setParentPanel(EntityPanel parentPanel)
- Parameters:
parentPanel
- the panel serving as parent panel for this entity panel- Throws:
IllegalStateException
- in case a parent panel has already been set
-
setupKeyboardActions
protected final void setupKeyboardActions()
Sets up the keyboard navigation actions. CTRL-T transfers focus to the table in case one is available, CTR-E transfers focus to the edit panel in case one is available, CTR-S opens a select search condition panel dialog, in case one is available, CTR-I opens a select input field dialog and CTR-F selects the table search field
-
setupResizing
protected final void setupResizing()
-
setupNavigation
protected final void setupNavigation()
-
initializeEditControlPanel
protected final void initializeEditControlPanel()
-
-