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.sdlctools.models.metabossmodel.ModelElement;
23: import com.metaboss.sdlctools.models.metabossmodel.ModelElementConstraint;
24:
25: /* Model Element Constraint properties tuning dialog class */
26:
27: public class ModelElementConstraintPropertiesDialog extends
28: ModelElementPropertiesDialog {
29: private JTextField mDefaultErrorTextField = new JTextField();
30: private JTextField mOclExpressionField = new JTextField();
31: private JTextArea mDescriptionField = new JTextArea(8, 40);
32:
33: public ModelElementConstraintPropertiesDialog() {
34: super ("Model Element Constraint", new Dimension(450, 320));
35:
36: addTextField(mPropertiesPanel, "Name: ", mNameField, 1, true);
37: addTextField(mPropertiesPanel, "Default Error Text: ",
38: mDefaultErrorTextField, 2, false);
39: addTextField(mPropertiesPanel, "Ocl Expression : ",
40: mOclExpressionField, 3, false);
41: addTextArea(mPropertiesPanel, "Description: ",
42: mDescriptionField, 4, false);
43: }
44:
45: // load entity properties
46: public void loadProperties(ModelElement pObject) throws Exception {
47: ModelElementConstraint lModelElementConstraint = (ModelElementConstraint) pObject;
48: if (lModelElementConstraint != null) {
49: mNameField.setText(lModelElementConstraint.getName());
50: mDefaultErrorTextField.setText(lModelElementConstraint
51: .getDefaultErrorText());
52: mOclExpressionField.setText(lModelElementConstraint
53: .getOclExpression());
54: mDescriptionField.setText(lModelElementConstraint
55: .getDescription());
56: }
57: super .loadProperties(pObject);
58: }
59:
60: // save entity proeprties
61: public void saveProperties(ModelElement pObject) throws Exception {
62: super .saveProperties(pObject);
63: if (pObject != null
64: && pObject instanceof ModelElementConstraint) {
65: ModelElementConstraint lModelElementConstraint = (ModelElementConstraint) pObject;
66: lModelElementConstraint.setName(mNameField.getText());
67: lModelElementConstraint
68: .setDefaultErrorText(mDefaultErrorTextField
69: .getText());
70: lModelElementConstraint
71: .setOclExpression(mOclExpressionField.getText());
72: lModelElementConstraint.setDescription(mDescriptionField
73: .getText());
74: }
75: }
76: }
|