01: /*
02: * Copyright 2007 Luca Garulli (luca.garulli@assetdata.it)
03: *
04: *
05: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
06: * use this file except in compliance with the License.
07: *
08: * You may obtain a copy of the License at
09: * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
10: * or agreed to in writing, software distributed under the License is
11: * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
12: * KIND, either express or implied. See the License for the specific language
13: * governing permissions and limitations under the License.
14: */
15: package org.romaframework.module.designer.view.domain;
16:
17: import org.romaframework.aspect.core.annotation.CoreClass;
18: import org.romaframework.aspect.view.ViewConstants;
19: import org.romaframework.aspect.view.annotation.ViewField;
20: import org.romaframework.core.domain.page.ContainerPage;
21: import org.romaframework.core.domain.type.TreeNodeList;
22: import org.romaframework.core.flow.ObjectContext;
23: import org.romaframework.module.designer.domain.RadClass;
24: import org.romaframework.module.designer.domain.RadPackage;
25: import org.romaframework.module.designer.view.domain.radpage.RadClassPage;
26:
27: @CoreClass(orderActions="reload reloadAll preview newClass deleteClass")
28: public class EntityExplorer extends ContainerPage {
29: @ViewField(render=ViewConstants.RENDER_TREE,layout="screen://explorer",selectionField="selected")
30: protected TreeNodeList root;
31: @ViewField(layout="screen://detail")
32: protected RadClassPage classInstance = new RadClassPage(null);
33:
34: // @ViewField(layout = "screen://aspects")
35: // protected AspectsPage aspectsPage = new AspectsPage();
36: public EntityExplorer() {
37: root = new RadPackage("org");
38: root.addChild(new RadPackage("romaframework")).addChild(
39: new RadPackage("rad")).addChild(
40: new RadClass("Business"));
41: }
42:
43: public void reload() {
44: }
45:
46: public void reloadAll() {
47: }
48:
49: public void preview() {
50: if (classInstance.getEntity() == null
51: || classInstance.getEntity().getName() == null) {
52: return;
53: }
54: ObjectContext.getInstance().show(
55: classInstance.getEntity().getName(),
56: ViewConstants.LAYOUT_POPUP);
57: }
58:
59: public void newClass() {
60: }
61:
62: public void deleteClass() {
63: }
64:
65: public void setSelected(TreeNodeList selected) {
66: if (selected instanceof RadPackage) {
67: return;
68: }
69: classInstance.setEntity((RadClass) selected);
70: ObjectContext.getInstance().refresh(classInstance, "entity");
71: }
72:
73: public TreeNodeList getRoot() {
74: return root;
75: }
76:
77: public TreeNodeList getSelected() {
78: return classInstance.getEntity();
79: }
80:
81: public RadClassPage getClassInstance() {
82: return classInstance;
83: }
84: }
|