Source Code Cross Referenced for MenuBar.java in  » Content-Management-System » harmonise » org » openharmonise » him » window » menus » 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 » Content Management System » harmonise » org.openharmonise.him.window.menus 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The contents of this file are subject to the 
003:         * Mozilla Public License Version 1.1 (the "License"); 
004:         * you may not use this file except in compliance with the License. 
005:         * You may obtain a copy of the License at http://www.mozilla.org/MPL/
006:         *
007:         * Software distributed under the License is distributed on an "AS IS"
008:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. 
009:         * See the License for the specific language governing rights and 
010:         * limitations under the License.
011:         *
012:         * The Initial Developer of the Original Code is Simulacra Media Ltd.
013:         * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
014:         *
015:         * All Rights Reserved.
016:         *
017:         * Contributor(s):
018:         */
019:        package org.openharmonise.him.window.menus;
020:
021:        import java.awt.Font;
022:        import java.util.ArrayList;
023:        import java.util.Iterator;
024:
025:        import javax.swing.JMenu;
026:        import javax.swing.JMenuBar;
027:
028:        import org.openharmonise.him.actions.*;
029:        import org.openharmonise.him.actions.file.*;
030:        import org.openharmonise.him.actions.help.*;
031:        import org.openharmonise.him.actions.publish.*;
032:        import org.openharmonise.him.actions.system.*;
033:        import org.openharmonise.vfs.context.*;
034:
035:        import org.openharmonise.him.actions.system.ActionExportContent;
036:
037:        /**
038:         * Main menu bar for the application.
039:         * 
040:         * @author Matthew Large
041:         * @version $Revision: 1.3 $
042:         *
043:         */
044:        public class MenuBar extends JMenuBar implements  ContextListener {
045:
046:            /**
047:             * List of {@link HIMAction} objects.
048:             */
049:            private ArrayList m_aActions = new ArrayList();
050:
051:            /**
052:             * Constructs a new menu bar.
053:             */
054:            public MenuBar() {
055:                super ();
056:                this .setup();
057:            }
058:
059:            /**
060:             * Initialises this component.
061:             *
062:             */
063:            private void setup() {
064:                this .add(this .getSystemMenu());
065:                this .add(this .getFileMenu());
066:                this .add(this .getPublishMenu());
067:                this .add(this .getCMHelpMenu());
068:
069:                ContextHandler.getInstance().addListener(
070:                        ContextType.CONTEXT_FILES, this );
071:                ContextHandler.getInstance().addListener(
072:                        ContextType.CONTEXT_DIRS, this );
073:                ContextHandler.getInstance().addListener(
074:                        ContextType.CONTEXT_TABS, this );
075:            }
076:
077:            /**
078:             * Gets the System menu.
079:             * 
080:             * @return System menu.
081:             */
082:            private JMenu getSystemMenu() {
083:                JMenu menu = new JMenu("System");
084:                menu.setMnemonic('S');
085:
086:                String fontName = "Dialog";
087:                int fontSize = 11;
088:                Font font = new Font(fontName, Font.PLAIN, fontSize);
089:                menu.setFont(font);
090:
091:                HIMAction action = new ActionSystemSettings();
092:                this .m_aActions.add(action);
093:                menu.add(action.getMenuItem());
094:
095:                action = new ActionPreviewSettings();
096:                this .m_aActions.add(action);
097:                menu.add(action.getMenuItem());
098:
099:                action = new ActionCustomise();
100:                this .m_aActions.add(action);
101:                menu.add(action.getMenuItem());
102:
103:                action = new ActionChangeMyPassword();
104:                this .m_aActions.add(action);
105:                menu.add(action.getMenuItem());
106:
107:                menu.addSeparator();
108:
109:                action = new ActionRefresh();
110:                this .m_aActions.add(action);
111:                menu.add(action.getMenuItem());
112:
113:                action = new ActionSyncWithServer();
114:                this .m_aActions.add(action);
115:                menu.add(action.getMenuItem());
116:
117:                action = new ActionExportContent();
118:                this .m_aActions.add(action);
119:                menu.add(action.getMenuItem());
120:
121:                menu.addSeparator();
122:
123:                action = new ActionExitReject();
124:                this .m_aActions.add(action);
125:                menu.add(action.getMenuItem());
126:
127:                action = new ActionExitCommit();
128:                this .m_aActions.add(action);
129:                menu.add(action.getMenuItem());
130:
131:                return menu;
132:            }
133:
134:            /**
135:             * Gets the File menu.
136:             * 
137:             * @return File menu.
138:             */
139:            private JMenu getFileMenu() {
140:                JMenu menu = new JMenu("Resource");
141:                menu.setMnemonic('R');
142:
143:                String fontName = "Dialog";
144:                int fontSize = 11;
145:                Font font = new Font(fontName, Font.PLAIN, fontSize);
146:                menu.setFont(font);
147:
148:                HIMAction action = new ActionNewFile();
149:                this .m_aActions.add(action);
150:                menu.add(action.getMenuItem());
151:
152:                action = new ActionUpload();
153:                this .m_aActions.add(action);
154:                menu.add(action.getMenuItem());
155:
156:                action = new ActionNewCollection();
157:                this .m_aActions.add(action);
158:                menu.add(action.getMenuItem());
159:
160:                menu.addSeparator();
161:
162:                action = new ActionOpen();
163:                this .m_aActions.add(action);
164:                menu.add(action.getMenuItem());
165:
166:                //commenting out as renaming a resource changes the path
167:                //which then can mess up property domain references
168:                //will be fixed in later releases
169:
170:                //		action = new ActionRename();
171:                //		this.m_aActions.add(action);
172:                //		menu.add(action.getMenuItem());
173:
174:                action = new ActionCreateCopy();
175:                this .m_aActions.add(action);
176:                menu.add(action.getMenuItem());
177:
178:                menu.addSeparator();
179:
180:                action = new ActionSynchronise();
181:                this .m_aActions.add(action);
182:                menu.add(action.getMenuItem());
183:
184:                action = new ActionLock();
185:                this .m_aActions.add(action);
186:                menu.add(action.getMenuItem());
187:
188:                action = new ActionUnlock();
189:                this .m_aActions.add(action);
190:                menu.add(action.getMenuItem());
191:
192:                return menu;
193:            }
194:
195:            /**
196:             * Gets the Publish menu.
197:             * 
198:             * @return Publish menu.
199:             */
200:            private JMenu getPublishMenu() {
201:                JMenu menu = new JMenu("Publish");
202:                menu.setMnemonic('P');
203:
204:                String fontName = "Dialog";
205:                int fontSize = 11;
206:                Font font = new Font(fontName, Font.PLAIN, fontSize);
207:                menu.setFont(font);
208:
209:                HIMAction action = new ActionPreview();
210:                this .m_aActions.add(action);
211:                menu.add(action.getMenuItem());
212:
213:                action = new ActionPublishToInternet();
214:                this .m_aActions.add(action);
215:                menu.add(action.getMenuItem());
216:
217:                action = new ActionExport();
218:                this .m_aActions.add(action);
219:                menu.add(action.getMenuItem());
220:
221:                menu.addSeparator();
222:
223:                action = new ActionArchive();
224:                this .m_aActions.add(action);
225:                menu.add(action.getMenuItem());
226:
227:                action = new ActionRetrieve();
228:                this .m_aActions.add(action);
229:                menu.add(action.getMenuItem());
230:
231:                return menu;
232:            }
233:
234:            /**
235:             * Gets the Help menu.
236:             * 
237:             * @return Help menu.
238:             */
239:            private JMenu getCMHelpMenu() {
240:                JMenu menu = new JMenu("Help");
241:                menu.setMnemonic('H');
242:
243:                String fontName = "Dialog";
244:                int fontSize = 11;
245:                Font font = new Font(fontName, Font.PLAIN, fontSize);
246:                menu.setFont(font);
247:
248:                HIMAction action = new ActionHelp();
249:                this .m_aActions.add(action);
250:                menu.add(action.getMenuItem());
251:
252:                action = new ActionKeyboardShortcuts();
253:                this .m_aActions.add(action);
254:                menu.add(action.getMenuItem());
255:
256:                action = new ActionAbout();
257:                this .m_aActions.add(action);
258:                menu.add(action.getMenuItem());
259:
260:                return menu;
261:            }
262:
263:            /* (non-Javadoc)
264:             * @see com.simulacramedia.contentmanager.context.ContextListener#contextMessage(com.simulacramedia.contentmanager.context.ContextEvent)
265:             */
266:            public void contextMessage(ContextEvent ce) {
267:                if (ce.CONTEXT_TYPE == ContextType.CONTEXT_DIRS) {
268:                    Iterator itor = this .m_aActions.iterator();
269:                    while (itor.hasNext()) {
270:                        HIMAction action = (HIMAction) itor.next();
271:                        action.isEnabled(ce);
272:                    }
273:                } else if (ce.CONTEXT_TYPE == ContextType.CONTEXT_FILES) {
274:                    Iterator itor = this .m_aActions.iterator();
275:                    while (itor.hasNext()) {
276:                        HIMAction action = (HIMAction) itor.next();
277:                        action.isEnabled(ce);
278:                    }
279:                } else if (ce.CONTEXT_TYPE == ContextType.CONTEXT_TABS) {
280:                    Iterator itor = this .m_aActions.iterator();
281:                    while (itor.hasNext()) {
282:                        HIMAction action = (HIMAction) itor.next();
283:                        action.isEnabled(ce);
284:                    }
285:                }
286:            }
287:
288:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.