001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.taglib.ui;
016    
017    import com.liferay.portal.kernel.util.StringPool;
018    import com.liferay.portal.kernel.util.Validator;
019    import com.liferay.taglib.util.IncludeTag;
020    
021    import javax.servlet.http.HttpServletRequest;
022    
023    /**
024     * @author Brian Wing Shun Chan
025     */
026    public class FlashTag extends IncludeTag {
027    
028            public void setAlign(String align) {
029                    if (Validator.isNotNull(align)) {
030                            _align = align;
031                    }
032            }
033    
034            public void setAllowFullScreen(String allowFullScreen) {
035                    if (Validator.isNotNull(allowFullScreen)) {
036                            _allowFullScreen = allowFullScreen;
037                    }
038            }
039    
040            public void setAllowScriptAccess(String allowScriptAccess) {
041                    if (Validator.isNotNull(allowScriptAccess)) {
042                            _allowScriptAccess = allowScriptAccess;
043                    }
044            }
045    
046            public void setBase(String base) {
047                    if (Validator.isNotNull(base)) {
048                            _base = base;
049                    }
050            }
051    
052            public void setBgcolor(String bgcolor) {
053                    if (Validator.isNotNull(bgcolor)) {
054                            _bgcolor = bgcolor;
055                    }
056            }
057    
058            public void setDevicefont(String devicefont) {
059                    if (Validator.isNotNull(devicefont)) {
060                            _devicefont = devicefont;
061                    }
062            }
063    
064            public void setFlashvars(String flashvars) {
065                    if (Validator.isNotNull(flashvars)) {
066                            _flashvars = flashvars;
067                    }
068            }
069    
070            public void setHeight(String height) {
071                    if (Validator.isNotNull(height)) {
072                            _height = height;
073                    }
074            }
075    
076            public void setId(String id) {
077                    if (Validator.isNotNull(id)) {
078                            _id = id;
079                    }
080            }
081    
082            public void setLoop(String loop) {
083                    if (Validator.isNotNull(loop)) {
084                            _loop = loop;
085                    }
086            }
087    
088            public void setMenu(String menu) {
089                    if (Validator.isNotNull(menu)) {
090                            _menu = menu;
091                    }
092            }
093    
094            public void setMovie(String movie) {
095                    _movie = movie;
096            }
097    
098            public void setPlay(String play) {
099                    if (Validator.isNotNull(play)) {
100                            _play = play;
101                    }
102            }
103    
104            public void setQuality(String quality) {
105                    if (Validator.isNotNull(quality)) {
106                            _quality = quality;
107                    }
108            }
109    
110            public void setSalign(String salign) {
111                    if (Validator.isNotNull(salign)) {
112                            _salign = salign;
113                    }
114            }
115    
116            public void setScale(String scale) {
117                    if (Validator.isNotNull(scale)) {
118                            _scale = scale;
119                    }
120            }
121    
122            public void setSwliveconnect(String swliveconnect) {
123                    if (Validator.isNotNull(swliveconnect)) {
124                            _swliveconnect = swliveconnect;
125                    }
126            }
127    
128            public void setVersion(String version) {
129                    if (Validator.isNotNull(version)) {
130                            _version = version;
131                    }
132            }
133    
134            public void setWidth(String width) {
135                    if (Validator.isNotNull(width)) {
136                            _width = width;
137                    }
138            }
139    
140            public void setWmode(String wmode) {
141                    if (Validator.isNotNull(wmode)) {
142                            _wmode = wmode;
143                    }
144            }
145    
146            protected void cleanUp() {
147                    _align = "left";
148                    _allowFullScreen = Boolean.FALSE.toString();
149                    _allowScriptAccess = "sameDomain";
150                    _base = StringPool.PERIOD;
151                    _bgcolor = "#FFFFFF";
152                    _devicefont = Boolean.TRUE.toString();
153                    _flashvars = StringPool.BLANK;
154                    _height = "500";
155                    _id = StringPool.BLANK;
156                    _loop = Boolean.TRUE.toString();
157                    _menu = Boolean.FALSE.toString();
158                    _movie = StringPool.BLANK;
159                    _play = Boolean.FALSE.toString();
160                    _quality = "best";
161                    _salign = StringPool.BLANK;
162                    _scale = "showall";
163                    _swliveconnect = Boolean.FALSE.toString();
164                    _version = "7";
165                    _width = "100%";
166                    _wmode = "opaque";
167            }
168    
169            protected String getPage() {
170                    return _PAGE;
171            }
172    
173            protected void setAttributes(HttpServletRequest request) {
174                    request.setAttribute("liferay-ui:flash:align", _align);
175                    request.setAttribute(
176                            "liferay-ui:flash:allowFullScreen", _allowFullScreen);
177                    request.setAttribute(
178                            "liferay-ui:flash:allowScriptAccess", _allowScriptAccess);
179                    request.setAttribute("liferay-ui:flash:base", _base);
180                    request.setAttribute("liferay-ui:flash:bgcolor", _bgcolor);
181                    request.setAttribute("liferay-ui:flash:devicefont", _devicefont);
182                    request.setAttribute("liferay-ui:flash:flashvars", _flashvars);
183                    request.setAttribute("liferay-ui:flash:height", _height);
184                    request.setAttribute("liferay-ui:flash:id", _id);
185                    request.setAttribute("liferay-ui:flash:loop", _loop);
186                    request.setAttribute("liferay-ui:flash:menu", _menu);
187                    request.setAttribute("liferay-ui:flash:movie", _movie);
188                    request.setAttribute("liferay-ui:flash:play", _play);
189                    request.setAttribute("liferay-ui:flash:quality", _quality);
190                    request.setAttribute("liferay-ui:flash:salign", _salign);
191                    request.setAttribute("liferay-ui:flash:scale", _scale);
192                    request.setAttribute("liferay-ui:flash:swliveconnect", _swliveconnect);
193                    request.setAttribute("liferay-ui:flash:version", _version);
194                    request.setAttribute("liferay-ui:flash:width", _width);
195                    request.setAttribute("liferay-ui:flash:wmode", _wmode);
196            }
197    
198            private static final String _PAGE = "/html/taglib/ui/flash/page.jsp";
199    
200            private String _align = "left";
201            private String _allowFullScreen = Boolean.FALSE.toString();
202            private String _allowScriptAccess = "sameDomain";
203            private String _base = StringPool.PERIOD;
204            private String _bgcolor = "#FFFFFF";
205            private String _devicefont = Boolean.TRUE.toString();
206            private String _flashvars = StringPool.BLANK;
207            private String _height = "500";
208            private String _id = StringPool.BLANK;
209            private String _loop = Boolean.TRUE.toString();
210            private String _menu = Boolean.FALSE.toString();
211            private String _movie = StringPool.BLANK;
212            private String _play = Boolean.FALSE.toString();
213            private String _quality = "best";
214            private String _salign = StringPool.BLANK;
215            private String _scale = "showall";
216            private String _swliveconnect = Boolean.FALSE.toString();
217            private String _version = "7";
218            private String _width = "100%";
219            private String _wmode = "opaque";
220    
221    }