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.BasePropertiesDialog;
23: import com.metaboss.applications.designstudio.BaseUserObject;
24: import com.metaboss.applications.designstudio.components.SeparatorAction;
25: import com.metaboss.applications.designstudio.propertiesdialogs.SimpleObjectPropertiesdialog;
26: import com.metaboss.sdlctools.models.metabossmodel.designlibrarymodel.DesignLibrary;
27:
28: /* Design Library user object */
29:
30: public class DesignLibUserObject extends BaseUserObject {
31: public static final int ADD_DATADICTIONARY = 1;
32:
33: private DesignLibrary mLibrary = null;
34: private StudyDependenciesAction mShowDataTypeDependenciesAction = new StudyDependenciesAction();
35: private AddNewDataDictionaryAction mAddNewAssociationRoleAction = new AddNewDataDictionaryAction();
36:
37: public DesignLibUserObject(DesignLibrary pLibrary) {
38: super (pLibrary, Application.DESIGNLIB_ICON);
39: mLibrary = pLibrary;
40: }
41:
42: public DesignLibUserObject(DesignLibrary pLibrary, String pCaption,
43: int pMode) {
44: super (pLibrary, pCaption, pMode);
45: mLibrary = pLibrary;
46: }
47:
48: // fill actions list
49: public void fillActionsList(ArrayList pList) {
50: switch (mMode) {
51: case ALL_ACTIONS:
52: pList.add(mEditAction);
53: pList.add(new SeparatorAction());
54: pList.add(mAddNewAssociationRoleAction);
55: pList.add(new SeparatorAction());
56: pList.add(mShowDataTypeDependenciesAction);
57: break;
58: case ADD_DATADICTIONARY:
59: pList.add(mAddNewAssociationRoleAction);
60: break;
61: }
62: }
63:
64: // get object editor
65: public BasePropertiesDialog getObjectEditor() {
66: return new SimpleObjectPropertiesdialog("Design Library");
67: }
68:
69: public String toString() {
70: if (mMode == 0)
71: return Application.getString("designlib_node");
72: else
73: return super .toString();
74: }
75:
76: // add new DataDictionary
77: public void addNewDataDictionary() throws Exception {
78: DataDictionaryUserObject.addNewDataDictionary(mLibrary);
79: }
80:
81: /* Actions */
82:
83: /* Add New DataDictionary Class Action */
84:
85: public class AddNewDataDictionaryAction extends BaseAction {
86: public AddNewDataDictionaryAction() {
87: super ("Add New Data Dictionary", Application
88: .getAddIcon(Application.DATADICTIONARY_ICON));
89: }
90:
91: public void actionPerformed(ActionEvent arg0) {
92: try {
93: addNewDataDictionary();
94: } catch (Exception e) {
95: e.printStackTrace();
96: }
97: }
98: }
99: }
|