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.systemsmodel.SystemsPanel;
25: import com.metaboss.sdlctools.models.metabossmodel.MetaBossModelPackage;
26: import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.Enterprise;
27: import com.metaboss.sdlctools.models.metabossmodel.visualmodel.EnterpriseSystemsDiagram;
28: import com.metaboss.sdlctools.models.metabossmodel.visualmodel.EnterpriseSystemsDiagramClass;
29:
30: /* Enterprise Systems Diagram user object */
31:
32: public class EnterpriseSystemsDiagramUserObject extends
33: DiagramUserObject {
34: protected EnterpriseSystemsDiagram mDiagram = null;
35: protected ShowSystemsDiagramAction mShowSystemsDiagramAction = new ShowSystemsDiagramAction();
36:
37: public EnterpriseSystemsDiagramUserObject(
38: EnterpriseSystemsDiagram pDiagram) {
39: super (pDiagram);
40: mDiagram = pDiagram;
41: }
42:
43: public static EnterpriseSystemsDiagramUserObject addNewEntrpriseEntitiesDiagram(
44: Enterprise pEnterprise) throws Exception {
45: BaseUserObject lResult = new EnterpriseSystemsDiagramUserObject(
46: null).addNewObject(getObjectPackage(pEnterprise),
47: pEnterprise.getEnterpriseSystemsDiagrams());
48: return (EnterpriseSystemsDiagramUserObject) lResult;
49: }
50:
51: public BaseUserObject createNewObject(MetaBossModelPackage pPackage) {
52: EnterpriseSystemsDiagramClass lClass = pPackage
53: .getVisualModel().getEnterpriseSystemsDiagram();
54: return new EnterpriseSystemsDiagramUserObject(lClass
55: .createEnterpriseSystemsDiagram());
56: }
57:
58: // fill actions list
59: public void fillActionsList(ArrayList pList) {
60: super .fillActionsList(pList);
61: pList.add(new SeparatorAction());
62: pList.add(mShowSystemsDiagramAction);
63: }
64:
65: // view systems diagram
66: public void viewSystemsDiagram() {
67: try {
68: Application.fireShowContainer(new SystemsPanel(mDiagram),
69: this , Application.SYSTEMSDIAGRAM_ICON);
70: } catch (Exception e) {
71: e.printStackTrace();
72: }
73: }
74:
75: // get enterprise systems diagram
76: public EnterpriseSystemsDiagram getEnterpriseSystemsDiagram() {
77: return mDiagram;
78: }
79:
80: /* Actions */
81:
82: /* Show Systems diagram */
83:
84: public class ShowSystemsDiagramAction extends BaseAction {
85: public ShowSystemsDiagramAction() {
86: super (Application
87: .getString("view_enterprisesystemsdiagram"),
88: Application.SYSTEMSDIAGRAM_ICON);
89: }
90:
91: public void actionPerformed(ActionEvent arg0) {
92: viewSystemsDiagram();
93: }
94: }
95: }
|