Source Code Cross Referenced for DefaultToolBarManager.java in  » Database-Client » executequery » org » underworldlabs » swing » toolbar » 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 » Database Client » executequery » org.underworldlabs.swing.toolbar 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DefaultToolBarManager.java
003:         *
004:         * Copyright (C) 2002, 2003, 2004, 2005, 2006 Takis Diakoumis
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 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, MA  02111-1307, USA.
019:         *
020:         */
021:
022:        package org.underworldlabs.swing.toolbar;
023:
024:        import java.util.Collections;
025:        import java.util.HashMap;
026:        import java.util.Vector;
027:        import org.underworldlabs.Constants;
028:        import org.underworldlabs.swing.RolloverButton;
029:        import org.underworldlabs.swing.actions.ActionBuilder;
030:
031:        /* ----------------------------------------------------------
032:         * CVS NOTE: Changes to the CVS repository prior to the 
033:         *           release of version 3.0.0beta1 has meant a 
034:         *           resetting of CVS revision numbers.
035:         * ----------------------------------------------------------
036:         */
037:
038:        /**
039:         * Tool bar manager class for managing and creating
040:         * tool bars and associated components.
041:         *
042:         * @author   Takis Diakoumis
043:         * @version  $Revision: 1.6 $
044:         * @date     $Date: 2006/06/25 13:18:43 $
045:         */
046:        public class DefaultToolBarManager {
047:
048:            /** All tool bars added */
049:            private HashMap toolBars;
050:
051:            /** The tool bar base panel */
052:            private ToolBarBase toolBarBase;
053:
054:            /** The button comparator */
055:            private ButtonComparator buttonComparator;
056:
057:            /**
058:             * Creates a new instance of DefaultToolBarManager.
059:             * The toolsConfigPath variable may be null and is usually
060:             * a user defined/modified file system path differing from the 
061:             * defaults specified as a package resource XML path.
062:             *
063:             * @param toolsConfigPath - the user XML conf file path
064:             * @param defaultToolsResourcePath - the default XML conf resource file
065:             */
066:            public DefaultToolBarManager(String toolsConfigPath,
067:                    String defaultToolsResourcePath) {
068:                ToolBarProperties.init(toolsConfigPath,
069:                        defaultToolsResourcePath);
070:
071:                // initialise the tool bar cache
072:                toolBars = new HashMap();
073:
074:                // initialise the tools base panel
075:                toolBarBase = new ToolBarBase(ToolBarProperties
076:                        .getNextToolbarRow());
077:
078:                // button comparator for sorting
079:                buttonComparator = new ButtonComparator();
080:            }
081:
082:            /**
083:             * Returns the tool bar base panel.
084:             */
085:            public ToolBarBase getToolBarBasePanel() {
086:                return toolBarBase;
087:            }
088:
089:            /**
090:             * Resets the state of the base tool bar panel.
091:             */
092:            protected void reset() {
093:                toolBarBase.removeAll();
094:                toolBarBase.setRows(ToolBarProperties.getNextToolbarRow());
095:            }
096:
097:            /**
098:             * Repaints and revalidates the tool bar base following a change to
099:             * its structure.
100:             */
101:            protected void fireToolbarsChanged() {
102:                toolBarBase.repaint();
103:                toolBarBase.revalidate();
104:            }
105:
106:            /**
107:             * Builds (or rebuilds) the tool bar with the specified name
108:             * and adds it to the tool bar base panel and local cache.
109:             *
110:             * @param name - the name of the tool bar as it appears in the
111:             *               XML tool bar conf file
112:             * @param rebuild - whether this is a rebuild of an existing tool bar
113:             */
114:            protected void buildToolBar(String name, boolean rebuild) {
115:                ToolBarWrapper eqtb = ToolBarProperties.getToolBar(name);
116:
117:                if (!eqtb.isVisible() || !eqtb.hasButtons()) {
118:                    return;
119:                }
120:
121:                ToolBar toolBar = null;
122:                if (rebuild) {
123:                    toolBar = (ToolBar) toolBars.get(name);
124:
125:                    if (toolBar != null) {
126:                        toolBar.removeAllButtons();
127:                        toolBar.invalidate();
128:                    } else {
129:                        toolBar = new ToolBar(toolBarBase, name);
130:                        toolBars.put(name, toolBar);
131:                    }
132:
133:                } else {
134:                    toolBar = new ToolBar(toolBarBase, name);
135:                    toolBars.put(name, toolBar);
136:                }
137:
138:                Vector buttons = eqtb.getButtonsVector();
139:                Collections.sort(buttons, buttonComparator);
140:
141:                int count = 0;
142:                RolloverButton button;
143:
144:                for (int i = 0, k = buttons.size(); i < k; i++) {
145:                    ToolBarButton tb = (ToolBarButton) buttons.get(i);
146:                    if (!tb.isVisible()) {
147:                        continue;
148:                    }
149:
150:                    if (tb.isSeparator()) {
151:                        toolBar.addSeparator();
152:                    } else {
153:                        button = new RolloverButton(ActionBuilder.get(tb
154:                                .getActionId()), tb.getName());
155:                        button.setText(Constants.EMPTY);
156:                        toolBar.addButton(button);
157:                    }
158:
159:                }
160:
161:                toolBar.buildToolBar();
162:                toolBarBase.addToolBar(toolBar, eqtb.getConstraints());
163:
164:            }
165:
166:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.