KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > j2biz > blogunity > web > decorator > AbstractTableDecorator


1 /*
2  * $Id: AbstractTableDecorator.java,v 1.5 2005/01/07 23:27:33 michelson Exp $
3  *
4  * Copyright (c) 2004 j2biz Group, http://www.j2biz.com Koeln / Duesseldorf ,
5  * Germany
6  *
7  * @author Max Kalina
8  *
9  *
10  * This program is free software; you can redistribute it and/or modify it under
11  * the terms of the GNU General Public License as published by the Free Software
12  * Foundation; either version 2 of the License, or (at your option) any later
13  * version.
14  *
15  * This program is distributed in the hope that it will be useful, but WITHOUT
16  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU General Public License along with
21  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
22  * Place, Suite 330, Boston, MA 02111-1307 USA
23  *
24  */

25
26 package com.j2biz.blogunity.web.decorator;
27
28 import java.util.Locale JavaDoc;
29
30 import javax.servlet.http.HttpServletRequest JavaDoc;
31 import javax.servlet.jsp.PageContext JavaDoc;
32
33 import org.apache.commons.logging.Log;
34 import org.apache.commons.logging.LogFactory;
35 import org.displaytag.decorator.TableDecorator;
36
37 import com.j2biz.blogunity.IConstants;
38 import com.j2biz.blogunity.i18n.I18NMessageManager;
39 import com.j2biz.blogunity.util.BlogUtils;
40
41 public abstract class AbstractTableDecorator extends TableDecorator {
42     /**
43      * Logger for this class
44      */

45     private static final Log log = LogFactory.getLog(AbstractTableDecorator.class);
46
47     protected HttpServletRequest JavaDoc request;
48
49     protected BlogUtils utils;
50
51     protected String JavaDoc ctx;
52
53     protected Locale JavaDoc locale;
54
55     /*
56      * (non-Javadoc)
57      *
58      * @see org.displaytag.decorator.Decorator#init(javax.servlet.jsp.PageContext,
59      * java.lang.Object)
60      */

61     public void init(PageContext JavaDoc pagectx, Object JavaDoc obj) {
62         super.init(pagectx, obj);
63
64         utils = BlogUtils.getInstance();
65         request = (HttpServletRequest JavaDoc) getPageContext().getRequest();
66         ctx = request.getContextPath();
67         locale = (Locale JavaDoc) request.getAttribute(IConstants.Request.LOCALE);
68     }
69
70     protected String JavaDoc getMessageForKey(String JavaDoc key) {
71         return I18NMessageManager.getInstance().getMessage(key, locale);
72     }
73
74 }
Popular Tags