OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Blame | Last modification | View Log | RSS feed

/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 * 
 * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
 * 
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
 * language governing permissions and limitations under the License.
 * 
 * When distributing the software, include this License Header Notice in each file.
 */
 
 /*
 * Créé le 19 oct. 2011
 */
package org.openconcerto.erp.core.supplychain.order.element;

import org.openconcerto.erp.core.common.component.TransfertBaseSQLComponent;
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
import org.openconcerto.erp.core.common.element.NumerotationAutoSQLElement;
import org.openconcerto.erp.panel.PanelOOSQLComponent;
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.element.ElementSQLObject;
import org.openconcerto.sql.element.SQLElement;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.sql.sqlobject.ElementComboBox;
import org.openconcerto.sql.sqlobject.JUniqueTextField;
import org.openconcerto.sql.ui.RadioButtons;
import org.openconcerto.sql.view.EditFrame;
import org.openconcerto.sql.view.list.RowValuesTable;
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.ui.FormLayouter;
import org.openconcerto.ui.JDate;
import org.openconcerto.ui.TitledSeparator;
import org.openconcerto.ui.VFlowLayout;
import org.openconcerto.ui.component.ITextArea;
import org.openconcerto.ui.component.InteractionMode;
import org.openconcerto.utils.ExceptionHandler;

import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.sql.SQLException;
import java.util.List;

import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;

public class DemandePrixSQLComponent extends TransfertBaseSQLComponent {
    JUniqueTextField field = new JUniqueTextField();
    DemandePrixItemTable table = new DemandePrixItemTable();
    PanelOOSQLComponent panelOO;
    private ElementSQLObject componentPrincipaleAdr;

    public DemandePrixSQLComponent(SQLElement elt) {
        super(elt);
    }

