Source Code Cross Referenced for AbstractComponentRenderer.java in  » Content-Management-System » contelligent » de » finix » contelligent » client » gui » 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 » Content Management System » contelligent » de.finix.contelligent.client.gui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2001-2006 C:1 Financial Services GmbH
003:         *
004:         * This software is free software; you can redistribute it and/or
005:         * modify it under the terms of the GNU Lesser General Public
006:         * License Version 2.1, as published by the Free Software Foundation.
007:         *
008:         * This software is distributed in the hope that it will be useful,
009:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
010:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
011:         * Lesser General Public License for more details.
012:         *
013:         * You should have received a copy of the GNU Lesser General Public
014:         * License along with this library; if not, write to the Free Software
015:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
016:         */
017:
018:        package de.finix.contelligent.client.gui;
019:
020:        import java.awt.BorderLayout;
021:        import java.awt.Color;
022:        import java.util.logging.Level;
023:        import java.util.logging.Logger;
024:
025:        import javax.swing.Action;
026:        import javax.swing.JPanel;
027:        import javax.swing.border.Border;
028:        import javax.swing.border.LineBorder;
029:
030:        import de.finix.contelligent.client.base.ComponentFactory;
031:        import de.finix.contelligent.client.base.ComponentPath;
032:        import de.finix.contelligent.client.base.ContelligentComponent;
033:        import de.finix.contelligent.client.event.ComponentEventListener;
034:        import de.finix.contelligent.client.event.ContelligentComponentEvent;
035:        import de.finix.contelligent.client.event.ContelligentEvent;
036:        import de.finix.contelligent.client.event.ContelligentEventDispatcher;
037:
038:        public abstract class AbstractComponentRenderer extends JPanel
039:                implements  ComponentRenderer, ComponentEventListener {
040:
041:            private static Logger logger = Logger
042:                    .getLogger(AbstractComponentEditor.class.getName());
043:
044:            protected final static Border UNDEFINED_BORDER = new LineBorder(
045:                    Color.orange, 2);
046:
047:            protected final static Border UNKNOWN_BORDER = new LineBorder(
048:                    Color.red, 1);
049:
050:            protected final Border DEFAULT_BORDER = getBorder();
051:
052:            private ContelligentComponent component = null;
053:
054:            private View view = null;
055:
056:            private GUI gui;
057:
058:            public AbstractComponentRenderer() {
059:                super (new BorderLayout());
060:                setOpaque(false);
061:                ComponentFactory.getInstance().addComponentEventListener(this ,
062:                        ContelligentEventDispatcher.DOES_USE_SWING);
063:            }
064:
065:            /**
066:             * Counter-part to {@link AbstractComponentEditor#updateComponent}. Loads
067:             * values from component to be displayed in renderer. Needs to be implemented
068:             * by sub class.
069:             */
070:            abstract public void update();
071:
072:            public void setComponent(ContelligentComponent component) {
073:                this .component = component;
074:            }
075:
076:            public ContelligentComponent getComponent() {
077:                return component;
078:            }
079:
080:            public void setView(View view) {
081:                this .view = view;
082:            }
083:
084:            public View getView() {
085:                return view;
086:            }
087:
088:            public void setGUI(GUI gui) {
089:                this .gui = gui;
090:            }
091:
092:            public GUI getGUI() {
093:                return gui;
094:            }
095:
096:            /**
097:             * Reacts on the event that the component represented by this gui has
098:             * changed.
099:             */
100:            abstract protected void componentChanged(ContelligentEvent event);
101:
102:            /**
103:             * Reacts on the event that a child has been added to the component
104:             * represented by this gui.
105:             */
106:            abstract protected void childComponentAdded(ContelligentEvent event);
107:
108:            /**
109:             * Reacts on the event that a child has been removed to the component
110:             * represented by this gui.
111:             */
112:            abstract protected void childComponentRemoved(
113:                    ContelligentEvent event);
114:
115:            /**
116:             * Reacts on the event that a child of the component represented by this gui
117:             * has changed.
118:             */
119:            abstract protected void childComponentChanged(
120:                    ContelligentEvent event);
121:
122:            /**
123:             * Reacts on the event that a descendent - i.e not a direct, but indirect
124:             * child - of the component represented by this gui has changed.
125:             */
126:            abstract protected void descendentComponentChanged(
127:                    ContelligentEvent event);
128:
129:            public void onComponentAdded(ContelligentComponentEvent event) {
130:                logger.log(Level.FINE, "event: " + event);
131:
132:                // How am I related to this event?
133:                boolean isMyChild = isMyChild(event.getTarget());
134:                boolean isMyDescendent = isMyDescendent(event.getTarget());
135:
136:                if (isMyChild) {
137:                    logger.log(Level.FINE, "component added: " + event);
138:                    childComponentAdded(event);
139:                } else if (isMyDescendent) {
140:                    logger.log(Level.FINE, "descendent component changed: "
141:                            + event);
142:                    descendentComponentChanged(event);
143:                }
144:
145:            }
146:
147:            public void onComponentRemoved(ContelligentComponentEvent event) {
148:                logger.log(Level.FINE, "event: " + event);
149:
150:                // How am I related to this event?
151:                boolean isMyChild = isMyChild(event.getTarget());
152:                boolean isMyDescendent = isMyDescendent(event.getTarget());
153:
154:                if (isMyChild) {
155:                    logger.log(Level.FINE, "child component removed: " + event);
156:                    childComponentRemoved(event);
157:                } else if (isMyDescendent) {
158:                    logger.log(Level.FINE, "descendent component changed: "
159:                            + event);
160:                    descendentComponentChanged(event);
161:                }
162:            }
163:
164:            public void onComponentChanged(ContelligentComponentEvent event) {
165:                logger.log(Level.FINE, "event: " + event);
166:
167:                // How am I related to this event?
168:                boolean isMe = isMe(event.getTarget());
169:                boolean isMyChild = isMyChild(event.getTarget());
170:                boolean isMyDescendent = isMyDescendent(event.getTarget());
171:
172:                if (isMe) {
173:                    logger.log(Level.FINE, "component changed: " + event);
174:                    componentChanged(event);
175:                } else if (isMyChild) {
176:                    logger.log(Level.FINE, "child component changed: " + event);
177:                    childComponentChanged(event);
178:                } else if (isMyDescendent) {
179:                    logger.log(Level.FINE, "descendent component changed: "
180:                            + event);
181:                    descendentComponentChanged(event);
182:                }
183:            }
184:
185:            /** default is to have no actions */
186:            public Action[] getActions() {
187:                return new Action[] {};
188:            }
189:
190:            /**
191:             * This method is used to determine whether the given server and path equals
192:             * the server and path of the component of this renderer.
193:             */
194:            private boolean isMe(String path) {
195:                if (path == null)
196:                    return false;
197:                String myPath = getMyPath();
198:                return (myPath.equals(ComponentPath.toComponentPath(path)));
199:            }
200:
201:            /**
202:             * This method is used to determine whether the given server and path
203:             * represents a child component of the component of this renderer.
204:             */
205:            private boolean isMyChild(String path) {
206:                if (path == null)
207:                    return false;
208:                String myPath = getMyPath();
209:                return (myPath.equals(ComponentPath.getComponentDir(path)));
210:            }
211:
212:            /**
213:             * This method is used to determine whether the given server and path
214:             * represents a descendent component of the component of this renderer.
215:             */
216:            private boolean isMyDescendent(String path) {
217:                if (path == null)
218:                    return false;
219:                String myPath = getMyPath();
220:
221:                return ((ComponentPath.toComponentPath(path).length() > myPath
222:                        .length()) && ComponentPath.toComponentPath(path)
223:                        .startsWith(myPath));
224:            }
225:
226:            private String getMyPath() {
227:                String myPath = ComponentPath.toComponentPath(getComponent()
228:                        .getPath());
229:                return myPath;
230:            }
231:
232:            public boolean isScalable() {
233:                return false;
234:            }
235:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.