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: import javax.swing.JTextField;
21:
22: import com.metaboss.applications.designstudio.fieldstable.FieldsEditPanel;
23: import com.metaboss.sdlctools.models.metabossmodel.ModelElement;
24: import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.Service;
25:
26: /* Service properties dialog */
27:
28: public class ServicePropertiesDialog extends
29: ModelElementPropertiesDialog {
30: // UI constrols
31: private FieldsEditPanel mFieldsPanel = new FieldsEditPanel(4);
32: // properties
33: private JTextField mNameField = new JTextField();
34: private JTextArea mDescriptionField = new JTextArea(8, 40);
35:
36: public ServicePropertiesDialog() {
37: super ("Service", new Dimension(420, 320));
38:
39: // properties
40: addTextField(mPropertiesPanel, "Name: ", mNameField, 1, true);
41: addTextArea(mPropertiesPanel, "Description: ",
42: mDescriptionField, 2, false);
43:
44: mTabControl
45: .insertTab("Operations", null, mFieldsPanel, null, 1);
46: }
47:
48: // load entity properties
49: public void loadProperties(ModelElement pObject) throws Exception {
50: if (pObject != null && pObject instanceof Service) {
51: Service lService = (Service) pObject;
52:
53: mNameField.setText(lService.getName());
54: mDescriptionField.setText(lService.getDescription());
55:
56: mFieldsPanel.loadFields(lService);
57: }
58: super .loadProperties(pObject);
59: }
60:
61: // save entity proeprties
62: public void saveProperties(ModelElement pObject) throws Exception {
63: super .saveProperties(pObject);
64: if (pObject != null && pObject instanceof Service) {
65: Service lService = (Service) pObject;
66:
67: lService.setName(mNameField.getText());
68: lService.setDescription(mDescriptionField.getText());
69: }
70: }
71: }
|