Author: echatellier Date: 2010-04-09 18:19:40 +0200 (Fri, 09 Apr 2010) New Revision: 2850 Log: Move class Removed: trunk/lima-swing/src/main/java/org/chorem/lima/combobox/model/AccountComboBoxModel.java Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/combobox/model/AccountComboBoxModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/combobox/model/AccountComboBoxModel.java 2010-04-09 16:19:17 UTC (rev 2849) +++ trunk/lima-swing/src/main/java/org/chorem/lima/combobox/model/AccountComboBoxModel.java 2010-04-09 16:19:40 UTC (rev 2850) @@ -1,91 +0,0 @@ -/** - * *##% Lima Main - * Copyright (C) 2008 CodeLutin - * - * This program 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 3 of the - * License, or (at your option) any later version. - * - * This program 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 Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* - */ - -package org.chorem.lima.combobox.model; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.lima.dto.AccountDTO; - -import javax.swing.*; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.util.Vector; - -/** - * @author ore - */ -public class AccountComboBoxModel extends DefaultComboBoxModel implements PropertyChangeListener { - - /** - * log - */ - private static final Log log = LogFactory.getLog(AccountComboBoxModel.class); - - /** - * @param v - */ - public AccountComboBoxModel(Vector<?> v) { - super(v); - } - - /** - * @param items - */ - public AccountComboBoxModel(Object[] items) { - super(items); - } - - /** - * @param evt - */ - @Override - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getPropertyName().equals("add")) { - addElement(evt.getNewValue()); - if (log.isDebugEnabled()) { - log.debug("add : "); - } - } - if (evt.getPropertyName().equals("update")) { - int index = getIndexOf(evt.getNewValue()); - fireContentsChanged(evt.getNewValue(), index, index); - if (log.isDebugEnabled()) { - log.debug("update : "); - } - } - if (evt.getPropertyName().equals("remove")) { - removeChildren((AccountDTO) evt.getOldValue()); - removeElement(evt.getOldValue()); - if (log.isDebugEnabled()) { - log.debug("remove : "); - } - } - } - - /** - * @param parent - */ - public void removeChildren(AccountDTO parent) { - for (AccountDTO acc : parent.getChildren()) { - removeElement(acc); - removeChildren(acc); - } - } -}