<j:carousel t:params="complexParams" t:clientId="myComplexCarousel">
<j:carouselItem t:imageSource="asset:context:img/flower_01.jpg"
t:page="core/DocsJQueryPalette" t:context="3"/>
<j:carouselItem t:imageSource="asset:context:img/flower_02.jpg"
t:event="zoneTest" t:zone="flowerZone" />
<j:carouselItem t:imageSource="asset:context:img/flower_03.jpg"
t:event="eventTest" t:context="literal:hello" />
<j:carouselItem t:imageSource="asset:context:img/flower_04.jpg" />
<j:carouselItem t:imageSource="asset:context:img/flower_05.jpg" />
<j:carouselItem t:imageSource="asset:context:img/flower_06.jpg" />
<j:carouselItem t:imageSource="asset:context:img/flower_07.jpg" />
<j:carouselItem t:imageSource="asset:context:img/flower_08.jpg" />
<j:carouselItem t:imageSource="asset:context:img/flower_09.jpg" />
<j:carouselItem t:imageSource="asset:context:img/flower_10.jpg" />
</j:carousel>
<div id="zoneContainer">
<span>Click on the big white flower of the complex carousel:</span>
<t:zone t:id="flowerZone" id="flowerZone">
</t:zone>
<t:block t:id="flowerBlock" id="flowerBlock">
You just clicked on the big white flower !
</t:block>
</div>
<br/><br/>
Ajax loaded:
<j:carousel t:params="ajaxParams" t:clientId="myAjaxCarousel" />
public class DocsCarouselPage{
@Inject
private Block flowerBlock;
@Inject
private ComponentResources resources;
@Inject
private AssetSource assetSource;
public JSONObject getAjaxParams(){
JSONObject retour = new JSONObject();
retour.put("wrap", "circular");
retour.put("height", "75");
String url = resources.createEventLink("ajaxEvent").toString();
retour.put("loadCallbackUrl", url);
return retour;
}
public JSONObject getComplexParams(){
JSONObject retour = new JSONObject();
retour.put("wrap", "circular");
return retour;
}
public Object getTest(){
return "hello";
}
@OnEvent("ajaxEvent")
public Object ajaxtTest(){
JSONArray retour = new JSONArray();
retour.put(assetSource.getContextAsset("img/flower_01.jpg",null).toClientURL());
retour.put(assetSource.getContextAsset("img/flower_02.jpg",null).toClientURL());
retour.put(assetSource.getContextAsset("img/flower_03.jpg",null).toClientURL());
retour.put(assetSource.getContextAsset("img/flower_04.jpg",null).toClientURL());
retour.put(assetSource.getContextAsset("img/flower_05.jpg",null).toClientURL());
retour.put(assetSource.getContextAsset("img/flower_06.jpg",null).toClientURL());
retour.put(assetSource.getContextAsset("img/flower_07.jpg",null).toClientURL());
retour.put(assetSource.getContextAsset("img/flower_08.jpg",null).toClientURL());
retour.put(assetSource.getContextAsset("img/flower_09.jpg",null).toClientURL());
retour.put(assetSource.getContextAsset("img/flower_10.jpg",null).toClientURL());
return retour;
}
@OnEvent("eventTest")
public void testEvent(Object ctx){
System.out.println(ctx);
}
@OnEvent("zoneTest")
public Object zoneEvent(){
return flowerBlock;
}
}