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