reffec.com

Script.aculo.us Effects in Java Maker Code 128 Code Set A in Java Script.aculo.us Effects

Script.aculo.us Effects generate, create code 128 code set a none on java projects Data Capacity of QR Code Script.aculo.us (http://script.aculo.us/) is an amazing JavaScript library written by Thomas Fuc hs that enables all kinds of snazzy transitions and visual effects inside the web page. It is a cross-browser-compatible library that is built on top of the prototype JavaScript framework. It is also one of the most popular Web 2.

0 libraries that is widely used in a variety of applications and is, most notably, also included in the Ruby On Rails web framework. Script.aculo.

us effects are. [ 145 ]. Browser Effects with JSNI and Javascript Libraries integrated and provid ANSI/AIM Code 128 for Java ed by the Effect class, which is a part of this library. We will use this class to invoke and use the various effects in our GWT application. Unlike the other sections in this chapter, we will not use JSNI here, but we will show how to use an existing wrapper library inside our application to provide some nice browser effects.

. Time for Action Applying Effects The gwt-widget librar javabean code128b y is a terrific group of extensions and enhancements to the GWT framework maintained by Robert Hanson (http://gwt-widget. sourceforge.net/).

It provides a Java class that wraps the effects, and we will use this class in our application. We will add a grid with two rows and four columns, each containing a small image file, and apply one effect to each of the images. We need to reference the gwt-widgets module that provides the Java wrapper for the library.

This is leveraging the module inheritance feature of GWT. We will go into an explanation of this concept in the What Just happened section of this sample. Follow the steps given below to add the grid: 1.

Add the following entry to the existing Samples.gwt.xml file in the com.

packtpub.gwtbook.samples package:.

<inherits name="org.gwtwidgets.WidgetLibrary"/> 2. Add the prototype Code 128B for Java and Script.aculo.

us JavaScript files that are used by the above module:. <script type="text /JavaScript"src="JavaScript/prototype.js"> </script> <script type="text/JavaScript src="JavaScript/Scriptaculous.js"> </script>.

3. Create the user in Code 128 Code Set C for Java terface for this application in a new Java file named ScriptaculousEffectsPanel.java in the com.

packtpub.gwtbook. samples.

client.panels package. Create a grid with two rows and four columns.

Create eight images, and eight buttons, and a work panel.. private private priva te private private private private private private HorizontalPanel workPanel = new HorizontalPanel(); Grid grid = new Grid(2, 4); Image packtlogo1 = new Image("images/packtlogo.jpg"); Image packtlogo2 = new Image("images/packtlogo.jpg"); Image packtlogo3 = new Image("images/packtlogo.

jpg"); Image packtlogo4 = new Image("images/packtlogo.jpg"); Image packtlogo5 = new Image("images/packtlogo.jpg"); Image packtlogo6 = new Image("images/packtlogo.

jpg"); Image packtlogo7 = new Image("images/packtlogo.jpg"); [ 146 ]. 6 private private pr USS Code 128 for Java ivate private private private private private private Image packtlogo8 = new Image("images/packtlogo.jpg"); Button fadeButton = new Button("fade"); Button puffButton = new Button("puff"); Button shakeButton = new Button("shake"); Button growButton = new Button("grow"); Button shrinkButton = new Button("shrink"); Button pulsateButton = new Button("pulsate"); Button blindUpButton = new Button("blindup"); Button blindDownButton = new Button("blinddown");. 4. Add the button and image for the fade effect to a VerticalPanel and add the panel to the grid. VerticalPanel gridCel servlet Code 128 Code Set C lPanel = new VerticalPanel(); gridCellPanel.add(packtlogo1); gridCellPanel.add(fadeButton); grid.

setWidget(0, 0, gridCellPanel);. 5. Add an event handl er for listening to the click on the fade effect button, and call the appropriate Script.aculo.

us effect.. fadeButton.addClickLi Code 128B for Java stener(new ClickListener() { public void onClick(Widget sender) { Effect.fade(packtlogo1); } });.

6. Add the button and image for the shake effect to a VerticalPanel and add the panel to the grid. gridCellPanel = new V Code 128 Code Set C for Java erticalPanel(); gridCellPanel.add(packtlogo3); gridCellPanel.add(shakeButton); grid.

setWidget(0, 1, gridCellPanel);. 7. Add an event handl er for listening to the click on the shake effect button, and call the appropriate Script.aculo.

us effect.. shakeButton.addClickL ANSI/AIM Code 128 for Java istener(new ClickListener() { public void onClick(Widget sender) { Effect.shake(packtlogo3); } });.

[ 147 ]. Browser Effects with JSNI and Javascript Libraries 8. Add the button and image for the grow effect to a VerticalPanel and add the panel to the grid. gridCellPanel = new V code 128 barcode for Java erticalPanel(); gridCellPanel.add(packtlogo4); gridCellPanel.add(growButton); grid.

setWidget(0, 2, gridCellPanel);. 9. Add an event handl er for listening to the click on the grow effect button, and call the appropriate Script.aculo.

us effect.. growButton.addClickLi Code 128A for Java stener(new ClickListener() { public void onClick(Widget sender) { Effect.grow(packtlogo4); } });.

10. Add the button an d image for the blind up effect to a VerticalPanel and add the panel to the grid..

gridCellPanel = new V barcode 128 for Java erticalPanel(); gridCellPanel.add(packtlogo8); gridCellPanel.add(blindUpButton); grid.

setWidget(0, 3, gridCellPanel);. 11. Add an event hand ler for listening to the click on the blind up effect button, and call the appropriate Script.aculo.

us effect.. blindUpButton.addClic tomcat ANSI/AIM Code 128 kListener(new ClickListener() { public void onClick(Widget sender) { Effect.blindUp(packtlogo8); } });.

Copyright © reffec.com . All rights reserved.