Source Code Cross Referenced for IUnEventChannel.java in  » J2EE » WiSerFramework » de » ug2t » unifiedGui » interfaces » 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 » J2EE » WiSerFramework » de.ug2t.unifiedGui.interfaces 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // @@
002:        // @@
003:        /*
004:         * Wi.Ser Framework
005:         *
006:         * Version: 1.8.1, 20-September-2007  
007:         * Copyright (C) 2005 Dirk von der Weiden <dvdw@imail.de>
008:         *
009:         * This library is free software; you can redistribute it and/or
010:         * modify it under the terms of the GNU Lesser General Public
011:         * License as published by the Free Software Foundation; either
012:         * version 2 of the License, or (at your option) any later version.
013:         *
014:         * This library is distributed in the hope that it will be useful,
015:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
016:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
017:         * Lesser General Public License for more details.
018:         *
019:         * You should have received a copy of the GNU Lesser General Public
020:         * License along with this library located in LGPL.txt in the 
021:         * license directory; if not, write to the 
022:         * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
023:         * Boston, MA  02111-1307, USA.
024:         * 
025:         * If this agreement does not cover your requirements, please contact us
026:         * via email to get detailed information about the commercial license 
027:         * or our service offerings!
028:         *
029:         */
030:        // @@
031:        package de.ug2t.unifiedGui.interfaces;
032:
033:        import java.awt.*;
034:        import java.util.*;
035:
036:        import de.ug2t.kernel.*;
037:        import de.ug2t.kernel.interfaces.*;
038:        import de.ug2t.unifiedGui.*;
039:        import de.ug2t.unifiedGui.interfaces.IUnTextInputComponent.*;
040:
041:        /**
042:         * @author Dirk
043:         * 
044:         * date: 10.09.2003 project: WiSer-Framework
045:         * 
046:         * <p>
047:         * This is the common interface to an event-channel. The purpose of an
048:         * event-channel is to receive, transport and deliver an event. The current
049:         * interface supports the following event-types: Drag, Drop, Getfocus, Lostfocus
050:         * and Click
051:         * </p>
052:         */
053:        public interface IUnEventChannel extends IKeTreeNode {
054:            public static final String[] EVENTs = { "DRAG", "DROP", "GETFOCUS",
055:                    "LOSTFOCUS", "CLICK", "KEYACTION", "MOUSEENTER",
056:                    "MOUSELEAVE", "SCROLLED", "DBCLICK", "MOVE", "RCLICK",
057:                    "SELECT", "POSITION" };
058:
059:            public static final int EVENT_DRAG = 0; // OK
060:            public static final int EVENT_DROP = 1; // OK
061:            public static final int EVENT_GETF = 2; // OK
062:            public static final int EVENT_LOSTF = 3; // OK
063:            public static final int EVENT_CLICK = 4; // OK
064:            public static final int EVENT_KEYACTION = 5; // OK
065:            public static final int EVENT_MOUSEENTER = 6; // OK
066:            public static final int EVENT_MOUSELEAVE = 7; // OK
067:            public static final int EVENT_SCROLL = 8; // OK
068:            public static final int EVENT_DBCLICK = 9; // OK
069:            public static final int EVENT_MOVE = 10; // OK
070:            public static final int EVENT_RCLICK = 11; // OK
071:            public static final int EVENT_SELECT = 12; // OK
072:            public static final int EVENT_POSITION = 13; // OK
073:
074:            /**
075:             * @author Dirk
076:             * 
077:             * date: 29.05.2007 project: WiSer-Framework
078:             * 
079:             * <p>
080:             * Factory is a convenience class to create components of the surrounding
081:             * interface's type without taking care for the WidgetServer MultiChannel API.
082:             * It's use is similar to a constructor.
083:             * </p>
084:             */
085:            public static class Factory {
086:                /**
087:                 * Creates a standard version of this component as described in the factory.
088:                 * If you create masses of components for e.g. within a renderer use
089:                 * <i> create(IUnApplication xAppl)</i> for performance
090:                 * reasons.
091:                 * 
092:                 * @param xEType
093:                 *          EVENT_DRAG, EVENT_DROP, EVENT_GETF, EVENT_LOSTF, EVENT_CLICK,
094:                 *          EVENT_RCLICK, EVENT_MOVE
095:                 * @return new component
096:                 */
097:                public static IUnEventChannel create(int xEType) {
098:                    IUnApplication l_appl = (IUnApplication) KeRegisteredObject
099:                            .pcmf_getObjByName(IUnApplication.MY_APPL);
100:                    return (l_appl.pcmf_getComponentFactory()
101:                            .pcmf_createEvChannel(l_appl.pcmf_getApplType(),
102:                                    "", xEType, l_appl));
103:                }
104:
105:                /**
106:                 * Creates a special version of this component as described in the factory
107:                 * configuration under the descriptor xFactoryDesc. If you create masses of
108:                 * components for e.g. within a renderer use <i>
109:                 * create(IUnApplication xAppl, String xFactoryDesc)</i> for performance
110:                 * reasons.
111:                 * 
112:                 * @param xEType
113:                 *          EVENT_DRAG, EVENT_DROP, EVENT_GETF, EVENT_LOSTF, EVENT_CLICK,
114:                 *          EVENT_RCLICK, EVENT_MOVE
115:                 * @param xFactoryDesc
116:                 *          descriptor
117:                 * @return new component
118:                 */
119:                public static IUnEventChannel create(int xEType,
120:                        String xFactoryDesc) {
121:                    IUnApplication l_appl = (IUnApplication) KeRegisteredObject
122:                            .pcmf_getObjByName(IUnApplication.MY_APPL);
123:                    return (l_appl.pcmf_getComponentFactory()
124:                            .pcmf_createEvChannelPlugin(l_appl
125:                                    .pcmf_getApplType(), "", xEType, l_appl,
126:                                    xFactoryDesc));
127:                }
128:
129:                /**
130:                 * Creates a standard version of this component as described in the factory
131:                 * within the given application-context. If you create masses of components
132:                 * for e.g. within a renderer use this method for performance reasons.
133:                 * 
134:                 * @param xEType
135:                 *          EVENT_DRAG, EVENT_DROP, EVENT_GETF, EVENT_LOSTF, EVENT_CLICK,
136:                 *          EVENT_RCLICK, EVENT_MOVE
137:                 * @param xAppl
138:                 *          application in which context the component is created
139:                 * @return new component
140:                 */
141:                public static IUnEventChannel create(int xEType,
142:                        IUnApplication xAppl) {
143:                    return (xAppl.pcmf_getComponentFactory()
144:                            .pcmf_createEvChannel(xAppl.pcmf_getApplType(), "",
145:                                    xEType, xAppl));
146:                }
147:
148:                /**
149:                 * Creates a special version of this component as described in the factory
150:                 * configuration under the descriptor xFactoryDesc. If you create masses of
151:                 * components for e.g. within a renderer use this function for performance
152:                 * reasons.
153:                 * 
154:                 * @param xEType
155:                 *          EVENT_DRAG, EVENT_DROP, EVENT_GETF, EVENT_LOSTF, EVENT_CLICK,
156:                 *          EVENT_RCLICK, EVENT_MOVE
157:                 * @param xFactoryDesc
158:                 *          descriptor
159:                 * @param xAppl
160:                 *          application in which context the component is created
161:                 * @return new component
162:                 */
163:                public static IUnEventChannel create(int xEType,
164:                        IUnApplication xAppl, String xFactoryDesc) {
165:                    return (xAppl.pcmf_getComponentFactory()
166:                            .pcmf_createEvChannelPlugin(xAppl
167:                                    .pcmf_getApplType(), "", xEType, xAppl,
168:                                    xFactoryDesc));
169:                }
170:            }
171:
172:            /**
173:             * <p>
174:             * Gets the associated gui-object which implements all common methods.
175:             * </p>
176:             * <p>
177:             * 
178:             * @return gui-object
179:             *         </p>
180:             *         <p>
181:             *         </p>
182:             */
183:            public UnComponent pcmf_getUnComponent();
184:
185:            /**
186:             * <p>
187:             * Gets the type of the event.
188:             * </p>
189:             * <p>
190:             * 
191:             * @return event-type: EVENT_DRAG, EVENT_DROP, EVENT_GETF, EVENT_LOSTF,
192:             *         EVENT_CLICK, EVENT_RCLICK, EVENT_MOVE
193:             *         </p>
194:             *         <p>
195:             *         </p>
196:             */
197:            public int pcmf_getType();
198:
199:            /**
200:             * <p>
201:             * Gets the keyFilter for a keyeventchannel.
202:             * </p>
203:             * <p>
204:             * 
205:             * @return keyeventfilter as regexp
206:             *         </p>
207:             *         <p>
208:             *         </p>
209:             */
210:            public String pcmf_getKeyFilter();
211:
212:            /**
213:             * <p>
214:             * Sets the keyFilter for a keyeventchannel.
215:             * </p>
216:             * <p>
217:             * 
218:             * @param keyfilter string as regular expression
219:             *         </p>
220:             *         <p>
221:             *         </p>
222:             */
223:            public void pcmf_setKeyFilter(String xFilter);
224:
225:            /**
226:             * <p>
227:             * Sets that the parent node is refreshed when a channels event comes up. As a
228:             * result listenrs to the channels parent are called when a channeled event
229:             * ocures. The default is not to refresh the parent
230:             * </p>
231:             * <p>
232:             * 
233:             * </p>
234:             * <p>
235:             * </p>
236:             */
237:            public void pcmf_refreshParent();
238:
239:            /**
240:             * <p>
241:             * Sets the channel as the receiver of the event. Default is that the parent
242:             * receives the event. That means that the channel listener is called but the
243:             * parent is given as paramter to the listener
244:             * </p>
245:             * <p>
246:             * 
247:             * </p>
248:             * <p>
249:             * </p>
250:             */
251:            public void pcmf_receiveEvent();
252:
253:            /**
254:             * <p>
255:             * Returns the refresh flag
256:             * </p>
257:             * <p>
258:             * 
259:             * @return flag
260:             *         </p>
261:             *         <p>
262:             *         </p>
263:             */
264:            public boolean pcmf_isRefreshParent();
265:
266:            /**
267:             * <p>
268:             * Returns the receive flag
269:             * </p>
270:             * <p>
271:             * 
272:             * @return flag
273:             *         </p>
274:             *         <p>
275:             *         </p>
276:             */
277:            public boolean pcmf_isReceiveEvent();
278:
279:            /**
280:             * <p>
281:             * Enables the submit flag of a widget. If this flag is enabled a change of
282:             * the widget value within the gui, or lost of focus leads to a server-side
283:             * event-dispatch.
284:             * </p>
285:             */
286:            public void pcmf_enableSubmit();
287:
288:            /**
289:             * <p>
290:             * Disables the submit Flag of a component
291:             * </p>
292:             */
293:            public void pcmf_disableSubmit();
294:
295:            /**
296:             * <p>
297:             * Disables the submit flag of a widget. If this flag is disabled the widgets
298:             * value will be stored at client-side until an other widget initiates a
299:             * server-side event-dispatch
300:             * </p>
301:             * <p>
302:             * 
303:             * </p>
304:             * <p>
305:             * </p>
306:             */
307:            public boolean pcmf_isSubmit();
308:
309:            /**
310:             * <p>
311:             * Adds a listener to the widget. The listener is called every time the value
312:             * of the widget is changed by the gui.
313:             * </p>
314:             * <p>
315:             * 
316:             * </p>
317:             * <p>
318:             * 
319:             * @param xListener
320:             *          listener to add
321:             *          </p>
322:             */
323:            public void pcmf_addListener(IUnGuiEventListener xListener);
324:
325:            /**
326:             * <p>
327:             * Removes a listener from a widget.
328:             * </p>
329:             * <p>
330:             * 
331:             * </p>
332:             * <p>
333:             * 
334:             * @param xListener
335:             *          listener to remove
336:             *          </p>
337:             */
338:            public void pcmf_remListener(IUnGuiEventListener xListener);
339:
340:            /**
341:             * @author dvonderweiden
342:             * 
343:             * date: 10.09.2003 project: JmcFrame_all
344:             * 
345:             * <p>
346:             * This class implements some functions which help to get event-data
347:             * </p>
348:             */
349:            public class UnEventChannelHelper {
350:                /**
351:                 * <p>
352:                 * Gets the selection interval of a selection event
353:                 * </p>
354:                 * <p>
355:                 * 
356:                 * @return character
357:                 *         </p>
358:                 *         <p>
359:                 * @param xEvent
360:                 *          event-object
361:                 *          </p>
362:                 */
363:                public static SelectionInterval pcmf_getSelectionInterval(
364:                        IUnEventChannel xEvent) {
365:                    if (xEvent.pcmf_getType() == EVENT_SELECT) {
366:                        StringTokenizer l_tok = new StringTokenizer(xEvent
367:                                .pcmf_getUnComponent().pcmf_getValue()
368:                                .toString(), ":,");
369:                        l_tok.nextElement(); // SELECT
370:                        int s = Integer.parseInt(l_tok.nextToken());
371:                        int l = Integer.parseInt(l_tok.nextToken());
372:                        return (new SelectionInterval(s, l));
373:                    } else
374:                        return (null);
375:                }
376:
377:                /**
378:                 * <p>
379:                 * Gets the character value of the key without any modifiers
380:                 * </p>
381:                 * <p>
382:                 * 
383:                 * @return character
384:                 *         </p>
385:                 *         <p>
386:                 * @param xEvent
387:                 *          event-object
388:                 *          </p>
389:                 */
390:                public static char pcmf_extractCharCode(IUnEventChannel xEvent)
391:                        throws Exception {
392:                    if (xEvent.pcmf_getType() == IUnEventChannel.EVENT_KEYACTION) {
393:                        Object l_str = xEvent.pcmf_getUnComponent()
394:                                .pcmf_getValue();
395:                        if (l_str != null)
396:                            return (l_str.toString().charAt(l_str.toString()
397:                                    .length() - 1));
398:                    }
399:                    throw (new Exception(
400:                            "event channel has no valid value or a wrong type"));
401:                }
402:
403:                /**
404:                 * <p>
405:                 * Gets the xy-coordinates where the event occurred relative to the
406:                 * component
407:                 * </p>
408:                 * <p>
409:                 * 
410:                 * @return Point where the event occurred
411:                 *         </p>
412:                 *         <p>
413:                 * @param xEvent
414:                 *          event-object
415:                 *          </p>
416:                 */
417:                public static Point pcmf_getPointRel(IUnEventChannel xEvent) {
418:                    try {
419:                        if (xEvent.pcmf_getType() == EVENT_CLICK
420:                                || xEvent.pcmf_getType() == EVENT_DBCLICK
421:                                || xEvent.pcmf_getType() == EVENT_MOUSEENTER
422:                                || xEvent.pcmf_getType() == EVENT_MOUSELEAVE
423:                                || xEvent.pcmf_getType() == EVENT_MOVE
424:                                || xEvent.pcmf_getType() == EVENT_SCROLL) {
425:                            StringTokenizer l_tok = new StringTokenizer(xEvent
426:                                    .pcmf_getUnComponent().pcmf_getValue()
427:                                    .toString(), ":,");
428:                            l_tok.nextElement(); // CLICK
429:                            int x = Integer.parseInt(l_tok.nextToken());
430:                            int y = Integer.parseInt(l_tok.nextToken());
431:                            return (new Point(x, y));
432:                        } else
433:                            return (null);
434:                    } catch (Exception e) {
435:                        KeLog.pcmf_logException("ug2t", null, e);
436:                        return (null);
437:                    }
438:                }
439:
440:                /**
441:                 * <p>
442:                 * Gets the xy-coordinates where the event occurred relative to the root
443:                 * pane
444:                 * </p>
445:                 * <p>
446:                 * 
447:                 * @return Point where the event occurred
448:                 *         </p>
449:                 *         <p>
450:                 * @param xEvent
451:                 *          event-object
452:                 *          </p>
453:                 */
454:                public static Point pcmf_getPointAbs(IUnEventChannel xEvent) {
455:                    try {
456:                        if (xEvent.pcmf_getType() == EVENT_CLICK
457:                                || xEvent.pcmf_getType() == EVENT_DBCLICK
458:                                || xEvent.pcmf_getType() == EVENT_MOUSEENTER
459:                                || xEvent.pcmf_getType() == EVENT_MOUSELEAVE
460:                                || xEvent.pcmf_getType() == EVENT_MOVE
461:                                || xEvent.pcmf_getType() == EVENT_POSITION) {
462:                            StringTokenizer l_tok = new StringTokenizer(xEvent
463:                                    .pcmf_getUnComponent().pcmf_getValue()
464:                                    .toString(), ":,");
465:                            l_tok.nextElement(); // CLICK
466:                            if (xEvent.pcmf_getType() != EVENT_POSITION) {
467:                                l_tok.nextElement(); // CLICK
468:                                l_tok.nextElement(); // CLICK
469:                            }
470:                            int x = Integer.parseInt(l_tok.nextToken());
471:                            int y = Integer.parseInt(l_tok.nextToken());
472:                            return (new Point(x, y));
473:                        } else
474:                            return (null);
475:                    } catch (Exception e) {
476:                        KeLog.pcmf_logException("ug2t", null, e);
477:                        return (null);
478:                    }
479:                }
480:
481:                /**
482:                 * <p>
483:                 * Gets the rectangle of a component
484:                 * pane
485:                 * </p>
486:                 * <p>
487:                 * 
488:                 * @return rectangle where the component is displayed
489:                 *         </p>
490:                 *         <p>
491:                 * @param xEvent
492:                 *          event-object
493:                 *          </p>
494:                 */
495:                public static Rectangle pcmf_getRectangle(IUnEventChannel xEvent) {
496:                    try {
497:                        if (xEvent.pcmf_getType() == EVENT_POSITION) {
498:                            StringTokenizer l_tok = new StringTokenizer(xEvent
499:                                    .pcmf_getUnComponent().pcmf_getValue()
500:                                    .toString(), ":,");
501:                            l_tok.nextElement(); // CLICK
502:                            int x = Integer.parseInt(l_tok.nextToken());
503:                            int y = Integer.parseInt(l_tok.nextToken());
504:                            int width = Integer.parseInt(l_tok.nextToken());
505:                            int height = Integer.parseInt(l_tok.nextToken());
506:                            return (new Rectangle(x, y, width, height));
507:                        } else
508:                            return (null);
509:                    } catch (Exception e) {
510:                        KeLog.pcmf_logException("ug2t", null, e);
511:                        return (null);
512:                    }
513:                }
514:
515:                /**
516:                 * <p>
517:                 * Gets the value which is transported via Drag&Drop
518:                 * </p>
519:                 * <p>
520:                 * 
521:                 * @return the transported value encapsulated in a registrable object
522:                 *         </p>
523:                 *         <p>
524:                 * @param xEvent
525:                 *          event-object
526:                 *          </p>
527:                 */
528:                public static KeRegisteredObject pcmf_getDnDValue(
529:                        IUnEventChannel xEvent) {
530:                    try {
531:                        if (!(xEvent.pcmf_getType() == EVENT_DRAG || xEvent
532:                                .pcmf_getType() == EVENT_DROP))
533:                            return (null);
534:                        else {
535:                            StringTokenizer l_tok = new StringTokenizer(xEvent
536:                                    .pcmf_getUnComponent().pcmf_getValue()
537:                                    .toString(), ":,");
538:                            l_tok.nextElement(); // DRAG || DROP
539:                            l_tok.nextElement();
540:                            l_tok.nextElement();
541:                            return ((KeRegisteredObject) KeRegisteredObject
542:                                    .pcmf_getObjByName(l_tok.nextElement()
543:                                            .toString()));
544:                        }
545:                    } catch (Exception e) {
546:                        KeLog.pcmf_logException("ug2t", null, e);
547:                        return (null);
548:                    }
549:                }
550:            }
551:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.