1 /*
2 * Copyright 2006-2016 The JGUIraffe Team.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License")
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package net.sf.jguiraffe.gui.builder.window;
17
18 import net.sf.jguiraffe.gui.builder.components.ComponentBuilderData;
19
20 /**
21 * <p>
22 * Definition of an interface for providing (platform-independent) information
23 * about a window to be created.
24 * </p>
25 * <p>
26 * This interface is used in communication with the {@link WindowManager}
27 * implementation. The methods it defines can be called to extract all
28 * information necessary for creating a new window object. Usually an
29 * implementation of this interface is created and initialized by tag handler
30 * classes of the window builder tag library.
31 * </p>
32 *
33 * @author Oliver Heger
34 * @version $Id: WindowData.java 205 2012-01-29 18:29:57Z oheger $
35 */
36 public interface WindowData
37 {
38 /** Constant for an undefined coordinate or size information. */
39 int UNDEFINED = -1;
40
41 /**
42 * Returns the X position of the new window.
43 *
44 * @return the window's X position or <code>UNDEFINED</code> if this is
45 * not defined
46 */
47 int getXPos();
48
49 /**
50 * Returns the Y position of the new window.
51 *
52 * @return the window's Y position or <code>UNDEFINED</code> if this is
53 * not defined
54 */
55 int getYPos();
56
57 /**
58 * Returns the width of the new window.
59 *
60 * @return the window's width or <code>UNDEFINED</code> if this is not
61 * defined
62 */
63 int getWidth();
64
65 /**
66 * Returns the height of the new window.
67 *
68 * @return the window's height or <code>UNDEFINED</code> if this is not
69 * defined
70 */
71 int getHeight();
72
73 /**
74 * Returns a flag whether the new window should be centered on the screen.
75 * If this flag is set, eventually set X and Y coordinates are ignored, and
76 * the window manager will itself determine appropriate coordinates.
77 *
78 * @return the center flag
79 */
80 boolean isCenter();
81
82 /**
83 * Returns the window's title.
84 *
85 * @return the window's title
86 */
87 String getTitle();
88
89 /**
90 * Returns an icon for the new window.
91 *
92 * @return the window's icon (can be <b>null</b>)
93 */
94 Object getIcon();
95
96 /**
97 * Returns a flag whether the new window should be resizable.
98 *
99 * @return the resizable flag
100 */
101 boolean isResizable();
102
103 /**
104 * Returns a flag whether the new window should be maximizable. Note that
105 * this flag might not be supported for all platforms and window types.
106 *
107 * @return the maximizable flag
108 */
109 boolean isMaximizable();
110
111 /**
112 * Returns a flag whether the new window should be iconifiable. Note that
113 * this flag might not be supported for all platforms and window types.
114 *
115 * @return the iconifiable flag
116 */
117 boolean isIconifiable();
118
119 /**
120 * Returns a flag whether the new window should have a close icon. If set to
121 * <b>false</b>, the user can not close the window directly. Note that this
122 * flag might not be supported for all platforms and window types.
123 *
124 * @return the closable flag
125 */
126 boolean isClosable();
127
128 /**
129 * Returns a flag whether auto-close is active for the new window. If set to
130 * <b>true</b>, the window should automatically close itself when the user
131 * clicks the closing icon. Otherwise, the developer has to handle the close
132 * operation manually.
133 *
134 * @return the auto-close flag
135 */
136 boolean isAutoClose();
137
138 /**
139 * Returns a flag whether the window should close itself if the user presses
140 * the {@code ESCAPE} key. This is especially useful for dialog windows.
141 *
142 * @return a flag whether the {@code ESCAPE} key should close the window
143 */
144 boolean isCloseOnEsc();
145
146 /**
147 * Returns the menu bar for the new window. The object returned by this
148 * method must be compatible with the platform specific window manager
149 * implementation, i.e. must represent a valid menu bar for this platform.
150 * This should be the case if it was constructed by the action builder
151 * library.
152 *
153 * @return the window's menu bar (can be <b>null</b> if the window does not
154 * have a menu bar)
155 */
156 Object getMenuBar();
157
158 /**
159 * Returns the new window's controller. This object is not really evaluated
160 * by the window manager, but should be passed to the platform specific
161 * implementation of the <code>Window</code> interface, so that the
162 * window's controller can be queried by application code.
163 *
164 * @return the window's controller object (can be <b>null</b>)
165 */
166 Object getController();
167
168 /**
169 * Returns the current {@code ComponentBuilderData} object. This object can
170 * be queried by a {@link WindowManager} implementation to obtain context
171 * information needed for the creation of a window.
172 *
173 * @return the current {@code ComponentBuilderData} object
174 */
175 ComponentBuilderData getComponentBuilderData();
176 }