001: /*
002: * Copyright (C) 2004 NNL Technology AB
003: * Visit www.infonode.net for information about InfoNode(R)
004: * products and how to contact NNL Technology AB.
005: *
006: * This program is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU General Public License
008: * as published by the Free Software Foundation; either version 2
009: * of the License, or (at your option) any later version.
010: *
011: * This program is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014: * GNU General Public License for more details.
015: *
016: * You should have received a copy of the GNU General Public License
017: * along with this program; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
019: * MA 02111-1307, USA.
020: */
021:
022: // $Id: DockingWindowProperties.java,v 1.25 2005/12/04 13:46:04 jesper Exp $
023: package net.infonode.docking.properties;
024:
025: import net.infonode.docking.title.DockingWindowTitleProvider;
026: import net.infonode.docking.title.DockingWindowTitleProviderProperty;
027: import net.infonode.properties.propertymap.*;
028: import net.infonode.properties.types.BooleanProperty;
029:
030: /**
031: * Properties and property values common for all docking windows.
032: *
033: * @author $Author: jesper $
034: * @version $Revision: 1.25 $
035: */
036: public class DockingWindowProperties extends PropertyMapContainer {
037: /**
038: * Property group containing all docking window properties.
039: */
040: public static final PropertyMapGroup PROPERTIES = new PropertyMapGroup(
041: "Docking Window Properties", "");
042:
043: /**
044: * Property values for the window tab when the window is located in a TabWindow or a WindowBar.
045: */
046: public static final PropertyMapProperty TAB_PROPERTIES = new PropertyMapProperty(
047: PROPERTIES,
048: "Tab Properties",
049: "Property values for the window tab when the window is located in a TabWindow or a WindowBar.",
050: WindowTabProperties.PROPERTIES);
051:
052: /**
053: * Property values for drop filters.
054: *
055: * @since IDW 1.4.0
056: */
057: public static final PropertyMapProperty DROP_FILTER_PROPERTIES = new PropertyMapProperty(
058: PROPERTIES, "Drop Filter Properties",
059: "Property values for drop filters.",
060: DockingWindowDropFilterProperties.PROPERTIES);
061:
062: /**
063: * Enables/disables window drag by the user.
064: *
065: * @since IDW 1.2.0
066: */
067: public static final BooleanProperty DRAG_ENABLED = new BooleanProperty(
068: PROPERTIES, "Drag Enabled",
069: "Enables/disables window drag by the user.",
070: PropertyMapValueHandler.INSTANCE);
071:
072: /**
073: * Enables/disables undock to a floating window.
074: *
075: * @since IDW 1.4.0
076: */
077: public static final BooleanProperty UNDOCK_ENABLED = new BooleanProperty(
078: PROPERTIES,
079: "Undock Enabled",
080: "Enables/disables if a window can be undocked to a floating window.",
081: PropertyMapValueHandler.INSTANCE);
082: /**
083: * <p>
084: * Enables/disables undock when dropped outside root window.
085: * </p>
086: *
087: * <p>
088: * <strong>Note:</strong> This property will only have effect if window drag is enabled and undocking is enabled.
089: * </p>
090: *
091: * @since IDW 1.4.0
092: */
093: public static final BooleanProperty UNDOCK_ON_DROP = new BooleanProperty(
094: PROPERTIES,
095: "Undock when Dropped",
096: "Enables/disables window undock to floating window when a drag and drop is performed outside the root window.",
097: PropertyMapValueHandler.INSTANCE);
098:
099: /**
100: * Enables/disables undock to a floating window.
101: *
102: * @since IDW 1.4.0
103: */
104: public static final BooleanProperty DOCK_ENABLED = new BooleanProperty(
105: PROPERTIES,
106: "Dock Enabled",
107: "Enables/disables if a window can be docked to the root window from a floating window.",
108: PropertyMapValueHandler.INSTANCE);
109:
110: /**
111: * Enables/disables window minimize by the user.
112: *
113: * @since IDW 1.2.0
114: */
115: public static final BooleanProperty MINIMIZE_ENABLED = new BooleanProperty(
116: PROPERTIES, "Minimize Enabled",
117: "Enables/disables window minimize by the user.",
118: PropertyMapValueHandler.INSTANCE);
119:
120: /**
121: * Enables/disables window close by the user.
122: *
123: * @since IDW 1.2.0
124: */
125: public static final BooleanProperty CLOSE_ENABLED = new BooleanProperty(
126: PROPERTIES, "Close Enabled",
127: "Enables/disables window close by the user.",
128: PropertyMapValueHandler.INSTANCE);
129:
130: /**
131: * Enables/disables window restore by the user.
132: *
133: * @since IDW 1.2.0
134: */
135: public static final BooleanProperty RESTORE_ENABLED = new BooleanProperty(
136: PROPERTIES, "Restore Enabled",
137: "Enables/disables window restore by the user.",
138: PropertyMapValueHandler.INSTANCE);
139:
140: /**
141: * Enables/disables window maximize by the user.
142: *
143: * @since IDW 1.2.0
144: */
145: public static final BooleanProperty MAXIMIZE_ENABLED = new BooleanProperty(
146: PROPERTIES, "Maximize Enabled",
147: "Enables/disables window maximize by the user.",
148: PropertyMapValueHandler.INSTANCE);
149:
150: /**
151: * Provides a title for a window.
152: *
153: * @since IDW 1.3.0
154: */
155: public static final DockingWindowTitleProviderProperty TITLE_PROVIDER = new DockingWindowTitleProviderProperty(
156: PROPERTIES, "Title Provider",
157: "Provides a title for a window.",
158: PropertyMapValueHandler.INSTANCE);
159:
160: /**
161: * Creates an empty property object.
162: */
163: public DockingWindowProperties() {
164: super (PropertyMapFactory.create(PROPERTIES));
165: }
166:
167: /**
168: * Creates a property map containing the map.
169: *
170: * @param map the property map
171: */
172: public DockingWindowProperties(PropertyMap map) {
173: super (map);
174: }
175:
176: /**
177: * Creates a property object that inherit values from another property object.
178: *
179: * @param inheritFrom the object from which to inherit property values
180: */
181: public DockingWindowProperties(DockingWindowProperties inheritFrom) {
182: super (PropertyMapFactory.create(inheritFrom.getMap()));
183: }
184:
185: /**
186: * Adds a super object from which property values are inherited.
187: *
188: * @param properties the object from which to inherit property values
189: * @return this
190: */
191: public DockingWindowProperties addSuperObject(
192: DockingWindowProperties properties) {
193: getMap().addSuperMap(properties.getMap());
194: return this ;
195: }
196:
197: /**
198: * Removes the last added super object.
199: *
200: * @return this
201: * @since IDW 1.1.0
202: * @deprecated Use {@link #removeSuperObject(DockingWindowProperties)} instead.
203: */
204: public DockingWindowProperties removeSuperObject() {
205: getMap().removeSuperMap();
206: return this ;
207: }
208:
209: /**
210: * Removes a super object.
211: *
212: * @param superObject the super object to remove
213: * @return this
214: * @since IDW 1.3.0
215: */
216: public DockingWindowProperties removeSuperObject(
217: DockingWindowProperties super Object) {
218: getMap().removeSuperMap(super Object.getMap());
219: return this ;
220: }
221:
222: /**
223: * Returns the property values for the window tab when the window is located in a TabWindow or a WindowBar.
224: *
225: * @return the property values for the window tab when the window is located in a TabWindow or a WindowBar
226: */
227: public WindowTabProperties getTabProperties() {
228: return new WindowTabProperties(TAB_PROPERTIES.get(getMap()));
229: }
230:
231: /**
232: * Returns the property values for drop filters.
233: *
234: * @return the property values for drop filters
235: * @since IDW 1.4.0
236: */
237: public DockingWindowDropFilterProperties getDropFilterProperties() {
238: return new DockingWindowDropFilterProperties(
239: DROP_FILTER_PROPERTIES.get(getMap()));
240: }
241:
242: /**
243: * Returns true if the window drag by the user is enabled.
244: *
245: * @return true if the window drag is enabled
246: * @since IDW 1.2.0
247: */
248: public boolean getDragEnabled() {
249: return DRAG_ENABLED.get(getMap());
250: }
251:
252: /**
253: * Enables/disables window drag by the user.
254: *
255: * @param enabled if true, drag is enabled, otherwise it's disabled
256: * @return this
257: * @since IDW 1.2.0
258: */
259: public DockingWindowProperties setDragEnabled(boolean enabled) {
260: DRAG_ENABLED.set(getMap(), enabled);
261: return this ;
262: }
263:
264: /**
265: * Returns true if the window can be undocked to a floating window.
266: *
267: * @return true if undocking is enabled
268: * @since IDW 1.4.0
269: */
270: public boolean getUndockEnabled() {
271: return UNDOCK_ENABLED.get(getMap());
272: }
273:
274: /**
275: * Enables/disables undock to floating window.
276: *
277: * @param enabled if true, a window can be undocked to a floating window,
278: * otherwise it's disabled
279: * @return this
280: * @since IDW 1.4.0
281: */
282: public DockingWindowProperties setUndockEnabled(boolean enabled) {
283: UNDOCK_ENABLED.set(getMap(), enabled);
284: return this ;
285: }
286:
287: /**
288: * <p>
289: * Returns true if the window drag by the user and is dropped outside the root window should undock to a floating
290: * window.
291: * </p>
292: *
293: * <p>
294: * <strong>Note:</strong> This property will only have effect if drag is enabled.
295: * </p>
296: *
297: * @return true if the dropped window should undock to a floating window
298: * @since IDW 1.4.0
299: */
300: public boolean getUndockOnDropEnabled() {
301: return UNDOCK_ON_DROP.get(getMap());
302: }
303:
304: /**
305: * <p>
306: * Enables/disables if the window drag by the user and is dropped outside the root window should undock to a floating
307: * window or not.
308: * </p>
309: *
310: * <p>
311: * <strong>Note:</strong> This property will only have effect if drag is enabled.
312: * </p>
313: *
314: * @param enabled if true, drop to floating window is enabled, otherwise it's disabled
315: * @return this
316: * @since IDW 1.4.0
317: */
318: public DockingWindowProperties setUndockOnDropEnabled(
319: boolean enabled) {
320: UNDOCK_ON_DROP.set(getMap(), enabled);
321: return this ;
322: }
323:
324: /**
325: * Returns true if the window can be docked to the root window from a floating window.
326: *
327: * @return true if docking is enabled
328: * @since IDW 1.4.0
329: */
330: public boolean getDockEnabled() {
331: return DOCK_ENABLED.get(getMap());
332: }
333:
334: /**
335: * Enables/disables dock to the root window from a floating window.
336: *
337: * @param enabled if true, a window can be docked to the root window from a floating window,
338: * otherwise it's disabled
339: * @return this
340: * @since IDW 1.4.0
341: */
342: public DockingWindowProperties setDockEnabled(boolean enabled) {
343: DOCK_ENABLED.set(getMap(), enabled);
344: return this ;
345: }
346:
347: /**
348: * Returns true if the window minimize by the user is enabled.
349: *
350: * @return true if the window minimize is enabled
351: * @since IDW 1.2.0
352: */
353: public boolean getMinimizeEnabled() {
354: return MINIMIZE_ENABLED.get(getMap());
355: }
356:
357: /**
358: * Enables/disables window minimize by the user.
359: *
360: * @param enabled if true, minimize is enabled, otherwise it's disabled
361: * @return this
362: * @since IDW 1.2.0
363: */
364: public DockingWindowProperties setMinimizeEnabled(boolean enabled) {
365: MINIMIZE_ENABLED.set(getMap(), enabled);
366: return this ;
367: }
368:
369: /**
370: * Returns true if the window maximize by the user is enabled.
371: *
372: * @return true if the window maximize is enabled
373: * @since IDW 1.2.0
374: */
375: public boolean getMaximizeEnabled() {
376: return MAXIMIZE_ENABLED.get(getMap());
377: }
378:
379: /**
380: * Enables/disables window maximize by the user.
381: *
382: * @param enabled if true, maximize is enabled, otherwise it's disabled
383: * @return this
384: * @since IDW 1.2.0
385: */
386: public DockingWindowProperties setMaximizeEnabled(boolean enabled) {
387: MAXIMIZE_ENABLED.set(getMap(), enabled);
388: return this ;
389: }
390:
391: /**
392: * Returns true if the window close by the user is enabled.
393: *
394: * @return true if the window close is enabled
395: * @since IDW 1.2.0
396: */
397: public boolean getCloseEnabled() {
398: return CLOSE_ENABLED.get(getMap());
399: }
400:
401: /**
402: * Enables/disables window close by the user.
403: *
404: * @param enabled if true, close is enabled, otherwise it's disabled
405: * @return this
406: * @since IDW 1.2.0
407: */
408: public DockingWindowProperties setCloseEnabled(boolean enabled) {
409: CLOSE_ENABLED.set(getMap(), enabled);
410: return this ;
411: }
412:
413: /**
414: * Returns true if the window restore by the user is enabled.
415: *
416: * @return true if the window restore is enabled
417: * @since IDW 1.2.0
418: */
419: public boolean getRestoreEnabled() {
420: return RESTORE_ENABLED.get(getMap());
421: }
422:
423: /**
424: * Enables/disables window restore by the user.
425: *
426: * @param enabled if true, restore is enabled, otherwise it's disabled
427: * @return this
428: * @since IDW 1.2.0
429: */
430: public DockingWindowProperties setRestoreEnabled(boolean enabled) {
431: RESTORE_ENABLED.set(getMap(), enabled);
432: return this ;
433: }
434:
435: /**
436: * Returns the title provider for the window.
437: *
438: * @return the title provider for the window
439: * @since IDW 1.3.0
440: */
441: public DockingWindowTitleProvider getTitleProvider() {
442: return TITLE_PROVIDER.get(getMap());
443: }
444:
445: /**
446: * Sets the title provider for the window.
447: *
448: * @param titleProvider the title provider for the window
449: * @since IDW 1.3.0
450: */
451: public DockingWindowProperties setTitleProvider(
452: DockingWindowTitleProvider titleProvider) {
453: TITLE_PROVIDER.set(getMap(), titleProvider);
454: return this;
455: }
456:
457: }
|