KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > core > windows > model > Model


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.core.windows.model;
21
22
23 import java.awt.Rectangle JavaDoc;
24 import org.netbeans.core.windows.ModeImpl;
25 import org.netbeans.core.windows.SplitConstraint;
26 import org.netbeans.core.windows.TopComponentGroupImpl;
27 import org.netbeans.core.windows.WindowSystemSnapshot;
28 import org.openide.windows.TopComponent;
29
30 import java.util.Collection JavaDoc;
31 import java.util.List JavaDoc;
32 import java.util.Map JavaDoc;
33 import java.util.Set JavaDoc;
34
35
36 /**
37  * Represents model of this window system implementation.
38  *
39  * @author Peter Zavadsky
40  */

41 public interface Model {
42
43     ////////////////////////////////
44
// Global (the highest) level >>
45
/////////////////////////////
46
// Mutators (global level) >>
47
/** Sets visibility status. */
48     public void setVisible(boolean visible);
49     /** Sets main window bounds when the editor area is in joined(tiled) state. */
50     public void setMainWindowBoundsJoined(Rectangle JavaDoc bounds);
51     /** Sets main window bounds when the editor area is in separated state. */
52     public void setMainWindowBoundsSeparated(Rectangle JavaDoc bounds);
53     /** Sets frame state of main window when editor area is in tiled(joined) state. */
54     public void setMainWindowFrameStateJoined(int frameState);
55     /** Sets frame state of main window when editor area is in separated state. */
56     public void setMainWindowFrameStateSeparated(int frameState);
57     /** Sets editor area state. */
58     public void setEditorAreaState(int editorAreaState);
59     /** Sets editor area frame state when in separate state. */
60     public void setEditorAreaFrameState(int frameState);
61     /** Sets editor area bounds. */
62     public void setEditorAreaBounds(Rectangle JavaDoc editorAreaBounds);
63     /** Sets editor area constraints. */
64     public void setEditorAreaConstraints(SplitConstraint[] editorAreaConstraints);
65     /** Sets toolbar configuration name. */
66     public void setToolbarConfigName(String JavaDoc toolbarConfigName);
67     /** Sets active mode. */
68     public void setActiveMode(ModeImpl mode);
69     /** Sets editor mode that is currenlty maximized */
70     public void setEditorMaximizedMode(ModeImpl maximizedMode);
71     /** Sets view mode that is currenlty maximized */
72     public void setViewMaximizedMode(ModeImpl maximizedMode);
73     /** Adds mode. */
74     public void addMode(ModeImpl mode, SplitConstraint[] constraints);
75     /** Adds mode. */
76     // XXX
77
public void addModeToSide(ModeImpl mode, ModeImpl attachMode, String JavaDoc side);
78     // XXX
79
/** Adds mode around (attaches from side). */
80     public void addModeAround(ModeImpl mode, String JavaDoc side);
81     // XXX
82
/** Adds mode around editor area (attaches from side). */
83     public void addModeAroundEditor(ModeImpl mode, String JavaDoc side);
84     /** Removes mode. */
85     public void removeMode(ModeImpl mode);
86     /** Sets mode constraints. */
87     public void setModeConstraints(ModeImpl mode, SplitConstraint[] constraints);
88     /** Adds top component group. */
89     public void addTopComponentGroup(TopComponentGroupImpl tcGroup);
90     /** Removes top component group. */
91     public void removeTopComponentGroup(TopComponentGroupImpl tcGroup);
92     /** Adds sliding mode into specific side */
93     public void addSlidingMode(ModeImpl mode, String JavaDoc side, Map JavaDoc<String JavaDoc,Integer JavaDoc> slideInSizes);
94     /** Resets the model to an initial state. */
95     public void reset();
96     /** Set the size (width or height of the given TopComponent when it is slided in */
97     public void setSlideInSize(String JavaDoc side, TopComponent tc, int size);
98     /**
99      * Set whether the given TopComponent is maximized when it is slided-in.
100      */

101     public void setTopComponentMaximizedWhenSlidedIn( String JavaDoc tcid, boolean maximized );
102     
103     // Mutators (global level) <<
104
/////////////////////////////
105

106     //////////////////////////////
107
// Accessors (global level) >>
108
/** Gets visibility status. */
109     public boolean isVisible();
110     /** Gets main window bounds for the joined (tiled) editor area state. */
111     public Rectangle JavaDoc getMainWindowBoundsJoined();
112     /** Gets main window bounds for the separated editor area state. */
113     public Rectangle JavaDoc getMainWindowBoundsSeparated();
114     /** Gets frame state of main window when editor area is in tiled(joined) state. */
115     public int getMainWindowFrameStateJoined();
116     /** Gets frame state of main window when editor area is in separated state. */
117     public int getMainWindowFrameStateSeparated();
118     /** Gets main window bounds for separated state (helper initial value). */
119     public Rectangle JavaDoc getMainWindowBoundsSeparatedHelp();
120     /** Gets editor area state. */
121     public int getEditorAreaState();
122     /** Gets editor area frame state when in serparate state. */
123     public int getEditorAreaFrameState();
124     /** Gets editor area bounds. */
125     public Rectangle JavaDoc getEditorAreaBounds();
126     /** Gets editor area bounds for separated state (helper initial value). */
127     public Rectangle JavaDoc getEditorAreaBoundsHelp();
128     /** Gets editor area constraints. */
129     public SplitConstraint[] getEditorAreaConstraints();
130     /** Gets toolbar configuration name. */
131     public String JavaDoc getToolbarConfigName();
132     /** Gets active mode. */
133     public ModeImpl getActiveMode();
134     /** Gets editor maximized mode. */
135     public ModeImpl getEditorMaximizedMode();
136     /** Gets view maximized mode. */
137     public ModeImpl getViewMaximizedMode();
138     /** Gets set of modes. */
139     public Set JavaDoc<ModeImpl> getModes();
140     /** Gets mode constraints. */
141     public SplitConstraint[] getModeConstraints(ModeImpl mode);
142     // XXX
143
/** Gets model element constraints. */
144     public SplitConstraint[] getModelElementConstraints(ModelElement element);
145     /** Gets constraints (its side) for sliding mode */
146     public String JavaDoc getSlidingModeConstraints(ModeImpl mode);
147     /** Gets constraints (its side) for sliding mode */
148     public ModeImpl getSlidingMode(String JavaDoc side);
149     /**
150      * Gets the sizes (width or height) of TopComponents in the given sliding
151      * side, the key in the Map is TopComponent's ID
152      */

153     public Map JavaDoc<String JavaDoc,Integer JavaDoc> getSlideInSizes(String JavaDoc side);
154     /**
155      * @return The docking status (docked/slided) of TopComponents before the window system
156      * switched to maximized mode.
157      */

158     public DockingStatus getDefaultDockingStatus();
159     /**
160      * @return The docking status (docked/slided) of TopComponents in maximized editor mode.
161      */

162     public DockingStatus getMaximizedDockingStatus();
163     /**
164      * Find the side (LEFT/RIGHT/BOTTOM) where the TopComponent from the given
165      * mode should slide to.
166      *
167      * @param mode Mode
168      * @return The slide side for TopComponents from the given mode.
169      */

170     public String JavaDoc getSlideSideForMode( ModeImpl mode );
171     /**
172      * @return True if the given TopComponent is maximized when it is slided-in.
173      */

174     public boolean isTopComponentMaximizedWhenSlidedIn( String JavaDoc tcid );
175
176     // Accessors (global level) >>
177
//////////////////////////////
178
// Global (the highest) level <<
179
////////////////////////////////
180

181     
182     ////////////////
183
// Mode level >>
184
///////////////////////////
185
// Mutators (mode level) >>
186
/** Sets state. */
187     public void setModeState(ModeImpl mode, int state);
188     /** Sets bounds. */
189     public void setModeBounds(ModeImpl mode, Rectangle JavaDoc bounds);
190     /** Sets frame state. */
191     public void setModeFrameState(ModeImpl mode, int frameState);
192     /** Sets selected TopComponent. */
193     public void setModeSelectedTopComponent(ModeImpl mode, TopComponent selected);
194     /** Remember which top component was the selected one before switching to/from maximized mode */
195     public void setModePreviousSelectedTopComponent(ModeImpl mode, TopComponent prevSelected);
196     /** Adds opened TopComponent. */
197     public void addModeOpenedTopComponent(ModeImpl mode, TopComponent tc);
198     /** Inserts opened TopComponent. */
199     public void insertModeOpenedTopComponent(ModeImpl mode, TopComponent tc, int index);
200     /** Adds closed TopComponent. */
201     public void addModeClosedTopComponent(ModeImpl mode, TopComponent tc);
202     // XXX
203
/** Adds unloaded TopComponent. */
204     public void addModeUnloadedTopComponent(ModeImpl mode, String JavaDoc tcID);
205     // XXX
206
public void setModeUnloadedSelectedTopComponent(ModeImpl mode, String JavaDoc tcID);
207     /** Remember which top component was the selected one before switching to/from maximized mode */
208     public void setModeUnloadedPreviousSelectedTopComponent(ModeImpl mode, String JavaDoc tcID);
209     /** */
210     public void removeModeTopComponent(ModeImpl mode, TopComponent tc);
211     // XXX
212
public void removeModeClosedTopComponentID(ModeImpl mode, String JavaDoc tcID);
213
214     // Info about previous top component context, used by sliding kind of modes
215

216     /** Sets information of previous mode top component was in. */
217     public void setModeTopComponentPreviousMode(ModeImpl mode, String JavaDoc tcID, ModeImpl previousMode, int previousIndex);
218     /** Sets information of previous constraints of mode top component was in. */
219     public void setModeTopComponentPreviousConstraints(ModeImpl mode, String JavaDoc tcID, SplitConstraint[] constraints);
220     
221     
222     // Mutators (mode level) <<
223
///////////////////////////
224

225     ////////////////////////////
226
// Accessors (mode level) >>
227
/** Gets programatic name of mode. */
228     public String JavaDoc getModeName(ModeImpl mode);
229     /** Gets bounds. */
230     public Rectangle JavaDoc getModeBounds(ModeImpl mode);
231     /** Gets mode bounds for separated state (helper initial value). */
232     public Rectangle JavaDoc getModeBoundsSeparatedHelp(ModeImpl mode);
233     /** Gets state. */
234     public int getModeState(ModeImpl mode);
235     /** Gets kind. */
236     public int getModeKind(ModeImpl mode);
237     /** Gets side. */
238     public String JavaDoc getModeSide(ModeImpl mode);
239     /** Gets frame state. */
240     public int getModeFrameState(ModeImpl mode);
241     /** Gets whether it is permanent. */
242     public boolean isModePermanent(ModeImpl mode);
243     /** */
244     public boolean isModeEmpty(ModeImpl mode);
245     /** Indicates whether the mode contains the TopComponent. */
246     public boolean containsModeTopComponent(ModeImpl mode, TopComponent tc);
247     /** Gets selected TopComponent. */
248     public TopComponent getModeSelectedTopComponent(ModeImpl mode);
249     /** Get the top component that had been the selected one before switching to/from maximzied mode */
250     public TopComponent getModePreviousSelectedTopComponent(ModeImpl mode);
251     /** Gets list of top components in this workspace. */
252     public List JavaDoc<TopComponent> getModeTopComponents(ModeImpl mode);
253     /** Gets list of top components in this workspace. */
254     public List JavaDoc<TopComponent> getModeOpenedTopComponents(ModeImpl mode);
255     // XXX
256
public List JavaDoc<String JavaDoc> getModeOpenedTopComponentsIDs(ModeImpl mode);
257     public List JavaDoc<String JavaDoc> getModeClosedTopComponentsIDs(ModeImpl mode);
258     public List JavaDoc<String JavaDoc> getModeTopComponentsIDs(ModeImpl mode);
259     
260     // Info about previous top component context, used by sliding kind of modes
261

262     public ModeImpl getModeTopComponentPreviousMode(ModeImpl mode, String JavaDoc tcID);
263     public SplitConstraint[] getModeTopComponentPreviousConstraints(ModeImpl mode, String JavaDoc tcID);
264     /** Gets the tab index of the given top component before it was moved to sliding/separate mode */
265     public int getModeTopComponentPreviousIndex(ModeImpl mode, String JavaDoc tcID);
266     
267     // Accessors (mode level) <<
268
////////////////////////////
269
// Mode level <<
270
////////////////
271

272
273     ///////////////////////////
274
// TopComponentGroup level >>
275
public Set JavaDoc<TopComponentGroupImpl> getTopComponentGroups();
276
277     /** Gets programatic name of goup. */
278     public String JavaDoc getGroupName(TopComponentGroupImpl tcGroup);
279
280     public void openGroup(TopComponentGroupImpl tcGroup,
281             Collection JavaDoc<TopComponent> openedTopComponents,
282             Collection JavaDoc<TopComponent> openedBeforeTopComponenets);
283     public void closeGroup(TopComponentGroupImpl tcGroup);
284     public boolean isGroupOpened(TopComponentGroupImpl tcGroup);
285     
286     public Set JavaDoc<TopComponent> getGroupTopComponents(TopComponentGroupImpl tcGroup);
287     
288     public Set JavaDoc<TopComponent> getGroupOpenedTopComponents(TopComponentGroupImpl tcGroup);
289     public Set JavaDoc<TopComponent> getGroupOpenedBeforeTopComponents(TopComponentGroupImpl tcGroup);
290     
291     public Set JavaDoc<TopComponent> getGroupOpeningTopComponents(TopComponentGroupImpl tcGroup);
292     public Set JavaDoc<TopComponent> getGroupClosingTopComponents(TopComponentGroupImpl tcGroup);
293
294     public boolean addGroupUnloadedTopComponent(TopComponentGroupImpl tcGroup, String JavaDoc tcID);
295     public boolean removeGroupUnloadedTopComponent(TopComponentGroupImpl tcGroup, String JavaDoc tcID);
296     
297     public boolean addGroupOpeningTopComponent(TopComponentGroupImpl tcGroup, TopComponent tc);
298     public boolean removeGroupOpeningTopComponent(TopComponentGroupImpl tcGroup, TopComponent tc);
299
300     public boolean addGroupUnloadedOpeningTopComponent(TopComponentGroupImpl tcGroup, String JavaDoc tcID);
301     public boolean removeGroupUnloadedOpeningTopComponent(TopComponentGroupImpl tcGroup, String JavaDoc tcID);
302     
303     public boolean addGroupUnloadedClosingTopComponent(TopComponentGroupImpl tcGroup, String JavaDoc tcID);
304     public boolean removeGroupUnloadedClosingTopComponent(TopComponentGroupImpl tcGroup, String JavaDoc tcID);
305     
306     // XXX
307
public boolean addGroupUnloadedOpenedTopComponent(TopComponentGroupImpl tcGroup, String JavaDoc tcID);
308     
309     // XXX>>
310
public Set JavaDoc<String JavaDoc> getGroupTopComponentsIDs(TopComponentGroupImpl tcGroup);
311     public Set JavaDoc<String JavaDoc> getGroupOpeningSetIDs(TopComponentGroupImpl tcGroup);
312     public Set JavaDoc<String JavaDoc> getGroupClosingSetIDs(TopComponentGroupImpl tcGroup);
313     public Set JavaDoc<String JavaDoc> getGroupOpenedTopComponentsIDs(TopComponentGroupImpl tcGroup);
314     // XXX<<
315
// TopComponentGroup level <<
316
///////////////////////////
317

318     //////////////////////////////////////
319
// Other methods, creating sub-models.
320
/** Creates mode sub model. */
321     public void createModeModel(ModeImpl mode, String JavaDoc name, int state, int kind, boolean permanent);
322     /** Creates top component group subg model. */
323     public void createGroupModel(TopComponentGroupImpl tcGroup, String JavaDoc name, boolean opened);
324
325     /////////////////////////
326
// snapshot
327
public WindowSystemSnapshot createWindowSystemSnapshot();
328
329     
330     ////////////////////////
331
// controller updates >>
332
// Helper values.
333
public void setMainWindowBoundsUserSeparatedHelp(Rectangle JavaDoc bounds);
334     public void setEditorAreaBoundsUserHelp(Rectangle JavaDoc bounds);
335     public void setModeBoundsSeparatedHelp(ModeImpl mode, Rectangle JavaDoc bounds);
336     
337     public void setSplitWeights( ModelElement[] snapshots, double[] splitWeights );
338     // controller updates <<
339
////////////////////////
340

341     
342 }
343
344
Popular Tags