/* PseudoCode Interpreted Language (PCIL): Part of the algoviz@vt collection of algorithm visualizations. Copyright (C) 2008 Brandon Malone, Frank Hadlock This file is part of the PseudoCode Interpreted Language. PseudoCode Interpreted Language is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. PseudoCode Interpreted Language is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with PseudoCode Interpreted Language. If not, see . */ /* * AddPropertyView.java * * Created on August 19, 2008, 12:18 PM */ package dynamicmvc; /** * * @author bm542 */ public class AddPropertyView extends javax.swing.JFrame { IAddPropertyViewCaller caller; Object callerFlag; /** Creates new form AddPropertyView */ public AddPropertyView(String text, IAddPropertyViewCaller caller, Object callerFlag) { initComponents(); this.ddlNewPropertyDataType.setModel(new javax.swing.DefaultComboBoxModel(PrimitiveFactory.getTypeNames().toArray())); this.lblText.setText(text); this.caller = caller; this.callerFlag = callerFlag; } public String getPropertyName() { return this.tbNewPropertyName.getText(); } public String getDataTypeName() { return (String)this.ddlNewPropertyDataType.getSelectedItem(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new javax.swing.JPanel(); lblText = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel(); tbNewPropertyName = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); ddlNewPropertyDataType = new javax.swing.JComboBox(); btnOK = new javax.swing.JButton(); btnCancel = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Add a Property")); lblText.setText("jLabel1"); jLabel1.setText("New Property Name"); tbNewPropertyName.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { tbNewPropertyNameActionPerformed(evt); } }); jLabel2.setText("New Property Data Type"); ddlNewPropertyDataType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); btnOK.setText("OK"); btnOK.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnOKActionPerformed(evt); } }); btnCancel.setText("Cancel"); btnCancel.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnCancelActionPerformed(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(tbNewPropertyName, javax.swing.GroupLayout.DEFAULT_SIZE, 344, Short.MAX_VALUE) .addComponent(lblText) .addComponent(jLabel1) .addComponent(jLabel2) .addComponent(ddlNewPropertyDataType, 0, 344, Short.MAX_VALUE) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(btnOK, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 214, Short.MAX_VALUE) .addComponent(btnCancel, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap()) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(lblText) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(tbNewPropertyName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(ddlNewPropertyDataType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btnOK) .addComponent(btnCancel)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()) ); pack(); }// //GEN-END:initComponents private void tbNewPropertyNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbNewPropertyNameActionPerformed // TODO add your handling code here: }//GEN-LAST:event_tbNewPropertyNameActionPerformed private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelActionPerformed // TODO add your handling code here: caller.cancelClicked(this, callerFlag); }//GEN-LAST:event_btnCancelActionPerformed private void btnOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOKActionPerformed // TODO add your handling code here: caller.okClicked(this, callerFlag); }//GEN-LAST:event_btnOKActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnCancel; private javax.swing.JButton btnOK; private javax.swing.JComboBox ddlNewPropertyDataType; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JPanel jPanel1; private javax.swing.JLabel lblText; private javax.swing.JTextField tbNewPropertyName; // End of variables declaration//GEN-END:variables }