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.propertiesdialogs.SimpleObjectPropertiesdialog;
25: import com.metaboss.sdlctools.models.metabossmodel.technologylibrarymodel.TechnologyLibrary;
26:
27: /* Design Library user object */
28:
29: public class TechLibUserObject extends BaseUserObject {
30: public static final int TECHLIB_ACTION = 1;
31:
32: private TechnologyLibrary mLibrary = null;
33: private AddStorageTachAction mAddStorageTachAction = new AddStorageTachAction();
34:
35: public TechLibUserObject(TechnologyLibrary pLibrary) {
36: super (pLibrary, Application.TECHLIB_ICON);
37: mLibrary = pLibrary;
38: }
39:
40: public TechLibUserObject(TechnologyLibrary pLibrary,
41: String pCaption, int pMode) {
42: super (pLibrary, pCaption, pMode);
43: mLibrary = pLibrary;
44: }
45:
46: // fill actions list
47: public void fillActionsList(ArrayList pList) {
48: switch (mMode) {
49: case ALL_ACTIONS:
50: pList.add(mEditAction);
51: pList.add(mAddStorageTachAction);
52: break;
53: case TECHLIB_ACTION:
54: pList.add(mAddStorageTachAction);
55: break;
56: }
57: }
58:
59: public String toString() {
60: if (mMode == 0)
61: return Application.getString("techlib_node");
62: else
63: return super .toString();
64: }
65:
66: // add new storage technology
67: private void addStorageTechnology() throws Exception {
68: RelationalStorageTechnologyUserObject
69: .addNewStorageTechnology(mLibrary);
70: }
71:
72: // get object editor
73: public BasePropertiesDialog getObjectEditor() {
74: return new SimpleObjectPropertiesdialog("Technology Library");
75: }
76:
77: /* Actions */
78:
79: public class AddStorageTachAction extends BaseAction {
80: public AddStorageTachAction() {
81: super ("Add New Storage Technology", Application
82: .getAddIcon(Application.STORAGE_ICON));
83: }
84:
85: public void actionPerformed(ActionEvent e) {
86: try {
87: addStorageTechnology();
88: } catch (Throwable t) {
89: Application.processError(t);
90: }
91: }
92: }
93: }
|