Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| http://www.jpicedt.org
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## jpicedt.ui
Class MDIManager

    java.lang.Object
      jpicedt.ui.MDIManager

Direct Known Subclasses:
  InternalFrameMDIManager, JFrameMDIManager

public abstract class MDIManager
extends Object

An abstract class that serves as the superclass for jPicEdt's Multiple Document Interface desktop managers.

Concrete implementation know how to add or remove a document (e.g. a PEDrawingBoard or a DockablePanel) to the MDI interface. Each document is actually contained in a MDIComponent (i.e. either a JFrame or a JInternalFrame), which is created by the factory method createMDIComponent(). The list of MDIComponent's which currently belong to the desktop is hold in separate hash maps, one for each family of documents. There are currently two kind of documents supported:

- PEDrawingBoard's: they're directly wrapped into a MDIComponent. The "boardMap" hash map holds the list of boards belonging to the desktop, together with their UI delegate. The addDrawingBoard() and removeDrawingBoard() methods allows one to add or remove boards from the desktop. These methods wrap board into their UI delegate on-the-fly. Finally, the "activeBoard" variable maintains a reference on the currently active drawing board (or null if none is active and/or open).
- DockablePanel's: there's one more layer in this case, as (i) we wish to remember UI properties (location, size, title,...) associated with each panel (ii) this allows us to implement most methods related to DockablePanel management directly in this class, instead of relying on concrete subclasses to do the job. Hence: (i) there's a "dockablePanelsMap" which holds the list of DockablePanel's belonging to the desktop, together with a key which allows us to retrieve these UI properties from jPicEdt's properties. (ii) each DockablePanel, instead of being directly wrapped into an MDIComponent, rather holds a reference to it; this in particular allows us to create/hide/show/etc... DockablePanel's directly in this class, since we do not need to rely on a particular implementation of MDIComponent.

Since:
  jPicEdt 1.3
Version:
  $Id: MDIManager.java,v 1.15.2.1 2007/09/02 11:56:30 reynal Exp $
Author:
  Sylvain Reynal

Nested Class Summary
`protected class` | `MDIManager.BoardEventHandler` A handler for events triggered from any PEDrawingBoard, its PECanvas or its EditorKit.
`class` | `MDIManager.DockablePanel` A wrapper for dockable panels, e.g.
`static interface` | `MDIManager.MDIComponent` A common interface for UI components being hosted by this MDIManager.

Field Summary
`static String` | `ACTIVE_BOARD_CHANGE` PropertyChangeEvent's name corresponding to a new board being activated
`protected PEDrawingBoard` | `activeBoard` Reference on the currently active board, or null if no board is currently open.
`protected MDIManager.BoardEventHandler` | `boardEventHandler` delegate which notifies dockable panels when a an event is triggered by a PEDrawingBoard
`protected HashMap` | `boardMap` A hash table used to bind a PEDrawingBoard (the key) and its MDIComponent container (the value) This map plays pretty much the same role as JDesktopPane, but it's able to manage any desktop component implementing the MDIComponent interface, e.g.
`protected HashMap` | `dockablePanelsMap` a hash table used to remember dockable panels added to the desktop, with key=panel's title
`static String` | `KEY_MDIMANAGER` key for persistent storage
`static String` | `MDI_CHILDFRAMES` value for persistent storage
`static String` | `MDI_STANDALONEFRAMES` value for persistent storage

Constructor Summary
`MDIManager()`

