--- /dev/null
+/*
+ * Copyright
+ * 2011 axYus - http://www.axyus.com
+ * 2011 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS_NB.
+ *
+ * XEMELIOS_NB is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * XEMELIOS_NB 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with XEMELIOS_NB; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+/*
+ * PnlEditColumn.java
+ *
+ * Created on 29 déc. 2011, 14:41:38
+ */
+
+package fr.gouv.finances.cp.buildtools.persist.ora.ihm;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import javax.swing.JCheckBox;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+
+/**
+ *
+ * @author cmarchand
+ */
+public class PnlEditColumn extends javax.swing.JPanel {
+ private OraGenFrame.ColumnNode column;
+
+ /** Creates new form PnlEditColumn */
+ public PnlEditColumn(OraGenFrame.ColumnNode column) {
+ this.column = column;
+ initComponents();
+ dfOriginalName.setText(column.getOriginalName());
+ dfNewName.setText(column.getNewName());
+ dfOriginalDatatype.setText(column.getOriginalDatatype());
+ dfNewDatatype.setText(column.getNewDatatype());
+ dfOriginalQualif.setText(column.getOriginalQualif());
+ dfNewQualif.setText(column.getNewQualif());
+ chkAvoidGenerate.setSelected(column.isAvoidGenerate());
+ dfNewName.getDocument().addDocumentListener(new TextFieldBinder() {
+ @Override
+ public void setData(String text) {
+ PnlEditColumn.this.column.setNewName(text);
+ }
+ });
+ dfNewDatatype.getDocument().addDocumentListener(new TextFieldBinder() {
+ @Override
+ public void setData(String text) {
+ PnlEditColumn.this.column.setNewDatatype(text);
+ }
+ });
+ dfNewQualif.getDocument().addDocumentListener(new TextFieldBinder() {
+ @Override
+ public void setData(String text) {
+ PnlEditColumn.this.column.setNewQualif(text);
+ }
+ });
+ chkAvoidGenerate.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ PnlEditColumn.this.column.setAvoidGenerate(((JCheckBox)e.getSource()).isSelected());
+ }
+ });
+ }
+
+ /** 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")
+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jLabel1 = new javax.swing.JLabel();
+ dfOriginalName = new javax.swing.JTextField();
+ jLabel2 = new javax.swing.JLabel();
+ pbSameName = new javax.swing.JButton();
+ dfNewName = new javax.swing.JTextField();
+ jLabel3 = new javax.swing.JLabel();
+ dfOriginalDatatype = new javax.swing.JTextField();
+ jLabel4 = new javax.swing.JLabel();
+ dfNewDatatype = new javax.swing.JTextField();
+ pbSameType = new javax.swing.JButton();
+ jLabel5 = new javax.swing.JLabel();
+ dfOriginalQualif = new javax.swing.JTextField();
+ jLabel6 = new javax.swing.JLabel();
+ dfNewQualif = new javax.swing.JTextField();
+ pbSameQualif = new javax.swing.JButton();
+ chkAvoidGenerate = new javax.swing.JCheckBox();
+
+ jLabel1.setText("Nom original");
+
+ dfOriginalName.setEditable(false);
+
+ jLabel2.setText("Nouveau nom");
+
+ pbSameName.setText("=");
+ pbSameName.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ pbSameNameActionPerformed(evt);
+ }
+ });
+
+ jLabel3.setText("Type original");
+
+ dfOriginalDatatype.setEditable(false);
+
+ jLabel4.setText("Nouveau Type");
+
+ pbSameType.setText("=");
+ pbSameType.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ pbSameTypeActionPerformed(evt);
+ }
+ });
+
+ jLabel5.setText("Qualification originale");
+
+ dfOriginalQualif.setEditable(false);
+
+ jLabel6.setText("Nouvelle qualification");
+
+ pbSameQualif.setText("=");
+ pbSameQualif.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ pbSameQualifActionPerformed(evt);
+ }
+ });
+
+ chkAvoidGenerate.setText("Ne pas générer");
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jLabel1)
+ .addComponent(jLabel2)
+ .addComponent(jLabel3))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(dfNewName, javax.swing.GroupLayout.DEFAULT_SIZE, 257, Short.MAX_VALUE)
+ .addGap(0, 0, 0)
+ .addComponent(pbSameName))
+ .addComponent(dfOriginalName, javax.swing.GroupLayout.DEFAULT_SIZE, 274, Short.MAX_VALUE)
+ .addComponent(dfOriginalDatatype, javax.swing.GroupLayout.DEFAULT_SIZE, 274, Short.MAX_VALUE)))
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(jLabel4)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(dfNewDatatype, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE)
+ .addGap(0, 0, 0)
+ .addComponent(pbSameType))
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jLabel6)
+ .addComponent(jLabel5))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(dfOriginalQualif, javax.swing.GroupLayout.DEFAULT_SIZE, 228, Short.MAX_VALUE)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(dfNewQualif, javax.swing.GroupLayout.DEFAULT_SIZE, 211, Short.MAX_VALUE)
+ .addGap(0, 0, 0)
+ .addComponent(pbSameQualif))))
+ .addComponent(chkAvoidGenerate))
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel1)
+ .addComponent(dfOriginalName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel2)
+ .addComponent(pbSameName)
+ .addComponent(dfNewName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel3)
+ .addComponent(dfOriginalDatatype, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel4)
+ .addComponent(pbSameType)
+ .addComponent(dfNewDatatype, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel5)
+ .addComponent(dfOriginalQualif, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel6)
+ .addComponent(pbSameQualif)
+ .addComponent(dfNewQualif, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(chkAvoidGenerate)
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ );
+
+ layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {dfNewName, pbSameName});
+
+ layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {dfNewDatatype, pbSameType});
+
+ layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {dfNewQualif, pbSameQualif});
+
+ }// </editor-fold>//GEN-END:initComponents
+
+ private void pbSameNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pbSameNameActionPerformed
+ dfNewName.setText(column.getOriginalName());
+ }//GEN-LAST:event_pbSameNameActionPerformed
+
+ private void pbSameTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pbSameTypeActionPerformed
+ dfNewDatatype.setText(column.getOriginalDatatype());
+ }//GEN-LAST:event_pbSameTypeActionPerformed
+
+ private void pbSameQualifActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pbSameQualifActionPerformed
+ dfNewQualif.setText(column.getOriginalQualif());
+ }//GEN-LAST:event_pbSameQualifActionPerformed
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JCheckBox chkAvoidGenerate;
+ private javax.swing.JTextField dfNewDatatype;
+ private javax.swing.JTextField dfNewName;
+ private javax.swing.JTextField dfNewQualif;
+ private javax.swing.JTextField dfOriginalDatatype;
+ private javax.swing.JTextField dfOriginalName;
+ private javax.swing.JTextField dfOriginalQualif;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JLabel jLabel2;
+ private javax.swing.JLabel jLabel3;
+ private javax.swing.JLabel jLabel4;
+ private javax.swing.JLabel jLabel5;
+ private javax.swing.JLabel jLabel6;
+ private javax.swing.JButton pbSameName;
+ private javax.swing.JButton pbSameQualif;
+ private javax.swing.JButton pbSameType;
+ // End of variables declaration//GEN-END:variables
+
+ public static abstract class TextFieldBinder implements DocumentListener {
+ @Override
+ public void insertUpdate(DocumentEvent e) {
+ try {
+ String content = e.getDocument().getText(0, e.getDocument().getLength());
+ setData(content);
+ } catch(Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+ @Override
+ public void removeUpdate(DocumentEvent e) {
+ try {
+ String content = e.getDocument().getText(0, e.getDocument().getLength());
+ setData(content);
+ } catch(Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+ @Override
+ public void changedUpdate(DocumentEvent e) {}
+ public abstract void setData(String text);
+ }
+}