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: TabAreaProperties.java,v 1.28 2005/12/04 13:46:05 jesper Exp $
023: package net.infonode.tabbedpanel;
024:
025: import net.infonode.gui.hover.HoverListener;
026: import net.infonode.properties.gui.util.ComponentProperties;
027: import net.infonode.properties.gui.util.ShapedPanelProperties;
028: import net.infonode.properties.propertymap.*;
029: import net.infonode.properties.types.HoverListenerProperty;
030:
031: /**
032: * TabAreaProperties holds all visual properties for a tabbed panel's tab area.
033: * TabbedPanelProperties contains TabAreaProperties.
034: *
035: * @author $Author: jesper $
036: * @version $Revision: 1.28 $
037: * @see TabbedPanel
038: * @see TabbedPanelProperties
039: */
040: public class TabAreaProperties extends PropertyMapContainer {
041: /**
042: * A property group for all properties in TabAreaProperties
043: */
044: public static final PropertyMapGroup PROPERTIES = new PropertyMapGroup(
045: "Tab Area Properties",
046: "Properties for the TabbedPanel class.");
047:
048: /**
049: * Properties for the component
050: *
051: * @see #getComponentProperties
052: */
053: public static final PropertyMapProperty COMPONENT_PROPERTIES = new PropertyMapProperty(
054: PROPERTIES, "Component Properties",
055: "Properties for tab area component.",
056: ComponentProperties.PROPERTIES);
057:
058: /**
059: * Properties for the shaped panel
060: *
061: * @see #getShapedPanelProperties
062: * @since ITP 1.2.0
063: */
064: public static final PropertyMapProperty SHAPED_PANEL_PROPERTIES = new PropertyMapProperty(
065: PROPERTIES, "Shaped Panel Properties",
066: "Properties for shaped tab area.",
067: ShapedPanelProperties.PROPERTIES);
068:
069: /**
070: * Hover listener property
071: *
072: * @see #setHoverListener
073: * @see #getHoverListener
074: * @since ITP 1.3.0
075: */
076: public static final HoverListenerProperty HOVER_LISTENER = new HoverListenerProperty(
077: PROPERTIES,
078: "Hover Listener",
079: "Hover Listener to be used for tracking mouse hovering over the tab area components area.",
080: PropertyMapValueHandler.INSTANCE);
081: /**
082: * Tab area visible property
083: *
084: * @see #setTabAreaVisiblePolicy(TabAreaVisiblePolicy)
085: * @see #getTabAreaVisiblePolicy()
086: * @since ITP 1.4.0
087: */
088: public static final TabAreaVisiblePolicyProperty TAB_AREA_VISIBLE_POLICY = new TabAreaVisiblePolicyProperty(
089: PROPERTIES, "Visible Policy",
090: "Visiblity for the tab area.",
091: PropertyMapValueHandler.INSTANCE);
092:
093: /**
094: * Constructs an empty TabAreaProperties object
095: */
096: public TabAreaProperties() {
097: super (PROPERTIES);
098: }
099:
100: /**
101: * Constructs a TabAreaProperties object with the given object
102: * as property storage
103: *
104: * @param object object to store properties in
105: */
106: public TabAreaProperties(PropertyMap object) {
107: super (object);
108: }
109:
110: /**
111: * Constructs a TabAreaProperties object that inherits its properties
112: * from the given TabAreaProperties object
113: *
114: * @param inheritFrom TabAreaProperties object to inherit properties from
115: */
116: public TabAreaProperties(TabAreaProperties inheritFrom) {
117: super (PropertyMapFactory.create(inheritFrom.getMap()));
118: }
119:
120: /**
121: * Adds a super object from which property values are inherited.
122: *
123: * @param superObject the object from which to inherit property values
124: * @return this
125: */
126: public TabAreaProperties addSuperObject(
127: TabAreaProperties super Object) {
128: getMap().addSuperMap(super Object.getMap());
129: return this ;
130: }
131:
132: /**
133: * Removes the last added super object.
134: *
135: * @return this
136: */
137: public TabAreaProperties removeSuperObject() {
138: getMap().removeSuperMap();
139: return this ;
140: }
141:
142: /**
143: * Removes the given super object.
144: *
145: * @param superObject super object to remove
146: * @return this
147: * @since ITP 1.3.0
148: */
149: public TabAreaProperties removeSuperObject(
150: TabAreaProperties super Object) {
151: getMap().removeSuperMap(super Object.getMap());
152: return this ;
153: }
154:
155: /**
156: * Gets the component properties
157: *
158: * @return component properties
159: */
160: public ComponentProperties getComponentProperties() {
161: return new ComponentProperties(COMPONENT_PROPERTIES
162: .get(getMap()));
163: }
164:
165: /**
166: * Gets the shaped panel properties
167: *
168: * @return shaped panel properties
169: * @since ITP 1.2.0
170: */
171: public ShapedPanelProperties getShapedPanelProperties() {
172: return new ShapedPanelProperties(SHAPED_PANEL_PROPERTIES
173: .get(getMap()));
174: }
175:
176: /**
177: * <p>Sets the hover listener that will be triggered when the tab area is hoverd by the mouse.</p>
178: *
179: * <p>The tabbed panel that the hovered tab area is part of will be the source of the hover event sent to the
180: * hover listener.</p>
181: *
182: * @param listener the hover listener
183: * @return this TabAreaProperties
184: * @since ITP 1.3.0
185: */
186: public TabAreaProperties setHoverListener(HoverListener listener) {
187: HOVER_LISTENER.set(getMap(), listener);
188: return this ;
189: }
190:
191: /**
192: * <p>Sets the hover listener that will be triggered when the tab area is hovered by the mouse.</p>
193: *
194: * <p>The tabbed panel that the hovered tab area is part of will be the source of the hover event sent to the
195: * hover listener.</p>
196: *
197: * @return the hover listener
198: * @since ITP 1.3.0
199: */
200: public HoverListener getHoverListener() {
201: return HOVER_LISTENER.get(getMap());
202: }
203:
204: /**
205: * Sets the tab area visible policy for the tab area, i.e. when the tab area is to be visible
206: *
207: * @param policy the tab area visible policy
208: * @return this TabAreaProperties
209: * @since ITP 1.4.0
210: */
211: public TabAreaProperties setTabAreaVisiblePolicy(
212: TabAreaVisiblePolicy policy) {
213: TAB_AREA_VISIBLE_POLICY.set(getMap(), policy);
214: return this ;
215: }
216:
217: /**
218: * Gets the tab area visible policy for the tab area, i.e. when the tab area is to be visible
219: *
220: * @return the tab area visible policy
221: * @since ITP 1.4.0
222: */
223: public TabAreaVisiblePolicy getTabAreaVisiblePolicy() {
224: return TAB_AREA_VISIBLE_POLICY.get(getMap());
225: }
226: }
|