KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infoglue > deliver > taglib > content > AssetThumbnailUrlTag


1 /* ===============================================================================
2 *
3 * Part of the InfoGlue Content Management Platform (www.infoglue.org)
4 *
5 * ===============================================================================
6 *
7 * Copyright (C)
8 *
9 * This program is free software; you can redistribute it and/or modify it under
10 * the terms of the GNU General Public License version 2, as published by the
11 * Free Software Foundation. See the file LICENSE.html for more information.
12 *
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY, including the implied warranty of MERCHANTABILITY or FITNESS
15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * this program; if not, write to the Free Software Foundation, Inc. / 59 Temple
19 * Place, Suite 330 / Boston, MA 02111-1307 / USA.
20 *
21 * ===============================================================================
22 */

23
24 package org.infoglue.deliver.taglib.content;
25
26 import javax.servlet.jsp.JspException JavaDoc;
27 import javax.servlet.jsp.JspTagException JavaDoc;
28
29 import org.infoglue.deliver.taglib.component.ComponentLogicTag;
30
31 /**
32  * This is an attempt to make an TagLib for attempts to get a AssetThumbnailUrl:s from a content referenced by a component
33  * in a JSP.
34  *
35  * <%@ taglib uri="infoglue" prefix="infoglue" %>
36  *
37  * <infoglue:component.AssetThumbnailUrl propertyName="Logotype" assetKey="logotype" width="100" height="100"/>
38  *
39  * @author Mattias Bogeblad
40  */

41
42 public class AssetThumbnailUrlTag extends ComponentLogicTag
43 {
44     private static final long serialVersionUID = 3978145452350648625L;
45
46     private String JavaDoc propertyName;
47     private String JavaDoc assetKey;
48     private int width;
49     private int height;
50     private boolean useInheritance = true;
51     
52     public AssetThumbnailUrlTag()
53     {
54         super();
55     }
56     
57     public int doEndTag() throws JspException JavaDoc
58     {
59         try
60         {
61             if(assetKey != null)
62                 write(getComponentLogic().getAssetThumbnailUrl(propertyName, assetKey, width, height, useInheritance));
63             else
64                 write(getComponentLogic().getAssetThumbnailUrl(propertyName, width, height, useInheritance));
65         }
66         catch(Exception JavaDoc e)
67         {
68             e.printStackTrace();
69             throw new JspTagException JavaDoc("ComponentLogic.getAssetThumbnailUrl error: " + e.getMessage());
70         }
71         return EVAL_PAGE;
72     }
73
74     public void setAssetKey(String JavaDoc assetKey)
75     {
76         this.assetKey = assetKey;
77     }
78
79     public void setHeight(int height)
80     {
81         this.height = height;
82     }
83     
84     public void setPropertyName(String JavaDoc propertyName) throws JspException JavaDoc
85     {
86         this.propertyName = evaluateString("assetThumbnailUrl", "propertyName", propertyName);
87     }
88     
89     public void setUseInheritance(boolean useInheritance)
90     {
91         this.useInheritance = useInheritance;
92     }
93     
94     public void setWidth(int width)
95     {
96         this.width = width;
97     }
98 }
Popular Tags