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


001:        /* Iframe.java
002:
003:        {{IS_NOTE
004:        	Purpose:
005:        		
006:        	Description:
007:        		
008:        	History:
009:        		Thu Jul 21 11:11:18     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.zul;
020:
021:        import org.zkoss.lang.Objects;
022:        import org.zkoss.util.media.Media;
023:        import org.zkoss.xml.HTMLs;
024:
025:        import org.zkoss.zk.ui.Desktop;
026:        import org.zkoss.zk.ui.Execution;
027:        import org.zkoss.zk.ui.UiException;
028:        import org.zkoss.zk.ui.ext.render.DynamicMedia;
029:
030:        import org.zkoss.zul.impl.XulElement;
031:        import org.zkoss.zul.impl.Utils;
032:
033:        /**
034:         * Includes an inline frame.
035:         *
036:         * @author tomyeh
037:         */
038:        public class Iframe extends XulElement {
039:            private String _align, _name;
040:            private String _src;
041:            /** The media. If not null, _src is generated automatically. */
042:            private Media _media;
043:            /** Count the version of {@link #_media}. */
044:            private int _medver;
045:            /** Whether to hide when a popup or dropdown is placed on top of it. */
046:            private boolean _autohide;
047:
048:            public Iframe() {
049:            }
050:
051:            public Iframe(String src) {
052:                setSrc(src);
053:            }
054:
055:            /** Returns the alignment.
056:             * <p>Default: null (use browser default).
057:             */
058:            public String getAlign() {
059:                return _align;
060:            }
061:
062:            /** Sets the alignment: one of top, middle, bottom, left, right and
063:             * center.
064:             */
065:            public void setAlign(String align) {
066:                if (align != null && align.length() == 0)
067:                    align = null;
068:
069:                if (!Objects.equals(_align, align)) {
070:                    _align = align;
071:                    smartUpdate("align", _align);
072:                }
073:            }
074:
075:            /** Returns the frame name.
076:             * <p>Default: null (use browser default).
077:             */
078:            public String getName() {
079:                return _name;
080:            }
081:
082:            /** Sets the frame name.
083:             */
084:            public void setName(String name) {
085:                if (name != null && name.length() == 0)
086:                    name = null;
087:
088:                if (!Objects.equals(_name, name)) {
089:                    _name = name;
090:                    smartUpdate("name", _name);
091:                }
092:            }
093:
094:            /** Returns whether to automatically hide this component if
095:             * a popup or dropdown is overlapped with it.
096:             *
097:             * <p>Default: false.
098:             *
099:             * <p>If an iframe contains PDF or other embeds, it will be placed
100:             * on top of other components. It may then make popups and dropdowns
101:             * obscure. In this case, you have to specify autohide="true" to
102:             * ask ZK to hide the iframe when popups or dropdowns is overlapped
103:             * with the iframe.
104:             */
105:            public boolean isAutohide() {
106:                return _autohide;
107:            }
108:
109:            /** Sets whether to automatically hide this component if
110:             * a popup or dropdown is overlapped with it.
111:             */
112:            public void setAutohide(boolean autohide) {
113:                if (_autohide != autohide) {
114:                    _autohide = autohide;
115:                    smartUpdate("z.autohide", "true");
116:                }
117:            }
118:
119:            /** Returns the src.
120:             * <p>Default: null.
121:             */
122:            public String getSrc() {
123:                return _src;
124:            }
125:
126:            /** Sets the src.
127:             * <p>If src is changed, the whole component is invalidate.
128:             * Thus, you want to smart-update, you have to override this method.
129:             *
130:             * @param src the source URL. If null or empty, nothing is included.
131:             */
132:            public void setSrc(String src) {
133:                if (src != null && src.length() == 0)
134:                    src = null;
135:
136:                if (!Objects.equals(_src, src)) {
137:                    _src = src;
138:                    if (_media == null)
139:                        smartUpdateDeferred("src", new EncodedSrc()); //Bug 1850895
140:                    //_src is meaningful only if _media is null
141:                }
142:            }
143:
144:            /** Returns the encoded src ({@link #getSrc}).
145:             */
146:            private String getEncodedSrc() {
147:                final Desktop dt = getDesktop();
148:                return _media != null ? getMediaSrc() : //already encoded
149:                        dt != null ? dt.getExecution().encodeURL(
150:                                _src != null ? _src : "~./img/spacer.gif") : "";
151:            }
152:
153:            /** Sets the content directly.
154:             * Default: null.
155:             *
156:             * @param media the media for this inline frame.
157:             * If not null, it has higher priority than {@link #getSrc}.
158:             */
159:            public void setContent(Media media) {
160:                if (media != _media) {
161:                    _media = media;
162:                    if (_media != null)
163:                        ++_medver; //enforce browser to reload
164:                    smartUpdateDeferred("src", new EncodedSrc()); //Bug 1850895
165:                }
166:            }
167:
168:            /** Returns the content set by {@link #setContent}.
169:             * <p>Note: it won't fetch what is set thru by {@link #setSrc}.
170:             * It simply returns what is passed to {@link #setContent}.
171:             */
172:            public Media getContent() {
173:                return _media;
174:            }
175:
176:            /** Returns the encoded URL for the current media content.
177:             * Don't call this method unless _media is not null;
178:             */
179:            private String getMediaSrc() {
180:                return Utils.getDynamicMediaURI(this , _medver,
181:                        _media.getName(), _media.getFormat());
182:            }
183:
184:            //-- super --//
185:            public String getOuterAttrs() {
186:                final StringBuffer sb = new StringBuffer(64).append(super 
187:                        .getOuterAttrs());
188:                HTMLs.appendAttribute(sb, "align", _align);
189:                HTMLs.appendAttribute(sb, "name", _name);
190:                HTMLs.appendAttribute(sb, "src", getEncodedSrc());
191:                if (_autohide)
192:                    HTMLs.appendAttribute(sb, "z.autohide", _autohide);
193:                return sb.toString();
194:            }
195:
196:            //-- Component --//
197:            /** Default: not childable.
198:             */
199:            public boolean isChildable() {
200:                return false;
201:            }
202:
203:            //-- ComponentCtrl --//
204:            protected Object newExtraCtrl() {
205:                return new ExtraCtrl();
206:            }
207:
208:            /** A utility class to implement {@link #getExtraCtrl}.
209:             * It is used only by component developers.
210:             */
211:            protected class ExtraCtrl extends XulElement.ExtraCtrl implements 
212:                    DynamicMedia {
213:                //-- DynamicMedia --//
214:                public Media getMedia(String pathInfo) {
215:                    return _media;
216:                }
217:            }
218:
219:            private class EncodedSrc implements 
220:                    org.zkoss.zk.ui.util.DeferredValue {
221:                public String getValue() {
222:                    return getEncodedSrc();
223:                }
224:            }
225:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.