Package com.ledruide.druidecave.model

Source Code of com.ledruide.druidecave.model.TableRecoltants

/**
* Copyright (C) 2007 Julien Revault d'Allonnes
*
* This file is part of DruideDB.
*
* DruideDB 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 2 of the License, or
* (at your option) any later version.
*
* DruideDB 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 DruideDB; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/
package com.ledruide.druidecave.model;

import com.ledruide.druidecave.business.lists.CountryProxy;
import com.ledruide.druidecave.dao.Vigneron;
import com.ledruide.druidecave.helpers.I18nScreens;

import java.util.Vector;

public class TableRecoltants extends ResultatsTableModel {
    private static final String[] LES_TITRES = {I18nScreens.getInstance().get("screen.vigneron.search.table.name"),
                                                I18nScreens.getInstance().get("screen.vigneron.search.table.pays"),
                                                I18nScreens.getInstance().get("screen.vigneron.search.table.note")};

    public static final int INDEX_NOM  = 0;
    public static final int INDEX_PAYS = 1;
    public static final int INDEX_NOTE = 2;

    public TableRecoltants() {
        columnNames = LES_TITRES;
        dataVector = new Vector();
    }

    public Object getValueAt(int row, int col) {
        Vigneron objet = (Vigneron)dataVector.get(row);
        if (objet != null) {
            try {
                switch (col) {
                    case INDEX_NOM:
                        return objet.getFirstname() + " " + objet.getLastname();
                    case INDEX_PAYS:
                        String countryKey = objet.getCountry_id();
                        if (countryKey != null) {
                            return CountryProxy.get(countryKey);
                        }
                        return "";
                    case INDEX_NOTE:
                        return objet.getNote();
                }
            }
            catch (Exception e) {
                System.out.println("Une erreur est survenue durant l'affichage : " + e.getMessage());
            }
        }
        return new Object();
    }

}
TOP

Related Classes of com.ledruide.druidecave.model.TableRecoltants

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.