M
- the application model typepublic abstract class EntityApplicationPanel<M extends SwingEntityApplicationModel> extends JPanel implements HierarchyPanel
Modifier and Type | Class and Description |
---|---|
static interface |
EntityApplicationPanel.Starter
A starter for entity application panels.
|
JPanel.AccessibleJPanel
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
static PropertyValue<Boolean> |
CONFIRM_EXIT
Indicates whether the application should ask for confirmation when exiting
Value type: Boolean Default value: false |
static PropertyValue<Boolean> |
DISPLAY_ENTITY_PANELS_IN_FRAME
Specifies if EntityPanels opened via the
displayEntityPanel(EntityPanel.Builder) method
should be displayed in a frame instead of the default dialogValue type: Boolean Default value: false |
static PropertyValue<String> |
HELP_URL
Specifies the URL to the application help
Value type: String Default value: https://codion.is/doc/{version}/{jdk}/help/client.html |
static PropertyValue<Boolean> |
PERSIST_ENTITY_PANELS
Specifies if EntityPanels opened via the
EntityApplicationPanel.displayEntityPanel method
should be persisted, or kept in memory, when the dialog/frame is closed, instead of being created each time.Value type: Boolean Default value: false |
static PropertyValue<Boolean> |
SHOW_STARTUP_DIALOG
Specifies whether a startup dialog should be shown
Value type: Boolean Default value: true |
static PropertyValue<Integer> |
TAB_PLACEMENT
Specifies the tab placement
Value type: Integer (SwingConstants.TOP, SwingConstants.BOTTOM, SwingConstants.LEFT, SwingConstants.RIGHT) Default value: SwingConstants.TOP |
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
EntityApplicationPanel(String applicationName) |
EntityApplicationPanel(String applicationName,
ImageIcon applicationIcon) |
EntityApplicationPanel(String applicationName,
ImageIcon applicationIcon,
Supplier<JFrame> frameProvider) |
Modifier and Type | Method and Description |
---|---|
void |
activatePanel()
Activates this panel, showing it and preparing it for input
|
void |
addAlwaysOnTopListener(EventDataListener<Boolean> listener) |
void |
addApplicationStartedListener(EventDataListener<JFrame> listener) |
protected void |
addOnExitListener(EventListener listener)
Adds a listener notified when the application is about to exit.
|
State |
alwaysOnTopState() |
ImageIcon |
applicationIcon() |
protected String |
applicationIdentifier()
Returns a String identifying the application this EntityApplicationPanel represents,
by default the full class name is returned.
|
String |
applicationName() |
protected JTabbedPane |
applicationTabPane()
Returns the JTabbedPane used by the default UI, note that this can be null if the default UI
initialization has been overridden.
|
protected void |
bindEvents()
Override to add event bindings after initialization
|
List<HierarchyPanel> |
childPanels() |
protected Version |
clientVersion() |
protected Control |
createAboutControl() |
protected JPanel |
createAboutPanel() |
protected List<Controls> |
createAdditionalMenuControls() |
protected ToggleControl |
createAlwaysOnTopControl() |
protected abstract M |
createApplicationModel(EntityConnectionProvider connectionProvider)
Creates the application model
|
static TreeModel |
createDependencyTreeModel(Entities entities) |
protected abstract List<EntityPanel> |
createEntityPanels(M applicationModel)
Creates the
EntityPanel s to include in this application panel. |
protected Control |
createExitControl() |
protected Controls |
createFileControls() |
protected Control |
createHelpControl() |
protected Controls |
createHelpControls() |
protected Control |
createLogLevelControl() |
protected Controls |
createMainMenuControls() |
protected JMenuBar |
createMenuBar()
Creates the JMenuBar to use on the application Frame
|
protected JPanel |
createNorthPanel()
Creates a panel to display in the NORTH position of this application panel.
|
protected Control |
createRefreshAllControl() |
protected Control |
createSelectFontSizeControl() |
protected Control |
createSelectLookAndFeelControl()
Allows the user the select between the available Look and Feels, saves the selection as a user preference.
|
protected JPanel |
createSouthPanel()
Creates a panel to display in the SOUTH position of this application frame,
override to provide a south panel.
|
protected JPanel |
createStartupIconPanel(Icon icon)
Initializes the icon panel to show in the startup dialog
|
protected List<EntityPanel.Builder> |
createSupportEntityPanelBuilders(M applicationModel) |
protected Controls |
createSupportTableControls() |
protected Controls |
createToolsControls() |
protected Control |
createViewApplicationTreeControl() |
protected Controls |
createViewControls() |
protected Control |
createViewDependencyTree() |
protected Control |
createViewKeyboardShortcutsControl() |
protected String |
defaultLookAndFeelName() |
protected String |
defaultUsername() |
void |
displayAbout()
Shows an about dialog
|
protected void |
displayEntityPanel(EntityPanel.Builder panelBuilder)
Displays the panel provided by the given builder in a frame or dialog,
depending on
DISPLAY_ENTITY_PANELS_IN_FRAME . |
protected void |
displayEntityPanelDialog(EntityPanel.Builder panelBuilder)
Shows a dialog containing the entity panel provided by the given panel builder
|
protected void |
displayEntityPanelDialog(EntityPanel.Builder panelBuilder,
boolean modalDialog)
Shows a dialog containing the entity panel provided by the given panel builder
|
protected void |
displayEntityPanelFrame(EntityPanel.Builder panelBuilder)
Shows a frame containing the entity panel provided by the given panel builder
|
void |
displayException(Throwable exception)
Displays the exception in a dialog
|
void |
displayHelp()
Displays the help.
|
void |
displayKeyboardShortcuts()
Displays a keyboard shortcut overview panel.
|
EntityPanel |
entityPanel(EntityType entityType) |
List<EntityPanel> |
entityPanels() |
void |
exit()
Exits this application
|
protected int |
fontSizePercentage()
Returns the font size multiplier to use, from user preferences, in percentages, e.g:
85 = decrease the default font size by 15% 100 = use the default font size 125 = increase the default font size by 25% |
protected String |
frameTitle() |
protected static User |
getUser(String[] args)
Looks up user credentials via a
CredentialsProvider service using an authentication token
found in the program arguments list. |
protected EntityConnectionProvider |
initializeConnectionProvider(User user,
String clientTypeId)
Initializes the entity connection provider
|
protected void |
initializeUI()
Initializes this EntityApplicationPanel
|
boolean |
isAlwaysOnTop() |
protected User |
loginUser(User defaultUser,
LoginDialogBuilder.LoginValidator loginValidator)
Returns the user, either via a login dialog or via override, called during startup if login is required
|
protected String |
lookAndFeelName()
Returns the name of the look and feel to use, this default implementation fetches
it from user preferences, if no preference is available the default system look and feel is used.
|
M |
model() |
Optional<HierarchyPanel> |
nextSiblingPanel() |
Optional<HierarchyPanel> |
parentPanel() |
Optional<Window> |
parentWindow() |
protected JFrame |
prepareFrame(boolean displayFrame,
boolean maximizeFrame,
Dimension frameSize,
boolean mainMenu)
Initializes a JFrame according to the given parameters, containing this EntityApplicationPanel
|
Optional<HierarchyPanel> |
previousSiblingPanel() |
void |
removeAlwaysOnTopListener(EventListener listener) |
void |
removeApplicationStartedListener(EventDataListener<JFrame> listener) |
protected void |
saveDefaultUsername(String username)
Saves the username so that it can be used as default the next time this application is started.
|
protected void |
savePreferences()
Called during the exit() method, override to save user preferences on program exit,
remember to call super.savePreferences() when overriding
|
void |
selectChildPanel(HierarchyPanel childPanel)
Activates (and shows) the given child panel
|
Optional<HierarchyPanel> |
selectedChildPanel() |
void |
selectFontSize()
Display a dialog for selecting the application font size percentage
|
void |
setAlwaysOnTop(boolean alwaysOnTop) |
void |
setLogLevel()
Shows a dialog for setting the log level
|
EntityApplicationPanel.Starter |
starter() |
void |
viewApplicationTree()
Displays in a dialog a tree describing the application layout
|
void |
viewDependencyTree()
Shows a dialog containing a dependency tree view of all defined entities
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
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
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, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
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, getPeer, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final PropertyValue<String> HELP_URL
public static final PropertyValue<Boolean> CONFIRM_EXIT
public static final PropertyValue<Boolean> SHOW_STARTUP_DIALOG
public static final PropertyValue<Boolean> DISPLAY_ENTITY_PANELS_IN_FRAME
displayEntityPanel(EntityPanel.Builder)
method
should be displayed in a frame instead of the default dialogdisplayEntityPanel(EntityPanel.Builder)
public static final PropertyValue<Boolean> PERSIST_ENTITY_PANELS
EntityApplicationPanel.displayEntityPanel
method
should be persisted, or kept in memory, when the dialog/frame is closed, instead of being created each time.public static final PropertyValue<Integer> TAB_PLACEMENT
public EntityApplicationPanel(String applicationName)
applicationName
- the application namepublic EntityApplicationPanel(String applicationName, ImageIcon applicationIcon)
applicationName
- the application nameapplicationIcon
- the application iconpublic final void displayException(Throwable exception)
exception
- the exception to displaypublic final M model()
public final EntityPanel entityPanel(EntityType entityType)
entityType
- the entityTypepublic final List<EntityPanel> entityPanels()
public final Optional<Window> parentWindow()
public final String applicationName()
public final ImageIcon applicationIcon()
FrameworkIcons.logo(int)
public final boolean isAlwaysOnTop()
public final void setAlwaysOnTop(boolean alwaysOnTop)
alwaysOnTop
- the new valueaddAlwaysOnTopListener(EventDataListener)
public final State alwaysOnTopState()
public final void setLogLevel()
public final void viewApplicationTree()
public final void viewDependencyTree()
public final void selectFontSize()
public final Optional<HierarchyPanel> parentPanel()
parentPanel
in interface HierarchyPanel
public final Optional<HierarchyPanel> selectedChildPanel()
selectedChildPanel
in interface HierarchyPanel
public final void selectChildPanel(HierarchyPanel childPanel)
HierarchyPanel
selectChildPanel
in interface HierarchyPanel
childPanel
- the child panel to activate and showpublic final Optional<HierarchyPanel> previousSiblingPanel()
previousSiblingPanel
in interface HierarchyPanel
public final Optional<HierarchyPanel> nextSiblingPanel()
nextSiblingPanel
in interface HierarchyPanel
public final List<HierarchyPanel> childPanels()
childPanels
in interface HierarchyPanel
public final void activatePanel()
HierarchyPanel
activatePanel
in interface HierarchyPanel
public final void exit()
CancelException
- if the exit is cancelledaddOnExitListener(EventListener)
,
CONFIRM_EXIT
,
EntityApplicationModel.isWarnAboutUnsavedData()
public void displayHelp() throws Exception
public final void displayKeyboardShortcuts()
public final void displayAbout()
createAboutPanel()
public final void addAlwaysOnTopListener(EventDataListener<Boolean> listener)
listener
- a listener notified each time the always on top status changespublic final void removeAlwaysOnTopListener(EventListener listener)
listener
- the listener to removepublic final void addApplicationStartedListener(EventDataListener<JFrame> listener)
listener
- a listener notified when to application has been successfully startedpublic final void removeApplicationStartedListener(EventDataListener<JFrame> listener)
listener
- the listener to removepublic static TreeModel createDependencyTreeModel(Entities entities)
entities
- the entitiespublic EntityApplicationPanel.Starter starter()
EntityApplicationPanel.Starter
for this application panel.protected final JTabbedPane applicationTabPane()
initializeUI()
has been calledprotected Controls createMainMenuControls()
createFileControls()
,
createViewControls()
,
createToolsControls()
,
createHelpControls()
protected Controls createFileControls()
protected Controls createToolsControls()
protected Controls createViewControls()
protected Controls createHelpControls()
protected final Control createExitControl()
protected final Control createLogLevelControl()
protected final Control createRefreshAllControl()
protected final Control createViewApplicationTreeControl()
protected final Control createViewDependencyTree()
protected final Control createSelectLookAndFeelControl()
LookAndFeelProvider.addLookAndFeelProvider(LookAndFeelProvider)
,
LookAndFeelProvider.getLookAndFeelProvider(String)
,
Dialogs.lookAndFeelSelectionDialog()
,
LookAndFeelSelectionPanel.CHANGE_ON_SELECTION
protected final Control createSelectFontSizeControl()
protected final ToggleControl createAlwaysOnTopControl()
protected final Control createAboutControl()
protected final Control createHelpControl()
protected final Control createViewKeyboardShortcutsControl()
protected JPanel createAboutPanel()
protected EntityConnectionProvider initializeConnectionProvider(User user, String clientTypeId)
user
- the userclientTypeId
- a string specifying the client typeCancelException
- in case the initialization is cancelledprotected Version clientVersion()
protected void bindEvents()
protected List<Controls> createAdditionalMenuControls()
protected Controls createSupportTableControls()
protected final void displayEntityPanel(EntityPanel.Builder panelBuilder)
DISPLAY_ENTITY_PANELS_IN_FRAME
.panelBuilder
- the entity panel builderprotected final void displayEntityPanelFrame(EntityPanel.Builder panelBuilder)
panelBuilder
- the entity panel builderprotected final void displayEntityPanelDialog(EntityPanel.Builder panelBuilder)
panelBuilder
- the entity panel builderprotected final void displayEntityPanelDialog(EntityPanel.Builder panelBuilder, boolean modalDialog)
panelBuilder
- the entity panel buildermodalDialog
- if true the dialog is made modalprotected void initializeUI()
protected abstract List<EntityPanel> createEntityPanels(M applicationModel)
EntityPanel
s to include in this application panel.applicationModel
- the application model responsible for providing EntityModels for the panelsEntityPanel
s to include in this application panelprotected List<EntityPanel.Builder> createSupportEntityPanelBuilders(M applicationModel)
protected String lookAndFeelName()
defaultLookAndFeelName()
protected String defaultLookAndFeelName()
Utilities.systemLookAndFeelClassName()
protected int fontSizePercentage()
selectFontSize()
protected JPanel createNorthPanel()
protected JPanel createSouthPanel()
protected JPanel createStartupIconPanel(Icon icon)
icon
- the iconprotected String frameTitle()
protected final JFrame prepareFrame(boolean displayFrame, boolean maximizeFrame, Dimension frameSize, boolean mainMenu)
displayFrame
- specifies whether the frame should be displayed or left invisiblemaximizeFrame
- specifies whether the frame should be maximized or use it's preferred sizeframeSize
- if the JFrame is not maximized then its preferredSize is set to this valuemainMenu
- yes if the main menu should be includedprotected final void addOnExitListener(EventListener listener)
CancelException
.listener
- a listener notified when the application is about to exitprotected JMenuBar createMenuBar()
createMainMenuControls()
protected abstract M createApplicationModel(EntityConnectionProvider connectionProvider)
connectionProvider
- the connection providerCancelException
- in case the initialization is cancelledprotected User loginUser(User defaultUser, LoginDialogBuilder.LoginValidator loginValidator)
defaultUser
- the default user to display in the login dialogloginValidator
- the user login validatorCancelException
- in case a login dialog is cancelledprotected void saveDefaultUsername(String username)
username
- the usernameprotected String defaultUsername()
protected String applicationIdentifier()
protected void savePreferences()
EntityApplicationModel.savePreferences()
protected static User getUser(String[] args)
CredentialsProvider
service using an authentication token
found in the program arguments list. Useful for single sign on application launch.
javaws -open authenticationToken:123-123-123 http://codion.is/demo/demo.jnlp
java -jar application/getdown-1.7.1.jar app_dir app_id authenticationToken:123-123-123
args
- the program arguments