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