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.structuresmodel.StructuresPanel;
25: import com.metaboss.sdlctools.models.metabossmodel.MetaBossModelPackage;
26: import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.Servicemodule;
27: import com.metaboss.sdlctools.models.metabossmodel.visualmodel.ServicemoduleStructuresDiagram;
28: import com.metaboss.sdlctools.models.metabossmodel.visualmodel.ServicemoduleStructuresDiagramClass;
29:
30: /* ServicemoduleStructuresDiagram user object */
31:
32: public class ServicemoduleStructuresDiagramUserObject extends
33: DiagramUserObject {
34: protected ServicemoduleStructuresDiagram mDiagram = null;
35: protected ViewStructureAction mViewStructureAction = new ViewStructureAction();
36:
37: public ServicemoduleStructuresDiagramUserObject(
38: ServicemoduleStructuresDiagram pDiagram) {
39: super (pDiagram);
40: mDiagram = pDiagram;
41: }
42:
43: public static ServicemoduleStructuresDiagramUserObject addNewServicemoduleStructuresDiagram(
44: Servicemodule pServicemodule) throws Exception {
45: BaseUserObject lResult = new ServicemoduleStructuresDiagramUserObject(
46: null).addNewObject(getObjectPackage(pServicemodule),
47: pServicemodule.getServicemoduleStructuresDiagrams());
48: return (ServicemoduleStructuresDiagramUserObject) lResult;
49: }
50:
51: public BaseUserObject createNewObject(MetaBossModelPackage pPackage) {
52: ServicemoduleStructuresDiagramClass lClass = pPackage
53: .getVisualModel().getServicemoduleStructuresDiagram();
54: return new ServicemoduleStructuresDiagramUserObject(lClass
55: .createServicemoduleStructuresDiagram());
56: }
57:
58: // fill actions list
59: public void fillActionsList(ArrayList pList) {
60: super .fillActionsList(pList);
61: pList.add(new SeparatorAction());
62: pList.add(mViewStructureAction);
63: }
64:
65: // view diagram
66: public void viewDiagram() {
67: try {
68: Application.fireShowContainer(
69: new StructuresPanel(mDiagram), this ,
70: Application.CLASSDIAGRAM_ICON);
71: } catch (Exception e) {
72: e.printStackTrace();
73: }
74: }
75:
76: // return entities diagram
77: public ServicemoduleStructuresDiagram getServicemoduleStructuresDiagram() {
78: return mDiagram;
79: }
80:
81: /* Actions */
82:
83: public class ViewStructureAction extends BaseAction {
84: public ViewStructureAction() {
85: super (Application.getString("view_structuresdiagram"),
86: Application.CLASSDIAGRAM_ICON);
87: }
88:
89: public void actionPerformed(ActionEvent e) {
90: try {
91: viewDiagram();
92: } catch (Throwable t) {
93: t.printStackTrace();
94: }
95: }
96: }
97: }
|