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


001:        /*
002:         * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
003:         * Distributed under the terms of either:
004:         * - the common development and distribution license (CDDL), v1.0; or
005:         * - the GNU Lesser General Public License, v2.1 or later
006:         * $Id: MainFrame.java 3669 2007-02-26 13:51:23Z gbevin $
007:         */
008:        package com.uwyn.rife.gui.ui;
009:
010:        import java.awt.BorderLayout;
011:        import java.awt.event.ActionEvent;
012:        import java.awt.event.ActionListener;
013:        import java.awt.event.WindowEvent;
014:        import java.awt.event.WindowListener;
015:
016:        import javax.swing.*;
017:
018:        import com.uwyn.rife.gui.Rife;
019:        import com.uwyn.rife.gui.model.ElementModel;
020:        import com.uwyn.rife.gui.model.SiteModel;
021:        import com.uwyn.rife.gui.model.exceptions.GuiModelException;
022:        import com.uwyn.rife.gui.ui.actions.ExitAction;
023:        import com.uwyn.rife.gui.ui.actions.OpenBeanshellAction;
024:        import com.uwyn.rife.gui.ui.commands.ChangeLookAndFeel;
025:        import com.uwyn.rife.swing.JAction;
026:        import com.uwyn.rife.swing.JDialogSystemError;
027:        import com.uwyn.rife.swing.JMenuBuilder;
028:        import com.uwyn.rife.tools.ExceptionUtils;
029:        import com.uwyn.rife.tools.Localization;
030:
031:        public class MainFrame extends JFrame implements  WindowListener,
032:                ActionListener {
033:            private EditorPane mEditorPane = null;
034:
035:            public MainFrame() {
036:                super (Localization.getString("rife.application.title"));
037:                this .addWindowListener(this );
038:
039:                this .createMenuBar();
040:                this .getContentPane().setLayout(new BorderLayout());
041:
042:                SiteModel site = new SiteModel();
043:                ElementModel element = null;
044:                for (int j = 0; j < 3; j++) {
045:                    try {
046:                        element = new ElementModel("element " + j);
047:                        site.addElement(element);
048:                    } catch (GuiModelException e) {
049:                    }
050:
051:                    int exits = (int) (Math.random() * 3);
052:                    int consumeds = (int) (Math.random() * 3);
053:                    int useds = (int) (Math.random() * 3);
054:                    try {
055:                        for (int i = 0; i < exits; i++) {
056:                            element.addExit("exit" + i);
057:                        }
058:                        for (int i = 0; i < consumeds; i++) {
059:                            element.addInput("input" + i);
060:                        }
061:                        for (int i = 0; i < useds; i++) {
062:                            element.addOutput("output" + i);
063:                        }
064:                    } catch (GuiModelException e) {
065:                    }
066:                    //			Color body_color = new Color(155+(int)(Math.random()*100), 155+(int)(Math.random()*100), 155+(int)(Math.random()*100));
067:                    //			element.setElementColor(body_color);
068:                    //			element.addElementListener(this);
069:                    //			mElements.add(element);
070:
071:                    //			this.add(element);
072:                    //			element.setBounds((int)(Math.random()*800), (int)(Math.random()*600), element.getWidth(), element.getHeight());
073:
074:                    //			calculateDimension();
075:                }
076:
077:                System.out.println(site.toString());
078:
079:                //		addKeyListener(mStructureEditor.getStructurePanel());
080:
081:                this .setEditorPane(new SiteEditorPane(site));
082:                this .pack();
083:                this .setSize(800, 600);
084:            }
085:
086:            public EditorPane getEditorPane() {
087:                return this .mEditorPane;
088:            }
089:
090:            protected void setEditorPane(EditorPane pane) {
091:                this .mEditorPane = pane;
092:                this .mEditorPane.constructLayout();
093:                this .getContentPane()
094:                        .add(this .mEditorPane, BorderLayout.CENTER);
095:            }
096:
097:            public void updateMenuBar() {
098:                JMenuBar menu_bar = getJMenuBar();
099:                menu_bar.removeAll();
100:                this .populateMenuBar(menu_bar);
101:                menu_bar.revalidate();
102:                menu_bar.repaint();
103:            }
104:
105:            private void createMenuBar() {
106:                JMenuBar menu_bar = new JMenuBar();
107:                this .populateMenuBar(menu_bar);
108:                this .setJMenuBar(menu_bar);
109:            }
110:
111:            private void populateMenuBar(JMenuBar menuBar) {
112:                // build the file menu
113:                JMenu menu_file = JMenuBuilder.addMenu(menuBar, Localization
114:                        .getString("rife.menu.file"), Localization
115:                        .getChar("rife.menu.file.mnemonic"));
116:                JMenuBuilder.addMenuItem(menu_file, new ExitAction());
117:
118:                // build the view menu
119:                JMenu menu_view = JMenuBuilder.addMenu(menuBar, Localization
120:                        .getString("rife.menu.view"), Localization
121:                        .getChar("rife.menu.view.mnemonic"));
122:                JMenu menu_lookandfeel = JMenuBuilder
123:                        .addMenu(
124:                                menu_view,
125:                                Localization
126:                                        .getString("rife.menu.view.lookandfeel"),
127:                                Localization
128:                                        .getChar("rife.menu.view.lookandfeel.mnemonic"));
129:
130:                // build the look&feel menu
131:                ButtonGroup lookandfeel_group = new ButtonGroup();
132:                LookAndFeel current_lookandfeel = UIManager.getLookAndFeel();
133:                UIManager.LookAndFeelInfo[] look_and_feels = UIManager
134:                        .getInstalledLookAndFeels();
135:                JRadioButtonMenuItem menu_item = null;
136:                String name = null;
137:                String classname = null;
138:                Class<LookAndFeel> testclass = null;
139:                LookAndFeel lookandfeel = null;
140:                for (int counter = 0; counter < look_and_feels.length; counter++) {
141:                    name = look_and_feels[counter].getName();
142:                    classname = look_and_feels[counter].getClassName();
143:                    try {
144:                        testclass = (Class<LookAndFeel>) Class
145:                                .forName(classname);
146:                        lookandfeel = testclass.newInstance();
147:                        if (lookandfeel.isSupportedLookAndFeel()) {
148:                            menu_item = JMenuBuilder.addRadioButtonMenuItem(
149:                                    menu_lookandfeel, new JAction(
150:                                            new ChangeLookAndFeel(classname),
151:                                            name));
152:                            if (current_lookandfeel.getName().equals(name)) {
153:                                menu_item.setSelected(true);
154:                            }
155:                            lookandfeel_group.add(menu_item);
156:                        }
157:                    } catch (Throwable e) {
158:                        (new JDialogSystemError(MainFrame.this ,
159:                                "MainFrame.populateMenuBar() : Error while determining the look & feel to '"
160:                                        + classname
161:                                        + "' : "
162:                                        + ExceptionUtils
163:                                                .getExceptionStackTrace(e)))
164:                                .setVisible(true);
165:                    }
166:                }
167:
168:                // build the tools menu
169:                JMenu menu_tools = JMenuBuilder.addMenu(menuBar, Localization
170:                        .getString("rife.menu.tools"), Localization
171:                        .getChar("rife.menu.tools.mnemonic"));
172:                JMenu menu_beanshell = JMenuBuilder.addMenu(menu_tools,
173:                        Localization.getString("rife.menu.tools.beanshell"),
174:                        Localization
175:                                .getChar("rife.menu.tools.beanshell.mnemonic"));
176:                JMenuBuilder.addMenuItem(menu_beanshell,
177:                        new OpenBeanshellAction());
178:
179:                // insert a horizontal glue to push the following menu items to the right
180:                menuBar.add(Box.createHorizontalGlue());
181:
182:                // build the help menu
183:                JMenuBuilder.addMenu(menuBar, Localization
184:                        .getString("rife.menu.help"), Localization
185:                        .getChar("rife.menu.help.mnemonic"));
186:                /*		JMenuBuilder.addMenuItem(menu_help, Localization.getString("rife.menu.help.context"),
187:                 null, Localization.getChar("rife.menu.help.context.mnemonic"),
188:                 KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0, false));
189:                 JMenuBuilder.addMenuItem(menu_help, Localization.getString("rife.menu.help.about"),
190:                 null, Localization.getChar("rife.menu.help.about.mnemonic"));*/
191:            }
192:
193:            public void windowActivated(WindowEvent e) {
194:            }
195:
196:            public void windowDeactivated(WindowEvent e) {
197:            }
198:
199:            public void windowOpened(WindowEvent e) {
200:            }
201:
202:            public void windowClosing(WindowEvent e) {
203:                e.getWindow().dispose();
204:            }
205:
206:            public void windowClosed(WindowEvent e) {
207:                Rife.quit();
208:            }
209:
210:            public void windowIconified(WindowEvent e) {
211:            }
212:
213:            public void windowDeiconified(WindowEvent e) {
214:            }
215:
216:            public void actionPerformed(ActionEvent e) {
217:            }
218:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.