r1042 - trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model
Author: tchemit Date: 2008-02-17 15:53:39 +0000 (Sun, 17 Feb 2008) New Revision: 1042 Removed: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/LoggableElementTreeNode.java Log: utilisation modele de selection d'entity + simplification code Deleted: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/LoggableElementTreeNode.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/LoggableElementTreeNode.java 2008-02-17 15:53:30 UTC (rev 1041) +++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/LoggableElementTreeNode.java 2008-02-17 15:53:39 UTC (rev 1042) @@ -1,99 +0,0 @@ -/* -* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin, -* Tony Chemit, Gabriel Landais -* -* 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.data.Library; -import fr.cemagref.simexplorer.is.entities.data.LoggableElement; -import fr.cemagref.simexplorer.is.entities.data.Result; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import javax.swing.JTree; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.TreePath; - -/** - * Le TreeNode de base pour afficher des LoggableElement dans un arbre. - * <p/> - * <b>Attention, l'objet interne au node n'est pas forcement un LoggableElement, - * par exemple pour le noeud 'Components' qui sera un simple String.</b> - * - * @author chemit - */ -public class LoggableElementTreeNode extends DefaultMutableTreeNode { - - static protected Log log = LogFactory.getLog(LoggableElementTreeNode.class); - - private static final long serialVersionUID = -7544097600554338499L; - - protected String text; - - protected boolean remote; - - public LoggableElementTreeNode(LoggableElementTreeNode parent, Object userObject,boolean remote, boolean allowedChildren) { - this(parent, userObject.toString(), userObject, remote,allowedChildren); - } - - public LoggableElementTreeNode(LoggableElementTreeNode parent, String i18n, Object userObject,boolean remote, boolean allowedChildren) { - super(userObject, allowedChildren); - if (parent != null) { - parent.add(this); - } - text = i18n; - this.remote=remote; - log.debug("Parent " + parent + ", userObject : " + userObject + ", type : " + userObject.getClass().getSimpleName()); - } - - @Override - public String toString() { - return text; - } - - public boolean isRemote() { - return remote; - } - - public void collaspeAll(JTree tree) { - if (isLeaf()) { - return; - } - for (Object child : children) { - ((LoggableElementTreeNode) child).collaspeAll(tree); - } - tree.collapsePath(new TreePath(getPath())); - } - - public void expandAll(JTree tree) { - if (isLeaf()) { - return; - } - tree.expandPath(new TreePath(getPath())); - for (Object child : children) { - ((LoggableElementTreeNode) child).expandAll(tree); - } - } - - public boolean isLoggableElement() { - return userObject != null && userObject instanceof LoggableElement; - } - - public boolean isDownloadableElement() { - return userObject != null && (userObject instanceof Result || userObject instanceof Library); - } -}
participants (1)
-
tchemit@users.labs.libre-entreprise.org