Source Code Cross Referenced for Out.java in  » Ajax » zk » org » zkoss » web » servlet » dsp » action » 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 » Ajax » zk » org.zkoss.web.servlet.dsp.action 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* Out.java
002:
003:        {{IS_NOTE
004:        	Purpose:
005:        		
006:        	Description:
007:        		
008:        	History:
009:        		Tue Sep  6 16:10:51     2005, Created by tomyeh
010:        }}IS_NOTE
011:
012:        Copyright (C) 2005 Potix Corporation. All Rights Reserved.
013:
014:        {{IS_RIGHT
015:        	This program is distributed under GPL Version 2.0 in the hope that
016:        	it will be useful, but WITHOUT ANY WARRANTY.
017:        }}IS_RIGHT
018:         */
019:        package org.zkoss.web.servlet.dsp.action;
020:
021:        import java.io.IOException;
022:
023:        import org.zkoss.web.mesg.MWeb;
024:        import org.zkoss.web.servlet.ServletException;
025:        import org.zkoss.xml.XMLs;
026:
027:        /**
028:         * Generates the specified value into a string.
029:         *
030:         * @author tomyeh
031:         */
032:        public class Out extends AbstractAction {
033:            private String _value = null;
034:            private int _maxlength;
035:            private boolean _escapeXML = true;
036:            private boolean _nbsp;
037:
038:            /** Returns whether to escape XML.
039:             * Default: true.
040:             */
041:            public boolean getEscapeXML() {
042:                return _escapeXML;
043:            }
044:
045:            /** Sets whether to escape XML.
046:             */
047:            public void setEscapeXML(boolean escapeXML) {
048:                _escapeXML = escapeXML;
049:            }
050:
051:            /** Returns whether to generate   if the content is empty.
052:             * Default: false.
053:             */
054:            public boolean getNbsp() {
055:                return _escapeXML;
056:            }
057:
058:            /** Sets whether to generate   if the content is empty.
059:             */
060:            public void setNbsp(boolean nbsp) {
061:                _nbsp = nbsp;
062:            }
063:
064:            /** Returns the value.
065:             * Default: null.
066:             */
067:            public String getValue() {
068:                return _value;
069:            }
070:
071:            /** Sets the value.
072:             */
073:            public void setValue(String value) {
074:                _value = value;
075:            }
076:
077:            /** Returns the maxlength of bytes to output.
078:             * <p>Default: 0 (no limit).
079:             */
080:            public int getMaxlength() {
081:                return _maxlength;
082:            }
083:
084:            /** Sets the maxlength to output.
085:             */
086:            public void setMaxlength(int maxlength) {
087:                _maxlength = maxlength;
088:            }
089:
090:            //-- Action --//
091:            public void render(ActionContext ac, boolean nested)
092:                    throws javax.servlet.ServletException, IOException {
093:                if (!isEffective())
094:                    return;
095:                if (nested)
096:                    throw new ServletException(
097:                            MWeb.DSP_NESTED_ACTION_NOT_ALLOWED, new Object[] {
098:                                    this , new Integer(ac.getLineNumber()) });
099:
100:                int len = _value != null ? _value.length() : 0;
101:                if (len == 0 || (_nbsp && _value.trim().length() == 0)) {
102:                    if (_nbsp)
103:                        ac.getOut().write("&nbsp;");
104:                    return;
105:                }
106:
107:                String value = _value;
108:                if (_maxlength > 0 && len > _maxlength) {
109:                    int j = _maxlength;
110:                    while (j > 0 && Character.isWhitespace(value.charAt(j - 1)))
111:                        --j;
112:                    value = value.substring(0, j) + "...";
113:                }
114:
115:                if (_escapeXML) {
116:                    StringBuffer sb = null;
117:                    len = value.length();
118:                    for (int j = 0; j < len; ++j) {
119:                        final char cc = value.charAt(j);
120:                        final String replace = _escapeXML ? XMLs.escapeXML(cc)
121:                                : null;
122:
123:                        if (replace != null) {
124:                            if (sb == null) {
125:                                sb = new StringBuffer(value.length() + 10);
126:                                sb.append(value.substring(0, j));
127:                            }
128:                            sb.append(replace);
129:                        } else if (sb != null) {
130:                            sb.append(cc);
131:                        }
132:                    }
133:                    if (sb != null)
134:                        value = sb.toString();
135:                }
136:
137:                ac.getOut().write(value);
138:            }
139:
140:            //-- Object --//
141:            public String toString() {
142:                return "out";
143:            }
144:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.