001: // The contents of this file are subject to the Mozilla Public License Version
002: // 1.1
003: //(the "License"); you may not use this file except in compliance with the
004: //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
005: //
006: //Software distributed under the License is distributed on an "AS IS" basis,
007: //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
008: //for the specific language governing rights and
009: //limitations under the License.
010: //
011: //The Original Code is "The Columba Project"
012: //
013: //The Initial Developers of the Original Code are Frederik Dietz and Timo
014: // Stich.
015: //Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
016: //
017: //All Rights Reserved.
018: package org.columba.api.gui.frame;
019:
020: import java.io.InputStream;
021:
022: import javax.swing.JComponent;
023: import javax.swing.JFrame;
024: import javax.swing.JMenuBar;
025: import javax.swing.JPanel;
026: import javax.swing.JToolBar;
027:
028: import org.columba.api.statusbar.IStatusBar;
029:
030: /**
031: * A container is actually a JFrame, which encapsulates a component called
032: * {@link IFrameMediator}in our case.
033: * <p>
034: * The basic default container is a JFrame, with a core menu, toolbar and
035: * statusbar. Additionally, it has a content pane in the center.
036: * <p>
037: * FrameMeditator extends the menu and toolbar. It also places its main ui
038: * components in the content pane.
039: *
040: * @author fdietz
041: */
042: public interface IContainer {
043:
044: /**
045: * internally used toolbar ID
046: */
047: public static final String MAIN_TOOLBAR = "main";
048:
049: /**
050: * Set new framemediator this container should encapsulate.
051: *
052: * @param m
053: * new framemediator
054: */
055: void setFrameMediator(IFrameMediator m);
056:
057: /**
058: * Switch to new framemediator. This also ensures that the menu, toolbar,
059: * infobar, etc. get also replaced correctly.
060: *
061: *
062: * @param m
063: * new framemediator
064: */
065: void switchFrameMediator(IFrameMediator m);
066:
067: /**
068: * Get current framemediator this container encapsulates.
069: *
070: * @return current container
071: */
072: IFrameMediator getFrameMediator();
073:
074: /**
075: * Get statusbar.
076: *
077: * @return current statusbar
078: */
079: public IStatusBar getStatusBar();
080:
081: /**
082: * Show/Hide toolbar.
083: *
084: * @param id
085: * id of toolbar
086: * @param enable
087: * if true, show toolbar. Otherwise, hide toolbar.
088: */
089: public void enableToolBar(String id, boolean enable);
090:
091: /**
092: * Check if toolbar is visible.
093: *
094: * @param id
095: * id of toolbar
096: * @return true, if visible. False, otherwise.
097: */
098: public boolean isToolBarEnabled(String id);
099:
100: /**
101: * Add another toolbar to this container. These are simply JComponent
102: * objects which are appended vertically currently.
103: *
104: * @param c
105: * new toolbar-like component
106: */
107: public void addToolBar(JComponent c);
108:
109: /**
110: * Set toolbar of this container.
111: *
112: * @param toolbar
113: * new toolbar
114: */
115: void setToolBar(JToolBar toolbar);
116:
117: /**
118: * @return
119: */
120: JToolBar getToolBar();
121:
122: /**
123: * Save window properties and close the window. This includes telling the
124: * frame model that this window/frame is closing, so it can be
125: * "unregistered" correctly
126: */
127: public void close();
128:
129: /**
130: * Set the content pane of this component. This is the center of the JFrame,
131: * right between the menu/toolbar and statusbar.
132: *
133: * @param view
134: * new content pane
135: */
136: void setContentPane(JPanel view);
137:
138: /**
139: * Get current swing JFrame. This could become handy when directly accessing
140: * JFrame functionality. For example, you don't want to use Columba's menu
141: * or toolbar framework.
142: *
143: * @return swing JFrame
144: */
145: JFrame getFrame();
146:
147: /**
148: * Get the current menu. Note, that this is Columba's xml-based JMenuBar
149: * extension.
150: * <p>
151: * This method is only added for convinience. If we would use getJMenuBar()
152: * instead, we would always have to check if its really an instance of
153: * ColumbaMenu.
154: *
155: * @return current menu
156: */
157: //
158: /**
159: * Get the menubar of this container.
160: *
161: * @return current menubar
162: */
163: JMenuBar getJMenuBar();
164:
165: /**
166: * Set the menubar of this container.
167: *
168: * @param menuBar
169: * new menubar
170: */
171: void setJMenuBar(JMenuBar menuBar);
172:
173: /**
174: * Extend current Columba menu from xml file.
175: *
176: * @param mediator
177: * current framemediator
178: * @param fileUrl
179: * path to xml file
180: */
181: void extendMenu(IFrameMediator mediator, InputStream is);
182:
183: /**
184: * Extend current toolbar from xml element.
185: *
186: * @param mediator
187: * current framemediator
188: * @param is
189: * xml element
190: */
191: void extendToolbar(IFrameMediator mediator, InputStream is);
192:
193: /**
194: * Sets the window name which is displayed in the title.
195: *
196: * @param name
197: */
198: void setWindowName(String name);
199:
200: /**
201: * Window closing action
202: *
203: * @param close
204: * if true, close window. Otherwise, don't close window
205: * automatically.
206: */
207: void setCloseOperation(boolean close);
208:
209: }
|