public class WindowManager
extends Object
ManagedWindow
Modifier and Type | Field and Description |
---|---|
private static Hashtable |
acceleratorList
for each window, keeps whatever accelerator key has been stored for it
|
static boolean |
enableTracing |
private static Hashtable<ManagedWindow,String> |
fileWindowLookup
Keeps the window file entries in the form of ( file, ManagedWindow) pairs
|
private static boolean |
listToBeSorted |
static int |
MAX_MENU_LABEL_LENGTH |
static String |
MENU_LABEL_PREFIX_IF_TOO_LONG |
private static Hashtable<JMenuItem,ManagedWindow> |
menuWindowLookup
Keeps the window entries in the form of (MenuItemLabel, ManagedWindow)
pairs
|
private static ArrayList<ManagedWindow> |
windowList
The global list of all managed windows, independent of any menus
|
private static Hashtable<ManagedWindow,String> |
windowMenuLabelLookup
Each window has a particular string that appears in the menu label.
|
Constructor and Description |
---|
WindowManager() |
Modifier and Type | Method and Description |
---|---|
static void |
changeFilename(ManagedWindow mw,
String filename)
Tell the window manager that it needs to change the filename it's using for this window.
|
static ManagedWindow |
chooseWindowFromMenu(JMenuItem mi)
Brings to the front whatever window goes with the menu item specified.
|
static void |
forgetWindow(ManagedWindow mw)
Notify this window manager that a window no longer needs to be managed.
|
static ManagedWindow |
getWindowFromFile(File f) |
static ManagedWindow |
getWindowFromFile(File f,
Class desiredClass)
Find the window that corresponds to a particular file.
|
static ManagedWindow |
getWindowFromMenuItem(JMenuItem mi) |
private static void |
insertNewWindowIntoList(ManagedWindow mw) |
static void |
makeMenu(ManagedWindow currentWindow)
Create menu entries for every managed window.
|
static void |
manageWindow(ManagedWindow mw)
Notify this window manager that a window wants to be managed.
|
static void |
manageWindow(ManagedWindow mw,
KeyStroke key)
Notify this window manager that a window wants to be managed.
|
static void |
refreshWindowMenuList(ManagedWindow activeFrame)
Refreshes the windows menu lists for the given window.
|
static void |
setSorted(boolean sortme) |
static String |
shortenMenuLabel(String label) |
static void |
windowActionPerformed(ActionEvent e)
Handles the window menu selections for the EditFrame, HubFrame, Craft and
CraftWindow classes.
|
public static boolean enableTracing
public static final int MAX_MENU_LABEL_LENGTH
public static final String MENU_LABEL_PREFIX_IF_TOO_LONG
private static Hashtable<JMenuItem,ManagedWindow> menuWindowLookup
private static Hashtable<ManagedWindow,String> windowMenuLabelLookup
private static Hashtable<ManagedWindow,String> fileWindowLookup
private static ArrayList<ManagedWindow> windowList
private static Hashtable acceleratorList
private static boolean listToBeSorted
public static void manageWindow(ManagedWindow mw)
mw
- the window to be managed; must implement the ManagedWindow
interface.public static void manageWindow(ManagedWindow mw, KeyStroke key)
mw
- the window to be managed; must implement the ManagedWindow
interface.key
- the accelerator to be associated with this window's menu item.
If null
then do not include an accelerator.public static void forgetWindow(ManagedWindow mw)
mw
- the window to be removed; if not found, then do nothing.public static ManagedWindow getWindowFromMenuItem(JMenuItem mi)
public static ManagedWindow chooseWindowFromMenu(JMenuItem mi)
mi
- A menu item previously associated with a particular window by
makeMenu.makeMenu(chargerlib.ManagedWindow)
private static void insertNewWindowIntoList(ManagedWindow mw)
public static void makeMenu(ManagedWindow currentWindow)
menu
- The menu (usually a "Windows" menu) to which items are to be
added.currentWindow
- put a check box next to this window's entry.ManagedWindow
public static String shortenMenuLabel(String label)
public static void windowActionPerformed(ActionEvent e)
public static void setSorted(boolean sortme)
public static void changeFilename(ManagedWindow mw, String filename)
mw
- The current window being managedfilename
- The new filenamepublic static ManagedWindow getWindowFromFile(File f)
public static ManagedWindow getWindowFromFile(File f, Class desiredClass)
f
- A file that is associated with some window.public static void refreshWindowMenuList(ManagedWindow activeFrame)
m
- activeFrame
- ManagedWindow.getWindowMenu()