Source Code Cross Referenced for DndEvent.java in  » J2EE » ICEfaces-1.6.1 » com » icesoft » faces » component » dragdrop » 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 » ICEfaces 1.6.1 » com.icesoft.faces.component.dragdrop 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Version: MPL 1.1/GPL 2.0/LGPL 2.1
003:         *
004:         * "The contents of this file are subject to the Mozilla Public License
005:         * Version 1.1 (the "License"); you may not use this file except in
006:         * compliance with the License. You may obtain a copy of the License at
007:         * http://www.mozilla.org/MPL/
008:         *
009:         * Software distributed under the License is distributed on an "AS IS"
010:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
011:         * License for the specific language governing rights and limitations under
012:         * the License.
013:         *
014:         * The Original Code is ICEfaces 1.5 open source software code, released
015:         * November 5, 2006. The Initial Developer of the Original Code is ICEsoft
016:         * Technologies Canada, Corp. Portions created by ICEsoft are Copyright (C)
017:         * 2004-2006 ICEsoft Technologies Canada, Corp. All Rights Reserved.
018:         *
019:         * Contributor(s): _____________________.
020:         *
021:         * Alternatively, the contents of this file may be used under the terms of
022:         * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"
023:         * License), in which case the provisions of the LGPL License are
024:         * applicable instead of those above. If you wish to allow use of your
025:         * version of this file only under the terms of the LGPL License and not to
026:         * allow others to use your version of this file under the MPL, indicate
027:         * your decision by deleting the provisions above and replace them with
028:         * the notice and other provisions required by the LGPL License. If you do
029:         * not delete the provisions above, a recipient may use your version of
030:         * this file under either the MPL or the LGPL License."
031:         *
032:         */
033:
034:        package com.icesoft.faces.component.dragdrop;
035:
036:        import javax.faces.component.UIComponent;
037:        import javax.faces.event.FacesEvent;
038:        import javax.faces.event.FacesListener;
039:        import javax.faces.event.PhaseId;
040:        import java.util.StringTokenizer;
041:
042:        /**
043:         * A DnDEvent is passed to Drag and Drop Event listeners. It contains all the
044:         * information on the type of event, and the components involved.
045:         */
046:        public class DndEvent extends FacesEvent {
047:
048:            private int eventType;
049:
050:            private Object targetDropValue;
051:            private Object targetDragValue;
052:            private String targetClientId;
053:
054:            /**
055:             * Event type for when a Draggable panel is starting to drag
056:             */
057:            public static final int DRAG_START = 1;
058:            public static final int DRAGGING = 1;
059:            /**
060:             * Event type for when a Draggable panel has been dropped, but not on a drop
061:             * target.
062:             */
063:            public static final int DRAG_CANCEL = 2;
064:            /**
065:             * Event type for when a Draggable panel has been dropped on a drop target.
066:             * The dndComponent will be set to the drop target for this event
067:             */
068:            public static final int DROPPED = 3;
069:            /**
070:             * Event type for when a Draggable panel is being hovered over a drop
071:             * target. The dndComponent will be set to the drop target for this event
072:             */
073:            public static final int HOVER_START = 4;
074:            /**
075:             * Event type for when a Drgabble panel is no longer hovering over a drop
076:             * target.
077:             */
078:            public static final int HOVER_END = 5;
079:
080:            private static String[] names = { "none", "dragging",
081:                    "drag_cancel", "dropped", "hover_start", "hover_end",
082:                    "pointerDraw" };
083:
084:            /**
085:             * Mask to cover all DnD Events.
086:             */
087:            public static final String MASK_ALL = "1,2,3,4,5";
088:
089:            public static final String MASK_ALL_BUT_DROPS = "1,4,5";
090:
091:            /**
092:             * DnDEvent This constructor is called by Drag and Drop components in the
093:             * Decode method.
094:             *
095:             * @param uiComponent
096:             * @param eventType
097:             * @param targetClentId
098:             * @param targetDragValue
099:             * @param targetDropValue
100:             */
101:            public DndEvent(UIComponent uiComponent, int eventType,
102:                    String targetClentId, Object targetDragValue,
103:                    Object targetDropValue) {
104:                super (uiComponent);
105:                setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
106:                this .eventType = eventType;
107:                this .targetClientId = targetClentId;
108:                this .targetDragValue = targetDragValue;
109:                this .targetDropValue = targetDropValue;
110:
111:            }
112:
113:            /**
114:             * False
115:             *
116:             * @param facesListener
117:             * @return boolean
118:             */
119:            public boolean isAppropriateListener(FacesListener facesListener) {
120:                return false;
121:            }
122:
123:            /**
124:             * Not implemented
125:             *
126:             * @param facesListener
127:             */
128:            public void processListener(FacesListener facesListener) {
129:            }
130:
131:            /**
132:             * Event type for the Event. Possible values are DRAG_START, DRAG_CANCEL,
133:             * DROPPED, HOVER_START HOVER_END
134:             *
135:             * @return int eventType
136:             */
137:            public int getEventType() {
138:                return eventType;
139:            }
140:
141:            /**
142:             * The drop value assigned to the target PanelGroup Null for DRAG_START,
143:             * DRAG_CANCEL, and HOVER_END events
144:             *
145:             * @return Object targetDropValue
146:             */
147:            public Object getTargetDropValue() {
148:                return targetDropValue;
149:            }
150:
151:            /**
152:             * The drag value assigned to the target PanelGroup Null for DRAG_START,
153:             * DRAG_CANCEL, and HOVER_END events
154:             *
155:             * @return Object targetDragValue
156:             */
157:            public Object getTargetDragValue() {
158:                return targetDragValue;
159:            }
160:
161:            /**
162:             * The clientId of the target Panel Group. Null for DRAG_START, DRAG_CANCEL,
163:             * and HOVER_END events
164:             *
165:             * @return String targetClientId
166:             */
167:            public String getTargetClientId() {
168:                return targetClientId;
169:            }
170:
171:            public static String getEventName(int i) {
172:                return names[i];
173:            }
174:
175:            /**
176:             * Parse a mask value to make its valid, Used in rendering.
177:             *
178:             * @param mask
179:             * @return String mask
180:             */
181:            public static String parseMask(String mask) {
182:                if (mask == null) {
183:                    return null;
184:                }
185:                StringTokenizer st = new StringTokenizer(mask, ",");
186:                StringBuffer sb = new StringBuffer();
187:                while (st.hasMoreTokens()) {
188:                    String token = st.nextToken();
189:                    boolean f = false;
190:                    for (int i = 1; i < names.length; i++) {
191:                        token = token.trim();
192:                        if (token.length() > 0) {
193:                            if (token.equalsIgnoreCase(names[i])) {
194:                                sb.append(i);
195:                                f = true;
196:                            }
197:                        }
198:                    }
199:                    if (!f) {
200:                        String message = "Mask value [" + token + "] in mask ["
201:                                + mask + "] is not valid. Valid values are [";
202:                        for (int ie = 1; ie < names.length; ie++) {
203:                            message += names[ie];
204:                            int next = ie + 1;
205:                            if (next < names.length) {
206:                                message += ", ";
207:                            }
208:                            message += "]";
209:                        }
210:                        throw new IllegalArgumentException(message);
211:                    }
212:                    if (st.hasMoreTokens()) {
213:                        sb.append(",");
214:                    }
215:                }
216:                return sb.toString();
217:            }
218:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.