001: // THIS SOFTWARE IS PROVIDED BY SOFTARIS PTY.LTD. AND OTHER METABOSS
002: // CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
003: // BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
004: // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTARIS PTY.LTD.
005: // OR OTHER METABOSS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
006: // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
007: // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
008: // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
009: // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
010: // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
011: // EVEN IF SOFTARIS PTY.LTD. OR OTHER METABOSS CONTRIBUTORS ARE ADVISED OF THE
012: // POSSIBILITY OF SUCH DAMAGE.
013: //
014: // Copyright 2000-2005 © Softaris Pty.Ltd. All Rights Reserved.
015: package com.metaboss.applications.designstudio.propertiesdialogs;
016:
017: import java.awt.Dimension;
018:
019: import javax.swing.JCheckBox;
020: import javax.swing.JComboBox;
021: import javax.swing.JTextArea;
022:
023: import com.metaboss.applications.designstudio.datatypefield.DataTypeBox;
024: import com.metaboss.applications.designstudio.userobjects.DatatypeItem;
025: import com.metaboss.sdlctools.models.metabossmodel.ModelElement;
026: import com.metaboss.sdlctools.models.metabossmodel.datadictionarymodel.DataType;
027: import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.Report;
028:
029: /* Report object properties tuning dialog class */
030:
031: public class ReportPropertiesDialog extends
032: ModelElementPropertiesDialog {
033: private Object[] mDataTypes = null;
034: // UI constrols
035: private JCheckBox mIsPagionalCheckBox = new JCheckBox();
036: private DataTypeBox mPageOffsetDataTypeField = new DataTypeBox(
037: "Page Offset DataType");
038: private DataTypeBox mPageSizeDataTypeField = new DataTypeBox(
039: "Page Size DataType");
040: private DataTypeBox mSizeDataTypeField = new DataTypeBox(
041: "Report Size DataType");
042: private JTextArea mDescriptionField = new JTextArea(8, 40);
043:
044: public ReportPropertiesDialog() {
045: super ("Report", new Dimension(420, 370));
046:
047: addTextField(mPropertiesPanel, "Name: ", mNameField, 1, true);
048: addComplexFieldWithEdit(mPropertiesPanel, mSizeDataTypeField,
049: 2, false);
050: addCheckBox(mPropertiesPanel, "- paginal", mIsPagionalCheckBox,
051: 3, false);
052: addComplexFieldWithEdit(mPropertiesPanel,
053: mPageOffsetDataTypeField, 4, false);
054: addComplexFieldWithEdit(mPropertiesPanel,
055: mPageSizeDataTypeField, 5, false);
056: addTextArea(mPropertiesPanel, "Description: ",
057: mDescriptionField, 6, false);
058: }
059:
060: // load entity properties
061: public void loadProperties(ModelElement pObject) throws Exception {
062: if (pObject != null && pObject instanceof Report) {
063: Report lReport = (Report) pObject;
064:
065: mSizeDataTypeField.setSystem(lReport.getDomain()
066: .getSystem());
067: mPageSizeDataTypeField.setSystem(lReport.getDomain()
068: .getSystem());
069: mPageOffsetDataTypeField.setSystem(lReport.getDomain()
070: .getSystem());
071:
072: mNameField.setText(lReport.getName());
073: mIsPagionalCheckBox.setSelected(lReport.isPaginal());
074: mPageOffsetDataTypeField.setSelectedDataType(lReport
075: .getReportPageOffsetDataType());
076: mPageSizeDataTypeField.setSelectedDataType(lReport
077: .getReportPageSizeDataType());
078: mSizeDataTypeField.setSelectedDataType(lReport
079: .getReportSizeDataType());
080:
081: mDescriptionField.setText(lReport.getDescription());
082: }
083: super .loadProperties(pObject);
084: }
085:
086: // save entity proeprties
087: public void saveProperties(ModelElement pObject) throws Exception {
088: if (pObject != null && pObject instanceof Report) {
089: Report lReport = (Report) pObject;
090:
091: lReport.setName(mNameField.getText());
092: lReport.setPaginal(mIsPagionalCheckBox.isSelected());
093: lReport.setReportSizeDataType(mSizeDataTypeField
094: .getSelectedDataType());
095: lReport
096: .setReportPageOffsetDataType(mPageOffsetDataTypeField
097: .getSelectedDataType());
098: lReport.setReportPageSizeDataType(mPageSizeDataTypeField
099: .getSelectedDataType());
100: lReport.setDescription(mDescriptionField.getText());
101: }
102: super .saveProperties(pObject);
103: }
104:
105: private DataType getDataType(JComboBox pBox) {
106: Object lItem = pBox.getSelectedItem();
107: if (lItem != null && lItem instanceof DatatypeItem)
108: return ((DatatypeItem) lItem).mDataType;
109: else
110: return null;
111: }
112: }
|