Source Code Cross Referenced for Effect.java in  » J2EE » ICEfaces-1.6.1 » com » icesoft » faces » context » effects » 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.context.effects 
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.context.effects;
035:
036:        /**
037:         * Base class for all javascript effects
038:         */
039:        public abstract class Effect {
040:
041:            protected EffectsArguments ea = new EffectsArguments();
042:            private boolean queued;
043:            private boolean queueEnd;
044:            private boolean fired;
045:            private boolean transitory = true;
046:            private float duration;
047:            private float fps; // Max 25fps
048:            private float from;
049:            private float to;
050:            private boolean sync;
051:            private float delay;
052:            private String queue;
053:            private boolean submit;
054:            private String id;
055:            private String sequence;
056:            private int sequenceId;
057:
058:            /**
059:             * Transitory effects return a component to its original state. This flag is
060:             * used to stop javascript from performing a partial submit at the end of an
061:             * effect.
062:             * <p/>
063:             * Example highlight.
064:             *
065:             * @return
066:             */
067:            public boolean isTransitory() {
068:                return transitory;
069:            }
070:
071:            /**
072:             * Transitory effects do not alter the display state. (Example: pulsate, shake)
073:             * However other effects change css style properties, and in some cases
074:             * the application needs to be aware of these changes. (For refreshing a page for example)
075:             *
076:             * When css changes need to be sent to the application you need to set the transitory
077:             * property to false. The framework will then populate a hidden field with the new style
078:             * information. Ready to be sent on the next submit.
079:             *
080:             * However, if you need to send the new style information immediately you need to set the submit attribute
081:             * to true as well. This will fire a partial submit at the end of the effect.
082:             *
083:             *
084:             * Default is true
085:             *
086:             * @param transitory true to not populate the css style changes, false to populate css style changes
087:             */
088:            public void setTransitory(boolean transitory) {
089:                this .transitory = transitory;
090:            }
091:
092:            /**
093:             * @return
094:             * @deprecated
095:             */
096:            public boolean isQueued() {
097:                return queued;
098:            }
099:
100:            /**
101:             * @param queued
102:             * @deprecated
103:             */
104:            public void setQueued(boolean queued) {
105:                this .queued = queued;
106:            }
107:
108:            /**
109:             * @return
110:             * @deprecated
111:             */
112:            public boolean isQueueEnd() {
113:                return queueEnd;
114:            }
115:
116:            /**
117:             * @param queueEnd
118:             * @deprecated
119:             */
120:            public void setQueueEnd(boolean queueEnd) {
121:                this .queueEnd = queueEnd;
122:            }
123:
124:            /**
125:             * Has this effect been fired. ONly effects that have not been fired are
126:             * sent to the browser
127:             *
128:             * @return
129:             */
130:            public boolean isFired() {
131:                return fired;
132:            }
133:
134:            /**
135:             * Set if this effect has been fired. When this flag is set to false
136:             * the effect will be sent to the browser on the next render pass.
137:             *
138:             * After being fired Icefaces will set this flag to true. To resend this
139:             * effect set the flag to false. 
140:             *
141:             * @param fired
142:             */
143:            public void setFired(boolean fired) {
144:                this .fired = fired;
145:            }
146:
147:            /**
148:             * Get the duration of the effect (In seconds)
149:             *
150:             * @return
151:             */
152:            public float getDuration() {
153:                return duration;
154:            }
155:
156:            /**
157:             * Set the duration of the effect (In seconds)
158:             *
159:             * @param duration
160:             */
161:            public void setDuration(float duration) {
162:                this .duration = duration;
163:                ea.add("duration", duration);
164:            }
165:
166:            /**
167:             * Get the frames per second of this effect
168:             *
169:             * @return
170:             */
171:            public float getFps() {
172:                return fps;
173:            }
174:
175:            /**
176:             * Set the frames per second of this effect. max is 25
177:             *
178:             * @param fps
179:             */
180:            public void setFps(float fps) {
181:                if (fps > 25f) {
182:                    throw new IllegalArgumentException("FPS max is 25");
183:                }
184:                this .fps = fps;
185:                ea.add("fps", fps);
186:            }
187:
188:            /**
189:             * Gets the starting point of the transition, a float between 0.0 and 1.0.
190:             * Defaults to 0.0.
191:             *
192:             * @return
193:             */
194:            public float getFrom() {
195:                return from;
196:            }
197:
198:            /**
199:             * Sets the starting point of the transition, a float between 0.0 and 1.0.
200:             * Defaults to 0.0.
201:             *
202:             * @param from
203:             */
204:            public void setFrom(float from) {
205:                this .from = from;
206:                ea.add("from", from);
207:            }
208:
209:            /**
210:             * Gets the end point of the transition, a float between 0.0 and 1.0.
211:             * Defaults to 1.0.
212:             *
213:             * @return
214:             */
215:            public float getTo() {
216:                return to;
217:            }
218:
219:            /**
220:             * Sets the end point of the transition, a float between 0.0 and 1.0.
221:             * Defaults to 1.0.
222:             *
223:             * @param to
224:             */
225:            public void setTo(float to) {
226:                this .to = to;
227:                ea.add("to", to);
228:            }
229:
230:            /**
231:             * Gets whether the effect should render new frames automatically (which it
232:             * does by default). If true, you can render frames manually by calling the
233:             * render() instance method of an effect. This is used by
234:             * Effect.Parallel().
235:             *
236:             * @return
237:             */
238:            public boolean isSync() {
239:                return sync;
240:            }
241:
242:            /**
243:             * Sets whether the effect should render new frames automatically (which it
244:             * does by default). If true, you can render frames manually by calling the
245:             * render() instance method of an effect. This is used by
246:             * Effect.Parallel().
247:             *
248:             * @param sync
249:             */
250:            public void setSync(boolean sync) {
251:                this .sync = sync;
252:                ea.add("sync", sync);
253:            }
254:
255:            /**
256:             * Gets the delay before invoking the effect
257:             *
258:             * @return
259:             */
260:            public float getDelay() {
261:                return delay;
262:            }
263:
264:            /**
265:             * Sets the delay before invoking the effect
266:             *
267:             * @param delay
268:             */
269:            public void setDelay(float delay) {
270:                this .delay = delay;
271:                ea.add("delay", delay);
272:            }
273:
274:            /**
275:             * Gets queuing options. When used with a string, can be 'front' or 'end' to
276:             * queue the effect in the global effects queue at the beginning or end, or
277:             * a queue parameter object that can have {position:'front/end',
278:             * scope:'scope', limit:1}
279:             *
280:             * @return
281:             */
282:            public String getQueue() {
283:                return queue;
284:            }
285:
286:            /**
287:             * Sets queuing options. When used with a string, can be 'front' or 'end' to
288:             * queue the effect in the global effects queue at the beginning or end, or
289:             * a queue parameter object that can have {position:'front/end',
290:             * scope:'scope', limit:1}
291:             *
292:             * @param queue
293:             */
294:            public void setQueue(String queue) {
295:                this .queue = queue;
296:                ea.add("queue", queue);
297:            }
298:
299:            /**
300:             * Gets is this effect should fire partial submit when finished
301:             *
302:             * @return
303:             */
304:            public boolean isSubmit() {
305:                return submit;
306:            }
307:
308:            /**
309:             * Sets is this effect should fire partial submit when finished.
310:             * Transitory also needs to be set to true.
311:             *
312:             * default is false
313:             *
314:             * @param submit
315:             */
316:            public void setSubmit(boolean submit) {
317:                this .submit = submit;
318:                ea.add("submit", submit);
319:            }
320:
321:            /**
322:             * get the name of the Function call to invoke the effect
323:             *
324:             * @return
325:             */
326:            public abstract String getFunctionName();
327:
328:            public String toString(String var, String lastCall) {
329:                if (queued) {
330:                    ea.add("queue", "front");
331:                }
332:                if (queueEnd) {
333:                    ea.add("queue", "end");
334:                }
335:                if (!transitory) {
336:                    ea.add("uploadCSS", "true");
337:                }
338:                if (lastCall != null) {
339:                    ea.addFunction("iceFinish", "function(){" + lastCall + "}");
340:                }
341:                return getFunctionName() + "(" + var + ea.toString();
342:            }
343:
344:            public String toString() {
345:                return toString("id", null);
346:            }
347:
348:            /**
349:             * Get the HTML ID of the element t
350:             *
351:             * @return
352:             */
353:            public String getId() {
354:                return id;
355:            }
356:
357:            /**
358:             * Set the HTML ID of the element t
359:             *
360:             * @param id
361:             */
362:            public void setId(String id) {
363:                this .id = id;
364:            }
365:
366:            /**
367:             * Get the name of the sequence this effect is in
368:             *
369:             * @return
370:             */
371:            public String getSequence() {
372:                return sequence;
373:            }
374:
375:            /**
376:             * Set the name of the sequence this effect is in.
377:             *
378:             * @param sequence
379:             */
380:            public void setSequence(String sequence) {
381:                this .sequence = sequence;
382:            }
383:
384:            /**
385:             * Get the ID or position of this effect in a sequence
386:             *
387:             * @return
388:             */
389:            public int getSequenceId() {
390:                return sequenceId;
391:            }
392:
393:            /**
394:             * Set the ID or position of this effect in a sequence
395:             *
396:             * @param sequenceId
397:             */
398:            public void setSequenceId(int sequenceId) {
399:                this .sequenceId = sequenceId;
400:            }
401:
402:            public void setOptions(String options) {
403:                ea.setOptions(options);
404:            }
405:
406:            public int hashCode() {
407:                return getIntfromString(toString());
408:            }
409:
410:            public int getIntfromString(String s) {
411:                int r = 0;
412:                char[] ca = s.toCharArray();
413:                for (int i = 0; i < ca.length; i++) {
414:                    r += (int) ca[i];
415:                }
416:                return r;
417:            }
418:
419:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.