    @Override
    protected void addViews() {

        GridBagConstraints c = new DefaultGridBagConstraints();
        setLayout(new GridBagLayout());
        // Champ Module
        c.gridx = 0;
        c.gridy++;
        c.gridwidth = GridBagConstraints.REMAINDER;
        final JPanel addP = ComptaSQLConfElement.createAdditionalPanel();
        this.setAdditionalFieldsPanel(new FormLayouter(addP, 2));
        this.add(addP, c);

        // c.gridy++;
        // c.gridx = 0;
        // c.weightx = 0;
        // this.add(new JLabel(getLabelFor("ID_COMMANDE_PREV"), SwingConstants.RIGHT), c);
        // c.gridx++;
        // c.weightx = 1;
        // final ElementComboBox boxCmd = new ElementComboBox();
        // this.add(boxCmd, c);
        // this.addView(boxCmd, "ID_COMMANDE_PREV");

        c.gridy++;
        c.gridwidth = 1;
        c.gridx = 0;
        c.weightx = 0;
        this.add(new JLabel(getLabelFor("NUMERO"), SwingConstants.RIGHT), c);
        c.gridx++;
        c.weightx = 1;
        this.add(field, c);
        this.addView(field, "NUMERO", REQ);

        c.gridx++;
        c.weightx = 0;
        this.add(new JLabel(getLabelFor("DATE"), SwingConstants.RIGHT), c);
        c.gridx++;
        c.weightx = 1;
        JDate date = new JDate(true);
        this.add(date, c);
        this.addView(date, "DATE", REQ);

        c.gridx = 0;
        c.gridy++;
        c.weightx = 0;
        this.add(new JLabel(getLabelFor("ID_FOURNISSEUR"), SwingConstants.RIGHT), c);
        c.gridx++;
        c.weightx = 1;
        final ElementComboBox boxFournisseur = new ElementComboBox();
        this.add(boxFournisseur, c);
        this.addView(boxFournisseur, "ID_FOURNISSEUR", REQ);

        c.gridx++;
        c.weightx = 0;
        this.add(new JLabel(getLabelFor("DATE_BUTOIRE"), SwingConstants.RIGHT), c);
        c.gridx++;
        c.weightx = 1;
        JDate dateButoire = new JDate(false);
        this.add(dateButoire, c);

        this.addView(dateButoire, "DATE_BUTOIRE");
        //
        // c.gridx++;
        // c.weightx = 0;
        // this.add(new JLabel(getLabelFor("DATE_DISPOSITION"), SwingConstants.RIGHT), c);
        // c.gridx++;
        // c.weightx = 1;
        // final JDate dateDisposition = new JDate();
        // this.add(dateDisposition, c);
        // this.addView(dateDisposition, "DATE_DISPOSITION", REQ);

        // c.gridx = 0;
        // c.gridy++;
        // c.weightx = 0;
        // this.add(new JLabel(getLabelFor("ID_CONTACT_FOURNISSEUR"), SwingConstants.RIGHT), c);
        // c.gridx++;
        // c.weightx = 1;
        // final ElementComboBox boxContactFournisseur = new ElementComboBox();
        // this.add(boxContactFournisseur, c);
        // final SQLElement contactElement =
        // Configuration.getInstance().getDirectory().getElement("CONTACT_FOURNISSEUR");
        // boxContactFournisseur.init(contactElement, contactElement.getComboRequest(true));
        // this.addView(boxContactFournisseur, "ID_CONTACT_FOURNISSEUR", REQ);
        //
        // boxFournisseur.addModelListener("wantedID", new PropertyChangeListener() {
        //
        // @Override
        // public void propertyChange(PropertyChangeEvent arg0) {
        //
        // SQLRow selectedRow =
        // boxFournisseur.getRequest().getPrimaryTable().getRow(boxFournisseur.getWantedID());
        // if (selectedRow != null) {
        // boxContactFournisseur.getRequest().setWhere(new
        // Where(contactElement.getTable().getField("ID_FOURNISSEUR"), "=", selectedRow.getID()));
        // } else {
        // boxContactFournisseur.getRequest().setWhere(null);
        // }
        // }
        // });

        // this.addView("ID_ADRESSE");
        // Etat devis
        // c.gridx = 0;
        // c.gridy++;
        //
        // this.add(new JLabel(getLabelFor("ID_COMMERCIAL")), c);
        // c.gridx++;
        // ElementComboBox boxComm = new ElementComboBox();
        // this.add(boxComm, c);
        // this.addView(boxComm, "ID_COMMERCIAL");

        // SQLRequestComboBox boxEtat = new SQLRequestComboBox();
        // c.weightx = 0;
        // this.add(new JLabel(getLabelFor("ID_ETAT_DEMANDE_PRIX")), c);
        // c.gridx++;
        // c.weightx = 1;
        // this.add(boxEtat, c);
        // this.addView(boxEtat, "ID_ETAT_DEMANDE_PRIX");

        c.weightx = 0;
        c.gridheight = 1;
        c.gridx = 0;
        c.gridy++;
        c.anchor = GridBagConstraints.WEST;
        c.weightx = 0;
        JLabel labelObjet = new JLabel(getLabelFor("OBJET"), SwingConstants.RIGHT);
        this.add(labelObjet, c);
        c.gridx++;
        ITextArea area = new ITextArea();
        c.weightx = 1;
        this.add(area, c);
        this.addView(area, "OBJET");

        RadioButtons radioEtat = new RadioButtons("NOM");
        radioEtat.setLayout(new VFlowLayout());
        radioEtat.setBorder(BorderFactory.createTitledBorder(getLabelFor("ID_ETAT_DEMANDE_PRIX")));
        c.gridx = 3;
        c.gridheight = 5;
        c.anchor = GridBagConstraints.NORTHWEST;
        this.add(radioEtat, c);
        this.addView(radioEtat, "ID_ETAT_DEMANDE_PRIX", REQ);

        // c.gridx = 0;
        // c.gridy++;
        // c.gridwidth = 2;
        // c.weightx = 1;
        // this.add(new TitledSeparator("Adresse de destination"), c);
        // c.gridy++;
        // c.weightx = 0;
        // final JCheckBox boxLivr = new JCheckBox("Livré par le fournisseur");
        // this.add(boxLivr, c);
        // this.addView(boxLivr, "LIVRAISON_F");
        // c.gridy++;
        // final ElementComboBox boxAdr = new ElementComboBox();
        // final SQLElement adrElement = getElement().getForeignElement("ID_ADRESSE");
        // boxAdr.init(adrElement);
        // c.gridwidth = 1;
        // final JLabel labelAdrLiv = new JLabel("Adresse de livraison existante");
        // this.add(labelAdrLiv, c);
        // c.gridx++;
        // c.gridwidth = 2;
        // this.add(boxAdr, c);
        // c.gridy++;
        // c.gridx = 0;
        // this.addView("ID_ADRESSE");
        // final DefaultElementSQLObject comp = (DefaultElementSQLObject)
        // this.getView("ID_ADRESSE").getComp();
        // componentPrincipaleAdr = (ElementSQLObject) this.getView("ID_ADRESSE");
        // this.add(comp, c);
        // boxLivr.addActionListener(new ActionListener() {
        //
        // @Override
        // public void actionPerformed(ActionEvent e) {
        // if (boxLivr.isSelected() && !comp.isCreated()) {
        // comp.setCreated(true);
        // componentPrincipaleAdr.setEditable(InteractionMode.READ_WRITE);
        // final SQLRow selectedRow2 = boxAffaire.getSelectedRow();
        // if (selectedRow2 != null) {
        // SQLRowValues rowVals = getLivraisonAdr(selectedRow2.asRow());
        // rowVals.put("RUE", "");
        // comp.setValue(rowVals);
        // }
        // } else {
        // if (!boxLivr.isSelected()) {
        // comp.setCreated(false);
        // componentPrincipaleAdr.setEditable(InteractionMode.DISABLED);
        // }
        // }
        //
        // }
        // });
        // comp.addValueListener(new PropertyChangeListener() {
        //
        // @Override
        // public void propertyChange(PropertyChangeEvent evt) {
        // boxAdr.setVisible(comp.isCreated());
        // labelAdrLiv.setVisible(comp.isCreated());
        // }
        // });

        // boxAffaire.addModelListener("wantedID", new PropertyChangeListener() {
        // SQLTable tableAdr = getTable().getTable("ADRESSE");
        //
        // @Override
        // public void propertyChange(PropertyChangeEvent evt) {
        //
        // SQLRow selectedRow =
        // boxAffaire.getRequest().getPrimaryTable().getRow(boxAffaire.getWantedID());
        // boxCmd.getRequest().setWhere(Where.FALSE);
        // if (selectedRow != null && !selectedRow.isUndefined()) {
        //
        // SQLRow client = selectedRow.getForeign("ID_CLIENT");
        //
        // boxAdr.getRequest().setWhere(((AffaireSQLElement)
        // boxAffaire.getElement()).getWhereAdrL(client));
        // boxCmd.getRequest().setWhere(new
        // Where(getTable().getForeignTable("ID_COMMANDE_PREV").getField("ID_AFFAIRE"), "=",
        // selectedRow.getID()));
        //
        // }
        // }
        // });
        // boxAdr.addValueListener(new PropertyChangeListener() {
        //
        // @Override
        // public void propertyChange(PropertyChangeEvent evt) {
        // final SQLRow selectedRow = boxAdr.getSelectedRow().asRow();
        // if (selectedRow != null && !selectedRow.isUndefined()) {
        // SQLRowValues rowVals = selectedRow.asRowValues();
        // rowVals.clearPrimaryKeys();
        // rowVals.put("RUE", "");
        // comp.setValue(rowVals);
        // }
        // }
        // });
        // boxAdr.setVisible(false);
        // labelAdrLiv.setVisible(false);
        c.gridwidth = GridBagConstraints.REMAINDER;
        c.gridheight = 1;
        c.gridy += 6;
        c.gridx = 0;
        c.weightx = 1;
        c.weighty = 1;
        c.fill = GridBagConstraints.BOTH;
        this.add(this.table, c);

        // boxFournisseur.addValueListener(new PropertyChangeListener() {
        //
        // @Override
        // public void propertyChange(PropertyChangeEvent evt) {
        // // TODO Raccord de méthode auto-généré
        // table.setFournisseurFilterOnCompletion(boxFournisseur.getSelectedRow().asRow());
        // if (boxFournisseur.getSelectedRow().asRow() != null &&
        // !boxFournisseur.getSelectedRow().asRow().isUndefined()) {
        // SQLRow rowFam =
        // boxFournisseur.getSelectedRow().asRow().getForeignRow("ID_FAMILLE_ARTICLE");
        // if (rowFam != null && !rowFam.isUndefined()) {
        // table.getRowValuesTable().getRowValuesTableModel().getDefaultRowValues().put("ID_FAMILLE_ARTICLE",
        // rowFam.getID());
        // } else {
        // table.getRowValuesTable().getRowValuesTableModel().getDefaultRowValues().putEmptyLink("ID_FAMILLE_ARTICLE");
        // }
        // } else {
        // table.getRowValuesTable().getRowValuesTableModel().getDefaultRowValues().putEmptyLink("ID_FAMILLE_ARTICLE");
        // }
        // }
        // });

        // INfos
        c.gridx = 0;
        c.gridy++;
        c.gridheight = 1;
        c.weighty = 0;
        c.weightx = 1;
        c.anchor = GridBagConstraints.WEST;
        c.gridwidth = 3;
        c.fill = GridBagConstraints.HORIZONTAL;
        this.add(new TitledSeparator(getLabelFor("INFOS")), c);

        c.gridy++;
        c.weightx = 1;
        c.weighty = 1;
        c.fill = GridBagConstraints.BOTH;
        JTextArea infos = new ITextArea();
        final JScrollPane scrollPane = new JScrollPane(infos);
        scrollPane.setBorder(null);
        this.add(scrollPane, c);

        // Total
        // DeviseField fieldHT = new DeviseField();
        // DeviseField fieldTVA = new DeviseField();
        // DeviseField fieldTTC = new DeviseField();
        // fieldHT.setOpaque(false);
        // fieldTVA.setOpaque(false);
        // fieldTTC.setOpaque(false);
        //
        // addRequiredSQLObject(fieldHT, "T_HT");
        // addRequiredSQLObject(fieldTVA, "T_TVA");
        // addRequiredSQLObject(fieldTTC, "T_TTC");
        // JTextField poids = new JTextField();
        // // addSQLObject(poids, "T_POIDS");
        // final TotalPanel totalTTC = new TotalPanel(this.table.getRowValuesTable(),
        // this.table.getPrixTotalHTElement(), this.table.getPrixTotalTTCElement(),
        // this.table.getHaElement(),
        // this.table.getQteElement(), fieldHT, fieldTVA, fieldTTC, new DeviseField(), new
        // DeviseField(), new DeviseField(), this.table.getPrixServiceElement(), new DeviseField(),
        // this.table.getTableElementTotalDevise(), poids, this.table.getPoidsTotalElement());
        //
        // c.gridx = GridBagConstraints.RELATIVE;
        // c.gridy--;
        // c.gridwidth = GridBagConstraints.REMAINDER;
        // c.gridheight = 2;
        // c.anchor = GridBagConstraints.NORTHEAST;
        // c.fill = GridBagConstraints.NONE;
        // c.weighty = 0;
        //
        // this.add(totalTTC, c);

        addSQLObject(infos, "INFOS");

        this.panelOO = new PanelOOSQLComponent(this);
        c.gridwidth = 1;
        c.fill = GridBagConstraints.HORIZONTAL;
        c.anchor = GridBagConstraints.SOUTHEAST;
        // c.gridx = 0;
        c.gridx += 3;
        c.weightx = 0;
        c.fill = GridBagConstraints.NONE;
        c.gridwidth = GridBagConstraints.REMAINDER;
        this.add(this.panelOO, c);
        // this.addView("PRIX");

        // boxAffaire.addValueListener(new PropertyChangeListener() {
        //
        // @Override
        // public void propertyChange(PropertyChangeEvent evt) {
        // SQLRow selectedRow = boxAffaire.getSelectedRow().asRow();
        // if (!isFilling() && selectedRow != null && !selectedRow.isUndefined()) {
        // Calendar date = selectedRow.getDate("DATE_LIVRAISON_EFFECTIVE");
        // if (date != null) {
        //
        // dateDisposition.setValue(date.getTime());
        // }
        // }
        // }
        // });

    }

