Source Code Cross Referenced for Caption.java in  » Library » Apache-beehive-1.0.2-src » org » apache » beehive » netui » tags » databinding » datagrid » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Library » Apache beehive 1.0.2 src » org.apache.beehive.netui.tags.databinding.datagrid 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         *
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         *
017:         * $Header:$
018:         */
019:        package org.apache.beehive.netui.tags.databinding.datagrid;
020:
021:        import java.io.IOException;
022:        import java.io.StringWriter;
023:        import javax.servlet.jsp.tagext.JspFragment;
024:        import javax.servlet.jsp.JspException;
025:        import javax.servlet.jsp.JspContext;
026:        import javax.servlet.http.HttpServletRequest;
027:
028:        import org.apache.beehive.netui.tags.html.HtmlConstants;
029:        import org.apache.beehive.netui.tags.rendering.AbstractHtmlState;
030:        import org.apache.beehive.netui.tags.rendering.CaptionTag;
031:        import org.apache.beehive.netui.tags.rendering.AbstractRenderAppender;
032:        import org.apache.beehive.netui.tags.rendering.WriteRenderAppender;
033:        import org.apache.beehive.netui.databinding.datagrid.api.rendering.DataGridTagModel;
034:        import org.apache.beehive.netui.databinding.datagrid.api.rendering.StyleModel;
035:        import org.apache.beehive.netui.databinding.datagrid.runtime.rendering.table.TableRenderer;
036:        import org.apache.beehive.netui.databinding.datagrid.runtime.util.JspUtil;
037:        import org.apache.beehive.netui.util.Bundle;
038:
039:        /**
040:         * <p>
041:         * The Caption tag is used to render an HTML &lt;caption&gt; inside of a data grid.  The caption
042:         * tag should be placed inside of a &lt;netui-data:dataGrid&gt; tag and will produce the
043:         * caption for the HTML table that the dataGrid renders.
044:         * </p>
045:         * <p>
046:         * To set HTML attributes on the rendered caption tag, use the attribute setters defined in this tag
047:         * </p>
048:         * <p>
049:         * The set of JSP implicit objects available to the body include:
050:         * <ul>
051:         * <li><code>dataGridModel</code> -- the {@link org.apache.beehive.netui.databinding.datagrid.api.rendering.DataGridTagModel}
052:         * for the cell's containing data grid.</li>
053:         * </ul>
054:         * </p>
055:         * @jsptagref.tagdescription
056:         * <p>
057:         * The Caption tag is used to render an HTML &lt;caption&gt; inside of a data grid.  The caption
058:         * tag should be placed inside of a &lt;netui-data:dataGrid&gt; tag and will produce the
059:         * caption for the HTML table that the dataGrid renders.
060:         * </p>
061:         * <p>
062:         * To set HTML attributes on the rendered caption tag, use the attribute setters defined in this tag
063:         * </p>
064:         * <p>
065:         * The set of JSP implicit objects available to the body include:
066:         * <ul>
067:         * <li><code>dataGridModel</code> -- the {@link org.apache.beehive.netui.databinding.datagrid.api.rendering.DataGridTagModel}
068:         * for the cell's containing data grid.</li>
069:         * </ul>
070:         * </p>
071:         * @netui:tag name="caption" body-content="scriptless"
072:         *            description="Renders the caption for the HTML table produced by the data grid tag"
073:         */
074:        public class Caption extends AbstractDataGridHtmlTag {
075:
076:            private CaptionTag.State _captionTag = new CaptionTag.State();
077:
078:            /**
079:             * The name of this tag; this value is used for error reporting.
080:             * @return the String name of this tag
081:             */
082:            public String getTagName() {
083:                return "Caption";
084:            }
085:
086:            /**
087:             * Sets the onClick JavaScript event for the HTML attribute.
088:             *
089:             * @param onClick the onClick event
090:             * @jsptagref.attributedescription The onClick JavaScript event for the HTML caption.
091:             * @jsptagref.attributesyntaxvalue <i>string_onClick</i>
092:             * @netui:attribute required="false" rtexprvalue="true" description="The onClick JavaScript event for the HTML caption."
093:             */
094:            public void setOnClick(String onClick) {
095:                _captionTag.registerAttribute(
096:                        AbstractHtmlState.ATTR_JAVASCRIPT,
097:                        HtmlConstants.ONCLICK, onClick);
098:            }
099:
100:            /**
101:             * Sets the onDblClick JavaScript event for the HTML caption.
102:             *
103:             * @param onDblClick the onDblClick event
104:             * @jsptagref.attributedescription The onDblClick JavaScript event for the HTML caption.
105:             * @jsptagref.attributesyntaxvalue <i>string_onDblClick</i>
106:             * @netui:attribute required="false" rtexprvalue="true" description="The onDblClick JavaScript event for the HTML caption."
107:             */
108:            public void setOnDblClick(String onDblClick) {
109:                _captionTag.registerAttribute(
110:                        AbstractHtmlState.ATTR_JAVASCRIPT,
111:                        HtmlConstants.ONDBLCLICK, onDblClick);
112:            }
113:
114:            /**
115:             * Sets the onKeyDown JavaScript event for the HTML caption.
116:             *
117:             * @param onKeyDown the onKeyDown event
118:             * @jsptagref.attributedescription The onKeyDown JavaScript event for the HTML caption.
119:             * @jsptagref.attributesyntaxvalue <i>string_onKeyDown</i>
120:             * @netui:attribute required="false" rtexprvalue="true" description="The onKeyDown JavaScript event for the HTML caption."
121:             */
122:            public void setOnKeyDown(String onKeyDown) {
123:                _captionTag.registerAttribute(
124:                        AbstractHtmlState.ATTR_JAVASCRIPT,
125:                        HtmlConstants.ONKEYDOWN, onKeyDown);
126:            }
127:
128:            /**
129:             * Sets the onKeyUp JavaScript event for the HTML caption.
130:             *
131:             * @param onKeyUp the onKeyUp event.
132:             * @jsptagref.attributedescription The onKeyUp JavaScript event for the HTML caption.
133:             * @jsptagref.attributesyntaxvalue <i>string_onKeyUp</i>
134:             * @netui:attribute required="false" rtexprvalue="true" description="The onKeyUp JavaScript event for the HTML caption."
135:             */
136:            public void setOnKeyUp(String onKeyUp) {
137:                _captionTag.registerAttribute(
138:                        AbstractHtmlState.ATTR_JAVASCRIPT,
139:                        HtmlConstants.ONKEYUP, onKeyUp);
140:            }
141:
142:            /**
143:             * Sets the onKeyPress JavaScript event for the HTML caption.
144:             *
145:             * @param onKeyPress the onKeyPress event.
146:             * @jsptagref.attributedescription The onKeyPress JavaScript event for the HTML caption.
147:             * @jsptagref.attributesyntaxvalue <i>string_onKeyPress</i>
148:             * @netui:attribute required="false" rtexprvalue="true" description="The onKeyPress JavaScript event for the HTML caption."
149:             */
150:            public void setOnKeyPress(String onKeyPress) {
151:                _captionTag.registerAttribute(
152:                        AbstractHtmlState.ATTR_JAVASCRIPT,
153:                        HtmlConstants.ONKEYPRESS, onKeyPress);
154:            }
155:
156:            /**
157:             * Sets the onMouseDown JavaScript event for the HTML caption.
158:             *
159:             * @param onMouseDown the onMouseDown event.
160:             * @jsptagref.attributedescription The onMouseDown JavaScript event for the HTML caption.
161:             * @jsptagref.attributesyntaxvalue <i>string_onMouseDown</i>
162:             * @netui:attribute required="false" rtexprvalue="true" description="The onMouseDown JavaScript event for the HTML caption."
163:             */
164:            public void setOnMouseDown(String onMouseDown) {
165:                _captionTag.registerAttribute(
166:                        AbstractHtmlState.ATTR_JAVASCRIPT,
167:                        HtmlConstants.ONMOUSEDOWN, onMouseDown);
168:            }
169:
170:            /**
171:             * Sets the onMouseUp JavaScript event for the HTML caption.
172:             *
173:             * @param onMouseUp the onMouseUp event.
174:             * @jsptagref.attributedescription The onMouseUp JavaScript event for the HTML caption.
175:             * @jsptagref.attributesyntaxvalue <i>string_onMouseUp</i>
176:             * @netui:attribute required="false" rtexprvalue="true" description="The onMouseUp JavaScript event for the HTML caption."
177:             */
178:            public void setOnMouseUp(String onMouseUp) {
179:                _captionTag.registerAttribute(
180:                        AbstractHtmlState.ATTR_JAVASCRIPT,
181:                        HtmlConstants.ONMOUSEUP, onMouseUp);
182:            }
183:
184:            /**
185:             * Sets the onMouseMove JavaScript event for the HTML caption.
186:             *
187:             * @param onMouseMove the onMouseMove event.
188:             * @jsptagref.attributedescription The onMouseMove JavaScript event for the HTML caption.
189:             * @jsptagref.attributesyntaxvalue <i>string_onMouseMove</i>
190:             * @netui:attribute required="false" rtexprvalue="true" description="The onMouseMove JavaScript event for the HTML caption."
191:             */
192:            public void setOnMouseMove(String onMouseMove) {
193:                _captionTag.registerAttribute(
194:                        AbstractHtmlState.ATTR_JAVASCRIPT,
195:                        HtmlConstants.ONMOUSEMOVE, onMouseMove);
196:            }
197:
198:            /**
199:             * Sets the onMouseOut JavaScript event for the HTML caption.
200:             *
201:             * @param onMouseOut the onMouseOut event.
202:             * @jsptagref.attributedescription The onMouseOut JavaScript event for the HTML caption.
203:             * @jsptagref.attributesyntaxvalue <i>string_onMouseOut</i>
204:             * @netui:attribute required="false" rtexprvalue="true" description="The onMouseOut JavaScript event for the HTML caption."
205:             */
206:            public void setOnMouseOut(String onMouseOut) {
207:                _captionTag.registerAttribute(
208:                        AbstractHtmlState.ATTR_JAVASCRIPT,
209:                        HtmlConstants.ONMOUSEOUT, onMouseOut);
210:            }
211:
212:            /**
213:             * Sets the onMouseOver JavaScript event for the HTML caption.
214:             *
215:             * @param onMouseOver the onMouseOver event.
216:             * @jsptagref.attributedescription The onMouseOver JavaScript event for the HTML caption.
217:             * @jsptagref.attributesyntaxvalue <i>string_onMouseOver</i>
218:             * @netui:attribute required="false" rtexprvalue="true" description="The onMouseOver JavaScript event for the HTML caption."
219:             */
220:            public void setOnMouseOver(String onMouseOver) {
221:                _captionTag.registerAttribute(
222:                        AbstractHtmlState.ATTR_JAVASCRIPT,
223:                        HtmlConstants.ONMOUSEOVER, onMouseOver);
224:            }
225:
226:            /**
227:             * Sets the style of the HTML caption.
228:             *
229:             * @param style the caption attribute.
230:             * @jsptagref.attributedescription The style of the HTML caption
231:             * @jsptagref.attributesyntaxvalue <i>string_style</i>
232:             * @netui:attribute required="false"  rtexprvalue="true" description="The style of the HTML caption"
233:             */
234:            public void setStyle(String style) {
235:                if ("".equals(style))
236:                    return;
237:
238:                _captionTag.style = style;
239:            }
240:
241:            /**
242:             * Sets the style class of the HTML caption.
243:             *
244:             * @param styleClass the style class
245:             * @jsptagref.attributedescription The style class of the HTML caption.
246:             * @jsptagref.attributesyntaxvalue <i>string_style_class</i>
247:             * @netui:attribute required="false"  rtexprvalue="true" description="The style class for the HTML caption"
248:             */
249:            public void setStyleClass(String styleClass) {
250:                if ("".equals(styleClass))
251:                    return;
252:
253:                _captionTag.styleClass = styleClass;
254:            }
255:
256:            /**
257:             * Sets the value of the title attribute for the HTML caption.
258:             *
259:             * @param title the title attribute
260:             * @jsptagref.attributedescription The title attribute for the HTML caption
261:             * @jsptagref.attributesyntaxvalue <i>string_title</i>
262:             * @netui:attribute required="false" rtexprvalue="true" description="The title attribute for the HTML caption"
263:             */
264:            public void setTitle(String title) {
265:                _captionTag.registerAttribute(AbstractHtmlState.ATTR_GENERAL,
266:                        HtmlConstants.TITLE, title);
267:            }
268:
269:            /**
270:             * Sets the value of the language attribute for the HTML caption.
271:             *
272:             * @param lang the language attribute
273:             * @jsptagref.attributedescription The language attribute for the HTML caption
274:             * @jsptagref.attributesyntaxvalue <i>string_lang</i>
275:             * @netui:attribute required="false" rtexprvalue="true" description="The language attribute for the HTML caption."
276:             */
277:            public void setLang(String lang) {
278:                _captionTag.registerAttribute(AbstractHtmlState.ATTR_GENERAL,
279:                        HtmlConstants.LANG, lang);
280:            }
281:
282:            /**
283:             * Sets the value of the text direction attribute for the HTML caption.
284:             *
285:             * @param dir the dir attribute
286:             * @jsptagref.attributedescription The text direction attribute for the caption
287:             * @jsptagref.attributesyntaxvalue <i>string_dir</i>
288:             * @netui:attribute required="false" rtexprvalue="true" description="The cell's text direction"
289:             */
290:            public void setDir(String dir) {
291:                _captionTag.registerAttribute(AbstractHtmlState.ATTR_GENERAL,
292:                        HtmlConstants.DIR, dir);
293:            }
294:
295:            /**
296:             * Set the name of the tagId for the HTML caption.  The page author is responsible for ensuring that the
297:             * tagId value is unique within the current page scope.
298:             *
299:             * @param tagId the the name of the tagId for the caption.
300:             * @jsptagref.attributedescription The tagId.
301:             * @jsptagref.attributesyntaxvalue <i>string_tagId</i>
302:             * @netui:attribute required="false" rtexprvalue="true"
303:             * description="String value. Sets the id (or name) attribute of the rendered HTML tag. "
304:             */
305:            public void setTagId(String tagId) throws JspException {
306:                applyTagId(_captionTag, tagId);
307:            }
308:
309:            /**
310:             * <p>
311:             * Render the caption tag.  This tag renders during the data grid's {@link DataGridTagModel#RENDER_STATE_CAPTION}
312:             * state and produces an HTML &lt;caption&gt; which contains the result of having evaluated
313:             * the body of this tag.
314:             * </p>
315:             * @throws IOException
316:             * @throws JspException when the {@link DataGridTagModel} can not be found in the {@link JspContext}
317:             */
318:            public void doTag() throws IOException, JspException {
319:
320:                JspContext jspContext = getJspContext();
321:                DataGridTagModel dgm = DataGridUtil
322:                        .getDataGridTagModel(jspContext);
323:                if (dgm == null)
324:                    throw new JspException(
325:                            Bundle
326:                                    .getErrorString("DataGridTags_MissingDataGridModel"));
327:
328:                if (dgm.getRenderState() == DataGridTagModel.RENDER_STATE_CAPTION) {
329:                    JspFragment fragment = getJspBody();
330:                    if (fragment != null) {
331:                        String captionScript = null;
332:                        if (_captionTag.id != null) {
333:                            HttpServletRequest request = JspUtil
334:                                    .getRequest(getJspContext());
335:                            captionScript = renderNameAndId(request,
336:                                    _captionTag, null);
337:                        }
338:
339:                        StringWriter sw = new StringWriter();
340:                        TableRenderer tableRenderer = dgm.getTableRenderer();
341:                        StyleModel stylePolicy = dgm.getStyleModel();
342:                        AbstractRenderAppender appender = new WriteRenderAppender(
343:                                jspContext);
344:
345:                        if (_captionTag.styleClass == null)
346:                            _captionTag.styleClass = stylePolicy
347:                                    .getCaptionClass();
348:
349:                        tableRenderer.openCaption(_captionTag, appender);
350:
351:                        fragment.invoke(sw);
352:                        appender.append(sw.toString());
353:
354:                        tableRenderer.closeCaption(appender);
355:
356:                        if (captionScript != null)
357:                            appender.append(captionScript);
358:                    }
359:                }
360:            }
361:        }
w___w__w.___j___a_va2__s_.c_o__m | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.