X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Farchaeopteryx%2FMainPanel.java;h=59fda587f01a08555760282e8f57c970decf36ad;hb=8571ac663cce8aade42941742402a8fe37c27ff4;hp=42332d4f3b72f08b3cd54c98bba7d10794225489;hpb=ccf4c584032d16ed0ed8d0678f01305887724f96;p=jalview.git diff --git a/forester/java/src/org/forester/archaeopteryx/MainPanel.java b/forester/java/src/org/forester/archaeopteryx/MainPanel.java index 42332d4..59fda58 100644 --- a/forester/java/src/org/forester/archaeopteryx/MainPanel.java +++ b/forester/java/src/org/forester/archaeopteryx/MainPanel.java @@ -8,7 +8,7 @@ // and Howard Hughes Medical Institute // Copyright (C) 2003-2007 Ethalinda K.S. Cannon // All rights reserved -// +// // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either @@ -18,7 +18,7 @@ // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. -// +// // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -36,8 +36,10 @@ import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; import java.awt.image.BufferedImage; import java.util.ArrayList; +import java.util.HashMap; import java.util.Hashtable; import java.util.List; +import java.util.Map; import java.util.Set; import javax.swing.JPanel; @@ -66,11 +68,12 @@ public class MainPanel extends JPanel implements ComponentListener { private Phylogeny _cut_or_copied_tree; private Set _copied_and_pasted_nodes; private Hashtable _image_map; + private static Map _lineage_to_rank_map; MainPanel() { } - MainPanel( final Configuration configuration, final MainFrame parent ) { + public MainPanel( final Configuration configuration, final MainFrame parent ) { if ( configuration == null ) { throw new IllegalArgumentException( "configuration is null" ); } @@ -85,10 +88,10 @@ public class MainPanel extends JPanel implements ComponentListener { getControlPanel().showWhole(); } - void addPhylogenyInNewTab( final Phylogeny phy, - final Configuration config, - final String default_name, - final String full_path ) { + public void addPhylogenyInNewTab( final Phylogeny phy, + final Configuration config, + final String default_name, + final String full_path ) { final TreePanel treepanel = new TreePanel( phy, config, this ); getControlPanel().phylogenyAdded( config ); treepanel.setControlPanel( getControlPanel() ); @@ -135,10 +138,7 @@ public class MainPanel extends JPanel implements ComponentListener { treegraphic_scroll_pane_panel.add( treegraphic_scroll_pane, BorderLayout.CENTER ); _treegraphic_scroll_pane_panels.add( treegraphic_scroll_pane_panel ); _treegraphic_scroll_panes.add( treegraphic_scroll_pane ); - getTabbedPane().addTab( name, - null, - treegraphic_scroll_pane_panel, - Util.createDescriptionForTab( phy, full_path ) ); + getTabbedPane().addTab( name, null, treegraphic_scroll_pane_panel, "" ); getTabbedPane().setSelectedIndex( getTabbedPane().getTabCount() - 1 ); getControlPanel().showWhole(); } @@ -207,7 +207,7 @@ public class MainPanel extends JPanel implements ComponentListener { return _configuration; } - ControlPanel getControlPanel() { + public ControlPanel getControlPanel() { return _control_panel; } @@ -224,7 +224,7 @@ public class MainPanel extends JPanel implements ComponentListener { JScrollPane getCurrentScrollPane() { if ( _treegraphic_scroll_panes.size() > 0 ) { - final int selected = _tabbed_pane.getSelectedIndex(); + final int selected = getTabbedPane().getSelectedIndex(); if ( selected >= 0 ) { return _treegraphic_scroll_panes.get( selected ); } @@ -238,7 +238,7 @@ public class MainPanel extends JPanel implements ComponentListener { } JPanel getCurrentScrollPanePanel() { - final int selected = _tabbed_pane.getSelectedIndex(); + final int selected = getTabbedPane().getSelectedIndex(); if ( selected >= 0 ) { return _treegraphic_scroll_pane_panels.get( selected ); } @@ -248,7 +248,7 @@ public class MainPanel extends JPanel implements ComponentListener { } int getCurrentTabIndex() { - final int selected = _tabbed_pane.getSelectedIndex(); + final int selected = getTabbedPane().getSelectedIndex(); if ( selected >= 0 ) { return selected; } @@ -257,7 +257,14 @@ public class MainPanel extends JPanel implements ComponentListener { } } - TreePanel getCurrentTreePanel() { + void setTitleOfSelectedTab( final String title ) { + final int selected = getTabbedPane().getSelectedIndex(); + if ( selected >= 0 ) { + getTabbedPane().setTitleAt( selected, title ); + } + } + + public TreePanel getCurrentTreePanel() { final int selected = getTabbedPane().getSelectedIndex(); if ( selected >= 0 ) { return _treepanels.get( selected ); @@ -295,7 +302,7 @@ public class MainPanel extends JPanel implements ComponentListener { return getCurrentScrollPane().getViewport().getExtentSize(); } - JTabbedPane getTabbedPane() { + public JTabbedPane getTabbedPane() { return _tabbed_pane; } @@ -329,6 +336,7 @@ public class MainPanel extends JPanel implements ComponentListener { _tabbed_pane.addChangeListener( new ChangeListener() { // This method is called whenever the selected tab changes + @Override public void stateChanged( final ChangeEvent evt ) { final JTabbedPane pane = ( JTabbedPane ) evt.getSource(); getControlPanel().tabChanged(); @@ -404,4 +412,11 @@ public class MainPanel extends JPanel implements ComponentListener { synchronized Hashtable getImageMap() { return _image_map; } + + public synchronized static Map getLineageToRankMap() { + if ( _lineage_to_rank_map == null ) { + _lineage_to_rank_map = new HashMap(); + } + return _lineage_to_rank_map; + } }