Source Code Cross Referenced for Test.java in  » XML-UI » xmlgui » org » beryl » gui » test » 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 » XML UI » xmlgui » org.beryl.gui.test 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Beryl - A web platform based on XML, XSLT and Java
003:         * This file is part of the Beryl XML GUI
004:         *
005:         * Copyright (C) 2004 Wenzel Jakob <wazlaf@tigris.org>
006:         *
007:         * This program is free software; you can redistribute it and/or
008:         * modify it under the terms of the GNU Lesser General Public
009:         * License as published by the Free Software Foundation; either
010:         * version 2.1 of the License, or (at your option) any later version.
011:
012:         * This program is distributed in the hope that it will be useful,
013:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
015:         * Lesser General Public License for more details.
016:         *
017:         * You should have received a copy of the GNU Lesser General Public
018:         * License along with this program; if not, write to the Free Software
019:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-3107  USA
020:         */
021:
022:        package org.beryl.gui.test;
023:
024:        import java.util.Date;
025:        import java.util.GregorianCalendar;
026:        import java.util.Locale;
027:
028:        import org.beryl.gui.Controller;
029:        import org.beryl.gui.GUIEvent;
030:        import org.beryl.gui.GUIException;
031:        import org.beryl.gui.GUIUtils;
032:        import org.beryl.gui.ImageIconFactory;
033:        import org.beryl.gui.InternationalizationManager;
034:        import org.beryl.gui.MessageDialog;
035:        import org.beryl.gui.ScriptedController;
036:        import org.beryl.gui.model.ListDataModel;
037:        import org.beryl.gui.model.MapChangeEvent;
038:        import org.beryl.gui.model.MapDataModel;
039:        import org.beryl.gui.model.ModelChangeEvent;
040:        import org.beryl.gui.model.ModelChangeListener;
041:        import org.beryl.gui.model.TableChangeEvent;
042:        import org.beryl.gui.model.TableDataModel;
043:        import org.beryl.gui.model.TableRow;
044:        import org.beryl.gui.swing.CommandEvent;
045:        import org.beryl.gui.swing.ConsoleAttribute;
046:        import org.beryl.gui.widgets.ComboBox;
047:        import org.beryl.gui.widgets.Frame;
048:        import org.beryl.gui.widgets.List;
049:        import org.beryl.gui.widgets.Table;
050:
051:        /**
052:         * Beryl XML GUI test program
053:         */
054:        public class Test extends Controller {
055:            private MapDataModel model = null;
056:            private Table table = null;
057:            private TableDataModel tableModel = null;
058:            private Frame frame = null;
059:            private ConsoleAttribute boldAttribute = null;
060:
061:            public Test() throws GUIException {
062:                /* Create a new data model and initialize it
063:                 * with default values for the main window */
064:                model = new MapDataModel();
065:                model.setValue("username", "wazlaf");
066:                model.setValue("password", "blubb");
067:                model.setValue("combo.index", new Integer(1));
068:                model.setValue("list.index", new int[] { 1 });
069:                model.setValue("icon.index", new Integer(1));
070:                model.setValue("radio", "choice3");
071:                model.setValue("ssl", new Boolean(true));
072:                model.setValue("table.index", new int[] { 1 });
073:
074:                /* Create some items for the combo box / list */
075:                ListDataModel listModel = new ListDataModel();
076:                for (int i = 1; i < 11; i++)
077:                    listModel.addValue("MVC item " + i);
078:
079:                /* Create a table data model for the table widget and add
080:                 * some rows to it */
081:                tableModel = new TableDataModel();
082:                tableModel.addRow(new Person("Wenzel", "Jakob",
083:                        "wazlaf@tigris.org",
084:                        new GregorianCalendar(1983, 11, 04).getTime()));
085:                tableModel.addRow(new Person("Hans", "Mustermann",
086:                        "asdf@asdf.com", new Date()));
087:                tableModel.addRow(new Person("Test", "Person", "test@test.de",
088:                        new Date()));
089:
090:                /* Add a debugging model change listener to the table data model */
091:                tableModel.addModelChangeListener(new ModelChangeListener() {
092:                    public void modelChanged(ModelChangeEvent e) {
093:                        TableChangeEvent event = (TableChangeEvent) e;
094:                        log.debug("Table data model change : "
095:                                + event.getKey()
096:                                + "["
097:                                + event.getFirstIndex()
098:                                + "] -> '"
099:                                + ((TableDataModel) event.getModel()).getValue(
100:                                        event.getFirstIndex(), event.getKey())
101:                                + "'");
102:                    }
103:                });
104:
105:                /* Add a debugging model change listener to the window data model */
106:                model.addModelChangeListener(new ModelChangeListener() {
107:                    public void modelChanged(ModelChangeEvent e) {
108:                        MapChangeEvent event = (MapChangeEvent) e;
109:                        log.debug("Data model change : '" + event.getKey()
110:                                + "' => '" + event.getNewValue() + "'");
111:                    }
112:                });
113:
114:                /* Create the window */
115:                frame = constructFrame("TestFrame", model);
116:
117:                /* Associate the table data model with the table */
118:                table = (Table) frame.getWidget("Table1");
119:                table.setTableDataModel(tableModel);
120:
121:                /* Associate the list data model with a combo box and a list */
122:                ((ComboBox) frame.getWidget("Combo1"))
123:                        .setListDataModel(listModel);
124:                ((List) frame.getWidget("List1")).setListDataModel(listModel);
125:
126:                /* Initialize the console */
127:                boldAttribute = new ConsoleAttribute();
128:                boldAttribute.setBold(true);
129:
130:                /* Show the frame */
131:                frame.show();
132:            }
133:
134:            /**
135:             * Called when events occur inside the GUI
136:             */
137:            public void eventOccured(GUIEvent e) {
138:                String name = e.getName();
139:                try {
140:                    log.debug("Caught event : " + e.toString());
141:                    if (name.equals("quit")) {
142:                        System.exit(0);
143:                    } else if (name.equals("wizard")) {
144:                        new WizardTest();
145:                    } else if (name.equals("outlook")) {
146:                        new OutlookBarTest();
147:                    } else if (name.equals("about")) {
148:                        new About(frame);
149:                    } else if (name.equals("dnd")) {
150:                        new DnDTest();
151:                    } else if (name.equals("groovy")) {
152:                        ScriptedController.launchScript(
153:                                "/org/beryl/gui/test/GroovyTest.groovy",
154:                                new Object[] { frame });
155:                    } else if (name.equals("message.info")) {
156:                        new MessageDialog(frame,
157:                                getString("test.message.info.title"),
158:                                getString("test.message.info.message"));
159:                    } else if (name.equals("message.warning")) {
160:                        new MessageDialog(frame, MessageDialog.WARNING_MESSAGE,
161:                                getString("test.message.warning.title"),
162:                                getString("test.message.warning.message"), null);
163:                    } else if (name.equals("message.error")) {
164:                        throw new GUIException("This is an example error");
165:                    } else if (name.equals("edit")) {
166:                        TableRow selection[] = (TableRow[]) model
167:                                .getValue("table.value");
168:                        for (int i = 0; i < selection.length; i++) {
169:                            new PersonEditor(selection[i]);
170:                        }
171:                    } else if (name.equals("consoleCommand")) {
172:                        CommandEvent event = (CommandEvent) e.getSwingEvent();
173:                        event.getSource().appendText(
174:                                getString("test.console.command"));
175:                        event.getSource().appendText(event.getCommand(),
176:                                boldAttribute);
177:                        event.getSource().appendText(
178:                                getString("test.console.notfound") + "\n");
179:                    } else if (name.equals("login")) {
180:                        log.debug("Login has been clicked. username ["
181:                                + model.getValue("username") + "], password ["
182:                                + model.getValue("password") + "], ssl ["
183:                                + model.getValue("ssl") + "], verbose ["
184:                                + model.getValue("verbose") + "]");
185:                    }
186:                } catch (Exception ex) {
187:                    new MessageDialog(ex);
188:                }
189:            }
190:
191:            public static void main(String args[]) {
192:                try {
193:                    Locale locale = Locale.US;
194:
195:                    if (Locale.getDefault().getLanguage().equals("de"))
196:                        locale = new Locale("de", "DE");
197:                    GUIUtils.defaultInitialization(locale);
198:                    ImageIconFactory.addSearchPath("resources/test/icons");
199:                    InternationalizationManager
200:                            .addLanguageFile("resources/test/test");
201:
202:                    new Test();
203:                } catch (Exception e) {
204:                    new MessageDialog(e);
205:                }
206:            }
207:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.