Source Code Cross Referenced for AbstractHtmlTableCell.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 java.util.ArrayList;
024:        import javax.servlet.jsp.tagext.JspFragment;
025:        import javax.servlet.jsp.JspException;
026:        import javax.servlet.http.HttpServletRequest;
027:
028:        import org.apache.beehive.netui.databinding.datagrid.api.rendering.DataGridTagModel;
029:        import org.apache.beehive.netui.databinding.datagrid.runtime.rendering.table.TableRenderer;
030:        import org.apache.beehive.netui.databinding.datagrid.runtime.util.JspUtil;
031:        import org.apache.beehive.netui.databinding.datagrid.api.sort.SortModel;
032:        import org.apache.beehive.netui.databinding.datagrid.api.filter.FilterModel;
033:        import org.apache.beehive.netui.tags.IAttributeConsumer;
034:        import org.apache.beehive.netui.tags.IBehaviorConsumer;
035:        import org.apache.beehive.netui.tags.html.HtmlConstants;
036:        import org.apache.beehive.netui.tags.rendering.AbstractHtmlState;
037:        import org.apache.beehive.netui.tags.rendering.TdTag;
038:        import org.apache.beehive.netui.tags.rendering.AbstractRenderAppender;
039:        import org.apache.beehive.netui.util.Bundle;
040:
041:        /**
042:         * <p>
043:         * Abstract base class that supports rendering an HTML &lt;td&gt;.  This tag should be used as the base class
044:         * for all tags which render content during the data grid's {@link DataGridTagModel#RENDER_STATE_GRID} render
045:         * state.  Subclasses must implement the {@link #renderDataCellContents(org.apache.beehive.netui.tags.rendering.AbstractRenderAppender, String)}
046:         * which will be invoked after the opening table cell tag and before the closing table cell tag.
047:         * </p>
048:         * <p>
049:         * State attributes set via the <code>setCell*</code> methods are added to the attribute set used
050:         * when rendering the &lt;td&gt; tag.
051:         * </p>
052:         */
053:        public abstract class AbstractHtmlTableCell extends AbstractCell
054:                implements  IAttributeConsumer, IBehaviorConsumer {
055:
056:            private String _sortExpression = null;
057:            private String _filterExpression = null;
058:
059:            private TdTag.State _cellState = new TdTag.State();
060:
061:            /**
062:             * <p>
063:             * Set the sort expression with which this cell should be associated.  Cells use this value
064:             * to lookup any {@link org.apache.beehive.netui.databinding.datagrid.api.sort.Sort} state
065:             * that may apply to this cell.  Often, this value matches a {@link HeaderCell#setSortExpression(String)}
066:             * set on a header cell.  It is used by data cells to render styles representing sorted data.
067:             * </p>
068:             * @param sortExpression the sort expression
069:             * @jsptagref.attributedescription
070:             * @jsptagref.attributesyntaxvalue <i>string</i>
071:             * @netui:attribute required="false" rtexprvalue="true"
072:             */
073:            public void setSortExpression(String sortExpression) {
074:                _sortExpression = sortExpression;
075:            }
076:
077:            /**
078:             * <p>
079:             * Set the filter expression with which this cell should be associated.  Cells use this value
080:             * to lookup any {@link org.apache.beehive.netui.databinding.datagrid.api.filter.Filter} state
081:             * that may apply to this cell.  Often, this value matches a {@link HeaderCell#setFilterExpression(String)}
082:             * set on a header cell.  It is used by data cells to render styles representing filtered data.
083:             * </p>
084:             * @param filterExpression the filter expression
085:             * @jsptagref.attributedescription
086:             * <p>
087:             * Set the filter expression with which this cell should be associated.  Cells use this value
088:             * to lookup any {@link org.apache.beehive.netui.databinding.datagrid.api.filter.Filter} state
089:             * that may apply to this cell.  Often, this value matches a {@link HeaderCell#setFilterExpression(String)}
090:             * set on a header cell.  It is used by data cells to render styles representing filtered data.
091:             * </p>
092:             * @jsptagref.attributesyntaxvalue <i>string</i>
093:             * @netui:attribute required="false" rtexprvalue="true"
094:             */
095:            public void setFilterExpression(String filterExpression) {
096:                _filterExpression = filterExpression;
097:            }
098:
099:            /* --------------------------------------------------------------
100:             *
101:             *    <td> attributes
102:             *
103:             * --------------------------------------------------------------
104:             */
105:
106:            /**
107:
108:             * Sets the onClick JavaScript event for the HTML table cell.
109:             *
110:             * @param onClick the onClick event.
111:             * @jsptagref.attributedescription The onClick JavaScript event for the HTML table cell.
112:             * @jsptagref.attributesyntaxvalue <i>string_cellOnClick</i>
113:             * @netui:attribute required="false" rtexprvalue="true" description="The onClick JavaScript event."
114:             */
115:            public void setCellOnClick(String onClick) {
116:                _cellState.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT,
117:                        HtmlConstants.ONCLICK, onClick);
118:            }
119:
120:            /**
121:             * Sets the onDblClick javascript event for the HTML table cell.
122:             *
123:             * @param onDblClick the onDblClick event.
124:             * @jsptagref.attributedescription The onDblClick JavaScript event for the HTML table cell.
125:             * @jsptagref.attributesyntaxvalue <i>string_cellOnDblClick</i>
126:             * @netui:attribute required="false" rtexprvalue="true" description="The onDblClick JavaScript event."
127:             */
128:            public void setCellOnDblClick(String onDblClick) {
129:                _cellState.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT,
130:                        HtmlConstants.ONDBLCLICK, onDblClick);
131:            }
132:
133:            /**
134:             * Sets the onKeyDown javascript event for the HTML table cell.
135:             *
136:             * @param onKeyDown the onKeyDown event.
137:             * @jsptagref.attributedescription The onKeyDown JavaScript event for the HTML table cell.
138:             * @jsptagref.attributesyntaxvalue <i>string_cellOnKeyDown</i>
139:             * @netui:attribute required="false" rtexprvalue="true" description="The onKeyDown JavaScript event."
140:             */
141:            public void setCellOnKeyDown(String onKeyDown) {
142:                _cellState.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT,
143:                        HtmlConstants.ONKEYDOWN, onKeyDown);
144:            }
145:
146:            /**
147:             * Sets the onKeyUp javascript event for the HTML table cell.
148:             *
149:             * @param onKeyUp the onKeyUp event.
150:             * @jsptagref.attributedescription The onKeyUp JavaScript event for the HTML table cell.
151:             * @jsptagref.attributesyntaxvalue <i>string_cellOnKeyUp</i>
152:             * @netui:attribute required="false" rtexprvalue="true" description="The onKeyUp JavaScript event."
153:             */
154:            public void setCellOnKeyUp(String onKeyUp) {
155:                _cellState.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT,
156:                        HtmlConstants.ONKEYUP, onKeyUp);
157:            }
158:
159:            /**
160:             * Sets the onKeyPress javascript event for the HTML table cell.
161:             *
162:             * @param onKeyPress the onKeyPress event.
163:             * @jsptagref.attributedescription The onKeyPress JavaScript event for the HTML table cell.
164:             * @jsptagref.attributesyntaxvalue <i>string_cellOnKeyPress</i>
165:             * @netui:attribute required="false" rtexprvalue="true" description="The onKeyPress JavaScript event."
166:             */
167:            public void setCellOnKeyPress(String onKeyPress) {
168:                _cellState.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT,
169:                        HtmlConstants.ONKEYPRESS, onKeyPress);
170:            }
171:
172:            /**
173:             * Sets the onMouseDown javascript event for the HTML table cell.
174:             *
175:             * @param onMouseDown the onMouseDown event.
176:             * @jsptagref.attributedescription The onMouseDown JavaScript event for the HTML table cell.
177:             * @jsptagref.attributesyntaxvalue <i>string_cellOnMouseDown</i>
178:             * @netui:attribute required="false" rtexprvalue="true" description="The onMouseDown JavaScript event."
179:             */
180:            public void setCellOnMouseDown(String onMouseDown) {
181:                _cellState.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT,
182:                        HtmlConstants.ONMOUSEDOWN, onMouseDown);
183:            }
184:
185:            /**
186:             * Sets the onMouseUp javascript event for the HTML table cell.
187:             *
188:             * @param onMouseUp the onMouseUp event.
189:             * @jsptagref.attributedescription The onMouseUp JavaScript event for the HTML table cell.
190:             * @jsptagref.attributesyntaxvalue <i>string_cellOnMouseUp</i>
191:             * @netui:attribute required="false" rtexprvalue="true" description="The onMouseUp JavaScript event."
192:             */
193:            public void setCellOnMouseUp(String onMouseUp) {
194:                _cellState.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT,
195:                        HtmlConstants.ONMOUSEUP, onMouseUp);
196:            }
197:
198:            /**
199:             * Sets the onMouseMove javascript event for the HTML table cell.
200:             *
201:             * @param onMouseMove the onMouseMove event.
202:             * @jsptagref.attributedescription The onMouseMove JavaScript event for the HTML table cell.
203:             * @jsptagref.attributesyntaxvalue <i>string_cellOnMouseMove</i>
204:             * @netui:attribute required="false" rtexprvalue="true" description="The onMouseMove JavaScript event."
205:             */
206:            public void setCellOnMouseMove(String onMouseMove) {
207:                _cellState.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT,
208:                        HtmlConstants.ONMOUSEMOVE, onMouseMove);
209:            }
210:
211:            /**
212:             * Sets the onMouseOut javascript event for the HTML table cell.
213:             *
214:             * @param onMouseOut the onMouseOut event.
215:             * @jsptagref.attributedescription The onMouseOut JavaScript event for the HTML table cell.
216:             * @jsptagref.attributesyntaxvalue <i>string_cellOnMouseOut</i>
217:             * @netui:attribute required="false" rtexprvalue="true" description="The onMouseOut JavaScript event."
218:             */
219:            public void setCellOnMouseOut(String onMouseOut) {
220:                _cellState.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT,
221:                        HtmlConstants.ONMOUSEOUT, onMouseOut);
222:            }
223:
224:            /**
225:             * Sets the onMouseOver javascript event for the HTML table cell.
226:             *
227:             * @param onMouseOver the onMouseOver event.
228:             * @jsptagref.attributedescription The onMouseOver JavaScript event for the HTML table cell.
229:             * @jsptagref.attributesyntaxvalue <i>string_cellOnMouseOver</i>
230:             * @netui:attribute required="false" rtexprvalue="true" description="The onMouseOver JavaScript event."
231:             */
232:            public void setCellOnMouseOver(String onMouseOver) {
233:                _cellState.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT,
234:                        HtmlConstants.ONMOUSEOVER, onMouseOver);
235:            }
236:
237:            /**
238:             * Sets the style attribute for the HTML table cell.
239:             *
240:             * @param style the html style.
241:             * @jsptagref.attributedescription The style attribute for the HTML table cell.
242:             * @jsptagref.attributesyntaxvalue <i>string_cellStyle</i>
243:             * @netui:attribute required="false"  rtexprvalue="true" description="The style attribute."
244:             */
245:            public void setCellStyle(String style) {
246:                if ("".equals(style))
247:                    return;
248:
249:                _cellState.style = style;
250:            }
251:
252:            /**
253:             * Sets the style class attribute for the HTML table cell.
254:             *
255:             * @param styleClass the html style class.
256:             * @jsptagref.attributedescription The style class attribute for the HTML table cell.
257:             * @jsptagref.attributesyntaxvalue <i>string_cellStyleClass</i>
258:             * @netui:attribute required="false"  rtexprvalue="true" description="The style class."
259:             */
260:            public void setCellStyleClass(String styleClass) {
261:                if ("".equals(styleClass))
262:                    return;
263:
264:                _cellState.styleClass = styleClass;
265:            }
266:
267:            /**
268:             * Sets the value of the title attribute for the HTML table cell.
269:             *
270:             * @param title the title
271:             * @jsptagref.attributedescription The title for the HTML table cell.
272:             * @jsptagref.attributesyntaxvalue <i>string_cellTitle</i>
273:             * @netui:attribute required="false" rtexprvalue="true" description="The title."
274:             */
275:            public void setCellTitle(String title) {
276:                _cellState.registerAttribute(AbstractHtmlState.ATTR_GENERAL,
277:                        HtmlConstants.TITLE, title);
278:            }
279:
280:            /**
281:             * Sets the rowspan attribute for the HTML table cell.
282:             *
283:             * @param rowSpan the rowspan
284:             * @jsptagref.attributedescription The row span attribute for the HTML table cell.
285:             * @jsptagref.attributesyntaxvalue <i>string_cellRowspan</i>
286:             * @netui:attribute required="false" rtexprvalue="true" description="The rowspan."
287:             */
288:            public void setCellRowspan(int rowSpan) {
289:                _cellState.registerAttribute(AbstractHtmlState.ATTR_GENERAL,
290:                        HtmlConstants.ROWSPAN, "" + rowSpan);
291:            }
292:
293:            /**
294:             * Sets the colspan attribute of the HTML table cell.
295:             *
296:             * @param colSpan the colspan
297:             * @jsptagref.attributedescription The colspan attribute of the HTML table cell.
298:             * @jsptagref.attributesyntaxvalue <i>string_cellColspan</i>
299:             * @netui:attribute required="false" rtexprvalue="true" description="The colspan."
300:             */
301:            public void setCellColspan(int colSpan) {
302:                _cellState.registerAttribute(AbstractHtmlState.ATTR_GENERAL,
303:                        HtmlConstants.COLSPAN, "" + colSpan);
304:            }
305:
306:            /**
307:             * Sets the horizontal alignment of the HTML table cell.
308:             *
309:             * @param align the alignment
310:             * @jsptagref.attributedescription The horizontal alignment of the HTML table cell.
311:             * @jsptagref.attributesyntaxvalue <i>string_cellAlign</i>
312:             * @netui:attribute required="false" rtexprvalue="true" description="The cell's horizontal alignment"
313:             */
314:            public void setCellAlign(String align) {
315:                /* todo: should this enforce left|center|right|justify|char as in the spec */
316:                _cellState.registerAttribute(AbstractHtmlState.ATTR_GENERAL,
317:                        HtmlConstants.ALIGN, align);
318:            }
319:
320:            /**
321:             * Sets the value of the horizontal alignment character attribute for the HTML table cell.
322:             *
323:             * @param alignChar the horizontal alignment character
324:             * @jsptagref.attributedescription The horizontal alignment character for the HTML table cell
325:             * @jsptagref.attributesyntaxvalue <i>string_cellAlignChar</i>
326:             * @netui:attribute required="false" rtexprvalue="true" description="The cell's horizontal alignment character"
327:             */
328:            public void setCellChar(String alignChar) {
329:                _cellState.registerAttribute(AbstractHtmlState.ATTR_GENERAL,
330:                        HtmlConstants.CHAR, alignChar);
331:            }
332:
333:            /**
334:             * Sets the value of the horizontal alignment character offset attribute for the HTML table cell.
335:             *
336:             * @param alignCharOff the alingnment character offset
337:             * @jsptagref.attributedescription The horizontal alignment character offset for the HTML table cell.
338:             * @jsptagref.attributesyntaxvalue <i>string_cellAignCharOff</i>
339:             * @netui:attribute required="false" rtexprvalue="true" description="The cell's horizontal alignment character offset"
340:             */
341:            public void setCellCharoff(String alignCharOff) {
342:                _cellState.registerAttribute(AbstractHtmlState.ATTR_GENERAL,
343:                        HtmlConstants.CHAROFF, alignCharOff);
344:            }
345:
346:            /**
347:             * Sets the value of the vertical alignment attribute for the HTML table cell.
348:             *
349:             * @param align the vertical alignment
350:             * @jsptagref.attributedescription The vertical alignment for the HTML table cell.
351:             * @jsptagref.attributesyntaxvalue <i>string_cellAlign</i>
352:             * @netui:attribute required="false" rtexprvalue="true" description="The cell's vertical alignment"
353:             */
354:            public void setCellValign(String align) {
355:                /* todo: should this enforce top|middle|bottom|baseline as in the spec */
356:                _cellState.registerAttribute(AbstractHtmlState.ATTR_GENERAL,
357:                        HtmlConstants.VALIGN, align);
358:            }
359:
360:            /**
361:             * Sets the value of the language attribute for the HTML table cell.
362:             *
363:             * @param lang the language
364:             * @jsptagref.attributedescription The language for the HTML table cell.
365:             * @jsptagref.attributesyntaxvalue <i>string_cellLang</i>
366:             * @netui:attribute required="false" rtexprvalue="true" description="The cell's language"
367:             */
368:            public void setCellLang(String lang) {
369:                _cellState.registerAttribute(AbstractHtmlState.ATTR_GENERAL,
370:                        HtmlConstants.LANG, lang);
371:            }
372:
373:            /**
374:             * Sets the value of the text direction attribute for the HTML table cell.
375:             *
376:             * @param dir the text direction
377:             * @jsptagref.attributedescription The text direction attribute for the HTML table cell.
378:             * @jsptagref.attributesyntaxvalue <i>string_cellDir</i>
379:             * @netui:attribute required="false" rtexprvalue="true" description="The cell's text direction"
380:             */
381:            public void setCellDir(String dir) {
382:                _cellState.registerAttribute(AbstractHtmlState.ATTR_GENERAL,
383:                        HtmlConstants.DIR, dir);
384:            }
385:
386:            /**
387:             * Sets the value of the abbreviated form of the HTML table cell's content.
388:             *
389:             * @param abbr the abbreviation
390:             * @jsptagref.attributedescription The abbreviated form of the HTML table cell's content.
391:             * @jsptagref.attributesyntaxvalue <i>string_cellAbbr</i>
392:             * @netui:attribute required="false" rtexprvalue="true" description="The abbreviated form of the cell's content"
393:             */
394:            public void setCellAbbr(String abbr) {
395:                _cellState.registerAttribute(AbstractHtmlState.ATTR_GENERAL,
396:                        HtmlConstants.ABBR, abbr);
397:            }
398:
399:            /**
400:             * Sets the value of the axis attribute for the HTML table cell.
401:             *
402:             * @param axis the axis
403:             * @jsptagref.attributedescription The axis attribute for the HTML table cell.
404:             * @jsptagref.attributesyntaxvalue <i>string_cellAxis</i>
405:             * @netui:attribute required="false" rtexprvalue="true" description="The axis attribute"
406:             */
407:            public void setCellAxis(String axis) {
408:                _cellState.registerAttribute(AbstractHtmlState.ATTR_GENERAL,
409:                        HtmlConstants.AXIS, axis);
410:            }
411:
412:            /**
413:             * Sets the value of the headers attribute for the HTML table cell.
414:             *
415:             * @param headers the headers
416:             * @jsptagref.attributedescription The headers attribute for the HTML table cell.
417:             * @jsptagref.attributesyntaxvalue <i>string_cellHeaders</i>
418:             * @netui:attribute required="false" rtexprvalue="true" description="The headers attribute"
419:             */
420:            public void setCellHeaders(String headers) {
421:                _cellState.registerAttribute(AbstractHtmlState.ATTR_GENERAL,
422:                        HtmlConstants.HEADERS, headers);
423:            }
424:
425:            /**
426:             * Sets the value of the scope attribute for the HTML table cell.
427:             *
428:             * @param scope the scope
429:             * @jsptagref.attributedescription The scope attribute for the HTML table cell.
430:             * @jsptagref.attributesyntaxvalue <i>string_cellScope</i>
431:             * @netui:attribute required="false" rtexprvalue="true" description="The scope attribute"
432:             */
433:            public void setCellScope(String scope) {
434:                _cellState.registerAttribute(AbstractHtmlState.ATTR_GENERAL,
435:                        HtmlConstants.SCOPE, scope);
436:            }
437:
438:            /**
439:             * Set the name of the tagId for the HTML table cell.  The user is responsible for ensuring that
440:             * this tag id is unique in the rendered page.
441:             *
442:             * @param tagId the tag id
443:             * @jsptagref.attributedescription The tagId for the HTML table cell.  The user is responsible for
444:             * ensuring that this tag id is unique in the rendered page.
445:             * @jsptagref.attributesyntaxvalue <i>string_cellTagId</i>
446:             * @netui:attribute required="false" rtexprvalue="true"
447:             * description="String value. Sets the id (or name) attribute of the rendered HTML tag. "
448:             */
449:            public void setCellTagId(String tagId) throws JspException {
450:                applyTagId(_cellState, tagId);
451:            }
452:
453:            /**
454:             * <p>
455:             * Base support for setting attributes on a tag via the {@link IAttributeConsumer} interface.  The
456:             * AbstractHtmlTableCell does not support any attributes by default.  Attributes set via this interface
457:             * are used to extend the HTML attributes exposed through the JSP tags themselves.  This allows
458:             * tag users to add arbitrary attributes to the HTML tags rendered by the data grid.
459:             * </p>
460:             *
461:             * @param name  The name of the attribute.
462:             * @param value The value of the attribute.
463:             * @param facet The name of a facet to which the attribute will be applied.  This is optional.
464:             * @throws JspException
465:             */
466:            public void setAttribute(String name, String value, String facet)
467:                    throws JspException {
468:                String s = Bundle.getString("Tags_AttributeFacetNotSupported",
469:                        new Object[] { facet });
470:                throw new JspException(s);
471:            }
472:
473:            /**
474:             * <p>
475:             * Base support for setting behavior values via the {@link IBehaviorConsumer} interface.  The
476:             * AbstractHtmlTableCell does not support any attributes by default.  Attributes set via this
477:             * interface are used to configure internal functionality of the tags which is not exposed
478:             * via JSP tag attributes.
479:             * </p>
480:             * @param name the name of the behavior
481:             * @param value the value of the behavior
482:             * @param facet the name of a facet of the tag to which the behavior will be applied.  This is optional.
483:             * @throws JspException
484:             */
485:            public void setBehavior(String name, Object value, String facet)
486:                    throws JspException {
487:                String s = Bundle.getString("Tags_BehaviorFacetNotSupported",
488:                        new Object[] { facet });
489:                throw new JspException(s);
490:            }
491:
492:            /**
493:             * <p>
494:             * Base HTML table cell rendering functionality which opens and closes the HTML &lt;td&gt; tags with
495:             * the correct style and attribute information.  Between the table cell tags, the tag
496:             * calls the {@link #renderDataCellContents(org.apache.beehive.netui.tags.rendering.AbstractRenderAppender, String)}
497:             * method so that subclasses implementing this method can provide content inside of the table cell.
498:             * </p>
499:             * <p>
500:             * The style information rendered here includes the following in order:
501:             * <ol>
502:             * <li>the {@link org.apache.beehive.netui.databinding.datagrid.api.rendering.StyleModel#getDataCellFilteredClass()}
503:             * if the cell has a filter expression and is filtered
504:             * </li>
505:             * <li>the {@link org.apache.beehive.netui.databinding.datagrid.api.rendering.StyleModel#getDataCellSortedClass()}
506:             * if the cell has a sort expression and is sorted
507:             * <li>the {@link #setCellStyleClass(String)} attribute if set;
508:             * {@link org.apache.beehive.netui.databinding.datagrid.api.rendering.StyleModel#getDataCellClass()} otherwise</li>
509:             * </ol>
510:             * </p>
511:             * @param appender the {@link AbstractRenderAppender} to which any output should be rendered
512:             * @throws IOException
513:             * @throws JspException
514:             */
515:            protected void renderCell(AbstractRenderAppender appender)
516:                    throws IOException, JspException {
517:
518:                DataGridTagModel dataGridModel = DataGridUtil
519:                        .getDataGridTagModel(getJspContext());
520:                if (dataGridModel == null)
521:                    throw new JspException(
522:                            Bundle
523:                                    .getErrorString("DataGridTags_MissingDataGridModel"));
524:
525:                TableRenderer tableRenderer = dataGridModel.getTableRenderer();
526:                assert tableRenderer != null;
527:
528:                /* todo: refactor. extensibility in supporting style decorators */
529:                ArrayList/*<String>*/styleClasses = new ArrayList/*<String>*/();
530:                FilterModel filterModel = dataGridModel.getState()
531:                        .getFilterModel();
532:                if (_filterExpression != null
533:                        && filterModel.isFiltered(_filterExpression))
534:                    styleClasses.add(dataGridModel.getStyleModel()
535:                            .getDataCellFilteredClass());
536:
537:                SortModel sortModel = dataGridModel.getState().getSortModel();
538:                if (_sortExpression != null
539:                        && sortModel.isSorted(_sortExpression))
540:                    styleClasses.add(dataGridModel.getStyleModel()
541:                            .getDataCellSortedClass());
542:
543:                if (_cellState.styleClass == null)
544:                    styleClasses.add(dataGridModel.getStyleModel()
545:                            .getDataCellClass());
546:                else
547:                    styleClasses.add(_cellState.styleClass);
548:
549:                _cellState.styleClass = dataGridModel.getStyleModel()
550:                        .buildStyleClassValue(styleClasses);
551:
552:                /*
553:                   note, this runs in order to allow any nested tags to do their work.  
554:                   this provides support for formatters, parameters, etc
555:                 */
556:                JspFragment fragment = getJspBody();
557:                StringWriter sw = new StringWriter();
558:                if (fragment != null)
559:                    fragment.invoke(sw);
560:
561:                tableRenderer.openTableCell(_cellState, appender);
562:                renderDataCellContents(appender, sw.toString());
563:                tableRenderer.closeTableCell(appender);
564:
565:                /* todo: need to add the JavaScript rendering for any tagIds that were set on <td>s */
566:                if (_cellState.id != null) {
567:                    HttpServletRequest request = JspUtil
568:                            .getRequest(getJspContext());
569:                    String script = renderNameAndId(request, _cellState, null);
570:                    if (script != null)
571:                        appender.append(script);
572:                }
573:
574:            }
575:
576:            /**
577:             * <p>
578:             * Abstract method implemented by subclasses in order to render a cell's content.
579:             * </p>
580:             * @param appender the {@link AbstractRenderAppender} to which any output should be rendered
581:             * @param output the output produced from having evaluated this tag's {@link JspFragment}
582:             * @throws IOException
583:             * @throws JspException
584:             */
585:            protected abstract void renderDataCellContents(
586:                    AbstractRenderAppender appender, String output)
587:                    throws IOException, JspException;
588:        }
w__w__w__.___j___av_a_2___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.