in progress
[jalview.git] / forester / java / src / org / forester / archaeopteryx / MainFrame.java
index 48c52e8..1fab617 100644 (file)
@@ -4,7 +4,7 @@
 //
 // Copyright (C) 2008-2010 Christian M. Zmasek
 // 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
@@ -14,7 +14,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
@@ -113,6 +113,7 @@ public abstract class MainFrame extends JFrame implements ActionListener {
     JMenuItem                 _collapse_species_specific_subtrees;
     JMenuItem                 _collapse_below_threshold;                                                                                                                                                                               //TODO implememt me
     JMenuItem                 _obtain_detailed_taxonomic_information_jmi;
+    JMenuItem                 _obtain_uniprot_seq_information_jmi;
     JMenuItem                 _move_node_names_to_tax_sn_jmi;
     JMenuItem                 _move_node_names_to_seq_names_jmi;
     JMenuItem                 _extract_tax_code_from_node_names_jmi;
@@ -173,6 +174,7 @@ public abstract class MainFrame extends JFrame implements ActionListener {
     JMenuItem                 _view_as_NHX_item;
     JMenuItem                 _view_as_XML_item;
     JMenuItem                 _view_as_nexus_item;
+    JMenuItem                 _display_basic_information_item;
     // help menu:
     JMenuItem                 _about_item;
     JMenuItem                 _help_item;
@@ -248,6 +250,9 @@ public abstract class MainFrame extends JFrame implements ActionListener {
         else if ( o == _switch_colors_mi ) {
             switchColors();
         }
+        else if ( o == _display_basic_information_item ) {
+            displayBasicInformation();
+        }
         else if ( o == _view_as_NH_item ) {
             viewAsNH();
         }
@@ -413,13 +418,15 @@ public abstract class MainFrame extends JFrame implements ActionListener {
     }
 
     boolean isSubtreeDisplayed() {
-        if ( getCurrentTreePanel().isCurrentTreeIsSubtree() ) {
-            JOptionPane
-                    .showMessageDialog( this,
-                                        "This operation can only be performed on a complete tree, not on the currently displayed sub-tree only.",
-                                        "Operation can not be exectuted on a sub-tree",
-                                        JOptionPane.WARNING_MESSAGE );
-            return true;
+        if ( getCurrentTreePanel() != null ) {
+            if ( getCurrentTreePanel().isCurrentTreeIsSubtree() ) {
+                JOptionPane
+                        .showMessageDialog( this,
+                                            "This operation can only be performed on a complete tree, not on the currently displayed sub-tree only.",
+                                            "Operation can not be exectuted on a sub-tree",
+                                            JOptionPane.WARNING_MESSAGE );
+                return true;
+            }
         }
         return false;
     }
@@ -503,11 +510,14 @@ public abstract class MainFrame extends JFrame implements ActionListener {
     }
 
     void buildViewMenu() {
-        _view_jmenu = createMenu( "View as Text", getConfiguration() );
+        _view_jmenu = createMenu( "View", getConfiguration() );
+        _view_jmenu.add( _display_basic_information_item = new JMenuItem( "Display Basic Information" ) );
+        _view_jmenu.addSeparator();
         _view_jmenu.add( _view_as_XML_item = new JMenuItem( "View as phyloXML" ) );
         _view_jmenu.add( _view_as_NH_item = new JMenuItem( "View as Newick" ) );
         _view_jmenu.add( _view_as_NHX_item = new JMenuItem( "View as NHX" ) );
         _view_jmenu.add( _view_as_nexus_item = new JMenuItem( "View as Nexus" ) );
+        customizeJMenuItem( _display_basic_information_item );
         customizeJMenuItem( _view_as_NH_item );
         customizeJMenuItem( _view_as_NHX_item );
         customizeJMenuItem( _view_as_XML_item );
@@ -649,7 +659,7 @@ public abstract class MainFrame extends JFrame implements ActionListener {
         }
     }
 
-    Configuration getConfiguration() {
+    public Configuration getConfiguration() {
         return _configuration;
     }
 
@@ -784,7 +794,7 @@ public abstract class MainFrame extends JFrame implements ActionListener {
         _circular_type_cbmi.setSelected( false );
     }
 
-    void showWhole() {
+    public void showWhole() {
         _mainpanel.getControlPanel().showWhole();
     }
 
@@ -840,7 +850,9 @@ public abstract class MainFrame extends JFrame implements ActionListener {
                 && _abbreviate_scientific_names.isSelected() );
         options.setColorLabelsSameAsParentBranch( ( _color_labels_same_as_parent_branch != null )
                 && _color_labels_same_as_parent_branch.isSelected() );
-        options.setShowNodeBoxes( ( _show_node_boxes_cbmi != null ) && _show_node_boxes_cbmi.isSelected() );
+        //TODO FIXME ~~
+        //options.setShowNodeBoxes( ( _show_node_boxes_cbmi != null ) && _show_node_boxes_cbmi.isSelected() );
+        //TODO FIXME ~~
         if ( ( _non_lined_up_cladograms_rbmi != null ) && ( _non_lined_up_cladograms_rbmi.isSelected() ) ) {
             options.setCladogramType( CLADOGRAM_TYPE.NON_LINED_UP );
         }
@@ -874,9 +886,8 @@ public abstract class MainFrame extends JFrame implements ActionListener {
         options.setAntialiasPrint( ( _antialias_print_cbmi != null ) && _antialias_print_cbmi.isSelected() );
         options.setPrintBlackAndWhite( ( _print_black_and_white_cbmi != null )
                 && _print_black_and_white_cbmi.isSelected() );
-        options
-                .setInternalNumberAreConfidenceForNhParsing( ( _internal_number_are_confidence_for_nh_parsing_cbmi != null )
-                        && _internal_number_are_confidence_for_nh_parsing_cbmi.isSelected() );
+        options.setInternalNumberAreConfidenceForNhParsing( ( _internal_number_are_confidence_for_nh_parsing_cbmi != null )
+                && _internal_number_are_confidence_for_nh_parsing_cbmi.isSelected() );
         options.setExtractPfamTaxonomyCodesInNhParsing( ( _extract_pfam_style_tax_codes_cbmi != null )
                 && _extract_pfam_style_tax_codes_cbmi.isSelected() );
         options.setReplaceUnderscoresInNhParsing( ( _replace_underscores_cbmi != null )
@@ -926,6 +937,13 @@ public abstract class MainFrame extends JFrame implements ActionListener {
         ( ( JCheckBoxMenuItem ) o ).setSelected( true );
     }
 
+    void displayBasicInformation() {
+        if ( ( _mainpanel.getCurrentPhylogeny() == null ) || _mainpanel.getCurrentPhylogeny().isEmpty() ) {
+            return;
+        }
+        _textframe = TextFrame.instantiate( Util.crateBasicInformation( _mainpanel.getCurrentPhylogeny() ) );
+    }
+
     void viewAsNexus() {
         removeTextFrame();
         if ( ( _mainpanel.getCurrentPhylogeny() == null ) || _mainpanel.getCurrentPhylogeny().isEmpty()
@@ -1064,8 +1082,7 @@ public abstract class MainFrame extends JFrame implements ActionListener {
         sb.append( "Mouse wheel+Ctrl changes the text size.\n" );
         sb.append( "Mouse wheel+Shift controls zooming in vertical direction only.\n" );
         sb.append( "Use the buttons on the control panel to zoom the tree in and out, horizontally or vertically.\n" );
-        sb
-                .append( "The entire tree can be fitted into the window by clicking the \"F\" button, or by pressing F, Delete, or Home.\n" );
+        sb.append( "The entire tree can be fitted into the window by clicking the \"F\" button, or by pressing F, Delete, or Home.\n" );
         sb.append( "The up, down, left, and right keys can be used to move the visible part (if zoomed in).\n" );
         sb.append( "Up, down, left, and right+Shift can be used to control zooming horizontally and vertically.\n" );
         sb.append( "Plus and minus keys+Ctrl change the text size; F+Ctrl, Delete+Ctrl, or Home+Ctrl resets it.\n\n" );
@@ -1076,8 +1093,7 @@ public abstract class MainFrame extends JFrame implements ActionListener {
         sb.append( "Memory problems (Java heap space error)\n" );
         sb.append( "---------------------------------------\n" );
         sb.append( "Since the Java default memory allocation is quite small, it might by necessary (for trees\n" );
-        sb
-                .append( "with more than approximately 5000 external nodes) to increase the memory which Java can use, with\n" );
+        sb.append( "with more than approximately 5000 external nodes) to increase the memory which Java can use, with\n" );
         sb.append( "the '-Xmx' Java command line option. For example:\n" );
         sb.append( "java -Xms32m -Xmx256m -cp path\\to\\forester.jar org.forester.archaeopteryx.Archaeopteryx\n\n" );
         if ( ( weblinks != null ) && ( weblinks.size() > 0 ) ) {