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;
16:
17: import java.io.Serializable;
18:
19: /**
20: * Widget is a component with a graphical representation (via <code>render(OutputData)</code>),
21: * event handling (via <code>event(Path, InputData</code>).
22: * <br><br>
23: * As every Widget has a lifecycle of a Component, it also has a request cycle. Request cycle
24: * starts with <code>update(InputData)</code> which gives the Widget the data from the request
25: * as InputData.
26: * <br><br>
27: * If an event is routed to this widget, <code>event(Path, InputData)</code> is invoked.
28: * <br>
29: *
30: * @author "Toomas Römer" <toomas@webmedia.ee>
31: * @author Jevgeni Kabanov (ekabanov <i>at</i> araneaframework <i>dot</i> org)
32: */
33: public interface Widget extends Service, Serializable {
34: public Interface _getWidget();
35:
36: public interface Interface extends Serializable {
37:
38: /**
39: * Widget starts its request cycle. <code>update(InputData)</code> gives the
40: * widget the chance to update itself with the current InputData and do the necessary
41: * updates.
42: */
43: public void update(InputData data);
44:
45: /**
46: * Widget received an event.
47: * @param path
48: * @param input
49: * @throws Exception
50: */
51: public void event(Path path, InputData input);
52:
53: /**
54: * Widget outputs its graphical representation to OutputData. This method is
55: * idempotent and thus can be called mupltiple times.
56: */
57: public void render(OutputData output) throws Exception;
58: }
59: }
|