001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.taglib.ui;
022:
023: import com.liferay.portal.kernel.servlet.StringServletResponse;
024: import com.liferay.portal.kernel.util.Validator;
025: import com.liferay.taglib.util.IncludeTag;
026:
027: import java.io.IOException;
028:
029: import javax.servlet.RequestDispatcher;
030: import javax.servlet.ServletContext;
031: import javax.servlet.ServletException;
032: import javax.servlet.http.HttpServletRequest;
033: import javax.servlet.http.HttpServletResponse;
034: import javax.servlet.jsp.JspException;
035:
036: /**
037: * <a href="FlashTag.java.html"><b><i>View Source</i></b></a>
038: *
039: * @author Brian Wing Shun Chan
040: *
041: */
042: public class FlashTag extends IncludeTag {
043:
044: public static void doTag(String align, String allowScriptAccess,
045: String base, String bgcolor, String devicefont,
046: String flashvars, String height, String id, String loop,
047: String menu, String movie, String play, String quality,
048: String salign, String scale, String swliveconnect,
049: String version, String width, String wmode,
050: ServletContext ctx, HttpServletRequest req,
051: HttpServletResponse res) throws IOException,
052: ServletException {
053:
054: doTag(_PAGE, align, allowScriptAccess, base, bgcolor,
055: devicefont, flashvars, height, id, loop, menu, movie,
056: play, quality, salign, scale, swliveconnect, version,
057: width, wmode, ctx, req, res);
058: }
059:
060: public static void doTag(String page, String align,
061: String allowScriptAccess, String base, String bgcolor,
062: String devicefont, String flashvars, String height,
063: String id, String loop, String menu, String movie,
064: String play, String quality, String salign, String scale,
065: String swliveconnect, String version, String width,
066: String wmode, ServletContext ctx, HttpServletRequest req,
067: HttpServletResponse res) throws IOException,
068: ServletException {
069:
070: req.setAttribute("liferay-ui:flash:align", align);
071: req.setAttribute("liferay-ui:flash:allowScriptAccess",
072: allowScriptAccess);
073: req.setAttribute("liferay-ui:flash:base", base);
074: req.setAttribute("liferay-ui:flash:bgcolor", bgcolor);
075: req.setAttribute("liferay-ui:flash:devicefont", devicefont);
076: req.setAttribute("liferay-ui:flash:flashvars", flashvars);
077: req.setAttribute("liferay-ui:flash:height", height);
078: req.setAttribute("liferay-ui:flash:id", id);
079: req.setAttribute("liferay-ui:flash:loop", loop);
080: req.setAttribute("liferay-ui:flash:menu", menu);
081: req.setAttribute("liferay-ui:flash:movie", movie);
082: req.setAttribute("liferay-ui:flash:play", play);
083: req.setAttribute("liferay-ui:flash:quality", quality);
084: req.setAttribute("liferay-ui:flash:salign", salign);
085: req.setAttribute("liferay-ui:flash:scale", scale);
086: req.setAttribute("liferay-ui:flash:swliveconnect",
087: swliveconnect);
088: req.setAttribute("liferay-ui:flash:version", version);
089: req.setAttribute("liferay-ui:flash:width", width);
090: req.setAttribute("liferay-ui:flash:wmode", wmode);
091:
092: RequestDispatcher rd = ctx.getRequestDispatcher(page);
093:
094: rd.include(req, res);
095: }
096:
097: public int doEndTag() throws JspException {
098: try {
099: ServletContext ctx = getServletContext();
100: HttpServletRequest req = getServletRequest();
101: StringServletResponse res = getServletResponse();
102:
103: doTag(_align, _allowScriptAccess, _base, _bgcolor,
104: _devicefont, _flashvars, _height, _id, _loop,
105: _menu, _movie, _play, _quality, _salign, _scale,
106: _swliveconnect, _version, _width, _wmode, ctx, req,
107: res);
108:
109: pageContext.getOut().print(res.getString());
110:
111: return EVAL_PAGE;
112: } catch (Exception e) {
113: throw new JspException(e);
114: }
115: }
116:
117: public void setAlign(String align) {
118: if (Validator.isNotNull(align)) {
119: _align = align;
120: }
121: }
122:
123: public void setAllowScriptAccess(String allowScriptAccess) {
124: if (Validator.isNotNull(allowScriptAccess)) {
125: _allowScriptAccess = allowScriptAccess;
126: }
127: }
128:
129: public void setBase(String base) {
130: if (Validator.isNotNull(base)) {
131: _base = base;
132: }
133: }
134:
135: public void setBgcolor(String bgcolor) {
136: if (Validator.isNotNull(bgcolor)) {
137: _bgcolor = bgcolor;
138: }
139: }
140:
141: public void setDevicefont(String devicefont) {
142: if (Validator.isNotNull(devicefont)) {
143: _devicefont = devicefont;
144: }
145: }
146:
147: public void setFlashvars(String flashvars) {
148: if (Validator.isNotNull(flashvars)) {
149: _flashvars = flashvars;
150: }
151: }
152:
153: public void setHeight(String height) {
154: if (Validator.isNotNull(height)) {
155: _height = height;
156: }
157: }
158:
159: public void setId(String id) {
160: if (Validator.isNotNull(id)) {
161: _id = id;
162: }
163: }
164:
165: public void setLoop(String loop) {
166: if (Validator.isNotNull(loop)) {
167: _loop = loop;
168: }
169: }
170:
171: public void setMenu(String menu) {
172: if (Validator.isNotNull(menu)) {
173: _menu = menu;
174: }
175: }
176:
177: public void setMovie(String movie) {
178: _movie = movie;
179: }
180:
181: public void setPlay(String play) {
182: if (Validator.isNotNull(play)) {
183: _play = play;
184: }
185: }
186:
187: public void setQuality(String quality) {
188: if (Validator.isNotNull(quality)) {
189: _quality = quality;
190: }
191: }
192:
193: public void setSalign(String salign) {
194: if (Validator.isNotNull(salign)) {
195: _salign = salign;
196: }
197: }
198:
199: public void setScale(String scale) {
200: if (Validator.isNotNull(scale)) {
201: _scale = scale;
202: }
203: }
204:
205: public void setSwliveconnect(String swliveconnect) {
206: if (Validator.isNotNull(swliveconnect)) {
207: _swliveconnect = swliveconnect;
208: }
209: }
210:
211: public void setVersion(String version) {
212: if (Validator.isNotNull(version)) {
213: _version = version;
214: }
215: }
216:
217: public void setWidth(String width) {
218: if (Validator.isNotNull(width)) {
219: _width = width;
220: }
221: }
222:
223: public void setWmode(String wmode) {
224: if (Validator.isNotNull(wmode)) {
225: _wmode = wmode;
226: }
227: }
228:
229: protected String getDefaultPage() {
230: return _PAGE;
231: }
232:
233: private static final String _PAGE = "/html/taglib/ui/flash/page.jsp";
234:
235: private String _align = "left";
236: private String _allowScriptAccess = "sameDomain";
237: private String _base = ".";
238: private String _bgcolor = "#FFFFFF";
239: private String _devicefont = "true";
240: private String _flashvars = "";
241: private String _height = "500";
242: private String _id = "";
243: private String _loop = "true";
244: private String _menu = "false";
245: private String _movie = "";
246: private String _play = "false";
247: private String _quality = "best";
248: private String _salign = "";
249: private String _scale = "showall";
250: private String _swliveconnect = "false";
251: private String _version = "7";
252: private String _width = "100%";
253: private String _wmode = "opaque";
254:
255: }
|