Method Summary
`void` | `addDockablePanel(String key, JPanel pane)` Adds the given pane to the hashtable of dockable panels, then shows it.
`void` | `addDrawingBoard(PEDrawingBoard board)` Adds a new DrawingBoard component to the list of drawing boards.
`abstract void` | `addMDIComponent(MDIManager.MDIComponent c)` Adds the given component to the desktop of this MDIManager.
`abstract void` | `cascadeDrawingBoards()` Rearranges all open drawing-boards by cascading them
`abstract void` | `closeBoard(PEDrawingBoard board)` Ask the given board to close itself
`abstract MDIManager.MDIComponent` | `createMDIComponent(JPanel pane)` Factory method that creates a MDIComponent that acts as a wrapper for the given pane.
`static MDIManager` | `createMDIManager(String value, PEProgressBar progress)` Create an MDIManager according to the given value.
`PopupMenuFactory` | `createPopupMenuFactory()` Factory method to create a PopupMenuFactory for newly created board
`abstract PEDrawingBoard` | `getActiveDrawingBoard()` Returns the currently active drawing board
`PEDrawingBoard[]` | `getAllDrawingBoards()` Returns all opened drawing boards
`static String` | `getDefaultManagerName()`
`abstract Dimension` | `getDesktopSize()` Returns the dimension of the desktop that hosts the components of this MDIManager.
`JPanel` | `getDockablePanelFromKey(String key)` Return the inner pane contained in the dockable panel associated with the given key, or null if none match.
`Set` | `getDockablePanelKeys()` Returns a set containing all keys (of class "String") that map to a DockablePanel
`int` | `getDrawingBoardCount()` Returns the number of open boards
`MDIManager.MDIComponent` | `getHostingContainer(PEDrawingBoard board)` Returns the MDIComponent that contains the given board
`static String[]` | `getInstalledMDIManagers()`
`abstract JMenuItem[]` | `getMenuItems()` Return an array containing all the menu-items components attached to menubars
`abstract String` | `getName()`
`protected boolean` | `removeDrawingBoard(PEDrawingBoard board)` Remove the given drawing board from the list of open drawing boards, possibly attempting to save its content if necessary, then unregisters any previously registered listener.
`void` | `saveGeometry()` Saves UI geometry to JPicEdt's preferences. This implementation saves geometrical properties related to DockablePanel only.
`abstract void` | `selectDrawingBoard(PEDrawingBoard board)` Selects the given drawing board ; concrete implementation should call show() or any similar method on the MDIComponent (aka container) hosting the given board.
`void` | `setHostingContainerTitle(String title, PEDrawingBoard board)` Sets the title of the frame/internal frame hosting the given board to the given string.
`void` | `showDockablePanel(String key, boolean visible)` Set the visible state of the dockable pane with the given key.
`void` | `showStatus(String str)` Requests that the argument string be displayed in the status bar
`abstract void` | `tileDrawingBoardsHorizontally()` Tiles all open drawing-boards horizontally
`abstract void` | `tileDrawingBoardsVertically()` Tiles all open drawing-boards vertically
`void` | `toggleDockablePanel(String key)` Toggle the visible state of the dockable pane with the given key.
`void` | `update()` Updates local properties from the JPicEdt's preferences (e.g.
`abstract void` | `updateAccelerators()` Update JMenuItem's accelerators from the key/value pairs stored in JPicEdt's preferences
`abstract void` | `updateFragmentsMenu()` Updates the "fragments" menu items
`abstract void` | `updateMenuBar()` Update the content (i.e.
`abstract void` | `updateRecentFilesSubmenu()` Updates the "recent files" sub-menu items after a frame was saved or opened.
`abstract void` | `updateScriptsMenu()` Updates the "script" menu items
`abstract void` | `updateToolkitMenu(PropertyChangeEvent e)` update currently "selected" menuitem in Toolkit menu
`abstract void` | `updateUndoRedoMenus(String undoName, String redoName)` update "undo" and "redo" text
`abstract void` | `updateWindowMenu()` Updates the Window menu as soon as an internal frame is opened or closed (this menu keeps tracks of every open internal frames so that the user can activate them quickly by use of a shortcut)

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### KEY_MDIMANAGER

    public static final String KEY_MDIMANAGER

  key for persistent storage

  See Also:
    Constant Field Values

### MDI_CHILDFRAMES

    public static final String MDI_CHILDFRAMES

  value for persistent storage

  See Also:
    Constant Field Values

### MDI_STANDALONEFRAMES

    public static final String MDI_STANDALONEFRAMES

  value for persistent storage

  See Also:
    Constant Field Values

### ACTIVE_BOARD_CHANGE

    public static final String ACTIVE_BOARD_CHANGE

  PropertyChangeEvent's name corresponding to a new board being activated

  See Also:
    Constant Field Values

### dockablePanelsMap

    protected HashMap dockablePanelsMap

  a hash table used to remember dockable panels added to the desktop, with key=panel's title

### boardMap

    protected HashMap boardMap

  A hash table used to bind a PEDrawingBoard (the key) and its MDIComponent container (the value) This map plays pretty much the same role as JDesktopPane, but it's able to manage any desktop component implementing the MDIComponent interface, e.g. JFrame's as well as JInternalFrame's. In particular, since this map holds the list of PEDrawingBoard's together with their hosting MDIComponent, it's at the core of the desktop management, e.g. for adding or removing boards properly.

### boardEventHandler

    protected MDIManager.BoardEventHandler boardEventHandler

  delegate which notifies dockable panels when a an event is triggered by a PEDrawingBoard

### activeBoard

    protected PEDrawingBoard activeBoard

  Reference on the currently active board, or null if no board is currently open. This reference is constantly being updated by MDIDesktopManager when a MDIComponent gets (de)activated, and it contains a PEDrawingBoard.

Constructor Detail

### MDIManager

    public MDIManager()

Method Detail

### createMDIManager

    public static MDIManager createMDIManager(String value,
                                              PEProgressBar progress)

  Create an MDIManager according to the given value.

  Parameters:
    `value` - one of MDI_CHILDFRAMES or MDI_STANDALONEFRAMES

### getInstalledMDIManagers

    public static String[] getInstalledMDIManagers()

### getDefaultManagerName

    public static String getDefaultManagerName()

### getName

    public abstract String getName()

### createMDIComponent

    public abstract MDIManager.MDIComponent createMDIComponent(JPanel pane)

  Factory method that creates a MDIComponent that acts as a wrapper for the given pane.

### addMDIComponent

    public abstract void addMDIComponent(MDIManager.MDIComponent c)

  Adds the given component to the desktop of this MDIManager.

### getDesktopSize

    public abstract Dimension getDesktopSize()

  Returns the dimension of the desktop that hosts the components of this MDIManager. Depending on the implementation, this may be either the whole screen, or the size of a JFrame containing all the documents.

### update

    public void update()

  Updates local properties from the JPicEdt's preferences (e.g. GUI colours, rendering-hints,...) This implementation update the rendering hints of each currently opened PEDrawingBoard

### saveGeometry

    public void saveGeometry()

  Saves UI geometry to JPicEdt's preferences.
  This implementation saves geometrical properties related to DockablePanel only.

  See Also:
    `addDockablePanel(java.lang.String, javax.swing.JPanel)`, `MDIManager.DockablePanel.setVisible(boolean)`

### showStatus

    public void showStatus(String str)

  Requests that the argument string be displayed in the status bar

### createPopupMenuFactory

    public PopupMenuFactory createPopupMenuFactory()

  Factory method to create a PopupMenuFactory for newly created board

### updateAccelerators

    public abstract void updateAccelerators()

  Update JMenuItem's accelerators from the key/value pairs stored in JPicEdt's preferences

### updateMenuBar

    public abstract void updateMenuBar()

  Update the content (i.e. PEMenu's) of the menu-bar depending on the current state of the MDIManager.

### updateRecentFilesSubmenu

    public abstract void updateRecentFilesSubmenu()

  Updates the "recent files" sub-menu items after a frame was saved or opened.

  Since:
    PicEdt 1.1

### updateScriptsMenu

    public abstract void updateScriptsMenu()

  Updates the "script" menu items

  Since:
    jpicedt 1.3.2

### updateFragmentsMenu

    public abstract void updateFragmentsMenu()

  Updates the "fragments" menu items

  Since:
    jpicedt 1.3.2

### updateUndoRedoMenus

    public abstract void updateUndoRedoMenus(String undoName,
                                             String redoName)

  update "undo" and "redo" text

  Since:
    jpicedt 1.3.2

### updateWindowMenu

    public abstract void updateWindowMenu()
                                   throws MissingResourceException

  Updates the Window menu as soon as an internal frame is opened or closed (this menu keeps tracks of every open internal frames so that the user can activate them quickly by use of a shortcut)

  Throws:
    `MissingResourceException`
  Since:
    PicEdt 1.1

### updateToolkitMenu

    public abstract void updateToolkitMenu(PropertyChangeEvent e)

  update currently "selected" menuitem in Toolkit menu

### getMenuItems

    public abstract JMenuItem[] getMenuItems()

  Return an array containing all the menu-items components attached to menubars

### getHostingContainer

    public MDIManager.MDIComponent getHostingContainer(PEDrawingBoard board)

  Returns the MDIComponent that contains the given board

### setHostingContainerTitle

    public void setHostingContainerTitle(String title,
                                         PEDrawingBoard board)

  Sets the title of the frame/internal frame hosting the given board to the given string.

### addDrawingBoard

    public void addDrawingBoard(PEDrawingBoard board)

  Adds a new DrawingBoard component to the list of drawing boards. The given board gets wrapped into a MDIComponent beforehands

### closeBoard

    public abstract void closeBoard(PEDrawingBoard board)

  Ask the given board to close itself

### removeDrawingBoard

    protected boolean removeDrawingBoard(PEDrawingBoard board)

  Remove the given drawing board from the list of open drawing boards, possibly attempting to save its content if necessary, then unregisters any previously registered listener. Closing the associated UI (i.e. the MDIComponent) is the responsibility of the caller.

  Returns:
    false if the operation failed because the action was cancelled by the user

### getAllDrawingBoards

    public PEDrawingBoard[] getAllDrawingBoards()

  Returns all opened drawing boards

### selectDrawingBoard

    public abstract void selectDrawingBoard(PEDrawingBoard board)

  Selects the given drawing board ; concrete implementation should call show() or any similar method on the MDIComponent (aka container) hosting the given board.

### getDrawingBoardCount

    public int getDrawingBoardCount()

  Returns the number of open boards

### getActiveDrawingBoard

    public abstract PEDrawingBoard getActiveDrawingBoard()

  Returns the currently active drawing board

### addDockablePanel

    public void addDockablePanel(String key,
                                 JPanel pane)

  Adds the given pane to the hashtable of dockable panels, then shows it. If "pane" is an instance of SelectionListener (resp. PropertyChangeListener), it will be notified selection (resp. propery-change) events from any currently opened drawing board.

  Parameters:
    `key` - used to retrieve geometrical properties from the JPicEdt's preferences, i.e. "ui." + key + ".visible" for the visible state at init time.

### toggleDockablePanel

    public void toggleDockablePanel(String key)

  Toggle the visible state of the dockable pane with the given key.

### showDockablePanel

    public void showDockablePanel(String key,
                                  boolean visible)

  Set the visible state of the dockable pane with the given key.

### getDockablePanelKeys

    public Set getDockablePanelKeys()

  Returns a set containing all keys (of class "String") that map to a DockablePanel

### getDockablePanelFromKey

    public JPanel getDockablePanelFromKey(String key)

  Return the inner pane contained in the dockable panel associated with the given key, or null if none match.

### cascadeDrawingBoards

    public abstract void cascadeDrawingBoards()

  Rearranges all open drawing-boards by cascading them

### tileDrawingBoardsHorizontally

    public abstract void tileDrawingBoardsHorizontally()

  Tiles all open drawing-boards horizontally

### tileDrawingBoardsVertically

    public abstract void tileDrawingBoardsVertically()

  Tiles all open drawing-boards vertically

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| http://www.jpicedt.org
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Submit a bug : syd@jpicedt.org