Class AbstractShowPanelAction<T extends JPanel>

Type Parameters:
T - type of the panel to show
All Implemented Interfaces:
ILocalized, ActionListener, PropertyChangeListener, Serializable, Cloneable, EventListener, Action
Direct Known Subclasses:
ShowPanelAction

public abstract class AbstractShowPanelAction<T extends JPanel> extends AuthenticatedAction
Action to show a panel. \nThis abstract class provides following features>
  • Integration with the panel controller to provide navigation and actions available on this panel;(printing, or saving).
  • Lazy building of the panel.
  • Specific help for this panel with the help broker.
  • Localization.
  • Authentication if needed.
  • Provided by the broldev.core.swing project.
    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 Details

      • frame

        protected IMainFrame frame
      • card

        protected Enum<?> card
      • panel

        protected T extends JPanel panel
      • panelId

        protected String panelId
    • Constructor Details

      • AbstractShowPanelAction

        public AbstractShowPanelAction(Class<T> clazz, Enum<? extends IBrolCard> card)
        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

        public AbstractShowPanelAction(Class<T> clazz, Enum<? extends IBrolCard> card, IBrolImage icon)
        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 panel
        icon - to display for all actions concerning this panel
        See Also:
        getCard(), getBrolImage()
    • Method Details

      • isVisibleInMenu

        public boolean isVisibleInMenu()
        Allows the controller 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 another IMainFrame.
      • authenticatedActionPerformed

        public void authenticatedActionPerformed(ActionEvent arg0)
        Shows the panel and set this action as current into the controller
        Specified by:
        authenticatedActionPerformed in class AuthenticatedAction
        Parameters:
        arg0 - to get event and source informations
        See Also:
        ActionListener.actionPerformed(java.awt.event.ActionEvent), ActionEvent
      • addPanelListener

        public void 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). Adds the specified component listener to receive component events from this component. If listener listener is null, 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 the Component is not currently in the scroll pane's view port.
        • the Component is obscured by another Component or Container.
        Returns:
        true if the component is showing, false otherwise
        Since:
        1.1 (Oct 23, 2010)
        See Also:
        showPanel()
      • 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 the controller according to the card. If the panel is an instance of IBrolCard, the controller will displays the panel title into the application's status bar.
      • close

        public void close()
        Closes the panel, informs the controller, and frees memory.
      • buildPanel

        protected T 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 no NullPointerException 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 a ResourceBundle to load information based on the user's Locale, and may observe the LanguageHelper to update the GUI on Locale switch.
      • getPanel

        public final T 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

        public Enum<?> getCard()
        The card identifies the panel; If the card is an instance of IBrolCard, it allows also to display a user readable title of the panel for all actions concerning it.
        Returns:
        the card
      • getTitle

        public String getTitle()
        Returns:
        the "NAME" property of the action, or an empty string
      • getBrolImage

        public IBrolImage getBrolImage()
        Returns:
        the brolImage(may be null)