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.JCheckBox;
20: import javax.swing.JTextArea;
21:
22: import com.metaboss.sdlctools.models.metabossmodel.ModelElement;
23: import com.metaboss.sdlctools.models.metabossmodel.datadictionarymodel.PropertyDescriptor;
24:
25: /* Property Descriptor properties dialog */
26:
27: public class PropertyDescriptorPropertiesDialog extends
28: ModelElementPropertiesDialog {
29: private JCheckBox mIsArrayCheckBox = new JCheckBox();
30: private JCheckBox mIsContainerCheckBox = new JCheckBox();
31: private JTextArea mDescriptionField = new JTextArea(8, 40);
32:
33: public PropertyDescriptorPropertiesDialog() {
34: super ("Property Descriptor", new Dimension(400, 310));
35:
36: addTextField(mPropertiesPanel, "Name: ", mNameField, 1, true);
37: addCheckBox(mPropertiesPanel, "- array", mIsArrayCheckBox, 2,
38: false);
39: addCheckBox(mPropertiesPanel, "- container",
40: mIsContainerCheckBox, 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: if (pObject != null && pObject instanceof PropertyDescriptor) {
48: PropertyDescriptor lProperty = (PropertyDescriptor) pObject;
49:
50: mNameField.setText(lProperty.getName());
51: mIsArrayCheckBox.setSelected(lProperty.isArray());
52: mIsContainerCheckBox.setSelected(lProperty.isContainer());
53: mDescriptionField.setText(lProperty.getDescription());
54: }
55: super .loadProperties(pObject);
56: }
57:
58: // save entity proeprties
59: public void saveProperties(ModelElement pObject) throws Exception {
60: super .saveProperties(pObject);
61: if (pObject != null && pObject instanceof PropertyDescriptor) {
62: PropertyDescriptor lProperty = (PropertyDescriptor) pObject;
63: lProperty.setName(mNameField.getText());
64: lProperty.setArray(mIsArrayCheckBox.isSelected());
65: lProperty.setContainer(mIsContainerCheckBox.isSelected());
66: lProperty.setDescription(mDescriptionField.getText());
67: }
68: }
69: }
|