01: /*
02: * Copyright (C) 2004 NNL Technology AB
03: * Visit www.infonode.net for information about InfoNode(R)
04: * products and how to contact NNL Technology AB.
05: *
06: * This program is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU General Public License
08: * as published by the Free Software Foundation; either version 2
09: * of the License, or (at your option) any later version.
10: *
11: * This program is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14: * GNU General Public License for more details.
15: *
16: * You should have received a copy of the GNU General Public License
17: * along with this program; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
19: * MA 02111-1307, USA.
20: */
21:
22: // $Id: TabbedPanelHoverAction.java,v 1.9 2005/02/16 11:28:14 jesper Exp $
23: package net.infonode.tabbedpanel.hover;
24:
25: import net.infonode.gui.hover.HoverEvent;
26: import net.infonode.gui.hover.HoverListener;
27: import net.infonode.tabbedpanel.TabbedPanel;
28: import net.infonode.tabbedpanel.TabbedPanelProperties;
29:
30: /**
31: * <p>
32: * TabbedPanelHoverAction is an action that makes it easy to change properties for
33: * a hovered {@link TabbedPanel}. The action is meant to be set as a {@link HoverListener}
34: * for the entire tabbed panel, the tab area, the tab area components area and/or the
35: * content area in their corresponding properties objects.
36: * </p>
37: *
38: * <p>
39: * This hover action contains a TabbedPanelProperties object that will be added as
40: * super object to the hovered tabbed panel and then automatically removed when the
41: * area is no longer hovered.
42: * </p>
43: *
44: * @author johan
45: * @version $Revision: 1.9 $
46: * @see TabbedPanel
47: * @see TabbedPanelProperties
48: * @see net.infonode.tabbedpanel.TabAreaProperties
49: * @see net.infonode.tabbedpanel.TabAreaComponentsProperties
50: * @see net.infonode.tabbedpanel.TabbedPanelContentPanelProperties
51: * @since ITP 1.3.0
52: */
53: public class TabbedPanelHoverAction implements HoverListener {
54: private TabbedPanelProperties props;
55:
56: /**
57: * Creates a TabbedPanelHoverAction containing an empty TabbedPanelProperties
58: * object.
59: */
60: public TabbedPanelHoverAction() {
61: this (new TabbedPanelProperties());
62: }
63:
64: /**
65: * Creates a TabbedPanelHoverAction with the given TabbedPanelProperties
66: * object.
67: *
68: * @param props reference to a TabbedPanelProperties object
69: */
70: public TabbedPanelHoverAction(TabbedPanelProperties props) {
71: this .props = props;
72: }
73:
74: /**
75: * Gets the TabbedPanelProperties object for this action.
76: *
77: * @return reference to the TabbedPanelProperties
78: */
79: public TabbedPanelProperties getTabbedPanelProperties() {
80: return props;
81: }
82:
83: public void mouseEntered(HoverEvent event) {
84: ((TabbedPanel) event.getSource()).getProperties()
85: .addSuperObject(props);
86: }
87:
88: public void mouseExited(HoverEvent event) {
89: ((TabbedPanel) event.getSource()).getProperties()
90: .removeSuperObject(props);
91: }
92: }
|