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.propertiesdialogs;
16:
17: import java.awt.Dimension;
18:
19: import javax.swing.JTextArea;
20:
21: import com.metaboss.applications.designstudio.Application;
22: import com.metaboss.applications.designstudio.fieldstable.FieldsEditPanel;
23: import com.metaboss.sdlctools.models.metabossmodel.ModelElement;
24:
25: /* Event properties dialog */
26:
27: public class EventPropertiesDialog extends ModelElementPropertiesDialog {
28: private com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.Event mEvent = null;
29: // UI constrols
30: private FieldsEditPanel mDataFieldsPanel = new FieldsEditPanel(1);
31: private FieldsEditPanel mMessageFieldsPanel = new FieldsEditPanel(2);
32: // properties
33: private JTextArea mDescriptionField = new JTextArea(8, 40);
34:
35: public EventPropertiesDialog() {
36: super ("Event", new Dimension(450, 320));
37:
38: addTextField(mPropertiesPanel, "Name: ", mNameField, 1, true);
39: addTextArea(mPropertiesPanel, "Description: ",
40: mDescriptionField, 2, false);
41:
42: mTabControl.insertTab("Data Fields", null, mDataFieldsPanel,
43: null, 1);
44: mTabControl.insertTab("Message Fields", null,
45: mMessageFieldsPanel, null, 2);
46: }
47:
48: // load service module properties
49: public void loadProperties(ModelElement pObject) throws Exception {
50: mEvent = null;
51: if (pObject != null
52: && pObject instanceof com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.Event) {
53: mEvent = (com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.Event) pObject;
54:
55: mNameField.setText(mEvent.getName());
56: mDescriptionField.setText(mEvent.getDescription());
57:
58: mDataFieldsPanel.loadFields(mEvent);
59: mMessageFieldsPanel.loadFields(mEvent);
60: }
61: super .loadProperties(pObject);
62: }
63:
64: // save service module proeprties
65: public void saveProperties(ModelElement pObject) throws Exception {
66: super .saveProperties(pObject);
67: if (pObject != null
68: && pObject instanceof com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.Event) {
69: com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.Event lEvent = (com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.Event) pObject;
70: lEvent.setName(mNameField.getText());
71: lEvent.setDescription(mDescriptionField.getText());
72: }
73: }
74:
75: // check fields data
76: public boolean checkProperties() {
77: if (mNameField.getText().length() == 0) {
78: Application.showError("Name field could not be blank!");
79: return false;
80: }
81: return super.checkProperties();
82: }
83: }
|