com.mucommander.ui.main
Class WindowManager

java.lang.Object
  extended by com.mucommander.ui.main.WindowManager
All Implemented Interfaces:
ConfigurationListener, java.awt.event.WindowListener, java.util.EventListener

public class WindowManager
extends java.lang.Object
implements java.awt.event.WindowListener, ConfigurationListener

Window Manager is responsible for creating, disposing, switching, in other words managing :) muCommander windows.

Author:
Maxence Bernard

Method Summary
 void configurationChanged(ConfigurationEvent event)
          Listens to certain configuration variables.
static MainFrame createNewMainFrame()
          Creates a new MainFrame and makes it visible on the screen, on top of any other frames.
static MainFrame createNewMainFrame(AbstractFile folder1, AbstractFile folder2)
          Creates a new MainFrame and makes it visible on the screen, on top of any other frames.
static MainFrame createNewMainFrame(java.lang.String folder1, java.lang.String folder2)
          Creates a new MainFrame and makes it visible on the screen, on top of any other frame.
static MainFrame getCurrentMainFrame()
          Returns the last MainFrame instance that was active.
static java.awt.Rectangle getFullScreenBounds(java.awt.Window window)
          Returns the maximum dimensions for a full-screen window.
static WindowManager getInstance()
          Returns the sole instance of WindowManager.
static java.util.Vector getMainFrames()
          Returns a Vector of all MainFrame instances the application has.
static java.awt.Insets getScreenInsets(java.awt.Window window)
          Computes the screen's insets for the specified window.
static void installLookAndFeel(java.lang.String className)
           
static boolean isInsideUsableScreen(java.awt.Frame frame, int x, int y)
          Checks whether the specified frame can be moved to the specified coordinates and still be fully visible.
static void quit()
          Disposes all opened windows, ending with the one that is currently active if there is one, or the last one which was activated.
static void switchToNextWindow()
          Switches to the next MainFrame, in the order of which they were created.
static void switchToPreviousWindow()
          Switches to previous MainFrame, in the order of which they were created.
static void tryRefreshCurrentFolders()
          Refreshes all panels in all frames in an asynchronous manner.
 void windowActivated(java.awt.event.WindowEvent e)
           
 void windowClosed(java.awt.event.WindowEvent e)
          windowClosed is synchronized so that it doesn't get called while quit() is executing.
 void windowClosing(java.awt.event.WindowEvent e)
           
 void windowDeactivated(java.awt.event.WindowEvent e)
           
 void windowDeiconified(java.awt.event.WindowEvent e)
           
 void windowIconified(java.awt.event.WindowEvent e)
           
 void windowOpened(java.awt.event.WindowEvent e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static WindowManager getInstance()
Returns the sole instance of WindowManager.


getCurrentMainFrame

public static MainFrame getCurrentMainFrame()
Returns the last MainFrame instance that was active. Note that the returned MainFrame may or may not be currently active.


getMainFrames

public static java.util.Vector getMainFrames()
Returns a Vector of all MainFrame instances the application has.


tryRefreshCurrentFolders

public static void tryRefreshCurrentFolders()
Refreshes all panels in all frames in an asynchronous manner.


createNewMainFrame

public static MainFrame createNewMainFrame()
Creates a new MainFrame and makes it visible on the screen, on top of any other frames.

The initial path of each frame will differ depending on whether this is the first mainframe we create or not.
If it is, we'll use the user's default paths. If it's not, the current mainframe's paths will be used.

Returns:
a fully initialised mainframe.

createNewMainFrame

public static MainFrame createNewMainFrame(java.lang.String folder1,
                                           java.lang.String folder2)
Creates a new MainFrame and makes it visible on the screen, on top of any other frame.

Parameters:
folder1 - path on which the left frame will be opened.
folder2 - path on which the right frame will be opened.
Returns:
a fully initialised mainframe.

createNewMainFrame

public static MainFrame createNewMainFrame(AbstractFile folder1,
                                           AbstractFile folder2)
Creates a new MainFrame and makes it visible on the screen, on top of any other frames.

Parameters:
folder1 - initial path for the left frame.
folder2 - initial path for the right frame.

quit

public static void quit()
Disposes all opened windows, ending with the one that is currently active if there is one, or the last one which was activated.


switchToNextWindow

public static void switchToNextWindow()
Switches to the next MainFrame, in the order of which they were created.


switchToPreviousWindow

public static void switchToPreviousWindow()
Switches to previous MainFrame, in the order of which they were created.


installLookAndFeel

public static void installLookAndFeel(java.lang.String className)
                               throws java.lang.ClassNotFoundException,
                                      java.lang.InstantiationException,
                                      java.lang.IllegalAccessException
Throws:
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException

windowActivated

public void windowActivated(java.awt.event.WindowEvent e)
Specified by:
windowActivated in interface java.awt.event.WindowListener

windowDeactivated

public void windowDeactivated(java.awt.event.WindowEvent e)
Specified by:
windowDeactivated in interface java.awt.event.WindowListener

windowClosing

public void windowClosing(java.awt.event.WindowEvent e)
Specified by:
windowClosing in interface java.awt.event.WindowListener

windowClosed

public void windowClosed(java.awt.event.WindowEvent e)
windowClosed is synchronized so that it doesn't get called while quit() is executing.

Specified by:
windowClosed in interface java.awt.event.WindowListener

windowIconified

public void windowIconified(java.awt.event.WindowEvent e)
Specified by:
windowIconified in interface java.awt.event.WindowListener

windowDeiconified

public void windowDeiconified(java.awt.event.WindowEvent e)
Specified by:
windowDeiconified in interface java.awt.event.WindowListener

windowOpened

public void windowOpened(java.awt.event.WindowEvent e)
Specified by:
windowOpened in interface java.awt.event.WindowListener

configurationChanged

public void configurationChanged(ConfigurationEvent event)
Listens to certain configuration variables.

Specified by:
configurationChanged in interface ConfigurationListener
Parameters:
event - describes the configuration modification.

getScreenInsets

public static java.awt.Insets getScreenInsets(java.awt.Window window)
Computes the screen's insets for the specified window.

While this might seem strange, screen insets can change from one window to another. For example, on X11 windowing systems, there is no guarantee that a window will be displayed on the same screen, let alone computer, as the one the application is running on.

Parameters:
window - the window for which screen insets should be computed.

isInsideUsableScreen

public static boolean isInsideUsableScreen(java.awt.Frame frame,
                                           int x,
                                           int y)
Checks whether the specified frame can be moved to the specified coordinates and still be fully visible.

If x (resp. y) is null, this method won't test whether the frame is within horizontal (resp. vertical) bounds.

Parameters:
frame - frame who's visibility should be tested.
x - horizontal coordinate of the upper-leftmost corner of the area to check for.
y - vertical coordinate of the upper-leftmost corner of the area to check for.
Returns:
true if the frame can be moved at the specified location, false otherwise.

getFullScreenBounds

public static java.awt.Rectangle getFullScreenBounds(java.awt.Window window)
Returns the maximum dimensions for a full-screen window.

Parameters:
window - window who's full screen size should be computed.


This file is part of muCommander - Copyright (C) 2002-2008 Maxence Bernard