in progress
[jalview.git] / forester / java / src / org / forester / archaeopteryx / MainFrame.java
index e89f978..ac9bd6d 100644 (file)
@@ -33,14 +33,13 @@ import java.awt.event.ActionListener;
 import java.io.File;\r
 import java.io.IOException;\r
 import java.util.ArrayList;\r
-import java.util.HashSet;\r
 import java.util.LinkedList;\r
 import java.util.List;\r
 import java.util.Locale;\r
 import java.util.NoSuchElementException;\r
-import java.util.Set;\r
 \r
 import javax.swing.Box;\r
+import javax.swing.Icon;\r
 import javax.swing.JApplet;\r
 import javax.swing.JCheckBoxMenuItem;\r
 import javax.swing.JFrame;\r
@@ -127,6 +126,8 @@ public abstract class MainFrame extends JFrame implements ActionListener {
     static final String         USE_BRACKETS_FOR_CONF_IN_NH_LABEL       = "Use Brackets for Confidence Values";\r
     static final String         USE_INTERNAL_NAMES_FOR_CONF_IN_NH_LABEL = "Use Internal Node Names for Confidence Values";\r
     static final String         SHOW_BASIC_TREE_INFORMATION_LABEL       = "Basic Tree Information";\r
+    static final String RIGHT_LINE_UP_DOMAINS = "Right-align Domain Architectures";\r
+    static final String LINE_UP_RENDERABLE_DATA = "Line Up Node Diagrams";\r
     JMenuBar                    _jmenubar;\r
     JMenu                       _file_jmenu;\r
     JMenu                       _tools_menu;\r
@@ -200,6 +201,8 @@ public abstract class MainFrame extends JFrame implements ActionListener {
     JMenuItem                   _cycle_node_fill_mi;\r
     JMenuItem                   _choose_node_size_mi;\r
     JCheckBoxMenuItem           _show_confidence_stddev_cbmi;\r
+   JCheckBoxMenuItem _right_line_up_domains_cbmi;\r
+    JCheckBoxMenuItem _line_up_renderable_data_cbmi;\r
     // _  print\r
     JCheckBoxMenuItem           _graphics_export_visible_only_cbmi;\r
     JCheckBoxMenuItem           _antialias_print_cbmi;\r
@@ -488,16 +491,30 @@ public abstract class MainFrame extends JFrame implements ActionListener {
                 getCurrentTreePanel().updateOvSizes();\r
             }\r
         }\r
+        else if ( o == _line_up_renderable_data_cbmi ) {\r
+            updateOptions( getOptions() );\r
+        }\r
+        else if ( o == _right_line_up_domains_cbmi ) {\r
+            updateOptions( getOptions() );\r
+        }\r
+        \r
+        \r
         else if ( ( o == _rectangular_type_cbmi ) || ( o == _triangular_type_cbmi ) || ( o == _curved_type_cbmi )\r
                 || ( o == _convex_type_cbmi ) || ( o == _euro_type_cbmi ) || ( o == _rounded_type_cbmi )\r
                 || ( o == _unrooted_type_cbmi ) || ( o == _circular_type_cbmi ) ) {\r
             typeChanged( o );\r
         }\r
+        \r
         else if ( o == _about_item ) {\r
             about();\r
         }\r
         else if ( o == _help_item ) {\r
-            help();\r
+            try {\r
+                AptxUtil.openWebsite( Constants.APTX_DOC_SITE, is_applet, applet );\r
+            }\r
+            catch ( final IOException e1 ) {\r
+                ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );\r
+            }\r
         }\r
         else if ( o == _website_item ) {\r
             try {\r
@@ -724,9 +741,10 @@ public abstract class MainFrame extends JFrame implements ActionListener {
 \r
     void buildHelpMenu() {\r
         _help_jmenu = createMenu( "Help", getConfiguration() );\r
-        _help_jmenu.add( _help_item = new JMenuItem( "Help" ) );\r
+        _help_jmenu.add( _help_item = new JMenuItem( "Documentation" ) );\r
+        _help_jmenu.addSeparator();\r
         _help_jmenu.add( _website_item = new JMenuItem( "Archaeopteryx Home" ) );\r
-        _aptx_ref_item = new JMenuItem( "Archaeopteryx Reference" );\r
+        _aptx_ref_item = new JMenuItem( "Archaeopteryx Reference" ); //TODO need to add this...\r
         _help_jmenu.add( _phyloxml_website_item = new JMenuItem( "phyloXML Home" ) );\r
         _help_jmenu.add( _phyloxml_ref_item = new JMenuItem( "phyloXML Reference" ) );\r
         _help_jmenu.addSeparator();\r
@@ -1082,95 +1100,7 @@ public abstract class MainFrame extends JFrame implements ActionListener {
         return _species_tree;\r
     }\r
 \r
-    void help() {\r
-        final StringBuilder sb = new StringBuilder();\r
-        sb.append( "Display options\n" );\r
-        sb.append( "-------------------\n" );\r
-        sb.append( "Use the checkboxes to select types of information to display on the tree.\n\n" );\r
-        sb.append( "Clickable tree nodes\n" );\r
-        sb.append( "--------------------\n" );\r
-        sb.append( "Tree nodes can be clicked, the action is determined by the 'click on node to' menu\n" );\r
-        sb.append( "or by right clicking:\n" );\r
-        sb.append( "o  Display Node Data -- display information for a node\n" );\r
-        sb.append( "o  Collapse/Uncollapse -- collapse and uncollapse subtree from clicked node\n" );\r
-        sb.append( "o  Root/Reroot -- change tree root to clicked node\n" );\r
-        sb.append( "o  Sub/Super Tree -- toggle between subtree from clicked node and whole tree\n" );\r
-        sb.append( "o  Swap Descendants -- switch descendant on either side of clicked node\n" );\r
-        sb.append( "o  Colorize Subtree -- color a subtree\n" );\r
-        sb.append( "o  Open Sequence Web -- launch a web browser to display sequence information\n" );\r
-        sb.append( "o  Open Taxonomy Web -- launch a web browser to display taxonomy information\n" );\r
-        sb.append( "-  there may be additional choices depending on this particular setup\n\n" );\r
-        sb.append( "Right clicking on a node always displays the information of a node.\n\n" );\r
-        sb.append( "Zooming\n" );\r
-        sb.append( "---------\n" );\r
-        sb.append( "The mouse wheel and the plus and minus keys control zooming.\n" );\r
-        sb.append( "Mouse wheel+Ctrl changes the text size.\n" );\r
-        sb.append( "Mouse wheel+Shift controls zooming in vertical direction only.\n" );\r
-        sb.append( "Use the buttons on the control panel to zoom the tree in and out, horizontally or vertically.\n" );\r
-        sb.append( "The entire tree can be fitted into the window by clicking the \"F\" button, or by pressing F, Delete, or Home.\n" );\r
-        sb.append( "The up, down, left, and right keys can be used to move the visible part (if zoomed in).\n" );\r
-        sb.append( "Up, down, left, and right+Shift can be used to control zooming horizontally and vertically.\n" );\r
-        sb.append( "Plus and minus keys+Ctrl change the text size; F+Ctrl, Delete+Ctrl, or Home+Ctrl resets it.\n\n" );\r
-        sb.append( "Quick tree manipulation:\n" );\r
-        sb.append( "------------------------\n" );\r
-        sb.append( "Order Subtrees -- order the tree by branch length\n" );\r
-        sb.append( "Uncollapse All -- uncollapse any and all collapsed branches\n\n" );\r
-        sb.append( "Memory problems (Java heap space error)\n" );\r
-        sb.append( "---------------------------------------\n" );\r
-        sb.append( "Since the Java default memory allocation is quite small, it might by necessary (for trees\n" );\r
-        sb.append( "with more than approximately 5000 external nodes) to increase the memory which Java can use, with\n" );\r
-        sb.append( "the '-Xmx' Java command line option. For example:\n" );\r
-        sb.append( "java -Xmx1024m -cp path\\to\\forester.jar org.forester.archaeopteryx.Archaeopteryx\n\n" );\r
-        // + "General remarks\n"\r
-        // + "---------------\n"\r
-        // +\r
-        // "o  The application version permits copying to the clipboard \n"\r
-        // +\r
-        // "    in the \"View\"|\"View as ...\" frame (either by control-c or button press).\n"\r
-        // +\r
-        // "o  Changes made to a subtree affect this subtree and its subtrees,\n"\r
-        // + "    but not any of its parent tree(s).\n"\r
-        // +\r
-        // "o  Archaeopteryx tries to detect whether the numerical values in a NH tree\n"\r
-        // +\r
-        // "    are likely to be bootstrap values instead of branch length values.\n\n"\r
-        // +\r
-        // " Remarks regarding SDI (Speciation Duplication Inference):\n"\r
-        // +\r
-        // "o  Each external node of the gene tree (in display) needs to be associated with\n"\r
-        // +\r
-        // "    a species: either directly through the \"Species\" field, or the species\n"\r
-        // +\r
-        // "    is part of the sequence name in the form \"XXXX_SPECIES\"\n"\r
-        // +\r
-        // "    (e.g. \"ACON_DROME\" or \"ACON_DROME/123-4489\" which is also acceptable).\n"\r
-        // +\r
-        // "o  A species tree for each species of the gene tree needs to be loaded with\n"\r
-        // +\r
-        // "   \"SDI\"|\"Load species tree\" prior the SDI execution.\n"\r
-        // +\r
-        // "o  !External nodes of the gene tree associated with species not present in\n"\r
-        // +\r
-        // "    the species tree are REMOVED prior to SDI execution!\n"\r
-        // +\r
-        // "o  Both the gene tree and the species tree must be completely binary.\n"\r
-        // +\r
-        // "o  Duplications and speciations are a function of the position of the root.\n"\r
-        // +\r
-        // "    Hence, after each manual \"Root/Reroot\"ing some duplications will be\n"\r
-        // + "    incorrect and need to be inferred again\n"\r
-        // +\r
-        // "    with: \"SDI\"|\"SDI (Speciation Duplication Inference)\n\n"\r
-        sb.append( "phyloXML\n" );\r
-        sb.append( "-------------------\n" );\r
-        sb.append( "Reference: " + Constants.PHYLOXML_REFERENCE + "\n" );\r
-        sb.append( "Website: " + Constants.PHYLOXML_WEB_SITE + "\n" );\r
-        sb.append( "Version: " + ForesterConstants.PHYLO_XML_VERSION + "\n" );\r
-        sb.append( "\n" );\r
-        sb.append( "For more information: https://sites.google.com/site/cmzmasek/home/software/archaeopteryx\n" );\r
-        sb.append( "Email: " + Constants.AUTHOR_EMAIL + "\n\n" );\r
-        TextFrame.instantiate( sb.toString(), "Help", _textframes );\r
-    }\r
+    \r
 \r
     void initializeTypeMenu( final Options options ) {\r
         setTypeMenuToAllUnselected();\r
@@ -1488,6 +1418,14 @@ public abstract class MainFrame extends JFrame implements ActionListener {
         else if ( ( _circular_type_cbmi != null ) && _circular_type_cbmi.isSelected() ) {\r
             options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.CIRCULAR );\r
         }\r
+        if ( ( _right_line_up_domains_cbmi != null ) && _right_line_up_domains_cbmi.isEnabled() ) {\r
+            options.setRightLineUpDomains( _right_line_up_domains_cbmi.isSelected() );\r
+        }\r
+        \r
+        \r
+        if ( ( _line_up_renderable_data_cbmi != null ) && _line_up_renderable_data_cbmi.isEnabled() ) {\r
+            options.setLineUpRendarableNodeData( _line_up_renderable_data_cbmi.isSelected() );\r
+        }\r
     }\r
 \r
     void updateTypeCheckboxes( final Options options, final Object o ) {\r
@@ -1688,7 +1626,7 @@ public abstract class MainFrame extends JFrame implements ActionListener {
      */\r
     static void about() {\r
         final StringBuffer about = new StringBuffer( "Archaeopteryx\nVersion " + Constants.VERSION + "\n" );\r
-        about.append( "Copyright (C) 2013 Christian M. Zmasek\n" );\r
+        about.append( "Copyright (C) 2014 Christian M Zmasek\n" );\r
         about.append( "All Rights Reserved\n" );\r
         about.append( "License: GNU Lesser General Public License (LGPL)\n" );\r
         about.append( "Last modified: " + Constants.PRG_DATE + "\n" );\r
@@ -1712,6 +1650,8 @@ public abstract class MainFrame extends JFrame implements ActionListener {
         about.append( Constants.PHYLOXML_REFERENCE_SHORT + "\n" );\r
         about.append( "For more information & download:\n" );\r
         about.append( Constants.APTX_WEB_SITE + "\n" );\r
+        about.append( "Documentation:\n" );\r
+        about.append( Constants.APTX_DOC_SITE + "\n" );\r
         about.append( "Comments: " + Constants.AUTHOR_EMAIL );\r
         JOptionPane.showMessageDialog( null, about, Constants.PRG_NAME, JOptionPane.PLAIN_MESSAGE );\r
     }\r