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 com.metaboss.applications.designstudio.Application;
18: import com.metaboss.applications.designstudio.BasePropertiesDialog;
19: import com.metaboss.applications.designstudio.BaseUserObject;
20: import com.metaboss.applications.designstudio.propertiesdialogs.SimpleObjectPropertiesdialog;
21: import com.metaboss.sdlctools.models.metabossmodel.MetaBossModelPackage;
22: import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.System;
23: import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemusagemodel.UsageSpecification;
24: import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemusagemodel.UsageSpecificationClass;
25:
26: /* UsageSpecification user object */
27:
28: public class UsageSpecificationUserObject extends
29: AbstractNamespaceUserObject {
30: private UsageSpecification mUsageSpecification = null;
31: private System mMasterSystem = null;
32:
33: public UsageSpecificationUserObject(
34: UsageSpecification pUsageSpecification) {
35: super (pUsageSpecification, Application.USAGESPECIFICATION_ICON);
36: mUsageSpecification = pUsageSpecification;
37: }
38:
39: public UsageSpecificationUserObject(
40: UsageSpecification pUsageSpecification, String pCaption,
41: int pMode) {
42: super (pUsageSpecification, pCaption, pMode);
43: mUsageSpecification = pUsageSpecification;
44: }
45:
46: // create new StateMachine
47: public static void addNewStateMachine(System pSystem)
48: throws Exception {
49: UsageSpecificationUserObject lObject = new UsageSpecificationUserObject(
50: null);
51: lObject.mMasterSystem = pSystem;
52: lObject.addNewObject(getObjectPackage(pSystem), null);
53: }
54:
55: public BaseUserObject createNewObject(MetaBossModelPackage pPackage) {
56: UsageSpecificationClass lClass = pPackage.getEnterpriseModel()
57: .getSystemUsageModel().getUsageSpecification();
58: UsageSpecification lUsageSpecification = lClass
59: .createUsageSpecification();
60: if (mMasterSystem != null)
61: mMasterSystem.setUsageSpecification(lUsageSpecification);
62: lUsageSpecification.setName("Default");
63: return new UsageSpecificationUserObject(lUsageSpecification);
64: }
65:
66: public String toString() {
67: if (mCaption.length() > 0)
68: return mCaption;
69: else
70: return "Usage Specification";
71: }
72:
73: // return object root node captions
74: public String getRootNodeName() {
75: return null;
76: }
77:
78: public UsageSpecification getUsageSpecification() {
79: return mUsageSpecification;
80: }
81:
82: // get object editor
83: public BasePropertiesDialog getObjectEditor() {
84: return new SimpleObjectPropertiesdialog("Usage Specification");
85: }
86: }
|