import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
+import java.util.Map;
import java.util.NoSuchElementException;
import javax.swing.Box;
-import javax.swing.JApplet;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
+import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import org.forester.util.ForesterUtil;
import org.forester.util.WindowsUtils;
-public abstract class MainFrame extends JFrame implements ActionListener {
-
- final static NHFilter nhfilter = new NHFilter();
- final static NHXFilter nhxfilter = new NHXFilter();
- final static XMLFilter xmlfilter = new XMLFilter();
- final static TolFilter tolfilter = new TolFilter();
- final static NexusFilter nexusfilter = new NexusFilter();
- final static PdfFilter pdffilter = new PdfFilter();
- final static GraphicsFileFilter graphicsfilefilter = new GraphicsFileFilter();
- final static MsaFileFilter msafilter = new MsaFileFilter();
- final static SequencesFileFilter seqsfilter = new SequencesFileFilter();
- final static DefaultFilter defaultfilter = new DefaultFilter();
- static final String USE_MOUSEWHEEL_SHIFT_TO_ROTATE = "In this display type, use mousewheel + Shift to rotate [or A and S]";
+public abstract class MainFrame extends JInternalFrame implements ActionListener {
+
+ public final static NHFilter nhfilter = new NHFilter();
+ public final static NHXFilter nhxfilter = new NHXFilter();
+ public final static XMLFilter xmlfilter = new XMLFilter();
+ public final static TolFilter tolfilter = new TolFilter();
+ public final static NexusFilter nexusfilter = new NexusFilter();
+ public final static PdfFilter pdffilter = new PdfFilter();
+ public final static GraphicsFileFilter graphicsfilefilter = new GraphicsFileFilter();
+ public final static MsaFileFilter msafilter = new MsaFileFilter();
+ public final static SequencesFileFilter seqsfilter = new SequencesFileFilter();
+ public final static DefaultFilter defaultfilter = new DefaultFilter();
+ static final String USE_MOUSEWHEEL_SHIFT_TO_ROTATE = "rotate with mousewheel + Shift (or A and S), D toggles between horizontal and radial labels";
static final String PHYLOXML_REF_TOOL_TIP = AptxConstants.PHYLOXML_REFERENCE; //TODO //FIXME
static final String APTX_REF_TOOL_TIP = AptxConstants.APTX_REFERENCE;
private static final long serialVersionUID = 3655000897845508358L;
static final String OPTIONS_HEADER = "Options";
static final String SEARCH_SUBHEADER = "Search:";
static final String DISPLAY_SUBHEADER = "Display:";
- static final String SEARCH_TERMS_ONLY_LABEL = "Match Complete Terms Only";
- static final String SEARCH_REGEX_LABEL = "Search with Regular Expressions";
- static final String SEARCH_CASE_SENSITIVE_LABEL = "Case Sensitive";
- static final String INVERSE_SEARCH_RESULT_LABEL = "Negate Result";
+ static final String SEARCH_TERMS_ONLY_LABEL = "Words";
+ static final String SEARCH_REGEX_LABEL = "Regex";
+ static final String SEARCH_CASE_SENSITIVE_LABEL = "Match Case";
+ static final String INVERSE_SEARCH_RESULT_LABEL = "Inverse";
static final String COLOR_BY_TAXONOMIC_GROUP = "Colorize by Taxonomic Group";
static final String DISPLAY_SCALE_LABEL = "Scale";
- static final String NON_LINED_UP_CLADOGRAMS_LABEL = "Non-Lined Up Cladograms";
- static final String UNIFORM_CLADOGRAMS_LABEL = "Total Node Sum Dependent Cladograms";
+ static final String NON_LINED_UP_CLADOGRAMS_LABEL = "Non-Lined Up Cladogram";
static final String LABEL_DIRECTION_LABEL = "Radial Labels";
static final String LABEL_DIRECTION_TIP = "To use radial node labels in radial and unrooted display types";
static final String SEARCH_WITH_REGEX_TIP = "To search using regular expressions (~Java/Perl syntax). For example, use \"^B.+\\d{2,}$\" to search for everything starting with a B and ending with at least two digits.";
static final String DISPLAY_NODE_BOXES_LABEL_MARKED = "Shapes for Nodes with Visual Data";
static final String SHOW_OVERVIEW_LABEL = "Overview";
static final String FONT_SIZE_MENU_LABEL = "Font Size";
- static final String NONUNIFORM_CLADOGRAMS_LABEL = "External Node Sum Dependent Cladograms";
+ static final String NONUNIFORM_CLADOGRAMS_LABEL = "Lined Up Cladogram";
static final String SHOW_DOMAIN_LABELS_LABEL = "Domain Labels";
static final String SHOW_ANN_REF_SOURCE_LABEL = "Seq Annotation Ref Sources";
static final String COLOR_LABELS_TIP = "To use parent branch colors for node labels as well, need to turn off taxonomy dependent colorization and turn on branch colorization for this to become apparent";
JMenuItem _write_to_tif_item;
JMenuItem _write_to_png_item;
JMenuItem _write_to_bmp_item;
+ JMenuItem _write_to_eps_item;
// tools menu:
JMenuItem _midpoint_root_item;
JMenuItem _taxcolor_item;
JMenuItem _confcolor_item;
JMenuItem _color_rank_jmi;
JMenuItem _collapse_species_specific_subtrees;
+
JMenuItem _obtain_detailed_taxonomic_information_jmi;
JMenuItem _obtain_detailed_taxonomic_information_deleting_jmi;
JMenuItem _obtain_seq_information_jmi;
JCheckBoxMenuItem _screen_antialias_cbmi;
JCheckBoxMenuItem _background_gradient_cbmi;
JRadioButtonMenuItem _non_lined_up_cladograms_rbmi;
- JRadioButtonMenuItem _uniform_cladograms_rbmi;
JRadioButtonMenuItem _ext_node_dependent_cladogram_rbmi;
JCheckBoxMenuItem _color_by_taxonomic_group_cbmi;
JCheckBoxMenuItem _show_scale_cbmi; //TODO fix me
JCheckBoxMenuItem _show_confidence_stddev_cbmi;
JCheckBoxMenuItem _right_line_up_domains_cbmi;
JCheckBoxMenuItem _line_up_renderable_data_cbmi;
+ JCheckBoxMenuItem _collapsed_with_average_height_cbmi;
+ JCheckBoxMenuItem _show_abbreviated_labels_for_collapsed_nodes_cbmi;
// _ print
JCheckBoxMenuItem _graphics_export_visible_only_cbmi;
JCheckBoxMenuItem _antialias_print_cbmi;
JMenuItem _about_item;
JMenuItem _help_item;
JMenuItem _website_item;
+ JMenuItem _aptxjs_website_item;
+ JMenuItem _mailing_list_item;
JMenuItem _phyloxml_website_item;
JMenuItem _phyloxml_ref_item;
JMenuItem _aptx_ref_item;
@Override
public void actionPerformed( final ActionEvent e ) {
final Object o = e.getSource();
- boolean is_applet = false;
- JApplet applet = null;
- if ( getCurrentTreePanel() != null ) {
- is_applet = getCurrentTreePanel().isApplet();
- if ( is_applet ) {
- applet = getCurrentTreePanel().obtainApplet();
- }
- }
+
if ( o == _exit_item ) {
close();
}
updateOptions( getOptions() );
showWhole();
}
- else if ( o == _uniform_cladograms_rbmi ) {
- updateOptions( getOptions() );
- showWhole();
- }
else if ( o == _ext_node_dependent_cladogram_rbmi ) {
updateOptions( getOptions() );
showWhole();
}
else if ( o == _search_case_senstive_cbmi ) {
+ if ( ( _search_with_regex_cbmi != null ) && _search_case_senstive_cbmi.isSelected() ) {
+ _search_with_regex_cbmi.setSelected( false );
+ }
updateOptions( getOptions() );
getMainPanel().getControlPanel().search0();
getMainPanel().getControlPanel().search1();
_search_whole_words_only_cbmi.setSelected( false );
}
if ( ( _search_case_senstive_cbmi != null ) && _search_with_regex_cbmi.isSelected() ) {
- _search_case_senstive_cbmi.setSelected( true );
+ _search_case_senstive_cbmi.setSelected( false );
}
updateOptions( getOptions() );
getMainPanel().getControlPanel().search0();
}
updateOptions( getOptions() );
}
+
+ else if ( o == _collapsed_with_average_height_cbmi ) {
+ if ( _collapsed_with_average_height_cbmi.isSelected() ) {
+ _collapsed_with_average_height_cbmi.setSelected( true );
+ }
+ updateOptions( getOptions() );
+ }
+ else if ( o == _show_abbreviated_labels_for_collapsed_nodes_cbmi ) {
+ if ( _show_abbreviated_labels_for_collapsed_nodes_cbmi.isSelected() ) {
+ _show_abbreviated_labels_for_collapsed_nodes_cbmi.setSelected( true );
+ }
+ updateOptions( getOptions() );
+ }
else if ( o == _right_line_up_domains_cbmi ) {
if ( _right_line_up_domains_cbmi.isSelected() ) {
_line_up_renderable_data_cbmi.setSelected( true );
}
else if ( o == _help_item ) {
try {
- AptxUtil.openWebsite( AptxConstants.APTX_DOC_SITE, is_applet, applet );
+ AptxUtil.openWebsite( AptxConstants.APTX_DOC_SITE );
}
catch ( final IOException e1 ) {
ForesterUtil.printErrorMessage( AptxConstants.PRG_NAME, e1.toString() );
}
else if ( o == _website_item ) {
try {
- AptxUtil.openWebsite( AptxConstants.APTX_WEB_SITE, is_applet, applet );
+ AptxUtil.openWebsite( AptxConstants.APTX_WEB_SITE);
+ }
+ catch ( final IOException e1 ) {
+ ForesterUtil.printErrorMessage( AptxConstants.PRG_NAME, e1.toString() );
+ }
+ }
+ else if ( o == _aptxjs_website_item ) {
+ try {
+ AptxUtil.openWebsite( AptxConstants.APTX_JS_WEB_SITE);;
+ }
+ catch ( final IOException e1 ) {
+ ForesterUtil.printErrorMessage( AptxConstants.PRG_NAME, e1.toString() );
+ }
+ }
+ else if ( o == _mailing_list_item ) {
+ try {
+ AptxUtil.openWebsite( AptxConstants.APTX_MAILING_LIST );
}
catch ( final IOException e1 ) {
ForesterUtil.printErrorMessage( AptxConstants.PRG_NAME, e1.toString() );
}
else if ( o == _phyloxml_website_item ) {
try {
- AptxUtil.openWebsite( AptxConstants.PHYLOXML_WEB_SITE, is_applet, applet );
+ AptxUtil.openWebsite( AptxConstants.PHYLOXML_WEB_SITE );
}
catch ( final IOException e1 ) {
ForesterUtil.printErrorMessage( AptxConstants.PRG_NAME, e1.toString() );
}
else if ( o == _aptx_ref_item ) {
try {
- AptxUtil.openWebsite( AptxConstants.APTX_REFERENCE_URL, is_applet, applet );
+ AptxUtil.openWebsite( AptxConstants.APTX_REFERENCE_URL );
}
catch ( final IOException e1 ) {
ForesterUtil.printErrorMessage( AptxConstants.PRG_NAME, e1.toString() );
}
else if ( o == _phyloxml_ref_item ) {
try {
- AptxUtil.openWebsite( AptxConstants.PHYLOXML_REFERENCE_URL, is_applet, applet );
+ AptxUtil.openWebsite( AptxConstants.PHYLOXML_REFERENCE_URL );
}
catch ( final IOException e1 ) {
ForesterUtil.printErrorMessage( AptxConstants.PRG_NAME, e1.toString() );
setCurrentDir( new_dir );
}
}
+ else if (o == _write_to_eps_item) {
+ final File new_dir = writeToGraphicsFile(_mainpanel.getCurrentPhylogeny(),
+ GraphicsExportType.EPS,
+ _mainpanel,
+ _writetographics_filechooser,
+ this,
+ getContentPane(),
+ _current_dir );
+ if (new_dir != null) {
+ setCurrentDir(new_dir);
+ }
+ }
else if ( o == _print_item ) {
print( getCurrentTreePanel(), getOptions(), this );
}
fc.showDialog( this, "Select the Base Font" );
getMainPanel().getTreeFontSet().setBaseFont( fc.getFont() );
getControlPanel().displayedPhylogenyMightHaveChanged( true );
- getMainPanel().getCurrentTreePanel().resetPreferredSize();
- getMainPanel().getCurrentTreePanel().updateOvSizes();
+ if ( getMainPanel().getCurrentTreePanel() != null ) {
+ getMainPanel().getCurrentTreePanel().resetPreferredSize();
+ getMainPanel().getCurrentTreePanel().updateOvSizes();
+ }
repaint();
}
_process_menu.setForeground( Color.RED );
}
_process_menu.removeAll();
- final String text = "processes running: " + _process_pool.size();
+ final String text = "Processes Running: " + _process_pool.size();
_process_menu.setText( text );
_jmenubar.add( _process_menu );
for( int i = 0; i < _process_pool.size(); ++i ) {
}
}
- void activateSaveAllIfNeeded() {
+ public void activateSaveAllIfNeeded() {
if ( ( getMainPanel().getTabbedPane() != null ) && ( getMainPanel().getTabbedPane().getTabCount() > 1 ) ) {
_save_all_item.setEnabled( true );
}
}
void buildFileMenu() {
- _file_jmenu = MainFrame.createMenu( "File", getConfiguration() );
- _file_jmenu.add( _save_item = new JMenuItem( "Save Tree As..." ) );
- _file_jmenu.addSeparator();
- _file_jmenu.add( _write_to_pdf_item = new JMenuItem( "Export to PDF file ..." ) );
- if ( AptxUtil.canWriteFormat( "tif" ) || AptxUtil.canWriteFormat( "tiff" ) || AptxUtil.canWriteFormat( "TIF" ) ) {
- _file_jmenu.add( _write_to_tif_item = new JMenuItem( "Export to TIFF file..." ) );
- }
- _file_jmenu.add( _write_to_png_item = new JMenuItem( "Export to PNG file..." ) );
- _file_jmenu.add( _write_to_jpg_item = new JMenuItem( "Export to JPG file..." ) );
- if ( AptxUtil.canWriteFormat( "gif" ) ) {
- _file_jmenu.add( _write_to_gif_item = new JMenuItem( "Export to GIF file..." ) );
- }
- if ( AptxUtil.canWriteFormat( "bmp" ) ) {
- _file_jmenu.add( _write_to_bmp_item = new JMenuItem( "Export to BMP file..." ) );
- }
- _file_jmenu.addSeparator();
- _file_jmenu.add( _print_item = new JMenuItem( "Print..." ) );
- _file_jmenu.addSeparator();
- _file_jmenu.add( _exit_item = new JMenuItem( "Exit" ) );
- customizeJMenuItem( _save_item );
- customizeJMenuItem( _write_to_pdf_item );
- customizeJMenuItem( _write_to_png_item );
- customizeJMenuItem( _write_to_jpg_item );
- customizeJMenuItem( _write_to_gif_item );
- customizeJMenuItem( _write_to_tif_item );
- customizeJMenuItem( _write_to_bmp_item );
- customizeJMenuItem( _print_item );
- customizeJMenuItem( _exit_item );
- _jmenubar.add( _file_jmenu );
+// _file_jmenu = MainFrame.createMenu( "File", getConfiguration() );
+// _file_jmenu.add( _save_item = new JMenuItem( "Save Tree As..." ) );
+// _file_jmenu.addSeparator();
+// _file_jmenu.add( _write_to_pdf_item = new JMenuItem( "Export to PDF file ..." ) );
+// if ( AptxUtil.canWriteFormat( "tif" ) || AptxUtil.canWriteFormat( "tiff" ) || AptxUtil.canWriteFormat( "TIF" ) ) {
+// _file_jmenu.add( _write_to_tif_item = new JMenuItem( "Export to TIFF file..." ) );
+// }
+// _file_jmenu.add( _write_to_png_item = new JMenuItem( "Export to PNG file..." ) );
+// _file_jmenu.add( _write_to_jpg_item = new JMenuItem( "Export to JPG file..." ) );
+// if ( AptxUtil.canWriteFormat( "gif" ) ) {
+// _file_jmenu.add( _write_to_gif_item = new JMenuItem( "Export to GIF file..." ) );
+// }
+// if ( AptxUtil.canWriteFormat( "bmp" ) ) {
+// _file_jmenu.add( _write_to_bmp_item = new JMenuItem( "Export to BMP file..." ) );
+// }
+//
+// _file_jmenu.add( _write_to_eps_item = new JMenuItem("Export to EPS file...") );
+//
+// _file_jmenu.addSeparator();
+// _file_jmenu.add( _print_item = new JMenuItem( "Print..." ) );
+// _file_jmenu.addSeparator();
+// _file_jmenu.add( _exit_item = new JMenuItem( "Exit" ) );
+// customizeJMenuItem( _save_item );
+// customizeJMenuItem( _write_to_pdf_item );
+// customizeJMenuItem( _write_to_png_item );
+// customizeJMenuItem( _write_to_jpg_item );
+// customizeJMenuItem( _write_to_gif_item );
+// customizeJMenuItem( _write_to_tif_item );
+// customizeJMenuItem( _write_to_bmp_item );
+// customizeJMenuItem(_write_to_eps_item);
+// customizeJMenuItem( _print_item );
+// customizeJMenuItem( _exit_item );
+// _jmenubar.add( _file_jmenu );
}
void buildFontSizeMenu() {
_help_jmenu.add( _help_item = new JMenuItem( "Documentation" ) );
_help_jmenu.addSeparator();
_help_jmenu.add( _website_item = new JMenuItem( "Archaeopteryx Home" ) );
+ _help_jmenu.add( _aptxjs_website_item = new JMenuItem( "NEW! Archaeopteryx online version: Archaeopteryx.js" ) );
+ _help_jmenu.add( _mailing_list_item = new JMenuItem( "Mailing List" ) );
_aptx_ref_item = new JMenuItem( "Archaeopteryx Reference" ); //TODO need to add this...
_help_jmenu.add( _phyloxml_website_item = new JMenuItem( "phyloXML Home" ) );
_help_jmenu.add( _phyloxml_ref_item = new JMenuItem( "phyloXML Reference" ) );
_help_jmenu.add( _about_item = new JMenuItem( "About" ) );
customizeJMenuItem( _help_item );
customizeJMenuItem( _website_item );
+ customizeJMenuItem( _aptxjs_website_item );
+ customizeJMenuItem( _mailing_list_item );
customizeJMenuItem( _phyloxml_website_item );
customizeJMenuItem( _aptx_ref_item );
customizeJMenuItem( _phyloxml_ref_item );
customizeCheckBoxMenuItem( _convex_type_cbmi, false );
customizeCheckBoxMenuItem( _unrooted_type_cbmi, false );
customizeCheckBoxMenuItem( _circular_type_cbmi, false );
+ _triangular_type_cbmi.setToolTipText( "not suitable for phylograms" );
+ _curved_type_cbmi.setToolTipText( "not suitable for phylograms" );
_unrooted_type_cbmi.setToolTipText( MainFrame.USE_MOUSEWHEEL_SHIFT_TO_ROTATE );
_circular_type_cbmi.setToolTipText( MainFrame.USE_MOUSEWHEEL_SHIFT_TO_ROTATE );
initializeTypeMenu( getOptions() );
void colorRank() {
if ( _mainpanel.getCurrentTreePanel() != null ) {
- final String[] ranks = AptxUtil.getAllPossibleRanks();
- final String rank = ( String ) JOptionPane
+ final Map<String, Integer> present_ranks = AptxUtil.getRankCounts( _mainpanel.getCurrentTreePanel().getPhylogeny());
+ final String[] ranks = AptxUtil.getAllPossibleRanks(present_ranks);
+ String rank = ( String ) JOptionPane
.showInputDialog( this,
"What rank should the colorization be based on",
"Rank Selection",
ranks,
null );
if ( !ForesterUtil.isEmpty( rank ) ) {
+ if ( rank.indexOf( '(' ) > 0 ) {
+ rank = rank.substring( 0, rank.indexOf( '(' ) ).trim();
+ }
_mainpanel.getCurrentTreePanel().colorRank( rank );
}
}
if ( ( _non_lined_up_cladograms_rbmi != null ) && ( _non_lined_up_cladograms_rbmi.isSelected() ) ) {
options.setCladogramType( CLADOGRAM_TYPE.NON_LINED_UP );
}
- else if ( ( _uniform_cladograms_rbmi != null ) && ( _uniform_cladograms_rbmi.isSelected() ) ) {
- options.setCladogramType( CLADOGRAM_TYPE.TOTAL_NODE_SUM_DEP );
- }
else if ( ( _ext_node_dependent_cladogram_rbmi != null ) && ( _ext_node_dependent_cladogram_rbmi.isSelected() ) ) {
- options.setCladogramType( CLADOGRAM_TYPE.EXT_NODE_SUM_DEP );
+ options.setCladogramType( CLADOGRAM_TYPE.LINED_UP );
}
options.setSearchCaseSensitive( ( _search_case_senstive_cbmi != null )
&& _search_case_senstive_cbmi.isSelected() );
if ( ( _parse_beast_style_extended_nexus_tags_cbmi != null ) && _parse_beast_style_extended_nexus_tags_cbmi.isEnabled() ) {
options.setParseBeastStyleExtendedNexusTags(_parse_beast_style_extended_nexus_tags_cbmi.isSelected() );
}
+ if ( ( _collapsed_with_average_height_cbmi != null ) && _collapsed_with_average_height_cbmi.isEnabled() ) {
+ options.setCollapsedWithAverageHeigh(_collapsed_with_average_height_cbmi.isSelected() );
+ }
+ if ( ( _show_abbreviated_labels_for_collapsed_nodes_cbmi != null ) && _show_abbreviated_labels_for_collapsed_nodes_cbmi.isEnabled() ) {
+ options.setShowAbbreviatedLabelsForCollapsedNodes(_show_abbreviated_labels_for_collapsed_nodes_cbmi.isSelected() );
+ }
+
}
void updateTypeCheckboxes( final Options options, final Object o ) {
/**
* Display the about box.
*/
- static void about() {
+ void about() {
final StringBuffer about = new StringBuffer( "Archaeopteryx\nVersion " + AptxConstants.VERSION + "\n" );
about.append( "Copyright (C) 2016 Christian M Zmasek\n" );
about.append( "All Rights Reserved\n" );
about.append( "License: GNU Lesser General Public License (LGPL)\n" );
about.append( "Last modified: " + AptxConstants.PRG_DATE + "\n" );
about.append( "Based on: " + ForesterUtil.getForesterLibraryInformation() + "\n" );
+
+ if ( _configuration.isCouldReadConfigFile() ) {
+ about.append( "Using configuration file: " + _configuration.config_filename + "\n" );
+ }
+ else {
+ about.append( "Not using a configuration file\n" );
+ }
+
about.append( "phyloXML version : " + ForesterConstants.PHYLO_XML_VERSION + "\n" );
about.append( "phyloXML location: " + ForesterConstants.PHYLO_XML_LOCATION + "\n" );
if ( !ForesterUtil.isEmpty( ForesterUtil.JAVA_VERSION ) && !ForesterUtil.isEmpty( ForesterUtil.JAVA_VENDOR ) ) {