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


001:        package com.xoetrope.carousel.builder;
002:
003:        import java.util.HashSet;
004:        import java.util.Enumeration;
005:
006:        import java.awt.Component;
007:        import java.awt.Container;
008:
009:        import net.xoetrope.editor.XEditorUtilities;
010:        import net.xoetrope.editor.project.pages.components.proxy.XComponentProxy;
011:        import net.xoetrope.editor.project.pages.components.proxy.XMenuBarProxy;
012:        import net.xoetrope.editor.project.pages.components.proxy.XPanelProxy;
013:        import net.xoetrope.xui.XComponentConstructor;
014:        import net.xoetrope.xui.XProject;
015:        import net.xoetrope.xui.style.XStyleFactory;
016:
017:        /**
018:         * A special component factory to build customized objects for use in the editor
019:         * <p> Copyright (c) Xoetrope Ltd., 2001-2006, This software is licensed under
020:         * the GNU Public License (GPL), please see license.txt for more details. If
021:         * you make commercial use of this software you must purchase a commercial
022:         * license from Xoetrope.</p>
023:         * <p> $Revision: 1.2 $</p>
024:         */
025:        public class XEditorHtmlComponentFactory extends XStyleFactory {
026:            private static HashSet proxiedComponents;
027:
028:            /**
029:             * Create the StyleFactory and initialise with an XStyleManager.
030:             * @param manager the XStyleManager to initialise with
031:             */
032:            public XEditorHtmlComponentFactory(XProject project,
033:                    String packageName) {
034:                super (project, packageName);
035:                if (proxiedComponents == null)
036:                    proxiedComponents = new HashSet();
037:            }
038:
039:            /**
040:             * A generic factory for constructing XComponents.
041:             * @param type  a constant identifying the type of component to be created
042:             * @param content the component text/content
043:             */
044:            public Object constructComponent(String type, String content) {
045:                int id = getTypeCode(type);
046:                Component c = null;
047:                //    if (( id == XLABEL ) || ( id == XEDIT ) /*|| ( type == XPage.XBUTTON )*/) {
048:                //      XComponentProxy xcp = new XComponentProxy();
049:                //      xcp.setProxiedComponent( (Component)super.constructComponent( type, content ));
050:                //      xcp.setText( content );
051:                //      return xcp;
052:                //    }
053:                if (id == XPANEL) {
054:                    XPanelProxy comp = new XPanelProxy();
055:                    if (parentPanel == null)
056:                        parentPanel = (Container) comp;
057:                    return comp;
058:                } else if (id == XMENUBAR) {
059:                    currentMenuBar = new XMenuBarProxy();
060:                    return (Component) currentMenuBar;
061:                }
062:                //    else {
063:                //      c = (Component)super.constructComponent( type, content );
064:                //      if (( c == null ) && ( id == XUNKNOWN ))
065:                //        c = new XUnknown();
066:                //      else if ( !(( id == XIMAGE ) || ( id == XIMAGEMAP ) || ( id == XCOMBO ) || ( id == XHOTSPOTIMAGE )))
067:                //        return c;
068:                //      
069:                //      XComponentProxy xcp = new XComponentProxy();
070:                //      xcp.setProxiedComponent( c );
071:                //      return xcp;
072:                //    }
073:                return super .constructComponent(type, content);
074:            }
075:
076:            /**
077:             * Apply a style to a component, looking up the style name if necessary
078:             * @param c the component to style
079:             * @param style the style name
080:             * @param lookupComp true to lookup the style based on the component class
081:             */
082:            public void applyStyle(Component c, String style, boolean lookupComp) {
083:                if (c instanceof  XComponentProxy)
084:                    c = ((XComponentProxy) c).getProxiedComponent();
085:
086:                super .applyStyle(c, style, lookupComp);
087:
088:                if ((style == null || style.length() == 0) && (c != null)) {
089:                    String compName = XEditorUtilities.getComponentClassName(c);
090:                    super .applyStyle(c, compName);
091:                }
092:            }
093:
094:            /**
095:             * Called after a new component is created. Append the style to the base and
096:             * then append the component classname with '/' delimiters.
097:             * @param c Component to apply the style to.
098:             * @param style the name of the style to apply.
099:             *
100:             */
101:            public void applyStyle(Object c, String style) {
102:                if (c instanceof  XComponentProxy)
103:                    c = ((XComponentProxy) c).getProxiedComponent();
104:                super .applyStyle(c, style);
105:            }
106:
107:            /**
108:             * A generic factory for creating registered components via the
109:             * XComponentConstructor interface or component factories.
110:             * @param type  a name identifying the type of component to be created
111:             * @param x the left coordinate
112:             * @param y the top coordinate
113:             * @param w the width
114:             * @param h the height
115:             * @param content the component text/content
116:             */
117:            protected Object buildRegisteredComponent(String type,
118:                    String content) {
119:                Enumeration enumeration = componentFactories.keys();
120:                while (enumeration.hasMoreElements()) {
121:                    XComponentConstructor factory = (XComponentConstructor) componentFactories
122:                            .get(enumeration.nextElement());
123:                    Object comp = factory.constructComponent(this , type,
124:                            content);
125:                    if (comp != null) {
126:                        if (isComponentProxied(comp)) {
127:                            XComponentProxy xcp = new XComponentProxy();
128:                            xcp.setProxiedComponent((Component) comp);
129:
130:                            return xcp;
131:                        }
132:                        return comp;
133:                    }
134:                }
135:                return null;
136:            }
137:
138:            /**
139:             * Check to see if this component should be proxied for use in the editor
140:             * @param c the component
141:             * @return true if it is to be proxied
142:             */
143:            protected boolean isComponentProxied(Object c) {
144:                return proxiedComponents.contains(c.getClass());
145:            }
146:
147:            /**
148:             * Adds a component to the list of proxied components
149:             * @param c the component.
150:             */
151:            public static void proxyComponent(Class c) {
152:                if (proxiedComponents == null)
153:                    proxiedComponents = new HashSet();
154:                if (!proxiedComponents.contains(c))
155:                    proxiedComponents.add(c);
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.