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