001 package echopoint.jquery;
002
003 import nextapp.echo.app.Component;
004 import nextapp.echo.app.util.Context;
005 import nextapp.echo.webcontainer.ServerMessage;
006 import nextapp.echo.webcontainer.Service;
007 import nextapp.echo.webcontainer.WebContainerServlet;
008 import nextapp.echo.webcontainer.service.JavaScriptService;
009
010 /**
011 * Rendering peer for the {@link echopoint.jquery.CarouselContainer} component.
012 *
013 * @author Hans Holmlund 2009-07-09
014 * @version $Id$
015 */
016 public class CarouselContainerPeer extends JQueryAbstractPeer {
017
018
019 /** The component name for which this class is a peer. */
020 private static final String COMPONENT_NAME = CarouselContainer.class.getName();
021
022
023 /** The JS service files to load. */
024 private static final String[] SERVICE_FILES =
025 {
026 "resource/js/jquery/jcarousellite_1.0.1.min.js",
027 "resource/js/jquery/jquery-CallbackContext.js",
028 "resource/js/jquery/Application.CarouselContainer.js",
029 "resource/js/jquery/Sync.CarouselContainer.js"
030 };
031
032
033 /** The associated client-side JavaScript module <code>Service</code>. */
034 private static final Service COMPONENT_SERVICE =
035 JavaScriptService.forResources(COMPONENT_NAME, SERVICE_FILES);
036
037 static {
038 WebContainerServlet.getServiceRegistry().add(COMPONENT_SERVICE);
039 }
040
041 /**
042 * @see nextapp.echo.webcontainer.ComponentSynchronizePeer#getClientComponentType(boolean)
043 */
044 public String getClientComponentType(boolean shortType) {
045 return COMPONENT_NAME;
046 }
047
048 /**
049 * @see nextapp.echo.webcontainer.ComponentSynchronizePeer#getComponentClass()
050 */
051 public Class getComponentClass() {
052 return CarouselContainer.class;
053 }
054
055 /**
056 * @see nextapp.echo.webcontainer.ComponentSynchronizePeer#init(nextapp.echo.app.util.Context, nextapp.echo.app.Component)
057 */
058 public void init(final Context context, final Component component) {
059 super.init(context, component);
060 final ServerMessage serverMessage =
061 (ServerMessage) context.get(ServerMessage.class);
062 serverMessage.addLibrary(COMPONENT_NAME);
063 }
064
065 }