    private SQLRowValues getLivraisonAdr(SQLRow rowAffaire) {
        if (rowAffaire != null) {
            SQLRow rowClient = rowAffaire.getForeignRow("ID_CLIENT");
            SQLRow rowAdrL = rowClient.getForeignRow("ID_ADRESSE_L");
            if (rowAdrL == null || rowAdrL.isUndefined()) {
                rowAdrL = rowClient.getForeignRow("ID_ADRESSE");
            }
            SQLRowValues rowVals = rowAdrL.asRowValues();
            rowVals.clearPrimaryKeys();
            return rowVals;
        } else {
            return new SQLRowValues(getTable().getTable("ADRESSE"));
        }
    }

    @Override
    public void select(SQLRowAccessor r) {
        // TODO Raccord de méthode auto-généré
        if (getTable().contains("LIVRAISON_F") && componentPrincipaleAdr != null) {
            final boolean bLivraison = r != null && r.getFields().contains("ID_ADRESSE") && !r.isForeignEmpty("ID_ADRESSE");
            componentPrincipaleAdr.setEditable(bLivraison ? InteractionMode.READ_WRITE : InteractionMode.DISABLED);
        }

        if (r != null) {
            // final SQLRowValues rVals = r.asRowValues().deepCopy();
            // final SQLRowValues vals = new SQLRowValues(r.getTable());
            // vals.load(rVals, CollectionUtils.createSet("ID_AFFAIRE"));
            // // vals a besoin de l'ID sinon incohérence entre ID_AFFAIRE et ID (eg for
            // // reloadTable())
            // // ne pas supprimer l'ID de rVals pour qu'on puisse UPDATE
            // vals.setID(rVals.getID());
            // super.select(vals);
            // rVals.remove("ID_AFFAIRE");
            // super.select(rVals);
            super.select(r);
            this.field.setIdSelected(r.getID());
            this.table.insertFrom("ID_DEMANDE_PRIX", r.getID());
        } else {
            super.select(r);
        }
    }

