Package be.gaudry.swing.action
Class AbstractShowPanelAction<T extends JPanel>
java.lang.Object
javax.swing.AbstractAction
be.gaudry.swing.action.LocalizableAction
be.gaudry.swing.action.AutoLocalizedAction
be.gaudry.swing.action.AuthenticatedAction
be.gaudry.swing.action.AbstractShowPanelAction<T>
- Type Parameters:
T
- type of the panel to show
- All Implemented Interfaces:
ILocalized
,ActionListener
,PropertyChangeListener
,Serializable
,Cloneable
,EventListener
,Action
- Direct Known Subclasses:
ShowPanelAction
Action to show a panel.
\nThis abstract class provides following features>
Integration with the
Lazy building of the panel.
Specific help for this panel with the
Localization.
Provided by the broldev.core.swing project.
panel controller
to provide
navigation and actions available on this panel;(printing, or saving).help broker
.Authentication
if needed.- Since:
- 1.0 (Mar 18, 2009), broldev.core.swing 0.0.1-SNAPSHOT dependency
- Version:
- 1.2 (May 28, 2011)
- Author:
- Steph GAUDRY
- See Also:
- Serialized Form
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Enum<?>
protected IMainFrame
protected T
protected String
Fields inherited from class be.gaudry.swing.action.AuthenticatedAction
loginMessage, loginTitle
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractShowPanelAction(Class<T> clazz, Enum<? extends IBrolCard> card)
Builds an instance of this action.AbstractShowPanelAction(Class<T> clazz, Enum<? extends IBrolCard> card, IBrolImage icon)
Builds an instance of this action with an associated icon. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPanelListener(ComponentListener listener)
Allows to add a listener to the panel in a lazy mode (the panel will be created later on demand, and the listener will be added on panel creation).void
Shows the panel and set this action as current into thecontroller
protected T
Builds a new instance of T extends JPanel if a T constructor exists without parameters.void
close()
Closes the panel, informs thecontroller
, and frees memory.Enum<?>
getCard()
The card identifies the panel; If the card is an instance ofIBrolCard
, it allows also to display a user readable title of the panel for all actions concerning it.getPanel()
Provides a way to get the panel without showing it.getTitle()
boolean
boolean
Determines whether this component is showing on screen.boolean
Allows thecontroller
to display the panel in the panels management controls.protected void
setFrame()
Sets another IMainFrame.void
Sets localized language The implementation should use aResourceBundle
to load information based on the user'sLocale
, and may observe theLanguageHelper
to update the GUI on Locale switch.void
setVisibleInMenu(boolean visibleInMenu)
void
Shows a panel into thecontroller
according to thecard
.Methods inherited from class be.gaudry.swing.action.AuthenticatedAction
actionPerformed, afterUpdateLanguage, authenticationCanceled, authenticationFailed, beforeActionPerformed, getLoginService, getServers, setLoginPane, unSecuredActionPerformed
Methods inherited from class be.gaudry.swing.action.AutoLocalizedAction
beforeUpdateLanguage, doAfterCreate, init, propertyChange
Methods inherited from class be.gaudry.swing.action.LocalizableAction
doOnCreate
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
Field Details
-
frame
-
card
-
panel
-
panelId
-
-
Constructor Details
-
AbstractShowPanelAction
Builds an instance of this action.- Parameters:
clazz
- Class of the panel;(to build an instance of the panel)card
- to identify the panel- See Also:
AbstractShowPanelAction(Class, Enum, IBrolImage)
-
AbstractShowPanelAction
Builds an instance of this action with an associated icon.- Parameters:
clazz
- Class of the panel;(to build an instance of the panel)card
- to identify the panelicon
- to display for all actions concerning this panel- See Also:
getCard()
,getBrolImage()
-
-
Method Details
-
isVisibleInMenu
public boolean isVisibleInMenu()Allows thecontroller
to display the panel in the panels management controls.- Returns:
true
if this action is visible in the menu.- See Also:
ShowPanelController.addAction(AbstractShowPanelAction)
,ShowPanelController.setCurrentAction(AbstractShowPanelAction)
-
setVisibleInMenu
public void setVisibleInMenu(boolean visibleInMenu)- Parameters:
visibleInMenu
-true
if this action is visible in the menu,false
otherwise.\n Default value :true
- See Also:
isVisibleInMenu()
-
setFrame
protected void setFrame()Sets another IMainFrame. \nOverride this to display the panel into anotherIMainFrame
. -
authenticatedActionPerformed
Shows the panel and set this action as current into thecontroller
- Specified by:
authenticatedActionPerformed
in classAuthenticatedAction
- Parameters:
arg0
- to get event and source informations- See Also:
ActionListener.actionPerformed(java.awt.event.ActionEvent)
,ActionEvent
-
addPanelListener
Allows to add a listener to the panel in a lazy mode (the panel will be created later on demand, and the listener will be added on panel creation). Adds the specified component listener to receive component events from this component. If listenerlistener
isnull
, no exception is thrown and no action is performed.- Parameters:
listener
- the component listener- Since:
- 1.1 (Oct 23, 2010)
- See Also:
ComponentEvent
,ComponentListener
-
isPanelShowing
public boolean isPanelShowing()Determines whether this component is showing on screen. This means that the component must be visible, and it must be in a container that is visible and showing.Note: sometimes there is no way to detect whether the
Component
is actually visible to the user. This can happen when:- the component has been added to a visible
ScrollPane
but theComponent
is not currently in the scroll pane's view port. - the
Component
is obscured by anotherComponent
orContainer
.
- Returns:
true
if the component is showing,false
otherwise- Since:
- 1.1 (Oct 23, 2010)
- See Also:
showPanel()
- the component has been added to a visible
-
isPanelBuilt
public boolean isPanelBuilt()- Returns:
true
if the panel is not null,false
otherwise- Since:
- 1.2 (May 28, 2011)
- See Also:
getPanel()
-
showPanel
public void showPanel()Shows a panel into thecontroller
according to thecard
. If the panel is an instance ofIBrolCard
, the controller will displays the panel title into the application's status bar. -
close
public void close()Closes the panel, informs thecontroller
, and frees memory. -
buildPanel
Builds a new instance of T extends JPanel if a T constructor exists without parameters. If an error occurs, a null value is returned. \nOverride this method to implement specific business, or to ensure noNullPointerException
if no default constructor exists for the panel. \nThis method is only called once when we need the panel for the first time(lazy initializer).- Returns:
- a new T or null
-
setLanguage
public void setLanguage()Description copied from interface:ILocalized
Sets localized language The implementation should use aResourceBundle
to load information based on the user'sLocale
, and may observe theLanguageHelper
to update the GUI on Locale switch. -
getPanel
Provides a way to get the panel without showing it. \nIf the panel is not built, calls the buildPanel() before returning it.- Returns:
- the panel
-
getCard
The card identifies the panel; If the card is an instance ofIBrolCard
, it allows also to display a user readable title of the panel for all actions concerning it.- Returns:
- the card
-
getTitle
- Returns:
- the "NAME" property of the action, or an empty string
-
getBrolImage
- Returns:
- the brolImage(may be null)
-