// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
//
// Contact: phylosoft @ gmail . com
-// WWW: www.phylosoft.org/forester
+// WWW: https://sites.google.com/site/cmzmasek/home/software/forester
package org.forester.archaeopteryx;
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;
private TreeColorSet _colorset;
private TreeFontSet _fontset;
private Phylogeny _cut_or_copied_tree;
- private Set<Integer> _copied_and_pasted_nodes;
+ private Set<Long> _copied_and_pasted_nodes;
private Hashtable<String, BufferedImage> _image_map;
+ private static Map<String, String> _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" );
}
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() );
_treepanels.add( treepanel );
String name = "";
- // if ( !ForesterUtil.isEmpty( phy.getName() ) ) {
- // name = phy.getName();
- // }
- // else if ( phy.getIdentifier() != null ) {
- // name = phy.getIdentifier().toString();
- // }
- /* else */
- if ( !ForesterUtil.isEmpty( default_name ) ) {
+ if ( !ForesterUtil.isEmpty( phy.getName() ) ) {
+ name = phy.getName();
+ }
+ else if ( phy.getIdentifier() != null ) {
+ name = phy.getIdentifier().toString();
+ }
+ else if ( !ForesterUtil.isEmpty( default_name ) ) {
name = default_name;
}
else {
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();
}
treepanel.setControlPanel( getControlPanel() );
_treepanels.add( treepanel );
final JScrollPane treegraphic_scroll_pane = new JScrollPane( treepanel );
+ treegraphic_scroll_pane.getHorizontalScrollBar().addAdjustmentListener( new AdjustmentListener() {
+
+ @Override
+ public void adjustmentValueChanged( final AdjustmentEvent e ) {
+ if ( treepanel.isOvOn() || getOptions().isShowScale() ) {
+ treepanel.repaint();
+ }
+ }
+ } );
+ treegraphic_scroll_pane.getVerticalScrollBar().addAdjustmentListener( new AdjustmentListener() {
+
+ @Override
+ public void adjustmentValueChanged( final AdjustmentEvent e ) {
+ if ( treepanel.isOvOn() || getOptions().isShowScale() ) {
+ treepanel.repaint();
+ //System.out.println( e.getValue() );
+ }
+ }
+ } );
treegraphic_scroll_pane.getHorizontalScrollBar().setUnitIncrement( 20 );
treegraphic_scroll_pane.getHorizontalScrollBar().setBlockIncrement( 50 );
treegraphic_scroll_pane.getVerticalScrollBar().setUnitIncrement( 20 );
// Do nothing.
}
- private Configuration getConfiguration() {
+ Configuration getConfiguration() {
return _configuration;
}
- ControlPanel getControlPanel() {
+ public ControlPanel getControlPanel() {
return _control_panel;
}
- public Set<Integer> getCopiedAndPastedNodes() {
+ public Set<Long> getCopiedAndPastedNodes() {
return _copied_and_pasted_nodes;
}
}
}
- TreePanel getCurrentTreePanel() {
+ public TreePanel getCurrentTreePanel() {
final int selected = getTabbedPane().getSelectedIndex();
if ( selected >= 0 ) {
return _treepanels.get( selected );
return getCurrentScrollPane().getViewport().getExtentSize();
}
- JTabbedPane getTabbedPane() {
+ public JTabbedPane getTabbedPane() {
return _tabbed_pane;
}
repaint();
}
- public void setCopiedAndPastedNodes( final Set<Integer> node_ids ) {
+ public void setCopiedAndPastedNodes( final Set<Long> node_ids ) {
_copied_and_pasted_nodes = node_ids;
}
synchronized Hashtable<String, BufferedImage> getImageMap() {
return _image_map;
}
+
+ public synchronized static Map<String, String> getLineageToRankMap() {
+ if ( _lineage_to_rank_map == null ) {
+ _lineage_to_rank_map = new HashMap<String, String>();
+ }
+ return _lineage_to_rank_map;
+ }
}