in progress
[jalview.git] / forester / java / src / org / forester / archaeopteryx / MainFrame.java
index 80555c0..1c67316 100644 (file)
@@ -116,10 +116,12 @@ public abstract class MainFrame extends JFrame implements ActionListener {
     JMenuItem                 _midpoint_root_item;
     JMenuItem                 _taxcolor_item;
     JMenuItem                 _confcolor_item;
+    JMenuItem                 _color_rank_jmi;
     JMenuItem                 _infer_common_sn_names_item;
     JMenuItem                 _collapse_species_specific_subtrees;
     JMenuItem                 _collapse_below_threshold;                                                                                                                                                                                //TODO implememt me
     JMenuItem                 _obtain_detailed_taxonomic_information_jmi;
+    JMenuItem                 _obtain_detailed_taxonomic_information_deleting_jmi;
     JMenuItem                 _obtain_uniprot_seq_information_jmi;
     JMenuItem                 _move_node_names_to_tax_sn_jmi;
     JMenuItem                 _move_node_names_to_seq_names_jmi;
@@ -230,6 +232,9 @@ public abstract class MainFrame extends JFrame implements ActionListener {
         else if ( o == _confcolor_item ) {
             confColor();
         }
+        else if ( o == _color_rank_jmi ) {
+            colorRank();
+        }
         else if ( o == _infer_common_sn_names_item ) {
             if ( isSubtreeDisplayed() ) {
                 return;
@@ -638,6 +643,30 @@ public abstract class MainFrame extends JFrame implements ActionListener {
         }
     }
 
+    void colorRank() {
+        if ( _mainpanel.getCurrentTreePanel() != null ) {
+            final String[] ranks = Util.getAllRanks( _mainpanel.getCurrentTreePanel().getPhylogeny() );
+            if ( ranks.length < 1 ) {
+                JOptionPane.showMessageDialog( this,
+                                               "No rank information was found",
+                                               "No Rank Information",
+                                               JOptionPane.WARNING_MESSAGE );
+                return;
+            }
+            final String rank = ( String ) JOptionPane
+                    .showInputDialog( this,
+                                      "What rank should the colorization be based on",
+                                      "Rank Selection",
+                                      JOptionPane.QUESTION_MESSAGE,
+                                      null,
+                                      ranks,
+                                      null );
+            if ( !ForesterUtil.isEmpty( rank ) ) {
+                _mainpanel.getCurrentTreePanel().colorRank( rank );
+            }
+        }
+    }
+
     void customizeCheckBoxMenuItem( final JCheckBoxMenuItem item, final boolean is_selected ) {
         if ( item != null ) {
             item.setFont( MainFrame.menu_font );