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: FloatingWindowProperties.java,v 1.6 2007/01/07 19:11:20 jesper Exp $
023: package net.infonode.docking.properties;
024:
025: import net.infonode.properties.gui.util.ComponentProperties;
026: import net.infonode.properties.gui.util.ShapedPanelProperties;
027: import net.infonode.properties.propertymap.*;
028: import net.infonode.properties.types.BooleanProperty;
029:
030: /**
031: * Properties and property values for floating windows.
032: *
033: * @author $Author: jesper $
034: * @since IDW 1.4.0
035: */
036: public class FloatingWindowProperties extends PropertyMapContainer {
037: /**
038: * Property group containing all floating window properties.
039: */
040: public static final PropertyMapGroup PROPERTIES = new PropertyMapGroup(
041: "Floating Window Properties", "");
042:
043: /**
044: * Properties for the component
045: *
046: * @see #getComponentProperties
047: */
048: public static final PropertyMapProperty COMPONENT_PROPERTIES = new PropertyMapProperty(
049: PROPERTIES, "Component Properties",
050: "Component properties for floating window.",
051: ComponentProperties.PROPERTIES);
052:
053: /**
054: * Properties for the shaped panel
055: *
056: * @see #getShapedPanelProperties
057: */
058: public static final PropertyMapProperty SHAPED_PANEL_PROPERTIES = new PropertyMapProperty(
059: PROPERTIES, "Shaped Panel Properties",
060: "Properties for floating window internal shape.",
061: ShapedPanelProperties.PROPERTIES);
062:
063: /**
064: * Auto close enabled
065: */
066: public static final BooleanProperty AUTO_CLOSE_ENABLED = new BooleanProperty(
067: PROPERTIES,
068: "Auto Close Enabled",
069: "Enables/disables if the floating window should be automatically closed when it doesn't contain any child window.",
070: PropertyMapValueHandler.INSTANCE);
071:
072: /**
073: * If true the floating window will be created as a JFrame, otherwise a JDialog will be created.
074: * Note that the value of this property only takes effect when the FloatingWindow is created, it doesn't affect
075: * existing FloatingWindows (but this might change in future versions).
076: *
077: * @since IDW 1.5.0
078: */
079: public static final BooleanProperty USE_FRAME = new BooleanProperty(
080: PROPERTIES,
081: "Use Frame",
082: "If true the floating window will be created as a JFrame, otherwise a JDialog will be created.",
083: PropertyMapValueHandler.INSTANCE);
084:
085: /**
086: * Creates an empty property object.
087: */
088: public FloatingWindowProperties() {
089: super (PropertyMapFactory.create(PROPERTIES));
090: }
091:
092: /**
093: * Creates a property map containing the map.
094: *
095: * @param map the property map
096: */
097: public FloatingWindowProperties(PropertyMap map) {
098: super (map);
099: }
100:
101: /**
102: * Creates a property object that inherit values from another property object.
103: *
104: * @param inheritFrom the object from which to inherit property values
105: */
106: public FloatingWindowProperties(FloatingWindowProperties inheritFrom) {
107: super (PropertyMapFactory.create(inheritFrom.getMap()));
108: }
109:
110: /**
111: * Adds a super object from which property values are inherited.
112: *
113: * @param properties the object from which to inherit property values
114: * @return this
115: */
116: public FloatingWindowProperties addSuperObject(
117: FloatingWindowProperties properties) {
118: getMap().addSuperMap(properties.getMap());
119: return this ;
120: }
121:
122: /**
123: * Removes a super object.
124: *
125: * @param superObject the super object to remove
126: * @return this
127: */
128: public FloatingWindowProperties removeSuperObject(
129: FloatingWindowProperties super Object) {
130: getMap().removeSuperMap(super Object.getMap());
131: return this ;
132: }
133:
134: /**
135: * Gets the component properties
136: *
137: * @return component properties
138: */
139: public ComponentProperties getComponentProperties() {
140: return new ComponentProperties(COMPONENT_PROPERTIES
141: .get(getMap()));
142: }
143:
144: /**
145: * Gets the shaped panel properties
146: *
147: * @return shaped panel properties
148: */
149: public ShapedPanelProperties getShapedPanelProperties() {
150: return new ShapedPanelProperties(SHAPED_PANEL_PROPERTIES
151: .get(getMap()));
152: }
153:
154: /**
155: * Returns true if the floating window should be automatically closed when it doesn't
156: * contain any child window.
157: *
158: * @return true if auto close is enabled, otherwise false
159: */
160: public boolean getAutoCloseEnabled() {
161: return AUTO_CLOSE_ENABLED.get(getMap());
162: }
163:
164: /**
165: * Enables/disables if the floating window should be automatically closed when it doesn't contain
166: * any child window.
167: *
168: * @param enabled true for auto close, otherwise disabled
169: * @return this
170: */
171: public FloatingWindowProperties setAutoCloseEnabled(boolean enabled) {
172: AUTO_CLOSE_ENABLED.set(getMap(), enabled);
173: return this ;
174: }
175:
176: /**
177: * Returns true if the floating window should be created as a JFrame, otherwise a JDialog is used.
178: *
179: * @return true if a JFrame should be used
180: * @since IDW 1.5.0
181: */
182: public boolean getUseFrame() {
183: return USE_FRAME.get(getMap());
184: }
185:
186: /**
187: * Set to true if the floating window should be created as a JFrame, otherwise a JDialog is used.
188: * Note that the value of this property only takes effect when the FloatingWindow is created, it doesn't affect
189: * existing FloatingWindows (but this might change in future versions).
190: *
191: * @param enabled true if a JFrame should be used
192: * @return this
193: * @since IDW 1.5.0
194: */
195: public FloatingWindowProperties setUseFrame(boolean enabled) {
196: USE_FRAME.set(getMap(), enabled);
197: return this;
198: }
199: }
|