    @Override
    public int insert(SQLRow order) {

        int idCommande = getSelectedID();

        // on verifie qu'un devis du meme numero n'a pas été inséré entre temps
        if (this.field.checkValidation()) {

            idCommande = super.insert(order);
            // this.table.updateField("ID_COMMANDE_CLIENT", idCommande);
            this.table.updateField("ID_DEMANDE_PRIX", idCommande);
            // Création des articles
            // this.table.createArticle(idCommande, this.getElement());

            // generation du document
            DemandePrixSheetXML sheet = new DemandePrixSheetXML(getTable().getRow(idCommande));
            sheet.createDocumentAsynchronous();
            sheet.showPrintAndExportAsynchronous(true, false, true);

            // incrémentation du numéro auto
            if (NumerotationAutoSQLElement.getNextNumero(DemandePrixSQLElement.class).equalsIgnoreCase(this.field.getText().trim())) {
                SQLTable tableNum = Configuration.getInstance().getRoot().findTable("NUMEROTATION_AUTO");
                SQLRowValues rowVals = new SQLRowValues(tableNum);
                int val = tableNum.getRow(2).getInt("DMD_PRIX_START");
                val++;
                rowVals.put("DMD_PRIX_START", new Integer(val));

                try {
                    rowVals.update(2);
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }

            DemandeAchatItemSQLElement elt = getElement().getDirectory().getElement(DemandeAchatItemSQLElement.class);
            elt.updateStatus(getTable(), getTable().getTable("DEMANDE_PRIX_ELEMENT"), idCommande);
        } else {
            ExceptionHandler.handle("Impossible d'ajouter, numéro de demande existant.");
            Object root = SwingUtilities.getRoot(this);
            if (root instanceof EditFrame) {
                EditFrame frame = (EditFrame) root;
                frame.getPanel().setAlwaysVisible(true);
            }
        }

        return idCommande;
    }

    @Override
    public void update() {

        if (!this.field.checkValidation()) {
            ExceptionHandler.handle("Impossible d'ajouter, numéro de demande existant.");
            Object root = SwingUtilities.getRoot(this);
            if (root instanceof EditFrame) {
                EditFrame frame = (EditFrame) root;
                frame.getPanel().setAlwaysVisible(true);
            }
            return;
        }
        super.update();
        // this.table.updateField("ID_COMMANDE_CLIENT", getSelectedID());
        // this.table.createArticle(getSelectedID(), this.getElement());
        this.table.updateField("ID_DEMANDE_PRIX", getSelectedID());
        DemandeAchatItemSQLElement elt = getElement().getDirectory().getElement(DemandeAchatItemSQLElement.class);
        elt.updateStatus(getTable(), getTable().getTable("DEMANDE_PRIX_ELEMENT"), getSelectedID());

        DemandePrixSheetXML sheet = new DemandePrixSheetXML(getTable().getRow(getSelectedID()));
        sheet.createDocumentAsynchronous();
        sheet.showPrintAndExportAsynchronous(true, false, true);

    }

    @Override
    protected SQLRowValues createDefaults() {
        SQLRowValues rowVals = new SQLRowValues(getTable());
        rowVals.put("NUMERO", NumerotationAutoSQLElement.getNextNumero(DemandePrixSQLElement.class));
        if (getTable().getUndefinedID() == SQLRow.NONEXISTANT_ID) {
            rowVals.put("ID_ETAT_DEMANDE_PRIX", EtatDemandePrixSQLElement.EN_ATTENTE);
        } else {
            SQLRow rowUndef = getTable().getRow(getTable().getUndefinedID());
            SQLRow foreign = rowUndef.getForeign("ID_ETAT_DEMANDE_PRIX");
            if (foreign != null && !foreign.isUndefined()) {
                rowVals.put("ID_ETAT_DEMANDE_PRIX", foreign.getID());
            } else {
                rowVals.put("ID_ETAT_DEMANDE_PRIX", EtatDemandePrixSQLElement.EN_ATTENTE);
            }
        }
        if (getTable().contains("LIVRAISON_F") && componentPrincipaleAdr != null) {
            componentPrincipaleAdr.setEditable(InteractionMode.DISABLED);
        }
        return rowVals;
    }

    /**
     * Création d'une demande à partir d'une demande existante
     * 
     * @param idDemande
     * 
     */
    public void loadDemandeExistant(final int idDemande) {

        final SQLElement demande = Configuration.getInstance().getDirectory().getElement("DEMANDE_PRIX");
        final SQLElement demandeElt = Configuration.getInstance().getDirectory().getElement("DEMANDE_PRIX_ELEMENT");

        // On duplique la demande
        if (idDemande > 1) {
            final SQLRow row = demande.getTable().getRow(idDemande);
            final SQLRowValues rowVals = new SQLRowValues(demande.getTable());
            rowVals.put("ID_AFFAIRE", row.getInt("ID_AFFAIRE"));
            // rowVals.put("DATE_BUTOIRE", row.getObject("DATE_BUTOIRE"));
            // rowVals.put("DATE_DISPOSITION", row.getObject("DATE_DISPOSITION"));
            rowVals.put("NUMERO", NumerotationAutoSQLElement.getNextNumero(DemandePrixSQLElement.class));
            rowVals.put("ID_ETAT_DEMANDE_PRIX", EtatDemandePrixSQLElement.EN_ATTENTE);
            rowVals.put("OBJET", row.getObject("OBJET"));
            rowVals.put("ID_COMMERCIAL", row.getObject("ID_COMMERCIAL"));
            this.select(rowVals);
        }

        // On duplique les elements de devis
        final List<SQLRow> myListItem = demande.getTable().getRow(idDemande).getReferentRows(demandeElt.getTable());

        if (myListItem.size() != 0) {
            this.table.getModel().clearRows();

            for (final SQLRow rowElt : myListItem) {

                final SQLRowValues rowVals = rowElt.createUpdateRow();
                rowVals.clearPrimaryKeys();
                this.table.getModel().addRow(rowVals);
                final int rowIndex = this.table.getModel().getRowCount() - 1;
                this.table.getModel().fireTableModelModified(rowIndex);
            }
        } else {
            this.table.getModel().clearRows();
        }
        this.table.getModel().fireTableDataChanged();
        this.table.repaint();
    }

    @Override
    protected RowValuesTable getRowValuesTable() {
        return this.table.getRowValuesTable();
    }

    @Override
    protected void refreshAfterSelect(SQLRowAccessor rSource) {
        // TODO Auto-generated method stub

    }
}