Source Code Cross Referenced for LookAheadInfo.java in  » Portal » Open-Portal » com » sun » portal » rewriter » 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 » Portal » Open Portal » com.sun.portal.rewriter 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2001 Sun Microsystems, Inc.  All rights reserved.
003:         * PROPRIETARY/CONFIDENTIAL.  Use of this product is subject to license terms.
004:         */
005:        package com.sun.portal.rewriter;
006:
007:        import com.sun.portal.rewriter.engines.markup.TagContext;
008:        import com.sun.portal.rewriter.util.Constants;
009:        import com.sun.portal.rewriter.util.collections.ListSet;
010:        import com.sun.portal.rewriter.util.uri.PageSpec;
011:
012:        /**
013:         * Contains the state info, related to current tag context, so that
014:         * any translator could info, if needed
015:         */
016:        public final class LookAheadInfo {
017:            private ListSet neededJSFunctions;
018:
019:            private int jsStartIndex = -1;
020:            private TagContext tagContext;
021:            private boolean inApplet = false;
022:            private PageSpec appletCodeBaseSpec = null;
023:            private boolean rootRewriterFlag = false;
024:            private boolean contentChanged = false;
025:
026:            public TagContext getTagContext() {
027:                return tagContext == null ? TagContext.EMPTY_TAG_CONTEXT
028:                        : tagContext;
029:            }//getTagContext()
030:
031:            public void setTagContext(final TagContext aTagContext) {
032:                tagContext = aTagContext;
033:            }//setTagContext()
034:
035:            public void setAppletCodeBase(String aURI) {
036:                if (aURI == null) {
037:                    appletCodeBaseSpec = null;
038:                } else {
039:                    //Applet codebase is always a directory as per HTTP spec
040:                    //Both code and archive would use the codebase value and not
041:                    //either page url or base tag url.
042:                    //Applet params should be rewritten based in Page URI
043:                    if (!(aURI.endsWith("/") || aURI.endsWith("\\"))) {
044:                        aURI = aURI + "/";
045:                    }
046:
047:                    appletCodeBaseSpec = new PageSpec(aURI);
048:                }
049:            }//setAppletCodeBase()
050:
051:            public PageSpec getAppletCodeBase() {
052:                return appletCodeBaseSpec;
053:            }//getAppletCodeBase()
054:
055:            public boolean isAppletCodeBaseExists() {
056:                return ((appletCodeBaseSpec != null) && isInApplet());
057:            }//isArchiveTranslate()
058:
059:            /**
060:             * We need to translate the archives based on codebase and not by HTML Page
061:             * base. Problem comes only when codebase of applet and baseref of HTML are different
062:             */
063:            public void setInAppletAttributeBegin() {
064:                inApplet = true;
065:            }//setArchiveTranslateBegin()
066:
067:            public void setInAppletAttributeEnd() {
068:                inApplet = false;
069:            }//setArchiveTranslateEnd()
070:
071:            private boolean isInApplet() {
072:                return inApplet;
073:            }//isArchive()
074:
075:            public void addJSFunction(final String aFuncName) {
076:                contentChanged = true;
077:                if (neededJSFunctions == null) {
078:                    neededJSFunctions = new ListSet();
079:                }
080:
081:                neededJSFunctions.add(aFuncName);
082:            }//addJSFunction();
083:
084:            public boolean isRootRewriter() {
085:                //BugNo:4683016, 4747776
086:                if (rootRewriterFlag) {
087:                    return false;
088:                }
089:
090:                rootRewriterFlag = true;
091:                return rootRewriterFlag;
092:            }//isRootRewriter()
093:
094:            public int getJSStartIndex() {
095:                return jsStartIndex;
096:            }//getJSStartIndex()
097:
098:            public void markJSStartIndex(final StringBuffer sb) {
099:                if (jsStartIndex == -1) {
100:                    jsStartIndex = sb.toString().lastIndexOf('<');
101:                }
102:            }//markJSStartIndex()
103:
104:            public String readJSFunctions(final Translator aTranslator) {
105:                if (neededJSFunctions == null) {
106:                    return "";
107:                }
108:
109:                StringBuffer sbf;
110:                switch (neededJSFunctions.size()) {
111:                case 0: {
112:                    return Constants.EMPTY_STRING;
113:                }
114:                case 1: {
115:                    String bFunctionName = neededJSFunctions.get(0).toString();
116:                    String bFunctionDefination;
117:                    JSFunctionSpec bJSFunctionSpec = aTranslator
118:                            .getJSFunctionSpec();
119:                    if (bFunctionName.equals(bJSFunctionSpec
120:                            .getExpressionFunctionName())) {
121:                        bFunctionDefination = aTranslator.getJSFunctionSpec()
122:                                .getExpressionFunctionDefination(
123:                                        aTranslator.getPageSpec());
124:                    } else if (bFunctionName.equals(bJSFunctionSpec
125:                            .getSystemFunctionName())) {
126:                        bFunctionDefination = aTranslator.getJSFunctionSpec()
127:                                .getSystemFunctionDefination(
128:                                        aTranslator.getPageSpec());
129:                    } else {
130:                        return Constants.EMPTY_STRING;
131:                    }
132:
133:                    sbf = new StringBuffer(bFunctionDefination);
134:                    break;
135:                }
136:                default: {
137:                    sbf = new StringBuffer(aTranslator.getJSFunctionSpec()
138:                            .readAll(aTranslator.getPageSpec()));
139:                    break;
140:                }
141:                }//switch/case
142:
143:                sbf.insert(0, '\n').append('\n');
144:                return sbf.toString();
145:            }//readJSFunctions()
146:
147:            public boolean isContentChanged() {
148:                return contentChanged;
149:
150:            }//isContentChanged()
151:
152:            public void enableContentChanged() {
153:                contentChanged = true;
154:            }//enableContentChanged()
155:
156:        }//class LookAheadInfo()
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.