001: /*=============================================================================
002: * Copyright Texas Instruments, Inc., 2001-2002. All Rights Reserved.
003: *
004: * This program is free software; you can redistribute it and/or modify
005: * it under the terms of the GNU General Public License as published by
006: * the Free Software Foundation; either version 2 of the License, or
007: * (at your option) any later version.
008: *
009: * This program is distributed in the hope that it will be useful,
010: * but WITHOUT ANY WARRANTY; without even the implied warranty of
011: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
012: * GNU General Public License for more details.
013: *
014: * You should have received a copy of the GNU General Public License
015: * along with this program; if not, write to the Free Software
016: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
017: */
018:
019: package ti.chimera.service;
020:
021: import ti.chimera.*;
022: import javax.swing.*;
023:
024: /**
025: * The window manager service provides a way for other parts of the system
026: * to display dialogs/docks, toolbars, and menubar entries.
027: *
028: * @author Rob Clark
029: * @version 0.1
030: */
031: public abstract class WindowManager extends ti.chimera.Service {
032: /**
033: * Class Constructor.
034: */
035: public WindowManager() {
036: super ("window manager");
037: }
038:
039: /**
040: * This exception type is used to abort closing a dialog, if it is not
041: * closable for whatever reason. It can, for example, be thrown by the
042: * dialog's close-runnable (see {@link Dialog#addCloseRunnable}).
043: */
044: public static class DialogNotClosableException extends
045: RuntimeException {
046: }
047:
048: /**
049: * Set the mode. The mode implements the actual display of the
050: * user interface to the user.
051: *
052: * @param mode the service implementing the mode which
053: * realizes the display of dialogs/toolbars/menubar
054: */
055: public abstract void setMode(WindowMode mode);
056:
057: /**
058: * Set the Look & Feel. Swing supports multiple look&feels, depending
059: * on the platform. (For example: Metal, Motif, Windows, MacOSX, plus
060: * any 3rd party L&F that the user has installed.)
061: *
062: * @param lnfName the full name of the class implementing the L&F
063: */
064: public abstract void setLookAndFeel(String lnfName);
065:
066: /**
067: * Get a dialog with the specified title. This method should be used,
068: * rather than creating a <code>JDialog</code>, because this will behave
069: * properly if the window manager is in <code>DESKTOP_MODE</code>.
070: *
071: * @param title the title of the dialog
072: * @return a dialog
073: */
074: public abstract Dialog getDialog(String title);
075:
076: // XXX temporary, until Dock get registrified:
077: public abstract void addDock(Dock dock);
078:
079: public abstract void removeDock(Dock dock);
080:
081: public abstract void dockUpdated(Dock dock);
082:
083: /**
084: * Add a tool-bar.
085: *
086: * @param toolBar the tool-bar to add
087: */
088: public abstract void addToolBar(JToolBar toolBar);
089:
090: /**
091: * Remove a tool-bar.
092: *
093: * @param toolBar the tool-bar to remove
094: */
095: public abstract void removeToolBar(JToolBar toolBar);
096:
097: /**
098: * Add a menu bar item. The path of the action is "/" seperated "path" of
099: * the action, such as "/File/Open". Multiple actions with the same path
100: * and name can exist, in which case when the user selects that entry from
101: * the pull-down menus, the <code>actionPerformed</code> methods will be
102: * in the order that the actions where added. If the action is null, a
103: * separator will be added.
104: *
105: * @param path which sub-menu the item should go under
106: * @param a the menu bar action to add.
107: * @see #removeMenuBarItem
108: */
109: public abstract void addMenuBarItem(String path, Action a);
110:
111: /**
112: * Remove a menu bar item.
113: *
114: * @param path which sub-menu the item should go under
115: * @param a the menu bar action to remove.
116: * @see #addMenuBarItem
117: */
118: public abstract void removeMenuBarItem(String path, Action a);
119:
120: /**
121: * Show or hide the user interface.
122: *
123: * @param b <code>true</code> to show the user interface, or
124: * <code>false</code> to hide it
125: */
126: public abstract void setVisible(boolean b);
127:
128: /**
129: * Show or hide the user interface.
130: *
131: * @param b <code>true</code> to show the user interface, or
132: * <code>false</code> to hide it
133: */
134: public abstract boolean isVisible();
135: }
136:
137: /*
138: * Local Variables:
139: * tab-width: 2
140: * indent-tabs-mode: nil
141: * mode: java
142: * c-indentation-style: java
143: * c-basic-offset: 2
144: * eval: (c-set-offset 'substatement-open '0)
145: * End:
146: */
|