01: /*
02: * Copyright 2006 Luca Garulli (luca.garulli@assetdata.it)
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: */
16:
17: package org.romaframework.core.domain.message;
18:
19: import org.romaframework.aspect.core.annotation.AnnotationConstants;
20: import org.romaframework.aspect.i18n.I18NAspect;
21: import org.romaframework.aspect.view.ViewAspect;
22: import org.romaframework.aspect.view.ViewCallback;
23: import org.romaframework.aspect.view.annotation.ViewAction;
24: import org.romaframework.aspect.view.annotation.ViewClass;
25: import org.romaframework.aspect.view.annotation.ViewField;
26: import org.romaframework.aspect.view.feature.ViewBaseFeatures;
27: import org.romaframework.core.flow.ObjectContext;
28:
29: @ViewClass(render="popup",layout="screen:popup:message")
30: public class Message implements ViewCallback {
31:
32: @ViewField(visible=AnnotationConstants.FALSE)
33: protected String id;
34: @ViewField(visible=AnnotationConstants.FALSE)
35: protected String title;
36: @ViewField(visible=AnnotationConstants.FALSE)
37: protected MessageResponseListener listener;
38:
39: public Message() {
40: }
41:
42: public Message(String iId, String iTitle,
43: MessageResponseListener iListener) {
44: id = iId;
45: title = ObjectContext.getInstance().getComponent(
46: I18NAspect.class).resolveString(iTitle);
47: listener = iListener;
48: }
49:
50: public void onShow() {
51: ObjectContext.getInstance().setClassFeature(this ,
52: ViewAspect.ASPECT_NAME, ViewBaseFeatures.LABEL, title);
53: }
54:
55: public void onDispose() {
56: }
57:
58: public MessageResponseListener getListener() {
59: return listener;
60: }
61:
62: public void setResponse(Object iResponse) {
63: if (listener != null)
64: listener.responseMessage(this , iResponse);
65: }
66:
67: @ViewAction(visible=AnnotationConstants.FALSE)
68: public void close() {
69: ObjectContext.getInstance().close(this );
70: }
71:
72: public String getId() {
73: return id;
74: }
75:
76: public String getTitle() {
77: return title;
78: }
79:
80: public void setListener(MessageResponseListener listener) {
81: this.listener = listener;
82: }
83:
84: }
|