Coverage details for net.sourceforge.demetrix.ui.ProcessChainNodeTree

LineHitsSource
1 /*******************************************************************************
2  * Demetrix process modelling system
3  *
4  * Copyright (c) 2003, 2004 Dimitri A. Pissarenko
5  *
6  * This file is part of Demetrix.
7  *
8  * Demetrix is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2.1 of the License, or
11  * (at your option) any later version.
12  *
13  * Demetrix is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with Demetrix; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21  *
22  * For further information you may
23  *
24  * - send an e-mail in Russian, German or English to dimitri.pissarenko@gmx.net
25  * - look at http://sourceforge.net/projects/demetrix/
26  * - look at http://demetrix.sourceforge.net/
27  * - look at http://members.inode.at/d.pissarenko/
28  *
29  *****************************************************************************/
30 /*
31  * Created on 02.02.2004
32  */
33 package net.sourceforge.demetrix.ui;
34  
35 import javax.swing.JTree;
36 import javax.swing.tree.DefaultMutableTreeNode;
37 import javax.swing.tree.TreePath;
38  
39 import org.apache.log4j.Logger;
40 import org.jgraph.graph.DefaultGraphCell;
41  
42  
43 /**
44  * @author Dimitri Pissarenko
45  *
46  */
47 public class ProcessChainNodeTree extends JTree implements CurrentlySelectedNodeObserver{
48     private Logger logger=Logger.getLogger(getClass());
49     public ProcessChainNodeTree(ProcessChainNodeTreeModel model)
50     {
518        super(model);
528        CurrentlySelectedNodeSingleton.getInstance().attach(this);
538    }
54     /* (non-Javadoc)
55      * @see net.sourceforge.demetrix.ui.CurrentlySelectedNodeObserver#currentlySelectedNodeChanged()
56      */
57     public void currentlySelectedNodeChanged() {
5830        this.clearSelection();
5930        this.currentlySelectedNodeChangedSingleCell(CurrentlySelectedNodeSingleton.getInstance().getCurrentlySelectedNode());
6030        this.currentlySelectedNodeChangedMultipleCells();
6130    }
62     private void currentlySelectedNodeChangedSingleCell(DefaultGraphCell cell)
63     {
6453        TreePath treePath=null;
6553        Object cellUserObject=null;
6653        DefaultMutableTreeNode treeNode=null;
6753        ProcessChainNodeTreeModel model=null;
68  
6953        if (cell!=null)
70         {
7145            cellUserObject=cell.getUserObject();
7245            if (cellUserObject!=null)
73             {
7445                model=(ProcessChainNodeTreeModel)this.getModel();
7545                treeNode=model.getTreeNodeByUserObject(cellUserObject);
7645                if (treeNode!=null)
77                 {
788                    this.getSelectionModel().addSelectionPath(new TreePath(treeNode.getPath()));
79                 }
80             }
81         }
8253    }
83     private void currentlySelectedNodeChangedMultipleCells()
84     {
8530        Object[] selectedCells=null;
8630        selectedCells=CurrentlySelectedNodeSingleton.getInstance().getCurrentlySelectedCells();
8730        if (selectedCells!=null)
88         {
8941            for (int i=0; i < selectedCells.length; i++)
90             {
9126                if (selectedCells[i] instanceof DefaultGraphCell)
92                 {
9323                    this.currentlySelectedNodeChangedSingleCell((DefaultGraphCell)selectedCells[i]);
94                 }
95             }
96  
97         }
9830    }
99 }

this report was generated by version 1.0.5 of jcoverage.
visit www.jcoverage.com for updates.

copyright © 2003, jcoverage ltd. all rights reserved.
Java is a trademark of Sun Microsystems, Inc. in the United States and other countries.