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


001:        package net.xoetrope.builder.editor.components.swing;
002:
003:        import java.awt.Color;
004:        import java.awt.Component;
005:        import java.awt.Dimension;
006:        import java.awt.event.MouseEvent;
007:        import java.awt.event.MouseListener;
008:        import javax.swing.JComponent;
009:        import javax.swing.JPanel;
010:
011:        import net.xoetrope.xui.XListHolder;
012:        import net.xoetrope.xui.XStateHolder;
013:        import net.xoetrope.xui.XTextHolder;
014:        import java.awt.event.ComponentListener;
015:        import java.awt.event.ComponentEvent;
016:        import java.awt.Font;
017:        import net.xoetrope.xui.XAttributedComponent;
018:
019:        /**
020:         * A stand-in for a component while it is being edited. Some components are
021:         * compound entities and we do not want the individual sub components to be
022:         * selected instead of 'this' component. Some others react to the mouse and
023:         * provide undesireable behavior on their own. This proxy adds the type of
024:         * interface required by the editor.
025:         * <p>Copyright (c) Xoetrope Ltd., 1998-2004</p>
026:         * <p> $Revision: 1.4 $</p>
027:         * <p> License: see License.txt</p>
028:         */
029:        public class XComponentProxy extends JComponent implements  XTextHolder,
030:                XListHolder, XStateHolder, MouseListener, ComponentListener,
031:                XAttributedComponent {
032:            Component proxiedComponent;
033:            GlassPanel glassPanel;
034:
035:            public XComponentProxy() {
036:                setLayout(null);
037:                glassPanel = new GlassPanel();
038:                glassPanel.setOpaque(false);
039:                glassPanel.setBackground(Color.red);
040:
041:            }
042:
043:            /**
044:             * Set the component that is being proxied
045:             * @param comp the component
046:             */
047:            public void setProxiedComponent(Component comp) {
048:                proxiedComponent = comp;
049:                //    comp.addMouseListener( this );
050:                glassPanel.addMouseListener(this );
051:                addComponentListener(this );
052:
053:                add(glassPanel);
054:                add(comp);
055:            }
056:
057:            /**
058:             * Get the proxied component
059:             * @return the component
060:             */
061:            public Component getProxiedComponent() {
062:                return proxiedComponent;
063:            }
064:
065:            /**
066:             * Is the component focusable? Always returns true so that the component can
067:             * be selected in the editor
068:             * @return true
069:             */
070:            public boolean isFocusable() {
071:                return true;
072:            }
073:
074:            //- XTextHolder methods-------------------------------------------------------
075:            /**
076:             * Set the text/label of a component
077:             * @param label the new text
078:             */
079:            public void setText(String text) {
080:                ((XTextHolder) proxiedComponent).setText(text);
081:            }
082:
083:            /**
084:             * Get the text/label of a component
085:             * @return the component's text
086:             */
087:            public String getText() {
088:                return ((XTextHolder) proxiedComponent).getText();
089:            }
090:
091:            //- XTextHolder methods-------------------------------------------------------
092:
093:            //- XStateHolder methods-------------------------------------------------------
094:            /**
095:             * Get the component state
096:             * @return the object state
097:             */
098:            public Object getComponentState() {
099:                return null;
100:            }
101:
102:            /**
103:             * Set the component state
104:             * @param the new component state
105:             */
106:            public void setComponentState(Object object) {
107:            }
108:
109:            //- XStateHolder methods-------------------------------------------------------
110:
111:            //- XListHolder methods-------------------------------------------------------
112:            /**
113:             * Get the number of items in the list
114:             * @return the number of items
115:             */
116:            public int getItemCount() {
117:                return 0;
118:            }
119:
120:            /**
121:             * Remove all items from the list
122:             */
123:            public void removeAll() {
124:            }
125:
126:            /**
127:             * Add an item to the list
128:             * @param s the new Item
129:             */
130:            public void addItem(String s) {
131:            }
132:
133:            /**
134:             * Select an item
135:             * @param i the index of the item to select
136:             */
137:            public void select(int i) {
138:            }
139:
140:            /**
141:             * Select an item
142:             * @param i the index of the item to select
143:             */
144:            public void select(Object o) {
145:            }
146:
147:            /**
148:             * Get the selected object
149:             * @return the selected object
150:             */
151:            public Object getSelectedObject() {
152:                return null;
153:            }
154:
155:            //- XListHolder methods-------------------------------------------------------
156:
157:            //- MouseListener methods-----------------------------------------------------
158:            /**
159:             * Invoked when the mouse button has been clicked (pressed
160:             * and released) on a component.
161:             */
162:            public void mouseClicked(MouseEvent e) {
163:            }
164:
165:            /**
166:             * Invoked when a mouse button has been pressed on a component.
167:             */
168:            public void mousePressed(MouseEvent e) {
169:            }
170:
171:            /**
172:             * Invoked when a mouse button has been released on a component.
173:             */
174:            public void mouseReleased(MouseEvent e) {
175:                MouseListener mel[] = this .getMouseListeners();
176:                MouseEvent me = new MouseEvent(this , e.getID(), e.getWhen(), e
177:                        .getModifiers(), e.getX(), e.getY(), e.getClickCount(),
178:                        e.isPopupTrigger());
179:                if (mel.length > 0)
180:                    mel[0].mouseReleased(me);
181:            }
182:
183:            /**
184:             * Invoked when the mouse enters a component.
185:             */
186:            public void mouseEntered(MouseEvent e) {
187:            }
188:
189:            /**
190:             * Invoked when the mouse exits a component.
191:             */
192:            public void mouseExited(MouseEvent e) {
193:            }
194:
195:            //- MouseListener methods-----------------------------------------------------
196:
197:            //- ComponentListener methods-------------------------------------------------
198:            /**
199:             * Invoked when the component's size changes.
200:             */
201:            public void componentResized(ComponentEvent e) {
202:                Dimension newSize = getSize();
203:                proxiedComponent.setSize(newSize);
204:                glassPanel.setSize(newSize);
205:            }
206:
207:            public void setForeground(Color c) {
208:                proxiedComponent.setForeground(c);
209:            }
210:
211:            public void setBackground(Color c) {
212:                proxiedComponent.setBackground(c);
213:            }
214:
215:            public void setFont(Font f) {
216:                proxiedComponent.setFont(f);
217:            }
218:
219:            public void repaint() {
220:                proxiedComponent.repaint();
221:                super .repaint();
222:            }
223:
224:            public void setAttribute(String name, String value) {
225:                if (proxiedComponent instanceof  XAttributedComponent)
226:                    ((XAttributedComponent) proxiedComponent).setAttribute(
227:                            name, value);
228:            }
229:
230:            /**
231:             * Invoked when the component's position changes.
232:             */
233:            public void componentMoved(ComponentEvent e) {
234:            }
235:
236:            /**
237:             * Invoked when the component has been made visible.
238:             */
239:            public void componentShown(ComponentEvent e) {
240:            }
241:
242:            /**
243:             * Invoked when the component has been made invisible.
244:             */
245:            public void componentHidden(ComponentEvent e) {
246:            }
247:            //- ComponentListener methods-------------------------------------------------
248:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.