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.aspect.view.echo2.component;
18:
19: import org.romaframework.aspect.view.ViewAspect;
20: import org.romaframework.aspect.view.echo2.form.DefaultEntityForm;
21: import org.romaframework.aspect.view.echo2.form.EntityForm;
22: import org.romaframework.aspect.view.echo2.look.LookAndFeelManager;
23: import org.romaframework.aspect.view.feature.ViewBaseFeatures;
24: import org.romaframework.aspect.view.form.ContentComponent;
25: import org.romaframework.core.config.RomaApplicationContext;
26:
27: public class PopupWindow extends WindowFormContainer {
28: public PopupWindow(EntityForm iForm) {
29: RomaApplicationContext.getInstance().getBean(
30: LookAndFeelManager.class)
31: .assignStyle(
32: this ,
33: iForm.getSchemaInstance().getSchemaClass()
34: .getClazz(),
35: (String) iForm.getSchemaInstance().getFeature(
36: ViewAspect.ASPECT_NAME,
37: ViewBaseFeatures.STYLE));
38:
39: setForm(iForm, iForm);
40:
41: show();
42: }
43:
44: /**
45: * Set the form in the PopupForm
46: *
47: * @param iCallerForm
48: * @param iForm
49: */
50: @Override
51: public void setForm(ContentComponent iCallerForm, EntityForm iForm) {
52: if (form == null) {
53: setFirstToOpenPopup(iForm.getContent());
54: }
55:
56: removeAll();
57: add(iForm, 0);
58:
59: form = iForm;
60: form.setWindow(this );
61:
62: // SET POPUP LABEL
63: setTitle((String) iForm.getSchemaInstance().getFeature(
64: ViewAspect.ASPECT_NAME, ViewBaseFeatures.LABEL));
65:
66: if (form instanceof DefaultEntityForm)
67: // REMOVE TITLE SINCE THE TITLE IS IN THE POPUP WINDOW
68: ((DefaultEntityForm) form).setTitle(null);
69: }
70: }
|