KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > icesoft > icefaces > samples > showcase > components > effects > Effects


1 /*
2  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3  *
4  * "The contents of this file are subject to the Mozilla Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License at
7  * http://www.mozilla.org/MPL/
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
11  * License for the specific language governing rights and limitations under
12  * the License.
13  *
14  * The Original Code is ICEfaces 1.5 open source software code, released
15  * November 5, 2006. The Initial Developer of the Original Code is ICEsoft
16  * Technologies Canada, Corp. Portions created by ICEsoft are Copyright (C)
17  * 2004-2006 ICEsoft Technologies Canada, Corp. All Rights Reserved.
18  *
19  * Contributor(s): _____________________.
20  *
21  * Alternatively, the contents of this file may be used under the terms of
22  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"
23  * License), in which case the provisions of the LGPL License are
24  * applicable instead of those above. If you wish to allow use of your
25  * version of this file only under the terms of the LGPL License and not to
26  * allow others to use your version of this file under the MPL, indicate
27  * your decision by deleting the provisions above and replace them with
28  * the notice and other provisions required by the LGPL License. If you do
29  * not delete the provisions above, a recipient may use your version of
30  * this file under either the MPL or the LGPL License."
31  *
32  */

33
34 package com.icesoft.icefaces.samples.showcase.components.effects;
35
36 import com.icesoft.faces.context.effects.*;
37
38 import javax.faces.model.SelectItem;
39
40 /**
41  * <p>The Effects class is used to swap the effects used for the
42  * "effect-specific attributes" and "results" panelStacks.</p>
43  */

