| 1 | /* |
| 2 | * TreeStatPanel.java |
| 3 | * |
| 4 | * Copyright (c) 2002-2015 Alexei Drummond, Andrew Rambaut and Marc Suchard |
| 5 | * |
| 6 | * This file is part of BEAST. |
| 7 | * See the NOTICE file distributed with this work for additional |
| 8 | * information regarding copyright ownership and licensing. |
| 9 | * |
| 10 | * BEAST is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU Lesser General Public License as |
| 12 | * published by the Free Software Foundation; either version 2 |
| 13 | * of the License, or (at your option) any later version. |
| 14 | * |
| 15 | * BEAST is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | * GNU Lesser General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU Lesser General Public |
| 21 | * License along with BEAST; if not, write to the |
| 22 | * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, |
| 23 | * Boston, MA 02110-1301 USA |
| 24 | */ |
| 25 | |
| 26 | package dr.app.treestat; |
| 27 | |
| 28 | import jam.framework.Exportable; |
| 29 | |
| 30 | import javax.swing.*; |
| 31 | import java.awt.*; |
| 32 | |
| 33 | /** |
| 34 | * A panel that displays information about trees |
| 35 | * |
| 36 | * @author Alexei Drummond |
| 37 | * @author Andrew Rambaut |
| 38 | * @version $Id: TreeStatPanel.java,v 1.3 2006/05/09 10:24:27 rambaut Exp $ |
| 39 | */ |
| 40 | public class TreeStatPanel extends javax.swing.JPanel implements Exportable { |
| 41 | |
| 42 | /** |
| 43 | * |
| 44 | */ |
| 45 | private static final long serialVersionUID = 2437334458007083790L; |
| 46 | private JTabbedPane tabbedPane = new JTabbedPane(); |
| 47 | private TaxonSetsPanel taxonSetsPanel; |
| 48 | //private CharactersPanel charactersPanel; |
| 49 | private StatisticsPanel statisticsPanel; |
| 50 | |
| 51 | // final Icon traceIcon = new ImageIcon(Utils.getImage(this, "/images/trace-small-icon.gif")); |
| 52 | |
| 53 | /** Creates new form TreeStatPanel */ |
| 54 | public TreeStatPanel(TreeStatFrame frame, TreeStatData treeStatData) { |
| 55 | taxonSetsPanel = new TaxonSetsPanel(frame, treeStatData); |
| 56 | //charactersPanel = new CharactersPanel(frame, treeStatData); |
| 57 | statisticsPanel = new StatisticsPanel(frame, treeStatData); |
| 58 | |
| 59 | tabbedPane.addTab("Taxon Sets", null, taxonSetsPanel); |
| 60 | //tabbedPane.addTab("Characters", null, charactersPanel); |
| 61 | tabbedPane.addTab("Statistics", null, statisticsPanel); |
| 62 | |
| 63 | setLayout(new BorderLayout()); |
| 64 | add(tabbedPane, BorderLayout.CENTER); |
| 65 | } |
| 66 | |
| 67 | /** This function calls dataChanged for each panel */ |
| 68 | public void fireDataChanged() { |
| 69 | |
| 70 | taxonSetsPanel.dataChanged(); |
| 71 | //charactersPanel.dataChanged(); |
| 72 | statisticsPanel.dataChanged(); |
| 73 | } |
| 74 | |
| 75 | public void doCopy() { |
| 76 | //summaryPanel.copyToClipboard(); |
| 77 | /*switch (tabbedPane.getSelectedIndex()) { |
| 78 | case 0: summaryPanel.copyToClipboard(); break; |
| 79 | case 1: densityPanel.copyToClipboard(); break; |
| 80 | case 2: tracePanel.copyToClipboard(); break; |
| 81 | }*/ |
| 82 | } |
| 83 | |
| 84 | public JComponent getExportableComponent() { |
| 85 | |
| 86 | JComponent exportable = null; |
| 87 | Component comp = tabbedPane.getSelectedComponent(); |
| 88 | |
| 89 | if (comp instanceof Exportable) { |
| 90 | exportable = ((Exportable)comp).getExportableComponent(); |
| 91 | } else if (comp instanceof JComponent) { |
| 92 | exportable = (JComponent)comp; |
| 93 | } |
| 94 | |
| 95 | return exportable; |
| 96 | } |
| 97 | |
| 98 | //************************************************************************ |
| 99 | // private methods |
| 100 | //************************************************************************ |
| 101 | |
| 102 | } |