001: /**
002: * Copyright 2006 Webmedia Group Ltd.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: **/package org.araneaframework.http.support;
016:
017: import java.io.Serializable;
018: import java.util.HashMap;
019: import java.util.Iterator;
020: import java.util.Map;
021:
022: /**
023: * Simple class including the getters/setters for properties
024: * that can be set when opening browser windows. Note that all of these
025: * may not work on all platforms and browsers. For meaning of all these
026: * attributes
027: * <link>"http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/open_0.asp"</link>
028: * is good reference.
029: *
030: * Note that modeless and modal popups (IE proprietary extension) are not really
031: * fully-functional browser windows and should only be used for displaying statical content.
032: *
033: * @author Taimo Peelo (taimo@araneaframework.org)
034: */
035:
036: public class PopupWindowProperties implements Serializable {
037: private Map propertyMap = new HashMap();
038:
039: private boolean modal;
040: private boolean modeless;
041:
042: public boolean isModal() {
043: return modal;
044: }
045:
046: public boolean isModeless() {
047: return modeless;
048: }
049:
050: public void setModal(boolean b) {
051: modal = b;
052: if (b)
053: modeless = false;
054: }
055:
056: public void setModeless(boolean b) {
057: modeless = b;
058: if (b)
059: modal = false;
060: }
061:
062: public String getChannelmode() {
063: return (String) propertyMap.get("channelmode");
064: }
065:
066: public void setChannelmode(String channelmode) {
067: propertyMap.put("channelmode", channelmode);
068: }
069:
070: public String getDirectories() {
071: return (String) propertyMap.get("directories");
072: }
073:
074: public void setDirectories(String directories) {
075: propertyMap.put("directories", directories);
076: }
077:
078: public String getFullscreen() {
079: return (String) propertyMap.get("fullscreen");
080: }
081:
082: public void setFullscreen(String fullscreen) {
083: propertyMap.put("fullscreen", fullscreen);
084: }
085:
086: public String getHeight() {
087: return (String) propertyMap.get("height");
088: }
089:
090: public void setHeight(String height) {
091: propertyMap.put("height", height);
092: }
093:
094: public String getLeft() {
095: return (String) propertyMap.get("left");
096: }
097:
098: public void setLeft(String left) {
099: propertyMap.put("left", left);
100: }
101:
102: public String getLocation() {
103: return (String) propertyMap.get("location");
104: }
105:
106: public void setLocation(String location) {
107: propertyMap.put("location", location);
108: }
109:
110: public String getMenubar() {
111: return (String) propertyMap.get("menubar");
112: }
113:
114: public void setMenubar(String menubar) {
115: propertyMap.put("menubar", menubar);
116: }
117:
118: public String getResizable() {
119: return (String) propertyMap.get("resizable");
120: }
121:
122: public void setResizable(String resizable) {
123: propertyMap.put("resizable", resizable);
124: }
125:
126: /**
127: * @return whether the dialog window displays scrollbars
128: */
129: public String getScrollbars() {
130: if (isModal() || isModeless())
131: return (String) propertyMap.get("scroll");
132: return (String) propertyMap.get("scrollbars");
133: }
134:
135: /**
136: * Specifies whether the dialog window displays scrollbars.
137: * Sets property "scroll", if window is modal or modeless,
138: * otherwise sets property "scrollbars".
139: * @param scrollbars ("yes" | "no" | 0 | 1 | "on" | "off")
140: */
141: public void setScrollbars(String scrollbars) {
142: if (isModal() || isModeless())
143: propertyMap.put("scroll", scrollbars);
144: else
145: propertyMap.put("scrollbars", scrollbars);
146: }
147:
148: public String getStatus() {
149: return (String) propertyMap.get("status");
150: }
151:
152: public void setStatus(String status) {
153: propertyMap.put("status", status);
154: }
155:
156: public String getTitlebar() {
157: return (String) propertyMap.get("titlebar");
158: }
159:
160: public void setTitlebar(String titlebar) {
161: propertyMap.put("titlebar", titlebar);
162: }
163:
164: public String getToolbar() {
165: return (String) propertyMap.get("toolbar");
166: }
167:
168: public void setToolbar(String toolbar) {
169: propertyMap.put("toolbar", toolbar);
170: }
171:
172: public String getTop() {
173: return (String) propertyMap.get("top");
174: }
175:
176: public void setTop(String top) {
177: propertyMap.put("top", top);
178: }
179:
180: public String getWidth() {
181: return (String) propertyMap.get("width");
182: }
183:
184: public void setWidth(String width) {
185: propertyMap.put("width", width);
186: }
187:
188: /**
189: * Center property specifies whether to center the dialog window within
190: * the desktop. The default is yes. Applicable to modal and modeless popups.
191: */
192: public String getCenter() {
193: return (String) propertyMap.get("center");
194: }
195:
196: public void setCenter(String center) {
197: propertyMap.put("center", center);
198: }
199:
200: /**
201: * DialogHide specifies whether the dialog window is hidden when printing or using print preview.
202: * This feature is only available when a dialog box is opened from a trusted application.
203: * The default is no. Applicable to modal and modeless popups.
204: */
205: public String getDialogHide() {
206: return (String) propertyMap.get("dialogHide");
207: }
208:
209: public void setDialogHide(String dialogHide) {
210: propertyMap.put("dialogHide", dialogHide);
211: }
212:
213: /**
214: * Edge specifies the edge style of the dialog window, default is "raised".
215: * Applicable to modal and modeless popups.
216: */
217: public String getEdge() {
218: return (String) propertyMap.get("edge");
219: }
220:
221: /**
222: * Specifies the edge style of the dialog window - valid values are "raised" and "sunken".
223: * Default is "raised". Applicable to modal and modeless popups.
224: */
225: public void setEdge(String edge) {
226: propertyMap.put("edge", edge);
227: }
228:
229: /**
230: * Specifies whether the dialog window displays the context-sensitive Help icon. The default is yes.
231: * Applicable to modal and modeless popups.
232: */
233: public String getHelp() {
234: return (String) propertyMap.get("help");
235: }
236:
237: /**
238: * Specifies whether the dialog window displays the context-sensitive Help icon. The default is yes.
239: * Applicable to modal and modeless popups.
240: */
241: public void setHelp(String help) {
242: propertyMap.put("help", help);
243: }
244:
245: /**
246: * Specifies whether the dialog window displays the border window chrome.
247: * This feature is only available when a dialog box is opened from a trusted application. The default is no.
248: * Applicable to modal and modeless popups.
249: */
250: public String getUnadorned() {
251: return (String) propertyMap.get("unadorned");
252: }
253:
254: /**
255: * Specifies whether the dialog window displays the border window chrome.
256: * This feature is only available when a dialog box is opened from a trusted application. The default is no.
257: * Applicable to modal and modeless popups.
258: */
259: public void setUnadorned(String unadorned) {
260: propertyMap.put("unadorned", unadorned);
261: }
262:
263: public String getDialogHeight() {
264: return (String) propertyMap.get("dialogHeight");
265: }
266:
267: /**
268: * Sets the height of the dialog window (see Remarks for default unit of measure).
269: * Applicable to modal and modeless popups.
270: * @param dialogHeight
271: */
272: public void setDialogHeight(String dialogHeight) {
273: propertyMap.put("dialogHeight", dialogHeight);
274: }
275:
276: public String getDialogWidth() {
277: return (String) propertyMap.get("dialogWidth");
278: }
279:
280: /**
281: * Sets the width of the dialog window (see Remarks for default unit of measure).
282: * Applicable to modal and modeless popups.
283: * @param dialogWidth
284: */
285: public void setDialogWidth(String dialogWidth) {
286: propertyMap.put("dialogWidth", dialogWidth);
287: }
288:
289: public String getDialogLeft() {
290: return (String) propertyMap.get("dialogLeft");
291: }
292:
293: /**
294: * Sets the left position of the dialog window relative to the upper-left corner of the desktop.
295: * Applicable to modal and modeless popups.
296: * @param dialogLeft
297: */
298: public void setDialogLeft(String dialogLeft) {
299: propertyMap.put("dialogLeft", dialogLeft);
300: }
301:
302: public String getDialogTop() {
303: return (String) propertyMap.get("dialogTop");
304: }
305:
306: /**
307: * Sets the left position of the dialog window relative to the upper-left corner of the desktop.
308: * Applicable to modal and modeless popups.
309: * @param dialogTop
310: */
311: public void setDialogTop(String dialogTop) {
312: propertyMap.put("dialogTop", dialogTop);
313: }
314:
315: public String toString() {
316: StringBuffer sb = new StringBuffer("");
317:
318: for (Iterator i = propertyMap.keySet().iterator(); i.hasNext();) {
319: String key = (String) i.next();
320: sb.append(key);
321: sb.append((modal || modeless) ? ':' : '=');
322: sb.append(propertyMap.get(key).toString());
323: if (i.hasNext())
324: sb.append((modal || modeless) ? "; " : ",");
325: }
326:
327: return sb.toString();
328: }
329: }
|