Source Code Cross Referenced for JThis.java in  » Swing-Library » jEdit » org » gjt » sp » jedit » bsh » 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 » Swing Library » jEdit » org.gjt.sp.jedit.bsh 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*****************************************************************************
002:         *                                                                           *
003:         *  This file is part of the BeanShell Java Scripting distribution.          *
004:         *  Documentation and updates may be found at http://www.beanshell.org/      *
005:         *                                                                           *
006:         *  Sun Public License Notice:                                               *
007:         *                                                                           *
008:         *  The contents of this file are subject to the Sun Public License Version  *
009:         *  1.0 (the "License"); you may not use this file except in compliance with *
010:         *  the License. A copy of the License is available at http://www.sun.com    * 
011:         *                                                                           *
012:         *  The Original Code is BeanShell. The Initial Developer of the Original    *
013:         *  Code is Pat Niemeyer. Portions created by Pat Niemeyer are Copyright     *
014:         *  (C) 2000.  All Rights Reserved.                                          *
015:         *                                                                           *
016:         *  GNU Public License Notice:                                               *
017:         *                                                                           *
018:         *  Alternatively, the contents of this file may be used under the terms of  *
019:         *  the GNU Lesser General Public License (the "LGPL"), in which case the    *
020:         *  provisions of LGPL are applicable instead of those above. If you wish to *
021:         *  allow use of your version of this file only under the  terms of the LGPL *
022:         *  and not to allow others to use your version of this file under the SPL,  *
023:         *  indicate your decision by deleting the provisions above and replace      *
024:         *  them with the notice and other provisions required by the LGPL.  If you  *
025:         *  do not delete the provisions above, a recipient may use your version of  *
026:         *  this file under either the SPL or the LGPL.                              *
027:         *                                                                           *
028:         *  Patrick Niemeyer (pat@pat.net)                                           *
029:         *  Author of Learning Java, O'Reilly & Associates                           *
030:         *  http://www.pat.net/~pat/                                                 *
031:         *                                                                           *
032:         *****************************************************************************/package org.gjt.sp.jedit.bsh;
033:
034:        import java.awt.event.*;
035:        import javax.swing.event.*;
036:        import java.beans.*;
037:
038:        /**
039:         JThis is a dynamically loaded extension which extends This and adds 
040:         explicit support for AWT and JFC events, etc.  This is a backwards 
041:         compatability measure for JDK 1.2.  With 1.3+ there is a general 
042:         reflection proxy mechanism that allows the base This to implement 
043:         arbitrary interfaces.
044:
045:         The NameSpace getThis() method will produce instances of JThis if 
046:         the java version is prior to 1.3 and swing is available...  (e.g. 1.2
047:         or 1.1 + swing installed)  
048:
049:         Users of 1.1 without swing will have minimal interface support (just run()).
050:        
051:         Bsh doesn't run on 1.02 and below because there is no reflection! 
052:
053:         Note: This module relies on features of Swing and will only compile
054:         with JDK1.2 or JDK1.1 + the swing package.  For other environments simply 
055:         do not compile this class.
056:         */
057:        class JThis extends This
058:                implements 
059:                // All core AWT listeners
060:                ActionListener, AdjustmentListener,
061:                ComponentListener,
062:                ContainerListener,
063:                FocusListener,
064:                ItemListener,
065:                KeyListener,
066:                MouseListener,
067:                MouseMotionListener,
068:                TextListener,
069:                WindowListener,
070:                PropertyChangeListener,
071:                // All listeners in javax.swing.event as of Swing 1.1
072:                AncestorListener, CaretListener, CellEditorListener,
073:                ChangeListener, DocumentListener, HyperlinkListener,
074:                InternalFrameListener, ListDataListener, ListSelectionListener,
075:                MenuDragMouseListener, MenuKeyListener, MenuListener,
076:                MouseInputListener, PopupMenuListener,
077:                TableColumnModelListener, TableModelListener,
078:                TreeExpansionListener, TreeModelListener,
079:                TreeSelectionListener, TreeWillExpandListener,
080:                UndoableEditListener {
081:
082:            JThis(NameSpace namespace, Interpreter declaringInterp) {
083:                super (namespace, declaringInterp);
084:            }
085:
086:            public String toString() {
087:                return "'this' reference (JThis) to Bsh object: "
088:                        + namespace.getName();
089:            }
090:
091:            void event(String name, Object event) {
092:                CallStack callstack = new CallStack(namespace);
093:                BshMethod method = null;
094:
095:                // handleEvent gets all events
096:                try {
097:                    method = namespace.getMethod("handleEvent",
098:                            new Class[] { null });
099:                } catch (UtilEvalError e) {/*squeltch*/
100:                }
101:
102:                if (method != null)
103:                    try {
104:                        method.invoke(new Object[] { event },
105:                                declaringInterpreter, callstack, null);
106:                    } catch (EvalError e) {
107:                        declaringInterpreter
108:                                .error("local event hander method invocation error:"
109:                                        + e);
110:                    }
111:
112:                // send to specific event handler
113:                try {
114:                    method = namespace.getMethod(name, new Class[] { null });
115:                } catch (UtilEvalError e) { /*squeltch*/
116:                }
117:                if (method != null)
118:                    try {
119:                        method.invoke(new Object[] { event },
120:                                declaringInterpreter, callstack, null);
121:                    } catch (EvalError e) {
122:                        declaringInterpreter
123:                                .error("local event hander method invocation error:"
124:                                        + e);
125:                    }
126:            }
127:
128:            // Listener interfaces
129:
130:            public void ancestorAdded(AncestorEvent e) {
131:                event("ancestorAdded", e);
132:            }
133:
134:            public void ancestorRemoved(AncestorEvent e) {
135:                event("ancestorRemoved", e);
136:            }
137:
138:            public void ancestorMoved(AncestorEvent e) {
139:                event("ancestorMoved", e);
140:            }
141:
142:            public void caretUpdate(CaretEvent e) {
143:                event("caretUpdate", e);
144:            }
145:
146:            public void editingStopped(ChangeEvent e) {
147:                event("editingStopped", e);
148:            }
149:
150:            public void editingCanceled(ChangeEvent e) {
151:                event("editingCanceled", e);
152:            }
153:
154:            public void stateChanged(ChangeEvent e) {
155:                event("stateChanged", e);
156:            }
157:
158:            public void insertUpdate(DocumentEvent e) {
159:                event("insertUpdate", e);
160:            }
161:
162:            public void removeUpdate(DocumentEvent e) {
163:                event("removeUpdate", e);
164:            }
165:
166:            public void changedUpdate(DocumentEvent e) {
167:                event("changedUpdate", e);
168:            }
169:
170:            public void hyperlinkUpdate(HyperlinkEvent e) {
171:                event("internalFrameOpened", e);
172:            }
173:
174:            public void internalFrameOpened(InternalFrameEvent e) {
175:                event("internalFrameOpened", e);
176:            }
177:
178:            public void internalFrameClosing(InternalFrameEvent e) {
179:                event("internalFrameClosing", e);
180:            }
181:
182:            public void internalFrameClosed(InternalFrameEvent e) {
183:                event("internalFrameClosed", e);
184:            }
185:
186:            public void internalFrameIconified(InternalFrameEvent e) {
187:                event("internalFrameIconified", e);
188:            }
189:
190:            public void internalFrameDeiconified(InternalFrameEvent e) {
191:                event("internalFrameDeiconified", e);
192:            }
193:
194:            public void internalFrameActivated(InternalFrameEvent e) {
195:                event("internalFrameActivated", e);
196:            }
197:
198:            public void internalFrameDeactivated(InternalFrameEvent e) {
199:                event("internalFrameDeactivated", e);
200:            }
201:
202:            public void intervalAdded(ListDataEvent e) {
203:                event("intervalAdded", e);
204:            }
205:
206:            public void intervalRemoved(ListDataEvent e) {
207:                event("intervalRemoved", e);
208:            }
209:
210:            public void contentsChanged(ListDataEvent e) {
211:                event("contentsChanged", e);
212:            }
213:
214:            public void valueChanged(ListSelectionEvent e) {
215:                event("valueChanged", e);
216:            }
217:
218:            public void menuDragMouseEntered(MenuDragMouseEvent e) {
219:                event("menuDragMouseEntered", e);
220:            }
221:
222:            public void menuDragMouseExited(MenuDragMouseEvent e) {
223:                event("menuDragMouseExited", e);
224:            }
225:
226:            public void menuDragMouseDragged(MenuDragMouseEvent e) {
227:                event("menuDragMouseDragged", e);
228:            }
229:
230:            public void menuDragMouseReleased(MenuDragMouseEvent e) {
231:                event("menuDragMouseReleased", e);
232:            }
233:
234:            public void menuKeyTyped(MenuKeyEvent e) {
235:                event("menuKeyTyped", e);
236:            }
237:
238:            public void menuKeyPressed(MenuKeyEvent e) {
239:                event("menuKeyPressed", e);
240:            }
241:
242:            public void menuKeyReleased(MenuKeyEvent e) {
243:                event("menuKeyReleased", e);
244:            }
245:
246:            public void menuSelected(MenuEvent e) {
247:                event("menuSelected", e);
248:            }
249:
250:            public void menuDeselected(MenuEvent e) {
251:                event("menuDeselected", e);
252:            }
253:
254:            public void menuCanceled(MenuEvent e) {
255:                event("menuCanceled", e);
256:            }
257:
258:            public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
259:                event("popupMenuWillBecomeVisible", e);
260:            }
261:
262:            public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
263:                event("popupMenuWillBecomeInvisible", e);
264:            }
265:
266:            public void popupMenuCanceled(PopupMenuEvent e) {
267:                event("popupMenuCanceled", e);
268:            }
269:
270:            public void columnAdded(TableColumnModelEvent e) {
271:                event("columnAdded", e);
272:            }
273:
274:            public void columnRemoved(TableColumnModelEvent e) {
275:                event("columnRemoved", e);
276:            }
277:
278:            public void columnMoved(TableColumnModelEvent e) {
279:                event("columnMoved", e);
280:            }
281:
282:            public void columnMarginChanged(ChangeEvent e) {
283:                event("columnMarginChanged", e);
284:            }
285:
286:            public void columnSelectionChanged(ListSelectionEvent e) {
287:                event("columnSelectionChanged", e);
288:            }
289:
290:            public void tableChanged(TableModelEvent e) {
291:                event("tableChanged", e);
292:            }
293:
294:            public void treeExpanded(TreeExpansionEvent e) {
295:                event("treeExpanded", e);
296:            }
297:
298:            public void treeCollapsed(TreeExpansionEvent e) {
299:                event("treeCollapsed", e);
300:            }
301:
302:            public void treeNodesChanged(TreeModelEvent e) {
303:                event("treeNodesChanged", e);
304:            }
305:
306:            public void treeNodesInserted(TreeModelEvent e) {
307:                event("treeNodesInserted", e);
308:            }
309:
310:            public void treeNodesRemoved(TreeModelEvent e) {
311:                event("treeNodesRemoved", e);
312:            }
313:
314:            public void treeStructureChanged(TreeModelEvent e) {
315:                event("treeStructureChanged", e);
316:            }
317:
318:            public void valueChanged(TreeSelectionEvent e) {
319:                event("valueChanged", e);
320:            }
321:
322:            public void treeWillExpand(TreeExpansionEvent e) {
323:                event("treeWillExpand", e);
324:            }
325:
326:            public void treeWillCollapse(TreeExpansionEvent e) {
327:                event("treeWillCollapse", e);
328:            }
329:
330:            public void undoableEditHappened(UndoableEditEvent e) {
331:                event("undoableEditHappened", e);
332:            }
333:
334:            // Listener interfaces
335:            public void actionPerformed(ActionEvent e) {
336:                event("actionPerformed", e);
337:            }
338:
339:            public void adjustmentValueChanged(AdjustmentEvent e) {
340:                event("adjustmentValueChanged", e);
341:            }
342:
343:            public void componentResized(ComponentEvent e) {
344:                event("componentResized", e);
345:            }
346:
347:            public void componentMoved(ComponentEvent e) {
348:                event("componentMoved", e);
349:            }
350:
351:            public void componentShown(ComponentEvent e) {
352:                event("componentShown", e);
353:            }
354:
355:            public void componentHidden(ComponentEvent e) {
356:                event("componentHidden", e);
357:            }
358:
359:            public void componentAdded(ContainerEvent e) {
360:                event("componentAdded", e);
361:            }
362:
363:            public void componentRemoved(ContainerEvent e) {
364:                event("componentRemoved", e);
365:            }
366:
367:            public void focusGained(FocusEvent e) {
368:                event("focusGained", e);
369:            }
370:
371:            public void focusLost(FocusEvent e) {
372:                event("focusLost", e);
373:            }
374:
375:            public void itemStateChanged(ItemEvent e) {
376:                event("itemStateChanged", e);
377:            }
378:
379:            public void keyTyped(KeyEvent e) {
380:                event("keyTyped", e);
381:            }
382:
383:            public void keyPressed(KeyEvent e) {
384:                event("keyPressed", e);
385:            }
386:
387:            public void keyReleased(KeyEvent e) {
388:                event("keyReleased", e);
389:            }
390:
391:            public void mouseClicked(MouseEvent e) {
392:                event("mouseClicked", e);
393:            }
394:
395:            public void mousePressed(MouseEvent e) {
396:                event("mousePressed", e);
397:            }
398:
399:            public void mouseReleased(MouseEvent e) {
400:                event("mouseReleased", e);
401:            }
402:
403:            public void mouseEntered(MouseEvent e) {
404:                event("mouseEntered", e);
405:            }
406:
407:            public void mouseExited(MouseEvent e) {
408:                event("mouseExited", e);
409:            }
410:
411:            public void mouseDragged(MouseEvent e) {
412:                event("mouseDragged", e);
413:            }
414:
415:            public void mouseMoved(MouseEvent e) {
416:                event("mouseMoved", e);
417:            }
418:
419:            public void textValueChanged(TextEvent e) {
420:                event("textValueChanged", e);
421:            }
422:
423:            public void windowOpened(WindowEvent e) {
424:                event("windowOpened", e);
425:            }
426:
427:            public void windowClosing(WindowEvent e) {
428:                event("windowClosing", e);
429:            }
430:
431:            public void windowClosed(WindowEvent e) {
432:                event("windowClosed", e);
433:            }
434:
435:            public void windowIconified(WindowEvent e) {
436:                event("windowIconified", e);
437:            }
438:
439:            public void windowDeiconified(WindowEvent e) {
440:                event("windowDeiconified", e);
441:            }
442:
443:            public void windowActivated(WindowEvent e) {
444:                event("windowActivated", e);
445:            }
446:
447:            public void windowDeactivated(WindowEvent e) {
448:                event("windowDeactivated", e);
449:            }
450:
451:            public void propertyChange(PropertyChangeEvent e) {
452:                event("propertyChange", e);
453:            }
454:
455:            public void vetoableChange(PropertyChangeEvent e) {
456:                event("vetoableChange", e);
457:            }
458:
459:            public boolean imageUpdate(java.awt.Image img, int infoflags,
460:                    int x, int y, int width, int height) {
461:
462:                BshMethod method = null;
463:                try {
464:                    method = namespace.getMethod("imageUpdate", new Class[] {
465:                            null, null, null, null, null, null });
466:                } catch (UtilEvalError e) {/*squeltch*/
467:                }
468:
469:                if (method != null)
470:                    try {
471:                        CallStack callstack = new CallStack(namespace);
472:                        method.invoke(new Object[] { img,
473:                                new Primitive(infoflags), new Primitive(x),
474:                                new Primitive(y), new Primitive(width),
475:                                new Primitive(height) }, declaringInterpreter,
476:                                callstack, null);
477:                    } catch (EvalError e) {
478:                        declaringInterpreter
479:                                .error("local event handler imageUpdate: method invocation error:"
480:                                        + e);
481:                    }
482:                return true;
483:            }
484:
485:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.