01: /**
02: * Copyright 2006 Webmedia Group Ltd.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: **/package org.araneaframework.http;
16:
17: import java.io.Serializable;
18: import java.util.Map;
19: import org.araneaframework.Message;
20: import org.araneaframework.Service;
21: import org.araneaframework.Widget;
22: import org.araneaframework.http.support.PopupWindowProperties;
23:
24: /**
25: * Interface for manipulating popup windows (each popup window
26: * corresponding to server-side "thread").
27: *
28: * @author Taimo Peelo
29: */
30: public interface PopupWindowContext extends Serializable {
31:
32: /** Popup closing key, when session-thread in a window receives response containing
33: * that key, it should close and take serverside service with it. */
34: public static final String POPUPS_CLOSE_KEY = "popupClose";
35:
36: /**
37: * Registers new thread-level service server-side and gives started service means of communicating with
38: * its opener and vice-versa.
39: * @param startMessage - message sent to newly created service (thread).
40: * @param properties - properties specifying behaviour and appearance of creatable popup window.
41: * @param opener - widget that is registered as opener of created thread.
42: * @return threadlevel id of created and registered service
43: */
44: public String open(Message startMessage,
45: PopupWindowProperties properties, Widget opener);
46:
47: /**
48: * Method for registering already created service under {@link org.araneaframework.framework.ThreadContext} as popup.
49: * @param service to register.
50: * @param properties properties specifying behaviour and appearance of creatable popup window.
51: * @param opener - widget that is registered as opener of created thread.
52: * @return ID of created service.
53: */
54: public String open(Service service,
55: PopupWindowProperties properties, Widget opener);
56:
57: public String openMounted(String url,
58: PopupWindowProperties properties);
59:
60: /**
61: * Opens given URL in a new popup window.
62: * @param url URL to be opened in the popup window
63: * @param properties properties specifying behaviour and appearance of creatable popup window.
64: */
65: public void open(String url, PopupWindowProperties properties);
66:
67: /**
68: * Closes the server side thread service (serving client side popup).
69: * @param id thread (popup) ID to close.
70: * @return whether service with given thread id was closed.
71: */
72: public boolean close(String id) throws Exception;
73:
74: /**
75: * Returns the widget that opened calling thread-level service (popup).
76: * @return opener of thread-level service, <code>null</code> when calling service does not have registered opener.
77: */
78: public Widget getOpener();
79:
80: /**
81: * @since 1.1
82: */
83: public Map getPopups();
84: }
|