KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > api > gui > frame > IContainer


1 // The contents of this file are subject to the Mozilla Public License Version
2
// 1.1
3
//(the "License"); you may not use this file except in compliance with the
4
//License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
5
//
6
//Software distributed under the License is distributed on an "AS IS" basis,
7
//WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
8
//for the specific language governing rights and
9
//limitations under the License.
10
//
11
//The Original Code is "The Columba Project"
12
//
13
//The Initial Developers of the Original Code are Frederik Dietz and Timo
14
// Stich.
15
//Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
16
//
17
//All Rights Reserved.
18
package org.columba.api.gui.frame;
19
20 import java.io.InputStream JavaDoc;
21
22 import javax.swing.JComponent JavaDoc;
23 import javax.swing.JFrame JavaDoc;
24 import javax.swing.JMenuBar JavaDoc;
25 import javax.swing.JPanel JavaDoc;
26 import javax.swing.JToolBar JavaDoc;
27
28 import org.columba.api.statusbar.IStatusBar;
29
30 /**
31  * A container is actually a JFrame, which encapsulates a component called
32  * {@link IFrameMediator}in our case.
33  * <p>
34  * The basic default container is a JFrame, with a core menu, toolbar and
35  * statusbar. Additionally, it has a content pane in the center.
36  * <p>
37  * FrameMeditator extends the menu and toolbar. It also places its main ui
38  * components in the content pane.
39  *
40  * @author fdietz
41  */

42 public interface IContainer {
43
44     /**
45      * internally used toolbar ID
46      */

47     public static final String JavaDoc MAIN_TOOLBAR = "main";
48
49     /**
50      * Set new framemediator this container should encapsulate.
51      *
52      * @param m
53      * new framemediator
54      */

55     void setFrameMediator(IFrameMediator m);
56
57     /**
58      * Switch to new framemediator. This also ensures that the menu, toolbar,
59      * infobar, etc. get also replaced correctly.
60      *
61      *
62      * @param m
63      * new framemediator
64      */

65     void switchFrameMediator(IFrameMediator m);
66
67     /**
68      * Get current framemediator this container encapsulates.
69      *
70      * @return current container
71      */

72     IFrameMediator getFrameMediator();
73
74     /**
75      * Get statusbar.
76      *
77      * @return current statusbar
78      */

79     public IStatusBar getStatusBar();
80
81     /**
82      * Show/Hide toolbar.
83      *
84      * @param id
85      * id of toolbar
86      * @param enable
87      * if true, show toolbar. Otherwise, hide toolbar.
88      */

89     public void enableToolBar(String JavaDoc id, boolean enable);
90
91     /**
92      * Check if toolbar is visible.
93      *
94      * @param id
95      * id of toolbar
96      * @return true, if visible. False, otherwise.
97      */

98     public boolean isToolBarEnabled(String JavaDoc id);
99
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 JavaDoc c);
108
109     /**
110      * Set toolbar of this container.
111      *
112      * @param toolbar
113      * new toolbar
114      */

115     void setToolBar(JToolBar JavaDoc toolbar);
116
117     /**
118      * @return
119      */

120     JToolBar JavaDoc 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 JavaDoc 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 JavaDoc 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 JavaDoc getJMenuBar();
164
165     /**
166      * Set the menubar of this container.
167      *
168      * @param menuBar
169      * new menubar
170      */

171     void setJMenuBar(JMenuBar JavaDoc 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 JavaDoc 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 JavaDoc is);
192
193     /**
194      * Sets the window name which is displayed in the title.
195      *
196      * @param name
197      */

198     void setWindowName(String JavaDoc 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 }
Popular Tags