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.sdlctools.models.metabossmodel.ModelElement;
23:
24: /* Simple model object properties tuning dialog */
25:
26: public class SimpleObjectPropertiesdialog extends
27: ModelElementPropertiesDialog {
28: private String mName = "";
29: private JTextArea mDescriptionField = new JTextArea(8, 40);
30:
31: public SimpleObjectPropertiesdialog(String pCaption) {
32: super (pCaption, new Dimension(400, 270));
33:
34: addTextField(mPropertiesPanel, "Name: ", mNameField, 1, true);
35: addTextArea(mPropertiesPanel, "Description: ",
36: mDescriptionField, 2, false);
37: }
38:
39: // load service module properties
40: public void loadProperties(ModelElement pObject) throws Exception {
41: if (pObject != null) {
42: mNameField.setText(pObject.getName());
43: mDescriptionField.setText(pObject.getDescription());
44: }
45: super .loadProperties(pObject);
46: }
47:
48: // save service module proeprties
49: public void saveProperties(ModelElement pObject) throws Exception {
50: super .saveProperties(pObject);
51: if (pObject != null) {
52: pObject.setName(mNameField.getText());
53: pObject.setDescription(mDescriptionField.getText());
54: }
55: }
56:
57: // check fields data
58: public boolean checkProperties() {
59: if (mNameField.getText().length() == 0) {
60: Application.showError("Name field could not be blank!");
61: return false;
62: }
63: return super .checkProperties();
64: }
65:
66: // return form properties file name
67: protected String getPreferencesFileName() {
68: return getPreferencesDirectoryName()
69: + System.getProperty("file.separator")
70: + this .getClass().getName() + mTitle + ".prop";
71: }
72: }
|