Source Code Cross Referenced for ExtendableMenu.java in  » Mail-Clients » columba-1.4 » org » columba » core » gui » menu » 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 » Mail Clients » columba 1.4 » org.columba.core.gui.menu 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // The contents of this file are subject to the Mozilla Public License Version
002:        // 1.1
003:        //(the "License"); you may not use this file except in compliance with the
004:        //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
005:        //
006:        //Software distributed under the License is distributed on an "AS IS" basis,
007:        //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
008:        //for the specific language governing rights and
009:        //limitations under the License.
010:        //
011:        //The Original Code is "The Columba Project"
012:        //
013:        //The Initial Developers of the Original Code are Frederik Dietz and Timo
014:        // Stich.
015:        //Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
016:        //
017:        //All Rights Reserved.
018:        package org.columba.core.gui.menu;
019:
020:        import java.awt.Component;
021:        import java.util.Enumeration;
022:        import java.util.Hashtable;
023:
024:        import javax.swing.Action;
025:        import javax.swing.JMenu;
026:        import javax.swing.JMenuItem;
027:        import javax.swing.JSeparator;
028:
029:        import org.columba.core.gui.base.CMenu;
030:
031:        public class ExtendableMenu extends CMenu {
032:
033:            private MenuModel model;
034:
035:            private Hashtable<String, ExtendableMenu> map = new Hashtable<String, ExtendableMenu>();
036:
037:            private String id;
038:
039:            public ExtendableMenu(String id, String label) {
040:                super (label, id);
041:
042:                this .id = id;
043:
044:                model = new MenuModel(id);
045:
046:                map.put(id, this );
047:            }
048:
049:            public MenuModel getMenuModel() {
050:                return model;
051:            }
052:
053:            /**
054:             * @see javax.swing.JMenu#add(javax.swing.Action)
055:             */
056:            public JMenuItem add(Action action) {
057:                model.add(action);
058:
059:                return super .add(action);
060:
061:            }
062:
063:            /**
064:             * @see javax.swing.JMenu#add(javax.swing.JMenuItem)
065:             */
066:            public JMenuItem add(JMenuItem menuItem) {
067:                model.add(menuItem);
068:
069:                return super .add(menuItem);
070:            }
071:
072:            /**
073:             * @see javax.swing.JMenu#addSeparator()
074:             */
075:            public void addSeparator() {
076:                int index = getComponentCount();
077:
078:                // make sure that we don't end up with two separators
079:                if (index > 0 && (index - 1 < getComponentCount())) {
080:                    Component prev = getComponent(index - 1);
081:                    if (prev instanceof  JSeparator)
082:                        return;
083:                }
084:
085:                model.addSeparator();
086:
087:                super .addSeparator();
088:            }
089:
090:            /**
091:             * @see javax.swing.JMenu#insert(javax.swing.Action, int)
092:             */
093:            public JMenuItem insert(Action action, int pos) {
094:                model.insert(action, pos);
095:
096:                return super .insert(action, pos);
097:            }
098:
099:            /**
100:             * @see javax.swing.JMenu#insert(javax.swing.JMenuItem, int)
101:             */
102:            public JMenuItem insert(JMenuItem menuItem, int pos) {
103:                model.insert(menuItem, pos);
104:
105:                return super .insert(menuItem, pos);
106:            }
107:
108:            /**
109:             * @see javax.swing.JMenu#insertSeparator(int)
110:             */
111:            public void insertSeparator(int index) {
112:                model.insertSeparator(index);
113:
114:                super .insertSeparator(index);
115:            }
116:
117:            public void addPlaceholder(String placeholderId) {
118:                model.appendPlaceholder(placeholderId);
119:            }
120:
121:            public void insertPlaceholder(String placeholderId, int pos) {
122:                model.insertPlaceholder(placeholderId, pos);
123:            }
124:
125:            public void insert(Action action, String placeholderId) {
126:                int index = model.insert(action, placeholderId);
127:                if (index != -1)
128:                    super .insert(action, index);
129:            }
130:
131:            public void insert(Component component, String placeholderId) {
132:                int index = model.insert(component, placeholderId);
133:                if (index != -1)
134:                    super .add(component, index);
135:            }
136:
137:            public void insert(JMenuItem menuItem, String placeholderId) {
138:                if (menuItem == null)
139:                    throw new IllegalArgumentException("menuItem == null");
140:                if (placeholderId == null)
141:                    throw new IllegalArgumentException("placeholderId == null");
142:
143:                int index = model.insert(menuItem, placeholderId);
144:                if (index != -1)
145:                    super .insert(menuItem, index);
146:            }
147:
148:            public void insertSeparator(String placeholderId) {
149:                int index = model.insertSeparator(placeholderId);
150:                // make sure that we don't end up with two separators
151:                if (index > 0 && (index - 1 < getComponentCount())) {
152:                    Component prev = getComponent(index - 1);
153:                    if (prev instanceof  JSeparator)
154:                        return;
155:                }
156:
157:                if (index != -1)
158:                    super .insertSeparator(index);
159:            }
160:
161:            public void add(ExtendableMenu submenu) {
162:
163:                map.put(submenu.getId(), submenu);
164:
165:                model.addSubmenu(submenu.getMenuModel());
166:
167:                super .add((JMenu) submenu);
168:            }
169:
170:            /**
171:             * @return Returns the id.
172:             */
173:            public String getId() {
174:                return id;
175:            }
176:
177:            public Enumeration<ExtendableMenu> getSubmenuEnumeration() {
178:                return map.elements();
179:            }
180:
181:            /**
182:             * @see javax.swing.JMenu#add(java.awt.Component, int)
183:             */
184:            public Component add(Component component, int index) {
185:                model.insert(component, index);
186:
187:                return super .add(component, index);
188:            }
189:
190:            /**
191:             * @see javax.swing.JMenu#add(java.awt.Component)
192:             */
193:            public Component add(Component component) {
194:                model.add(component);
195:
196:                return super .add(component);
197:            }
198:
199:            public void insertPlaceholder(String placeholderId,
200:                    String insertionPlaceholder) {
201:                model.insertPlaceholder(placeholderId, insertionPlaceholder);
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.