Package com.ledruide.druidecave.business

Source Code of com.ledruide.druidecave.business.CombosProxy

/**
* Copyright (C) 2007 Julien Revault d'Allonnes
*
* This file is part of DruideCave.
*
* DruideCave 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.
*
* DruideCave 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 DruideCave; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/
package com.ledruide.druidecave.business;

import com.ledruide.druidegui.helpers.KeyValueBean;

import javax.swing.JComboBox;
import java.util.List;

/**
* @author Julien
* @since 12 oct. 2006
*/
public class CombosProxy {

    /**
     * Permet d'initialiser la liste des pays. Sans blanc en 1er
     * @param combo
     * @throws Exception
     */
    public static void add(JComboBox combo, List list) throws Exception {
        CombosProxy.add(combo, list, false);
    }
    public static void add(JComboBox combo, List list, boolean blancEnPremier) throws Exception {
        // on va initialiser les pays
        if (blancEnPremier) {
            combo.addItem(new KeyValueBean("",""));
        }
        if (list != null) {
            for (int i = 0; i < list.size(); i++) {
                combo.addItem(list.get(i));
            }
        }
    }

}
TOP

Related Classes of com.ledruide.druidecave.business.CombosProxy

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.