Source Code Cross Referenced for DynamicMenuBuilder.java in  » Web-Framework » rife-1.6.1 » com » uwyn » rife » gui » old » 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 » Web Framework » rife 1.6.1 » com.uwyn.rife.gui.old 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // OBSOLETE
002:        // Just to keep to old rife gui code running
003:
004:        /*
005:         * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
006:         * Distributed under the terms of either:
007:         * - the common development and distribution license (CDDL), v1.0; or
008:         * - the GNU Lesser General Public License, v2.1 or later
009:         * $Id: DynamicMenuBuilder.java 3634 2007-01-08 21:42:24Z gbevin $
010:         */
011:        package com.uwyn.rife.gui.old;
012:
013:        import javax.swing.*;
014:
015:        import java.awt.MenuContainer;
016:        import java.awt.event.ActionEvent;
017:        import java.awt.event.ActionListener;
018:
019:        public class DynamicMenuBuilder implements  ActionListener {
020:            public JMenu addMenu(MenuContainer parentMenu, String menuLabel) {
021:                return addMenu(parentMenu, menuLabel, (char) 0);
022:            }
023:
024:            public JMenu addMenu(MenuContainer parentMenu, String menuLabel,
025:                    Character mnemonic) {
026:                return addMenu(parentMenu, menuLabel, mnemonic.charValue());
027:            }
028:
029:            public JMenu addMenu(MenuContainer parentMenu, String menuLabel,
030:                    char mnemonic) {
031:                JMenu menu = new JMenu(menuLabel);
032:                if (0 != mnemonic) {
033:                    menu.setMnemonic(mnemonic);
034:                }
035:                if (null != parentMenu) {
036:                    ((JComponent) parentMenu).add(menu);
037:                }
038:
039:                return menu;
040:            }
041:
042:            public JMenuItem addMenuItem(MenuContainer parentMenu,
043:                    String menuLabel, DynamicMenuAction action) {
044:                return addMenuItem(parentMenu, menuLabel, action, (char) 0,
045:                        null);
046:            }
047:
048:            public JMenuItem addMenuItem(MenuContainer parentMenu,
049:                    String menuLabel, DynamicMenuAction action,
050:                    Character mnemonic) {
051:                return addMenuItem(parentMenu, menuLabel, action, mnemonic
052:                        .charValue(), null);
053:            }
054:
055:            public JMenuItem addMenuItem(MenuContainer parentMenu,
056:                    String menuLabel, DynamicMenuAction action,
057:                    Character mnemonic, KeyStroke accelerator) {
058:                return addMenuItem(parentMenu, menuLabel, action, mnemonic
059:                        .charValue(), accelerator);
060:            }
061:
062:            public JMenuItem addMenuItem(MenuContainer parentMenu,
063:                    String menuLabel, DynamicMenuAction action, char mnemonic) {
064:                return addMenuItem(parentMenu, menuLabel, action, mnemonic,
065:                        null);
066:            }
067:
068:            public JMenuItem addMenuItem(MenuContainer parentMenu,
069:                    String menuLabel, DynamicMenuAction action, char mnemonic,
070:                    KeyStroke accelerator) {
071:                return processMenuItem(new JMenuItem(menuLabel), parentMenu,
072:                        action, mnemonic, accelerator);
073:            }
074:
075:            public JCheckBoxMenuItem addCheckBoxMenuItem(
076:                    MenuContainer parentMenu, String menuLabel,
077:                    DynamicMenuAction action) {
078:                return addCheckBoxMenuItem(parentMenu, menuLabel, action,
079:                        (char) 0, null);
080:            }
081:
082:            public JCheckBoxMenuItem addCheckBoxMenuItem(
083:                    MenuContainer parentMenu, String menuLabel,
084:                    DynamicMenuAction action, Character mnemonic) {
085:                return addCheckBoxMenuItem(parentMenu, menuLabel, action,
086:                        mnemonic.charValue(), null);
087:            }
088:
089:            public JCheckBoxMenuItem addCheckBoxMenuItem(
090:                    MenuContainer parentMenu, String menuLabel,
091:                    DynamicMenuAction action, Character mnemonic,
092:                    KeyStroke accelerator) {
093:                return addCheckBoxMenuItem(parentMenu, menuLabel, action,
094:                        mnemonic.charValue(), accelerator);
095:            }
096:
097:            public JCheckBoxMenuItem addCheckBoxMenuItem(
098:                    MenuContainer parentMenu, String menuLabel,
099:                    DynamicMenuAction action, char mnemonic) {
100:                return addCheckBoxMenuItem(parentMenu, menuLabel, action,
101:                        mnemonic, null);
102:            }
103:
104:            public JCheckBoxMenuItem addCheckBoxMenuItem(
105:                    MenuContainer parentMenu, String menuLabel,
106:                    DynamicMenuAction action, char mnemonic,
107:                    KeyStroke accelerator) {
108:                return (JCheckBoxMenuItem) processMenuItem(
109:                        new JCheckBoxMenuItem(menuLabel), parentMenu, action,
110:                        mnemonic, accelerator);
111:            }
112:
113:            public JRadioButtonMenuItem addRadioButtonMenuItem(
114:                    MenuContainer parentMenu, String menuLabel,
115:                    DynamicMenuAction action) {
116:                return addRadioButtonMenuItem(parentMenu, menuLabel, action,
117:                        (char) 0, null);
118:            }
119:
120:            public JRadioButtonMenuItem addRadioButtonMenuItem(
121:                    MenuContainer parentMenu, String menuLabel,
122:                    DynamicMenuAction action, Character mnemonic) {
123:                return addRadioButtonMenuItem(parentMenu, menuLabel, action,
124:                        mnemonic.charValue(), null);
125:            }
126:
127:            public JRadioButtonMenuItem addRadioButtonMenuItem(
128:                    MenuContainer parentMenu, String menuLabel,
129:                    DynamicMenuAction action, Character mnemonic,
130:                    KeyStroke accelerator) {
131:                return addRadioButtonMenuItem(parentMenu, menuLabel, action,
132:                        mnemonic.charValue(), accelerator);
133:            }
134:
135:            public JRadioButtonMenuItem addRadioButtonMenuItem(
136:                    MenuContainer parentMenu, String menuLabel,
137:                    DynamicMenuAction action, char mnemonic) {
138:                return addRadioButtonMenuItem(parentMenu, menuLabel, action,
139:                        mnemonic, null);
140:            }
141:
142:            public JRadioButtonMenuItem addRadioButtonMenuItem(
143:                    MenuContainer parentMenu, String menuLabel,
144:                    DynamicMenuAction action, char mnemonic,
145:                    KeyStroke accelerator) {
146:                return (JRadioButtonMenuItem) processMenuItem(
147:                        new JRadioButtonMenuItem(menuLabel), parentMenu,
148:                        action, mnemonic, accelerator);
149:            }
150:
151:            private JMenuItem processMenuItem(JMenuItem menuItem,
152:                    MenuContainer parentMenu, DynamicMenuAction action,
153:                    char mnemonic, KeyStroke accelerator) {
154:                menuItem.addActionListener(this );
155:                menuItem.putClientProperty("DYNAMICMENUACTION", action);
156:                if (0 != mnemonic) {
157:                    menuItem.setMnemonic(mnemonic);
158:                }
159:                if (null != accelerator) {
160:                    menuItem.setAccelerator(accelerator);
161:                }
162:                if (null != parentMenu) {
163:                    ((JComponent) parentMenu).add(menuItem);
164:                }
165:
166:                return menuItem;
167:            }
168:
169:            public void actionPerformed(ActionEvent e) {
170:                Object source = e.getSource();
171:                if (source instanceof  JMenuItem) {
172:                    DynamicMenuAction action = (DynamicMenuAction) ((JMenuItem) source)
173:                            .getClientProperty("DYNAMICMENUACTION");
174:                    if (null != action) {
175:                        action.execute((JMenuItem) source);
176:                    }
177:                }
178:            }
179:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.