Source Code Cross Referenced for XEditorComponentFactory.java in  » XML-UI » XUI » net » xoetrope » builder » editor » 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 » XUI » net.xoetrope.builder.editor 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package net.xoetrope.builder.editor;
002:
003:        import java.awt.Component;
004:
005:        import net.xoetrope.xui.XPage;
006:        import net.xoetrope.xui.style.XStyleFactory;
007:        import net.xoetrope.builder.editor.components.swing.XMenuBarProxy;
008:        import net.xoetrope.builder.editor.components.swing.XPanelProxy;
009:        import java.awt.Container;
010:        import net.xoetrope.xui.style.XStyle;
011:        import net.xoetrope.builder.editor.components.swing.XComponentProxy;
012:        import java.util.HashSet;
013:        import net.xoetrope.xui.XComponentConstructor;
014:        import javax.swing.JComponent;
015:
016:        /**
017:         * A special component factory to build customized objects for use in the editor
018:         * <p>Copyright: Copyright (c) Xoetrope Ltd., 1998-2003</p>
019:         * <p>Company: Xoetrope Ltd.</p>
020:         */
021:        public class XEditorComponentFactory extends XStyleFactory {
022:            private static HashSet proxiedComponents;
023:
024:            /**
025:             * Create the StyleFactory and initialise with an XStyleManager.
026:             * @param manager the XStyleManager to initialise with
027:             */
028:            public XEditorComponentFactory(String packageName) {
029:                super (packageName);
030:                if (proxiedComponents == null)
031:                    proxiedComponents = new HashSet();
032:            }
033:
034:            /**
035:             * A generic factory for constructing XComponents.
036:             * @param type  a constant identifying the type of component to be created
037:             * @param content the component text/content
038:             */
039:            public Component constructComponent(int type, String content) {
040:                Component c = null;
041:                if (type == XPage.XCOMBO) {
042:                    XComponentProxy xcp = new XComponentProxy();
043:                    xcp.setProxiedComponent(super .constructComponent(type,
044:                            content));
045:                    return xcp;
046:                } else if (type == XPage.XLABEL) {
047:                    XComponentProxy xcp = new XComponentProxy();
048:                    xcp.setProxiedComponent(super .constructComponent(type,
049:                            content));
050:                    xcp.setText(content);
051:                    ((JComponent) xcp.getProxiedComponent()).setOpaque(true);
052:                    return xcp;
053:                } else if (type == XPage.XPANEL) {
054:                    XPanelProxy comp = new XPanelProxy();
055:                    if (parentPanel == null)
056:                        parentPanel = (Container) comp;
057:                    return comp;
058:                } else if (type == XPage.XMENUBAR) {
059:                    currentMenuBar = new XMenuBarProxy();
060:                    return (Component) currentMenuBar;
061:                } else
062:                    return super .constructComponent(type, content);
063:            }
064:
065:            /**
066:             * Apply a style to a component, looking up the style name if necessary
067:             * @param c the component to style
068:             * @param style the style name
069:             * @param lookupComp true to lookup the style based on the component class
070:             */
071:            public void applyStyle(Component c, String style, boolean lookupComp) {
072:                super .applyStyle(c, style, lookupComp);
073:
074:                if ((style == null || style.length() == 0) && (c != null)) {
075:                    String compName = XEditorUtilities.getComponentClassName(c);
076:                    super .applyStyle(c, compName);
077:                }
078:            }
079:
080:            /**
081:             * A generic factory for adding registered components via the
082:             * XComponentConstructor interface or component factories.
083:             * @param type  a name identifying the type of component to be created
084:             * @param x the left coordinate
085:             * @param y the top coordinate
086:             * @param w the width
087:             * @param h the height
088:             * @param content the component text/content
089:             */
090:            protected Component buildRegisteredComponent(String type,
091:                    String content) {
092:                int numFactories = componentFactories.size();
093:                for (int i = 0; i < numFactories; i++) {
094:                    XComponentConstructor factory = (XComponentConstructor) componentFactories
095:                            .elementAt(i);
096:                    Component comp = factory.constructComponent(this , type,
097:                            content);
098:                    if (comp != null) {
099:                        if (isComponentProxied(comp)) {
100:                            XComponentProxy xcp = new XComponentProxy();
101:                            xcp.setProxiedComponent(comp);
102:
103:                            addComponent(xcp);
104:                            return xcp;
105:                        } else
106:                            addComponent(comp);
107:                        return comp;
108:                    }
109:                }
110:                return null;
111:            }
112:
113:            /**
114:             * Check to see if this component should be proxied for use in the editor
115:             * @param c the component
116:             * @return true if it is to be proxied
117:             */
118:            protected boolean isComponentProxied(Component c) {
119:                return proxiedComponents.contains(c.getClass());
120:            }
121:
122:            /**
123:             * Adds a component to the list of proxied components
124:             * @param c the component.
125:             */
126:            public static void proxyComponent(Class c) {
127:                if (proxiedComponents == null)
128:                    proxiedComponents = new HashSet();
129:                proxiedComponents.add(c);
130:            }
131:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.