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: SplitWindowProperties.java,v 1.20 2005/12/04 13:46:04 jesper Exp $
023: package net.infonode.docking.properties;
024:
025: import net.infonode.properties.propertymap.*;
026: import net.infonode.properties.types.BooleanProperty;
027: import net.infonode.properties.types.ColorProperty;
028: import net.infonode.properties.types.IntegerProperty;
029:
030: import java.awt.*;
031:
032: /**
033: * Properties and property values for split windows.
034: *
035: * @author $Author: jesper $
036: * @version $Revision: 1.20 $
037: */
038: public class SplitWindowProperties extends PropertyMapContainer {
039: /**
040: * Property group containing all split window properties.
041: */
042: public static final PropertyMapGroup PROPERTIES = new PropertyMapGroup(
043: "Split Window Properties", "");
044:
045: /**
046: * When enabled causes the windows to change size continuously while dragging the split window divider.
047: *
048: * @since IDW 1.1.0
049: */
050: public static final BooleanProperty CONTINUOUS_LAYOUT_ENABLED = new BooleanProperty(
051: PROPERTIES,
052: "Continuous Layout Enabled",
053: "When enabled causes the windows to change size continuously while dragging the split window divider.",
054: PropertyMapValueHandler.INSTANCE);
055:
056: /**
057: * The split pane divider size.
058: */
059: public static final IntegerProperty DIVIDER_SIZE = IntegerProperty
060: .createPositive(PROPERTIES, "Divider Size",
061: "The split pane divider size.", 2,
062: PropertyMapValueHandler.INSTANCE);
063:
064: /**
065: * When enabled the user can drag the SplitWindow divider to a new location.
066: *
067: * @since IDW 1.2.0
068: */
069: public static final BooleanProperty DIVIDER_LOCATION_DRAG_ENABLED = new BooleanProperty(
070: PROPERTIES,
071: "Divider Location Drag Enabled",
072: "When enabled the user can drag the SplitWindow divider to a new location.",
073: PropertyMapValueHandler.INSTANCE);
074:
075: /**
076: * The split pane drag indicator color.
077: *
078: * @since IDW 1.4.0
079: */
080: public static final ColorProperty DRAG_INDICATOR_COLOR = new ColorProperty(
081: PROPERTIES,
082: "Drag Indicator Color",
083: "The color for the divider's drag indicator that is shown when continuous layout is disabled.",
084: PropertyMapValueHandler.INSTANCE);
085:
086: /**
087: * Creates an empty property object.
088: */
089: public SplitWindowProperties() {
090: super (PropertyMapFactory.create(PROPERTIES));
091: }
092:
093: /**
094: * Creates a property map containing the map.
095: *
096: * @param map the property map
097: */
098: public SplitWindowProperties(PropertyMap map) {
099: super (map);
100: }
101:
102: /**
103: * Creates a property object that inherit values from another property object.
104: *
105: * @param inheritFrom the object from which to inherit property values
106: */
107: public SplitWindowProperties(SplitWindowProperties inheritFrom) {
108: super (PropertyMapFactory.create(inheritFrom.getMap()));
109: }
110:
111: /**
112: * Adds a super object from which property values are inherited.
113: *
114: * @param properties the object from which to inherit property values
115: * @return this
116: */
117: public SplitWindowProperties addSuperObject(
118: SplitWindowProperties properties) {
119: getMap().addSuperMap(properties.getMap());
120: return this ;
121: }
122:
123: /**
124: * Removes the last added super object.
125: *
126: * @return this
127: * @since IDW 1.1.0
128: * @deprecated Use {@link #removeSuperObject(SplitWindowProperties)} instead.
129: */
130: public SplitWindowProperties removeSuperObject() {
131: getMap().removeSuperMap();
132: return this ;
133: }
134:
135: /**
136: * Removes a super object.
137: *
138: * @param superObject the super object to remove
139: * @return this
140: * @since IDW 1.3.0
141: */
142: public SplitWindowProperties removeSuperObject(
143: SplitWindowProperties super Object) {
144: getMap().removeSuperMap(super Object.getMap());
145: return this ;
146: }
147:
148: /**
149: * Sets the split pane divider size.
150: *
151: * @param size the split pane divider size
152: * @return this
153: */
154: public SplitWindowProperties setDividerSize(int size) {
155: DIVIDER_SIZE.set(getMap(), size);
156: return this ;
157: }
158:
159: /**
160: * Returns the split pane divider size.
161: *
162: * @return the split pane divider size
163: */
164: public int getDividerSize() {
165: return DIVIDER_SIZE.get(getMap());
166: }
167:
168: /**
169: * Sets the split pane drag indicator color.
170: *
171: * @param color the color for the drag indicator
172: * @return this
173: * @since IDW 1.4.0
174: */
175: public SplitWindowProperties setDragIndicatorColor(Color color) {
176: DRAG_INDICATOR_COLOR.set(getMap(), color);
177: return this ;
178: }
179:
180: /**
181: * Returns the split pane drag indicator color.
182: *
183: * @return the split pane drag indicator color
184: * @since IDW 1.4.0
185: */
186: public Color getDragIndicatorColor() {
187: return DRAG_INDICATOR_COLOR.get(getMap());
188: }
189:
190: /**
191: * Returns true if continuous layout is enabled.
192: *
193: * @return true if continuous layout is enabled
194: * @since IDW 1.1.0
195: */
196: public boolean getContinuousLayoutEnabled() {
197: return CONTINUOUS_LAYOUT_ENABLED.get(getMap());
198: }
199:
200: /**
201: * Enables/disables continuous layout.
202: *
203: * @param enabled if true continuous layout is enabled
204: * @return this
205: * @since IDW 1.1.0
206: */
207: public SplitWindowProperties setContinuousLayoutEnabled(
208: boolean enabled) {
209: CONTINUOUS_LAYOUT_ENABLED.set(getMap(), enabled);
210: return this ;
211: }
212:
213: /**
214: * Returns true if the user can drag the SplitWindow divider to a new location.
215: *
216: * @return true if the user can drag the SplitWindow divider to a new location
217: * @since IDW 1.2.0
218: */
219: public boolean getDividerLocationDragEnabled() {
220: return DIVIDER_LOCATION_DRAG_ENABLED.get(getMap());
221: }
222:
223: /**
224: * When enabled the user can drag the SplitWindow divider to a new location.
225: *
226: * @param enabled if true the user can drag the SplitWindow divider to a new location
227: * @return this
228: * @since IDW 1.2.0
229: */
230: public SplitWindowProperties setDividerLocationDragEnabled(
231: boolean enabled) {
232: DIVIDER_LOCATION_DRAG_ENABLED.set(getMap(), enabled);
233: return this;
234: }
235:
236: }
|