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 IMainFrameprotected Tprotected StringFields inherited from class be.gaudry.swing.action.AuthenticatedAction
loginMessage, loginTitleFields inherited from class javax.swing.AbstractAction
changeSupport, enabledFields 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 TypeMethodDescriptionvoidaddPanelListener(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).voidShows the panel and set this action as current into thecontrollerprotected TBuilds a new instance of T extends JPanel if a T constructor exists without parameters.voidclose()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()booleanbooleanDetermines whether this component is showing on screen.booleanAllows thecontrollerto display the panel in the panels management controls.protected voidsetFrame()Sets another IMainFrame.voidSets localized language The implementation should use aResourceBundleto load information based on the user'sLocale, and may observe theLanguageHelperto update the GUI on Locale switch.voidsetVisibleInMenu(boolean visibleInMenu)voidShows a panel into thecontrolleraccording to thecard.Methods inherited from class be.gaudry.swing.action.AuthenticatedAction
actionPerformed, afterUpdateLanguage, authenticationCanceled, authenticationFailed, beforeActionPerformed, getLoginService, getServers, setLoginPane, unSecuredActionPerformedMethods inherited from class be.gaudry.swing.action.AutoLocalizedAction
beforeUpdateLanguage, doAfterCreate, init, propertyChangeMethods inherited from class be.gaudry.swing.action.LocalizableAction
doOnCreateMethods 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 thecontrollerto display the panel in the panels management controls.- Returns:
trueif this action is visible in the menu.- See Also:
ShowPanelController.addAction(AbstractShowPanelAction),ShowPanelController.setCurrentAction(AbstractShowPanelAction)
-
setVisibleInMenu
public void setVisibleInMenu(boolean visibleInMenu)- Parameters:
visibleInMenu-trueif this action is visible in the menu,falseotherwise.\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:
authenticatedActionPerformedin 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 listenerlistenerisnull, 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
Componentis actually visible to the user. This can happen when:- the component has been added to a visible
ScrollPanebut theComponentis not currently in the scroll pane's view port. - the
Componentis obscured by anotherComponentorContainer.
- Returns:
trueif the component is showing,falseotherwise- Since:
- 1.1 (Oct 23, 2010)
- See Also:
showPanel()
- the component has been added to a visible
-
isPanelBuilt
public boolean isPanelBuilt()- Returns:
trueif the panel is not null,falseotherwise- Since:
- 1.2 (May 28, 2011)
- See Also:
getPanel()
-
showPanel
public void showPanel()Shows a panel into thecontrolleraccording 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 noNullPointerExceptionif 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:ILocalizedSets localized language The implementation should use aResourceBundleto load information based on the user'sLocale, and may observe theLanguageHelperto 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)
-