Mercurial > hg > ltpda
view src/MPipeline2/src/mpipeline/pipelinelist/PipelineListTree.java @ 52:daf4eab1a51e database-connection-manager tip
Fix. Default password should be [] not an empty string
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 07 Dec 2011 17:29:47 +0100 |
parents | f0afece42f48 |
children |
line wrap: on
line source
/* * Copyright (c) 2009 Max-Planck-Gesellschaft, Martin Hewitson <martin.hewitson at aei.mpg.de> * * 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 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 Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ package mpipeline.pipelinelist; import java.util.Iterator; import javax.swing.ImageIcon; import javax.swing.JTree; import javax.swing.ToolTipManager; import javax.swing.tree.DefaultTreeCellRenderer; import mpipeline.canvas.BlockDiagram; import mpipeline.main.MainWindow; /** * A subclass of JTree which implements only a constructor to gather together * various settings and behaviours. * * @author hewitson */ public class PipelineListTree extends JTree { private MainWindow mw = null; /** * Empty constructor. * @param mw */ public PipelineListTree(MainWindow mw) { super(); this.mw = mw; DefaultTreeCellRenderer renderer = new PipelineListTreeRenderer(); ImageIcon closedIcon = new ImageIcon(getClass().getResource("/mpipeline/icons/pipeline_icon_16x16.png")); if (closedIcon != null) { renderer.setClosedIcon(closedIcon); } ImageIcon openIcon = new ImageIcon(getClass().getResource("/mpipeline/icons/pipeline_icon_16x16.png")); if (openIcon != null) { renderer.setOpenIcon(openIcon); } ImageIcon leafIcon = new ImageIcon(getClass().getResource("/mpipeline/icons/pipeline_icon_16x16.png")); if (leafIcon != null) { renderer.setLeafIcon(leafIcon); } this.setCellRenderer(renderer); ToolTipManager.sharedInstance().registerComponent(this); this.setRootVisible(false); this.setShowsRootHandles(true); // this.setRootVisible(false); } public void setActivePipeline(BlockDiagram diag) { // System.out.println("setting active diagram: " + diag.getCanvas().getCanvasTreeName()); if (diag != null) { Object root = this.getModel().getRoot(); if (root instanceof PipelineList) { // System.out.println("got root"); PipelineList proot = (PipelineList) root; Iterator it = proot.getPipelines().iterator(); while (it.hasNext()) { PipelineList pl = (PipelineList) it.next(); // search for the pipeline list with the matching diag PipelineList plfound = pl.findMatchingDiagram(diag); if (plfound != null) { proot.deselectAll(); plfound.setSelected(true); break; } else { // System.err.println("no match found"); } } } } this.revalidate(); this.repaint(); } }