Source Code Cross Referenced for XuiProComponentFactory.java in  » XML-UI » xui32 » com » xoetrope » swing » 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 » xui32 » com.xoetrope.swing 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.xoetrope.swing;
002:
003:        import com.xoetrope.swing.survey.XKioskQuestion;
004:        import com.xoetrope.swing.survey.XQuestion;
005:        import com.xoetrope.swing.survey.XWrapQuestion;
006:        import java.util.Hashtable;
007:
008:        import java.awt.Component;
009:
010:        import net.xoetrope.xui.XComponentConstructor;
011:        import net.xoetrope.xui.XComponentFactory;
012:        import net.xoetrope.xui.XImageHolder;
013:        import net.xoetrope.xui.XProjectManager;
014:        import net.xoetrope.xui.XTextHolder;
015:        import net.xoetrope.registry.ComponentAdapter;
016:        import net.xoetrope.xui.XProject;
017:
018:        /**
019:         * @todo get rid of this class, all components should be added through the registry
020:         * A component factory for XForms swing components
021:         *
022:         * <p> Copyright (c) Xoetrope Ltd., 2001-2006, This software is licensed under
023:         * the GNU Public License (GPL), please see license.txt for more details. If
024:         * you make commercial use of this software you must purchase a commercial
025:         * license from Xoetrope.</p>
026:         * <p> $Revision: 1.9 $</p>
027:         */
028:        public class XuiProComponentFactory implements  XComponentConstructor {
029:            private String packageName = "com.xoetrope.swing";
030:            private XQuestion lastQuestion;
031:            private int nextValue = 0;
032:            private String defaultQuestionFormat;
033:
034:            /**
035:             * The owner project and the context in which this object operates.
036:             */
037:            protected XProject currentProject;
038:
039:            public XuiProComponentFactory(XProject project) {
040:                currentProject = project;
041:                update();
042:            }
043:
044:            public void update() {
045:                try {
046:                    defaultQuestionFormat = currentProject
047:                            .getStartupParam("DefaultQuestionFormat");
048:                } catch (Exception ex) {
049:                }
050:                if (defaultQuestionFormat == null)
051:                    defaultQuestionFormat = "Question";
052:            }
053:
054:            public void setPackageName(String defPackage) {
055:                packageName = defPackage;
056:            }
057:
058:            public Component constructComponent(XComponentFactory cf, int type,
059:                    String content) {
060:                return null;
061:            }
062:
063:            public Object constructComponent(XComponentFactory cf, String type,
064:                    String content) {
065:                Component comp = null;
066:                if (type.compareToIgnoreCase("Question") == 0) {
067:                    if (defaultQuestionFormat.compareTo("WrapQuestion") == 0)
068:                        comp = lastQuestion = new XWrapQuestion();
069:                    else if (defaultQuestionFormat.compareTo("KioskQuestion") == 0)
070:                        comp = lastQuestion = new XKioskQuestion();
071:                    if (comp == null)
072:                        comp = lastQuestion = new XQuestion();
073:                    ((XTextHolder) comp).setText(content);
074:                    nextValue = 0;
075:                }
076:                //    else if ( type.compareToIgnoreCase( "EasterEgg" ) == 0 ) {
077:                //      comp = new XEasterEgg();
078:                //      ((XImageHolder)comp).setImage( currentProject.getImage( content ));
079:                //    }
080:                //    else if ( type.compareToIgnoreCase( "ProgressBar" ) == 0 )
081:                //      comp = new XProgressBar();
082:                //    else if ( type.compareToIgnoreCase( "Date" ) == 0 )
083:                //      comp = new XDateEdit();
084:                //    else if ( type.compareToIgnoreCase( "DateChooser" ) == 0 )
085:                //      comp = new XDateChooser();
086:                //    else if ( type.compareToIgnoreCase( "Keypad" ) == 0 )
087:                //      comp = new XKeypad();
088:                //    else if ( type.compareToIgnoreCase( "Money" ) == 0 )
089:                //      comp = new XMoneyEdit();
090:                //    else if ( type.compareToIgnoreCase( "Shape" ) == 0 )
091:                //      comp = new XShape();
092:                //    else if ( type.compareToIgnoreCase( "AWTSpinner" ) == 0 )
093:                //      comp = new XSpinner();
094:                //    else if ( type.compareToIgnoreCase( "AnimatedText" ) == 0 )
095:                //      comp = new XAnimatedText();
096:                //    else if ( type.compareToIgnoreCase( "Audio" ) == 0 )
097:                //      comp = new XAudio();
098:                //    else if ( type.compareToIgnoreCase( "Credits" ) == 0 )
099:                //      comp = new XCreditsText();
100:                //    else if ( type.compareToIgnoreCase( "FlowedText" ) == 0 )
101:                //      comp = new XFlowedTextComponent();
102:                //    else if ( type.compareToIgnoreCase( "Graph" ) == 0 )
103:                //      comp = new XGraph();
104:                //    else if ( type.compareToIgnoreCase( "Html" ) == 0 )
105:                //      comp = new XHtmlText();
106:                //    else if ( type.compareToIgnoreCase( "Marquee" ) == 0 )
107:                //      comp = new XMarqueeText();
108:                //    else if ( type.compareToIgnoreCase( "PolygonalTextArea" ) == 0 )
109:                //      comp = new XPolygonalTextArea();
110:                //    else if ( type.compareToIgnoreCase( "RotatedText" ) == 0 )
111:                //      comp = new XRotatedText();
112:                //    else if ( type.compareToIgnoreCase( "Slider" ) == 0 )
113:                //      comp = new XSlider();
114:                //    else if ( type.compareToIgnoreCase( "Spinner" ) == 0 )
115:                //      comp = new XSpinner();
116:                //    else if ( type.compareToIgnoreCase( "TreeView" ) == 0 )
117:                //      comp = new XTreeView();
118:                //    else if ( type.compareToIgnoreCase( "Video" ) == 0 )
119:                //      comp = new XVideo();
120:
121:                return comp;
122:            }
123:
124:            public Object addElement(XComponentFactory cf, String type,
125:                    String name, String content, Hashtable attribs) {
126:                if (type.compareToIgnoreCase("Response") == 0)
127:                    lastQuestion.addResponse(new Integer((String) attribs
128:                            .get("id")).intValue(), content);
129:                else if (type.compareToIgnoreCase("QuestionManager") == 0) {
130:                    int slots = new Integer((String) attribs.get("slots"))
131:                            .intValue();
132:                    int width = new Integer((String) attribs.get("w"))
133:                            .intValue();
134:                    int height = new Integer((String) attribs.get("h"))
135:                            .intValue();
136:                    for (int i = 0; i < slots; i++) {
137:                        Component comp = lastQuestion = (XQuestion) cf
138:                                .addComponent("Question", 0, 0, width, height,
139:                                        "");
140:                        comp.setName(name);
141:                        ((XTextHolder) comp).setText(content);
142:                        lastQuestion.setAttribute("ref", "next");
143:                    }
144:                    nextValue = 0;
145:                }
146:
147:                return lastQuestion;
148:            }
149:
150:            /**
151:             * Get the component adapter for this type
152:             * @param type the name identifying the type
153:             */
154:            public ComponentAdapter getComponentAdapter(String type) {
155:                return null;
156:            }
157:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.