Class FWTabView

java.lang.Object
net.simplace.ui.tabview.FWTabView
All Implemented Interfaces:
ActionListener, EventListener, ChangeListener, HyperlinkListener

public class FWTabView extends Object implements ActionListener, ChangeListener, HyperlinkListener
Toolkit for arranging multiple extern panels in one target panel. Just add the 'target'-panel to the desired viewcontainer. Now u can create panels and use them as usuall (etc. adding some widgets, setting viewport...). The manager will provide one tab/view if there are * views. It also provides a popup with the default actions - close all views. - close this view.
Author:
Andreas Enders
  • Field Details

    • DESKTOP_ID

      public static final String DESKTOP_ID
      Constant-ID for the desktop.
      See Also:
    • iViewMap

      protected final LinkedHashMap<Object,JPanel> iViewMap
      Map containing the views(value) and their ids (key).
    • iTabbedPane

      protected final FWTabViewPane iTabbedPane
      Tabbedpane for displaying multiple views.
  • Constructor Details

    • FWTabView

      protected FWTabView(boolean aShowDesktopTab)
      Constructor for subclasses. Initiates the basic elements.
      Parameters:
      aShowDesktopTab - whether the desktop tab is added
  • Method Details

    • getInstance

      public static FWTabView getInstance()
      Returns the only instance of this class.
      Returns:
      the singleton instance
    • createView

      public boolean createView(Object aID, String aCaption, JPanel aView, String aSystemID)
      Adds a view as new tab and selects it. If a view of the system is already open, it is replaced; if a view with the id is already open, it is only selected.
      Parameters:
      aID - id of the view
      aCaption - tab caption, or null to use the localised <prefix>.tabview.<id>
      aView - the view panel
      aSystemID - system id; if not empty it is used as view key and for the icon tool.<id>
      Returns:
      true, if the view was created successfully, otherwise returns false
    • createView

      public boolean createView(Object aID, JPanel aView, String aSystemID)
      Adds a view with the localised default caption, see createView(Object, String, JPanel, String).
      Parameters:
      aID - id of the view
      aView - the view panel
      aSystemID - system id, or null
      Returns:
      true, if the view was created successfully, otherwise returns false
    • disposeView

      public void disposeView(Object aID, boolean aShouldBeApproved)
      Removes the view.
      Parameters:
      aID - id of the view
      aShouldBeApproved - if true the user has to confirm closing (not in development mode and only for views of a functionality)
    • disposeAll

      public void disposeAll()
      Removes all views except the desktop, each with confirmation.
    • disposeAll

      public void disposeAll(boolean aLeaveCurrent, boolean aForceDispose)
      Removes all views except the desktop.
      Parameters:
      aLeaveCurrent - whether the selected view is kept
      aForceDispose - if true the views are closed without confirmation
    • selectView

      public void selectView(Object aID)
      Parameters:
      aID - id of the view to select
    • getSelectedView

      public Component getSelectedView()
      Returns:
      Component at selected index
    • getView

      public Component getView(Object aOID)
      Returns the view for the given oid.
      Parameters:
      aOID - id of the view
      Returns:
      the view, or null if there is none
    • getSelectedViewID

      public Object getSelectedViewID()
      Returns:
      selected view ID
    • closeSelectedView

      public void closeSelectedView(boolean aSuppressApproving)
      Closes the selected view.
      Parameters:
      aSuppressApproving - if true the view is closed without confirmation
    • isViewVisible

      public boolean isViewVisible(String aViewID)
      Returns whether or not there is an existing view with the given id.
      Parameters:
      aViewID - id of the view
      Returns:
      true if the view exists
    • getTabCount

      public int getTabCount()
      Returns:
      number of tabs without the desktop tab
    • getTargetPanel

      public JPanel getTargetPanel()
      Returns:
      target Panel
    • actionPerformed

      public void actionPerformed(ActionEvent aActionEvent)
      Specified by:
      actionPerformed in interface ActionListener
    • fireActionEvent

      public void fireActionEvent(ActionListener aActionListener, String aCommand)
      Sends an action event with this tab view as source to the listener.
      Parameters:
      aActionListener - the listener
      aCommand - the action command
    • stateChanged

      public void stateChanged(ChangeEvent aChangeEvent)
      Informs the listeners when a view is selected.
      Specified by:
      stateChanged in interface ChangeListener
    • addViewManagerListener

      public void addViewManagerListener(FWTabViewListener aListener)
      Parameters:
      aListener - listener to add
    • removeViewManagerListener

      public void removeViewManagerListener(FWTabViewListener aListener)
      Parameters:
      aListener - listener to remove
    • hyperlinkUpdate

      public void hyperlinkUpdate(HyperlinkEvent aHyperlinkEvent)
      This method is called when a click action is performed on a Link. Currently does nothing.
      Specified by:
      hyperlinkUpdate in interface HyperlinkListener
    • setTabPlacement

      public void setTabPlacement(int aOrientation)
      Sets a new orientation to the tabpane.
      Parameters:
      aOrientation - tab placement (JTabbedPane.TOP, BOTTOM, LEFT, RIGHT)
    • setEmptyPanel

      public void setEmptyPanel(JPanel aNewEmptyPanel)
      Replaces the emptyPanel.
      Parameters:
      aNewEmptyPanel - panel shown when no view is open
    • getIDOfComponent

      public Object getIDOfComponent(JPanel aComponent)
      Returns the id of a view.
      Parameters:
      aComponent - the view panel
      Returns:
      the id, or null if the panel is not registered
    • hasView

      public boolean hasView(Object aID)
      indicates if a given view is already opened (author: jschoder)
      Parameters:
      aID - id of the view
      Returns:
      true, if a given view is already opened, otherwise returns false
    • setWaitCursor

      public void setWaitCursor(String aSystemID)
      Parameters:
      aSystemID - id of the view showing the wait cursor
    • setDefaultCursor

      public void setDefaultCursor(String aSystemID)
      Parameters:
      aSystemID - id of the view showing the default cursor