Interface MDIManager


public interface MDIManager

This interface acts as window manager. It is the place to create new windows, close existing ones or modify their properties (size, position, etc).

Any class extending from JPanel and implementing the IWindow interface may become an Andami window. Andami will create a real window (normally a JInternalFrame) and put the JPanel inside the real window. In order to differentiate the contents (panels extending JPanel and implementing IWindow) from the real window (normally JInternalFrames or JDialogs), we will use window to refer to the contents and frame to refer to the real window.

This class is implemented by the Andami Skin (currently libCorePlugin), which will decide the final implementation of frames. A different frame implementation could be used by switching the Skin.

See Also:
  • Field Details

    • WINDOW

      static final org.gvsig.tools.swing.api.windowmanager.WindowManager.MODE WINDOW
    • TOOL

      static final org.gvsig.tools.swing.api.windowmanager.WindowManager.MODE TOOL
    • DIALOG

      static final org.gvsig.tools.swing.api.windowmanager.WindowManager.MODE DIALOG
    • ALIGN_FIRST_LINE_START

      static final int ALIGN_FIRST_LINE_START
      See Also:
    • ALIGN_PAGE_START

      static final int ALIGN_PAGE_START
      See Also:
    • ALIGN_FIRST_LINE_END

      static final int ALIGN_FIRST_LINE_END
      See Also:
    • ALIGN_FIRST_LINE_END_CASCADE

      static final int ALIGN_FIRST_LINE_END_CASCADE
      See Also:
    • ALIGN_LINE_START

      static final int ALIGN_LINE_START
      See Also:
    • ALIGN_LINE_END

      static final int ALIGN_LINE_END
      See Also:
    • ALIGN_LAST_LINE_START

      static final int ALIGN_LAST_LINE_START
      See Also:
    • ALIGN_PAGE_END

      static final int ALIGN_PAGE_END
      See Also:
    • ALIGN_LAST_LINE_END

      static final int ALIGN_LAST_LINE_END
      See Also:
    • ALIGN_CENTER

      static final int ALIGN_CENTER
      See Also:
  • Method Details

    • init

      void init(MDIFrame f)
      Initializes the MDIFrame. It must be called before starting to use it. It receives the application's main frame (MDIFrame) as parameter.
      Parameters:
      f - Application's main frame.
    • addWindow

      Creates a new frame with the provided contents, and shows this new window. The new frame's properties are set according to the WindowInfo object from IWindow's getWindowInfo() method. The new frame is disposed when closed.

      If the provided IWindow also implements SingletonWindow, and another SingletonWindow already exists and uses the same model, this later window will be sent to the foreground and no new window will be created.

      Parameters:
      p - Panel with the contents of the new window.
      Returns:
      Returns the added IWindow, or in case it is a SingletonWindow and there is another SingletonWindow with the same model that it is already shown, returns this later SingletonWindow.
      Throws:
      SingletonDialogAlreadyShownException
    • showWindow

      void showWindow(JPanel panel, String title, org.gvsig.tools.swing.api.windowmanager.WindowManager.MODE mode)
      Useful method to simplify the presentation of a window. For more precise control over the behavior of the window use addWindow This methos
      Parameters:
      panel - to show as a window
      title - title of the window
      mode - type of the window to create
    • getSingletonWindow

      SingletonWindow getSingletonWindow(Class windowClass, Object model)
      Return the window associated to the SingletonWindow class and the model specified. If not exists any singleton window associated to this null is returned.
      Parameters:
      windowClass - , the class that implement SingletonWindow
      model - , the model associated to the SingletonWindow
      Returns:
      the requested window or null.
    • addCentredWindow

      Creates a new frame with the provided contents, and shows this new window. The new frame will be centered, regardless the position specified in the WindowInfo object from IWindow's getWindowInfo() method. The new frame is disposed when closed.

      If the provided IWindow also implements SingletonWindow, and another SingletonWindow already exists and uses the same model, this later window will be sent to the foreground and no new window will be created.

      Parameters:
      p - Panel with the contents of the new window.
      Returns:
      Returns the added IWindow, or in case it is a SingletonWindow and there is another SingletonWindow with the same model that it is already shown, returns this later SingletonWindow.
      Throws:
      SingletonDialogAlreadyShownException
    • addWindow

      IWindow addWindow(IWindow p, int align) throws SingletonDialogAlreadyShownException
      Throws:
      SingletonDialogAlreadyShownException
    • getActiveWindow

      IWindow getActiveWindow()

      Returns the currently active window, excluding the modal windows and the PALETTE windows. If the currently active window is modal or PALETTE type, the previous non-modal and non-PALETTE active window is returned.

      Modal windows and PALETTE windows are considered to be auxiliary windows, that is the reason why they are not returned.

      Returns:
      A reference to the active window, or null if there is no active window
    • getFocusWindow

      IWindow getFocusWindow()

      Returns the currently focused window, excluding the modal windows. If the currently focused window is modal, the previous non-modal focused window is returned.

      Returns:
      A reference to the focused window, or null if there is no focused window
    • moveToFrom

      void moveToFrom(IWindow win)
    • getAllWindows

      IWindow[] getAllWindows()
      Gets all the open windows. Minimized and maximized windows are included. The application's main frame is excluded; it can be accessed using PluginServices.getMainFrame().
      Returns:
      An IWindow array containing all the open windows.
    • getOrderedWindows

      IWindow[] getOrderedWindows()
      Gets all the open windows (as getAllWindows()), but in this method the windows are returned in the same deepness order that they have in the application.
      Returns:
      An ordered array containing all the panels in the application. The first element of the array is the topmost (foreground) window in the application. The last element is the bottom (background) window.
    • closeSingletonWindow

      boolean closeSingletonWindow(Class viewClass, Object model)
      Close the SingletonWindow whose class and model are provided as parameters.
      Parameters:
      viewClass - Class of the window which is to be closed
      model - Model of the window which is to be closed
      Returns:
      true if there is an open window whose class and model match the provided parameteres, false otherwise.
    • closeSingletonWindow

      boolean closeSingletonWindow(Object model)
      Close the SingletonWindow whose model is provided as parameter.
      Parameters:
      model - Model of the window which is to be closed
      Returns:
      true if there is an open window whose model matchs the provided one, false otherwise.
    • closeWindow

      void closeWindow(IWindow p)
      Close the provided window. If the window is openend with the WindowManager, use setVisible(false) in the JPanel to close it.
      Parameters:
      p - window to be closed
    • closeAllWindows

      void closeAllWindows()
      Close all the currently open windows
    • getWindowInfo

      WindowInfo getWindowInfo(IWindow v)
      Gets the WindowInfo object associated with the provided window.
      Parameters:
      v - window whose information is to be retrieved
      Returns:
      WindowInfo The WindowInfo object containing the information about the provided window
      See Also:
    • setWaitCursor

      void setWaitCursor()
      Shows the wait cursor and blocks all the events from main window until restoreCursor() is called.
    • restoreCursor

      void restoreCursor()
      Sets the normal cursor and unblocks events from main window.
      See Also:
    • setMaximum

      void setMaximum(IWindow v, boolean bMaximum) throws PropertyVetoException
      Maximizes or restores the provided window
      Parameters:
      v - The window to be maximized or restored
      bMaximum - If true, the window will be maximized, if false, it will be restored
      Throws:
      PropertyVetoException
    • changeWindowInfo

      void changeWindowInfo(IWindow v, WindowInfo vi)
      Updates the window properties (size, location, etc) according to the provided WindowInfo object.
      Parameters:
      v - The window whose properties are to be changed
      vi - The WindowInfo object containing the new properties to be set
    • refresh

      void refresh(IWindow win)
      Forces a window to be repainted. Normally, this is not necessary, as windows are refreshed when necessary.
      Parameters:
      win - The window to be refreshed.
    • setBackgroundImage

      void setBackgroundImage(ImageIcon image, String typeDesktop)
      Sets the provided image as background image in the main window. The image will be centered, set in mosaic or expanded to fill the full window, depending on the typeDesktop argument.
      Parameters:
      image - The image to be set as background image
      typeDesktop - Decides whether the image should be centered, set in mosaic or expanded. Accepted values are: Theme.CENTERED, Theme.MOSAIC and Theme.EXPAND.
    • setLocale

      void setLocale(Locale locale)
    • move

      void move(IWindow window, int x, int y)
      Change the position of the speficied window.
      Parameters:
      window -
      x -
      y -
    • getWindow

      IWindow getWindow(JPanel panel)
      Gets the associated IWindow to the panel shown with showWindow method. Also panel shown with the tools WindowManager.
      Parameters:
      panel -
      Returns:
    • getImagePreview

      BufferedImage getImagePreview()
    • isModalDialogShowing

      boolean isModalDialogShowing()
    • getInternalSize

      Dimension getInternalSize()