Source Code Cross Referenced for TitledTabTabbedPanelHoverAction.java in  » Swing-Library » InfoNode-Tabbed-Panel » net » infonode » tabbedpanel » hover » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Swing Library » InfoNode Tabbed Panel » net.infonode.tabbedpanel.hover 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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: TitledTabTabbedPanelHoverAction.java,v 1.5 2005/02/16 11:28:14 jesper Exp $
023:        package net.infonode.tabbedpanel.hover;
024:
025:        import net.infonode.gui.hover.HoverEvent;
026:        import net.infonode.gui.hover.HoverListener;
027:        import net.infonode.tabbedpanel.TabAdapter;
028:        import net.infonode.tabbedpanel.TabStateChangedEvent;
029:        import net.infonode.tabbedpanel.TabbedPanel;
030:        import net.infonode.tabbedpanel.TabbedPanelProperties;
031:        import net.infonode.tabbedpanel.titledtab.TitledTab;
032:        import net.infonode.tabbedpanel.titledtab.TitledTabProperties;
033:
034:        /**
035:         * <p>
036:         * TitledTabTabbedPanelHoverAction is an action that makes it easy to change
037:         * properties for a hovered {@link TitledTab} and the {@link TabbedPanel} it is a
038:         * member of. The action is meant to be set as a {@link HoverListener} for a
039:         * TitledTab in the
040:         * {@link net.infonode.tabbedpanel.titledtab.TitledTabProperties}.
041:         * </p>
042:         *
043:         * <p>
044:         * The action can be configured to add the TabbedPanelProperties only when the
045:         * highlighted TitledTab is hovered or when any of the TitledTabs are hovered.
046:         * </p>
047:         *
048:         * <p>
049:         * This hover action contains a TitledTabProperties object that will be added as
050:         * super object to the hovered titled tab and then automatically removed when
051:         * the titled tab is no longer hovered. It also contains a TabbedPanelProperties
052:         * object that will be added as super object to the tabbed panel that the
053:         * hovered titled tab is a member of. The TabbedPanelProperties are
054:         * automatically removed from the tabbed panel if the hovered titled tab is
055:         * removed.
056:         * </p>
057:         *
058:         * <p>
059:         * <strong>Note: </strong> This action is not meant to be set as hover listener
060:         * for a Tabbed Panel (or any of its areas). For TabbedPanel, use
061:         * {@link net.infonode.tabbedpanel.hover.TabbedPanelTitledTabHoverAction} instead.
062:         * </p>
063:         *
064:         * @author johan
065:         * @version $Revision: 1.5 $
066:         * @see TabbedPanel
067:         * @see TitledTab
068:         * @see net.infonode.tabbedpanel.titledtab.TitledTabProperties
069:         * @see TabbedPanelProperties
070:         * @see net.infonode.tabbedpanel.hover.TabbedPanelTitledTabHoverAction
071:         * @since ITP 1.3.0
072:         */
073:        public class TitledTabTabbedPanelHoverAction implements  HoverListener {
074:            private TabbedPanelProperties tabbedPanelProperties;
075:            private TitledTabProperties titledTabProperties;
076:
077:            private boolean applied = false;
078:            private boolean onlyHighlighted;
079:
080:            private TabAdapter tabListener = new TabAdapter() {
081:                public void tabHighlighted(TabStateChangedEvent event) {
082:                    if (event.getCurrentTab() != null && onlyHighlighted)
083:                        applyTabbedPanel(event.getCurrentTab().getTabbedPanel());
084:                }
085:
086:                public void tabDehighlighted(TabStateChangedEvent event) {
087:                    if (event.getPreviousTab() != null && onlyHighlighted)
088:                        removeTabbedPanel(event.getPreviousTab()
089:                                .getTabbedPanel());
090:                }
091:            };
092:
093:            /**
094:             * Creates a TitledTabTabbedPanelHoverAction containing an empty
095:             * TitledTabProperties object and an empty TabbedPanelProperties object. The
096:             * TabbedPanelProperties are only applied when the highlighted tab is
097:             * hovered.
098:             */
099:            public TitledTabTabbedPanelHoverAction() {
100:                this (new TitledTabProperties(), new TabbedPanelProperties());
101:            }
102:
103:            /**
104:             * Creates a TitledTabTabbedPanelHoverAction containing an empty
105:             * TitledTabProperties object and an empty TabbedPanelProperties object.
106:             *
107:             * @param allTabs true if the TabbedPanelProperties should be applied to the
108:             *                tabbed panel when a tab is hovered, false if it should only be
109:             *                applied when the the highlighted tab is hovered
110:             */
111:            public TitledTabTabbedPanelHoverAction(boolean allTabs) {
112:                this (new TitledTabProperties(), new TabbedPanelProperties(),
113:                        allTabs);
114:            }
115:
116:            /**
117:             * Creates a TitledTabTabbedPanelHoverAction containing with the given
118:             * TitledTabProperties object and the given TabbedPanelProperties object.
119:             * The TabbedPanelProperties are only applied when the highlighted tab is
120:             * hovered.
121:             *
122:             * @param titledTabProperties   reference to a TitledTabProperties object
123:             * @param tabbedPanelProperties reference to a TabbedPanelProperties object
124:             */
125:            public TitledTabTabbedPanelHoverAction(
126:                    TitledTabProperties titledTabProperties,
127:                    TabbedPanelProperties tabbedPanelProperties) {
128:                this (titledTabProperties, tabbedPanelProperties, false);
129:            }
130:
131:            /**
132:             * Creates a TitledTabTabbedPanelHoverAction containing with the given
133:             * TitledTabProperties object and the given TabbedPanelProperties object.
134:             *
135:             * @param titledTabProperties   reference to a TitledTabProperties object
136:             * @param tabbedPanelProperties reference to a TabbedPanelProperties object
137:             * @param allTabs               true if the TabbedPanelProperties should be applied to the
138:             *                              tabbed panel when a tab is hovered, false if it should only be
139:             *                              applied when the the highlighted tab is hovered
140:             */
141:            public TitledTabTabbedPanelHoverAction(
142:                    TitledTabProperties titledTabProperties,
143:                    TabbedPanelProperties tabbedPanelProperties, boolean allTabs) {
144:                this .titledTabProperties = titledTabProperties;
145:                this .tabbedPanelProperties = tabbedPanelProperties;
146:                this .onlyHighlighted = !allTabs;
147:            }
148:
149:            /**
150:             * Gets the TitledTabProperties object for this action.
151:             *
152:             * @return reference to the TitledTabProperties
153:             */
154:            public TitledTabProperties getTitledTabProperties() {
155:                return titledTabProperties;
156:            }
157:
158:            /**
159:             * Gets the TabbedPanelProperties object for this action.
160:             *
161:             * @return reference to the TabbedPanelProperties
162:             */
163:            public TabbedPanelProperties getTabbedPanelProperties() {
164:                return tabbedPanelProperties;
165:            }
166:
167:            public void mouseEntered(HoverEvent event) {
168:                TitledTab tab = (TitledTab) event.getSource();
169:                if (onlyHighlighted) {
170:                    tab.addTabListener(tabListener);
171:                    if (tab.isHighlighted())
172:                        applyTabbedPanel(tab.getTabbedPanel());
173:                } else {
174:                    applyTabbedPanel(tab.getTabbedPanel());
175:                }
176:
177:                tab.getProperties().addSuperObject(titledTabProperties);
178:            }
179:
180:            public void mouseExited(HoverEvent event) {
181:                TitledTab tab = (TitledTab) event.getSource();
182:                removeTabbedPanel(tab.getTabbedPanel());
183:                if (onlyHighlighted)
184:                    tab.removeTabListener(tabListener);
185:                tab.getProperties().removeSuperObject(titledTabProperties);
186:            }
187:
188:            private void applyTabbedPanel(TabbedPanel tabbedPanel) {
189:                if (!applied) {
190:                    tabbedPanel.getProperties().addSuperObject(
191:                            tabbedPanelProperties);
192:                    applied = true;
193:                }
194:            }
195:
196:            private void removeTabbedPanel(TabbedPanel tabbedPanel) {
197:                if (applied) {
198:                    tabbedPanel.getProperties().removeSuperObject(
199:                            tabbedPanelProperties);
200:                    applied = false;
201:                }
202:            }
203:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.