KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opensubsystems > patterns > dialoglayout > www > CachedRow


1 /*
2  * Copyright (c) 2005 - 2007 OpenSubsystems s.r.o. Slovak Republic. All rights reserved.
3  *
4  * Project: OpenSubsystems
5  *
6  * $Id: CachedRow.java,v 1.4 2007/01/07 06:14:28 bastafidli Exp $
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; version 2 of the License.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20  */

21
22 package org.opensubsystems.patterns.dialoglayout.www;
23
24 import javax.servlet.jsp.JspException JavaDoc;
25 import javax.servlet.jsp.tagext.BodyContent JavaDoc;
26
27 import org.opensubsystems.core.www.BlockElementTag;
28 import org.opensubsystems.core.www.TagUtils;
29
30 /**
31  * Base class for all tags which represents dialog rows, that is rows in dialog
32  * displaying labels and controls. This class ensures that the content of the
33  * entire row is first cached and then correct id is substituted to the HTML
34  * elements for the control in case the ID was not known at the time when the ID
35  * was generated.
36  *
37  * @version $Id: CachedRow.java,v 1.4 2007/01/07 06:14:28 bastafidli Exp $
38  * @author Julian Legeny
39  * @code.reviewer Miro Halas
40  * @code.reviewed 1.2 2005/10/06 06:38:46 bastafidli
41  */

42 public abstract class CachedRow extends BlockElementTag
43 {
44    // Constructors /////////////////////////////////////////////////////////////
45

46    /**
47     * Constructor for cached row.
48     *
49     * @param strCssclass - initial class of the element
50     * @param strType - type of tag - DIV or SPAN
51     */

52    public CachedRow(
53       String JavaDoc strCssclass,
54       String JavaDoc strType
55    )
56    {
57       super(strCssclass, strType);
58    }
59
60    // Business logic ///////////////////////////////////////////////////////////
61

62    /**
63     * {@inheritDoc}
64     */

65    public int doStartTag(
66    ) throws JspException JavaDoc
67    {
68       super.doStartTag();
69       return (EVAL_BODY_BUFFERED);
70    }
71
72    /**
73     * {@inheritDoc}
74     */

75    public int doEndTag(
76    ) throws JspException JavaDoc
77    {
78       // Get the buffered body and replace all occurences of 'unknownrowid'
79
// generated within the DialogUnknownRowTag by actual ID.
80
BodyContent JavaDoc content = getBodyContent();
81       String JavaDoc strContent = content.getString();
82
83       if ((m_strId != null) && (m_strId.length() > 0))
84       {
85          if (strContent != null && strContent.length() > 0)
86          {
87             strContent = strContent.replaceAll(DialogUnknownRowTag.UNKNOWN_ROW_ID,
88                                                m_strId);
89          }
90       }
91       
92       TagUtils.write(pageContext, strContent);
93       
94       super.doEndTag();
95
96       return (EVAL_PAGE);
97    }
98 }
99
Popular Tags