01: //THIS SOFTWARE IS PROVIDED BY SOFTARIS PTY.LTD. AND OTHER METABOSS
02: //CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
03: //BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
04: //FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTARIS PTY.LTD.
05: //OR OTHER METABOSS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
06: //INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
07: //LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
08: //OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
09: //LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
10: //NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
11: //EVEN IF SOFTARIS PTY.LTD. OR OTHER METABOSS CONTRIBUTORS ARE ADVISED OF THE
12: //POSSIBILITY OF SUCH DAMAGE.
13: //
14: //Copyright 2000-2005 © Softaris Pty.Ltd. All Rights Reserved.
15: package com.metaboss.applications.designstudio.userobjects;
16:
17: import java.awt.event.ActionEvent;
18: import java.util.ArrayList;
19:
20: import com.metaboss.applications.designstudio.Application;
21: import com.metaboss.applications.designstudio.BaseAction;
22: import com.metaboss.applications.designstudio.BaseUserObject;
23: import com.metaboss.applications.designstudio.components.SeparatorAction;
24: import com.metaboss.applications.designstudio.domainmodel.DomainViewPanel;
25: import com.metaboss.sdlctools.models.metabossmodel.MetaBossModelPackage;
26: import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.Domain;
27: import com.metaboss.sdlctools.models.metabossmodel.visualmodel.DomainEntitiesDiagram;
28: import com.metaboss.sdlctools.models.metabossmodel.visualmodel.DomainEntitiesDiagramClass;
29:
30: /* Domain Entities Diagram user object class */
31:
32: public class DomainEntitiesDiagramUserObject extends DiagramUserObject {
33: private ViewStructureAction mViewStructureAction = new ViewStructureAction();
34: protected DomainEntitiesDiagram mDiagram = null;
35:
36: public DomainEntitiesDiagramUserObject(
37: DomainEntitiesDiagram pDiagram) {
38: super (pDiagram);
39: mDiagram = pDiagram;
40: }
41:
42: public static DomainEntitiesDiagramUserObject addNewDomainEntitiesDiagram(
43: Domain pDomain) throws Exception {
44: BaseUserObject lResult = new DomainEntitiesDiagramUserObject(
45: null).addNewObject(getObjectPackage(pDomain), pDomain
46: .getEntityClassDiagrams());
47: return (DomainEntitiesDiagramUserObject) lResult;
48: }
49:
50: public BaseUserObject createNewObject(MetaBossModelPackage pPackage) {
51: DomainEntitiesDiagramClass lClass = pPackage.getVisualModel()
52: .getDomainEntitiesDiagram();
53: return new DomainEntitiesDiagramUserObject(lClass
54: .createDomainEntitiesDiagram());
55: }
56:
57: // fill actions list
58: public void fillActionsList(ArrayList pList) {
59: super .fillActionsList(pList);
60: pList.add(new SeparatorAction());
61: pList.add(mViewStructureAction);
62: }
63:
64: // view diagram
65: public void viewDiagram() {
66: try {
67: Application.fireShowContainer(
68: new DomainViewPanel(mDiagram), this ,
69: Application.DOMAINCLASSDIAGRAM_ICON);
70: } catch (Exception e) {
71: e.printStackTrace();
72: }
73: }
74:
75: // return entities diagram
76: public DomainEntitiesDiagram getEntitiesDiagram() {
77: return mDiagram;
78: }
79:
80: /* Actions */
81:
82: public class ViewStructureAction extends BaseAction {
83: public ViewStructureAction() {
84: super (Application.getString("view_domainclassdiagram"),
85: Application.DOMAINCLASSDIAGRAM_ICON);
86: }
87:
88: public void actionPerformed(ActionEvent e) {
89: try {
90: viewDiagram();
91: } catch (Throwable t) {
92: t.printStackTrace();
93: }
94: }
95: }
96: }
|