1 /*** 2 * The contents of this file are subject to the Mozilla Public 3 * License Version 1.1 (the "License"); you may not use this file 4 * except in compliance with the License. You may obtain a copy of 5 * the License at http://www.mozilla.org/MPL/ 6 * 7 * Software distributed under the License is distributed on an "AS 8 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or 9 * implied. See the License for the specific language governing 10 * rights and limitations under the License. 11 * 12 * The Original Code is pow2WebGui library. 13 * 14 * The Initial Owner of the Original Code is Power Of Two S.R.L. 15 * Portions created by Power Of Two S.R.L. are Copyright (C) Power Of Two S.R.L. 16 * All Rights Reserved. 17 * 18 * Contributor(s): 19 */ 20 21 package com.pow2.webgui.lister; 22 23 import org.apache.velocity.VelocityContext; 24 import com.pow2.webgui.*; 25 import com.pow2.util.*; 26 27 28 /*** 29 * ListerDrawer class. 30 * @author Luca Fossato 31 */ 32 public class AmazonListerDrawer extends WidgetDrawer 33 { 34 /*** 35 * Constructor. 36 * 37 * @param widget the widget to draw 38 */ 39 public AmazonListerDrawer(Widget widget) 40 { 41 super(widget); 42 } 43 44 45 /*** 46 * Gets the string representation of the Lister widget. 47 * 48 * @return the string representation of the Lister widget 49 */ 50 public StringBuffer draw() throws Exception 51 { 52 VelocityContext context = new VelocityContext(); 53 Lister lister = (Lister)widget; 54 55 context.put("title", lister.getTitle()); 56 context.put("titleType", lister.getTitleType()); 57 context.put("color", lister.getColor()); 58 context.put("width", lister.getWidth()); 59 context.put("content", lister.getContent()); 60 61 return new StringBuffer(VelocityUtil.getTemplate(context, "lister/amazon/lister.vm")); 62 } 63 }