From: cmzmasek@gmail.com Date: Sat, 16 Apr 2011 19:18:02 +0000 (+0000) Subject: update tab title X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=bfe6fc2e246794a6845c7c8cf99031c2bcd6281c;p=jalview.git update tab title --- diff --git a/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java b/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java index 4cabfe3..071863d 100644 --- a/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java +++ b/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java @@ -2348,6 +2348,7 @@ public final class MainFrameApplication extends MainFrame { } } if ( !exception ) { + getMainPanel().setTitleOfSelectedTab( file.getName() ); getMainPanel().getCurrentTreePanel().setTreeFile( file ); getMainPanel().getCurrentTreePanel().setEdited( false ); } diff --git a/forester/java/src/org/forester/archaeopteryx/MainPanel.java b/forester/java/src/org/forester/archaeopteryx/MainPanel.java index 921ff91..7e20578 100644 --- a/forester/java/src/org/forester/archaeopteryx/MainPanel.java +++ b/forester/java/src/org/forester/archaeopteryx/MainPanel.java @@ -94,13 +94,14 @@ public class MainPanel extends JPanel implements ComponentListener { 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 { @@ -224,7 +225,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 +239,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 +249,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,6 +258,13 @@ public class MainPanel extends JPanel implements ComponentListener { } } + void setTitleOfSelectedTab( final String title ) { + final int selected = getTabbedPane().getSelectedIndex(); + if ( selected >= 0 ) { + getTabbedPane().setTitleAt( selected, title ); + } + } + TreePanel getCurrentTreePanel() { final int selected = getTabbedPane().getSelectedIndex(); if ( selected >= 0 ) {