44 public class Effects {
45
46     private String JavaDoc selectedEffect = "effectAppearFade";
47     private String JavaDoc specific = "AppearFade";
48
49     private String JavaDoc sampleData = "";
50
51     private PulsateBean pulsateBean;
52     private HighlightBean highlightBean;
53     private AppearFadeBean appearFadeBean;
54     private MoveBean moveBean;
55     private float scalePercent = 50;
56
57     private Effect panelGroupEffect;
58     private Effect commandButtonEffect;
59     private Effect inputTextEffect;
60
61     private static final SelectItem[] durationChoices = new SelectItem[]{
62             new SelectItem(new Float JavaDoc(0.5f), "0.5s"),
63             new SelectItem(new Float JavaDoc(1.0f), "1.0s"),
64             new SelectItem(new Float JavaDoc(2.0f), "2.0s"),
65             new SelectItem(new Float JavaDoc(3.5f), "3.5s"),
66             new SelectItem(new Float JavaDoc(5.0f), "5.0s"),
67     };
68
69     private float duration = 0.5f;
70
71     public Effects() {
72         pulsateBean = new PulsateBean(this);
73         highlightBean = new HighlightBean(this);
74         appearFadeBean = new AppearFadeBean(this);
75         moveBean = new MoveBean(this);
76     }
77
78     public AppearFadeBean getAppearFadeBean() {
79         return appearFadeBean;
80     }
81
82     public void setAppearFadeBean(AppearFadeBean appearFadeBean) {
83         this.appearFadeBean = appearFadeBean;
84     }
85
86     public HighlightBean getHighlightBean() {
87         return highlightBean;
88     }
89
90     public void setHighlightBean(HighlightBean highlightBean) {
91         this.highlightBean = highlightBean;
92     }
93
94     public MoveBean getMoveBean() {
95         return moveBean;
96     }
97
98     public void setMoveBean(MoveBean moveBean) {
99         this.moveBean = moveBean;
100     }
101
102     public PulsateBean getPulsateBean() {
103         return pulsateBean;
104     }
105
106     public void setPulsateBean(PulsateBean pulsateBean) {
107         this.pulsateBean = pulsateBean;
108     }
109
110     public float getDurationPrimitive() {
111         return duration;
112     }
113
114     public Float JavaDoc getDuration() {
115         return new Float JavaDoc(duration);
116     }
117
118     public void setDuration(Float JavaDoc duration) {
119         if (duration != null) {
120             this.duration = duration.floatValue();
121         }
122     }
123
124     public SelectItem[] getDurationChoices() {
125         return durationChoices;
126     }
127
128
129     public String JavaDoc getSpecific() {
130         return specific;
131     }
132
133     public String JavaDoc getSelectedEffect() {
134         return selectedEffect;
135     }
136
137     public void setSelectedEffect(String JavaDoc selectedEffect) {
138         this.specific = selectedEffect.substring(6, selectedEffect.length());
139         this.selectedEffect = selectedEffect;
140     }
141
142     public String JavaDoc getSampleData() {
143         return sampleData;
144     }
145
146     public void setSampleData(String JavaDoc sampleData) {
147         this.sampleData = sampleData;
148     }
149
150     public String JavaDoc sampleDataAction() {
151         return null;
152     }
153
154     public Effect getPanelGroupEffect() {
155         return panelGroupEffect;
156     }
157
158     public void setPanelGroupEffect(Effect panelGroupEffect) {
159         this.panelGroupEffect = panelGroupEffect;
160     }
161
162     public Effect getCommandButtonEffect() {
163         return commandButtonEffect;
164     }
165
166     public void setCommandButtonEffect(Effect commandButtonEffect) {
167         this.commandButtonEffect = commandButtonEffect;
168     }
169
170     public Effect getInputTextEffect() {
171         return inputTextEffect;
172     }
173
174     public void setInputTextEffect(Effect inputTextEffect) {
175         this.inputTextEffect = inputTextEffect;
176     }
177
178     public float getScalePercent() {
179         return scalePercent;
180     }
181
182     public void setScalePercent(float scalePercent) {
183         this.scalePercent = scalePercent;
184     }
185
186     public String JavaDoc scale() {
187         panelGroupEffect = new Scale(scalePercent);
188         inputTextEffect = new Scale(scalePercent);
189         commandButtonEffect = new Scale(scalePercent);
190         panelGroupEffect.setDuration(duration);
191         inputTextEffect.setDuration(duration);
192         commandButtonEffect.setDuration(duration);
193         return null;
194     }
195
196      public String JavaDoc resetScale() {
197         float defaultScale = 150;
198         panelGroupEffect = new Scale(defaultScale);
199         inputTextEffect = new Scale(defaultScale);
200         commandButtonEffect = new Scale(defaultScale);
201         panelGroupEffect.setDuration(duration);
202         inputTextEffect.setDuration(duration);
203         commandButtonEffect.setDuration(duration);
204         return null;
205     }
206
207     public String JavaDoc puff() {
208         panelGroupEffect = new Puff();
209         inputTextEffect = new Puff();
210         commandButtonEffect = new Puff();
211         panelGroupEffect.setDuration(duration);
212         inputTextEffect.setDuration(duration);
213         commandButtonEffect.setDuration(duration);
214         return null;
215     }
216
217      public String JavaDoc resetDisappearEffect() {
218         panelGroupEffect = new Appear();
219         inputTextEffect = new Appear();
220         commandButtonEffect = new Appear();
221         panelGroupEffect.setDuration(duration);
222         inputTextEffect.setDuration(duration);
223         commandButtonEffect.setDuration(duration);
224         return null;
225     }
226
227     public String JavaDoc blindUp() {
228         panelGroupEffect = new BlindUp();
229         inputTextEffect = new BlindUp();
230         commandButtonEffect = new BlindUp();
231         panelGroupEffect.setDuration(duration);
232         inputTextEffect.setDuration(duration);
233         commandButtonEffect.setDuration(duration);
234         return null;
235     }
236
237     public String JavaDoc blindDown() {
238         panelGroupEffect = new BlindDown();
239         inputTextEffect = new BlindDown();
240         commandButtonEffect = new BlindDown();
241         panelGroupEffect.setDuration(duration);
242         inputTextEffect.setDuration(duration);
243         commandButtonEffect.setDuration(duration);
244         return null;
245     }
246
247     public String JavaDoc switchOff() {
248         panelGroupEffect = new SwitchOff();
249         inputTextEffect = new SwitchOff();
250         commandButtonEffect = new SwitchOff();
251         panelGroupEffect.setDuration(duration);
252         inputTextEffect.setDuration(duration);
253         commandButtonEffect.setDuration(duration);
254         return null;
255
256     }
257
258     public String JavaDoc dropOut() {
259         panelGroupEffect = new DropOut();
260         inputTextEffect = new DropOut();
261         commandButtonEffect = new DropOut();
262         panelGroupEffect.setDuration(duration);
263         inputTextEffect.setDuration(duration);
264         commandButtonEffect.setDuration(duration);
265         return null;
266     }
267
268     public String JavaDoc shake() {
269         panelGroupEffect = new Shake();
270         inputTextEffect = new Shake();
271         commandButtonEffect = new Shake();
272         panelGroupEffect.setDuration(duration);
273         inputTextEffect.setDuration(duration);
274         commandButtonEffect.setDuration(duration);
275         return null;
276     }
277
278     public String JavaDoc slideDown() {
279         panelGroupEffect = new SlideDown();
280         inputTextEffect = new SlideDown();
281         commandButtonEffect = new SlideDown();
282         panelGroupEffect.setDuration(duration);
283         inputTextEffect.setDuration(duration);
284         commandButtonEffect.setDuration(duration);
285         return null;
286     }
287
288     public String JavaDoc slideUp() {
289         panelGroupEffect = new SlideUp();
290         inputTextEffect = new SlideUp();
291         commandButtonEffect = new SlideUp();
292         panelGroupEffect.setDuration(duration);
293         inputTextEffect.setDuration(duration);
294         commandButtonEffect.setDuration(duration);
295         return null;
296     }
297
298     public String JavaDoc squish() {
299         panelGroupEffect = new Squish();
300         inputTextEffect = new Squish();
301         commandButtonEffect = new Squish();
302         panelGroupEffect.setDuration(duration);
303         inputTextEffect.setDuration(duration);
304         commandButtonEffect.setDuration(duration);
305         return null;
306     }
307
308     public String JavaDoc grow() {
309         panelGroupEffect = new Grow();
310         inputTextEffect = new Grow();
311         commandButtonEffect = new Grow();
312         panelGroupEffect.setDuration(duration);
313         inputTextEffect.setDuration(duration);
314         commandButtonEffect.setDuration(duration);
315         return null;
316     }
317
318     public String JavaDoc shrink() {
319         panelGroupEffect = new Shrink();
320         inputTextEffect = new Shrink();
321         commandButtonEffect = new Shrink();
322         panelGroupEffect.setDuration(duration);
323         inputTextEffect.setDuration(duration);
324         commandButtonEffect.setDuration(duration);
325         return null;
326     }
327
328     public String JavaDoc fold() {
329         panelGroupEffect = new Fold();
330         inputTextEffect = new Fold();
331         commandButtonEffect = new Fold();
332         panelGroupEffect.setDuration(duration);
333         inputTextEffect.setDuration(duration);
334         commandButtonEffect.setDuration(duration);
335         return null;
336     }
337
338
339 }
340
Popular Tags