r1026 - trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model
Author: tchemit Date: 2008-02-16 15:18:55 +0000 (Sat, 16 Feb 2008) New Revision: 1026 Removed: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/JDetailTableModel.java Log: renommage model Deleted: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/JDetailTableModel.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/JDetailTableModel.java 2008-02-16 15:18:36 UTC (rev 1025) +++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/JDetailTableModel.java 2008-02-16 15:18:55 UTC (rev 1026) @@ -1,94 +0,0 @@ -/* -* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin, -* Tony Chemit -* -* This program 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. -* -* 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 Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -* ##% */ -package fr.cemagref.simexplorer.is.ui.swing.model; - -import fr.cemagref.simexplorer.is.entities.metadata.MetaData; -import static org.codelutin.i18n.I18n._; -import static org.codelutin.i18n.I18n.n_; - -import javax.swing.table.AbstractTableModel; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -/** - * Table model to contains a MetaData details - * - * @author chemit - */ -public class JDetailTableModel extends AbstractTableModel { - - protected MetaData data; - protected List<String> descriptors; - private static final long serialVersionUID = -2377632046940030206L; - - protected final String[] columnNames = { - n_("simexplorer.common.key"), - n_("simexplorer.common.value") - }; - - public JDetailTableModel() { - } - - public int getRowCount() { - return getDescriptors().size(); - } - - public int getColumnCount() { - return columnNames.length; - } - - public Object getValueAt(int rowIndex, int columnIndex) { - Object result = null; - if (data == null) { - return null; - } - if (columnIndex == 0) { - // key - result = getDescriptors().get(rowIndex); - } else if (columnIndex == 1) { - // value - String propertyDescriptor = getDescriptors().get(rowIndex); - result = data.getDescriptors().get(propertyDescriptor); - } - return result; - } - - @Override - public String getColumnName(int column) { - return _(columnNames[column]); - } - - public List<String> getDescriptors() { - if (descriptors == null) { - descriptors = new ArrayList<String>(); - } - return descriptors; - } - - public void setData(MetaData data) { - this.data = data; - getDescriptors().clear(); - if (data != null) { - getDescriptors().addAll(data.getDescriptors().keySet()); - Collections.sort(getDescriptors()); - } - } - -} \ No newline at end of file
participants (1)
-
tchemit@users.labs.libre-entreprise.org