}\r
}\r
else if ( o == _write_to_pdf_item ) {\r
- writeToPdf( _mainpanel.getCurrentPhylogeny() );\r
+ final File curr_dir = writeToPdf( _mainpanel.getCurrentPhylogeny(),\r
+ getMainPanel(),\r
+ _writetopdf_filechooser,\r
+ _current_dir,\r
+ getContentPane(),\r
+ this );\r
+ if ( curr_dir != null ) {\r
+ setCurrentDir( curr_dir );\r
+ }\r
}\r
else if ( o == _save_all_item ) {\r
writeAllToFile();\r
writeToGraphicsFile( _mainpanel.getCurrentPhylogeny(), GraphicsExportType.BMP );\r
}\r
else if ( o == _print_item ) {\r
- print( getCurrentTreePanel(),\r
- getOptions(),\r
- \r
- this );\r
+ print( getCurrentTreePanel(), getOptions(), this );\r
}\r
else if ( o == _save_item ) {\r
writeToFile( _mainpanel.getCurrentPhylogeny() );\r
"Please enter the default line width for PDF export.\n"\r
+ "[current value: "\r
+ getOptions().getPrintLineWidth() + "]\n",\r
- "Line Width for PDF Export",\r
- JOptionPane.QUESTION_MESSAGE,\r
- null,\r
- null,\r
- getOptions().getPrintLineWidth() );\r
+ "Line Width for PDF Export",\r
+ JOptionPane.QUESTION_MESSAGE,\r
+ null,\r
+ null,\r
+ getOptions().getPrintLineWidth() );\r
if ( !ForesterUtil.isEmpty( s ) ) {\r
boolean success = true;\r
float f = 0.0f;\r
+ Constants.A4_SIZE_Y + "]\n" + "[US Letter: "\r
+ Constants.US_LETTER_SIZE_X + ", "\r
+ Constants.US_LETTER_SIZE_Y + "]",\r
- "Default Size for Graphics Export",\r
- JOptionPane.QUESTION_MESSAGE,\r
- null,\r
- null,\r
- getOptions().getPrintSizeX() + ", "\r
- + getOptions().getPrintSizeY() );\r
+ "Default Size for Graphics Export",\r
+ JOptionPane.QUESTION_MESSAGE,\r
+ null,\r
+ null,\r
+ getOptions().getPrintSizeX() + ", "\r
+ + getOptions().getPrintSizeY() );\r
if ( !ForesterUtil.isEmpty( s ) && ( s.indexOf( ',' ) > 0 ) ) {\r
boolean success = true;\r
int x = 0;\r
+ gsdi.getStrippedExternalGeneTreeNodes().size() + "\n"\r
+ "Taxonomy linkage based on: " + gsdi.getTaxCompBase() + "\n"\r
+ "Number of polytomies in species tree used: " + poly + "\n",\r
- "GSDI successfully completed",\r
- JOptionPane.WARNING_MESSAGE );\r
+ "GSDI successfully completed",\r
+ JOptionPane.WARNING_MESSAGE );\r
}\r
else {\r
JOptionPane.showMessageDialog( this,\r
+ gsdi.getStrippedExternalGeneTreeNodes().size() + "\n"\r
+ "Taxonomy linkage based on: " + gsdi.getTaxCompBase() + "\n"\r
+ "Number of polytomies in species tree used: " + poly + "\n",\r
- "GSDI successfully completed",\r
- JOptionPane.INFORMATION_MESSAGE );\r
+ "GSDI successfully completed",\r
+ JOptionPane.INFORMATION_MESSAGE );\r
}\r
}\r
\r
+ gsdir.getStrippedExternalGeneTreeNodes().size() + "\n"\r
+ "Taxonomy linkage based on: " + gsdir.getTaxCompBase() + "\n"\r
+ "Number of polytomies in species tree used: " + poly + "\n",\r
- "GSDIR successfully completed",\r
- JOptionPane.WARNING_MESSAGE );\r
+ "GSDIR successfully completed",\r
+ JOptionPane.WARNING_MESSAGE );\r
}\r
else {\r
JOptionPane.showMessageDialog( this,\r
+ gsdir.getStrippedExternalGeneTreeNodes().size() + "\n"\r
+ "Taxonomy linkage based on: " + gsdir.getTaxCompBase() + "\n"\r
+ "Number of polytomies in species tree used: " + poly + "\n",\r
- "GSDIR successfully completed",\r
- JOptionPane.INFORMATION_MESSAGE );\r
+ "GSDIR successfully completed",\r
+ JOptionPane.INFORMATION_MESSAGE );\r
}\r
}\r
\r
if ( getCurrentTreePanel() != null ) {\r
if ( getCurrentTreePanel().isCurrentTreeIsSubtree() ) {\r
JOptionPane\r
- .showMessageDialog( this,\r
- "This operation can only be performed on a complete tree, not on the currently displayed sub-tree only.",\r
- "Operation can not be exectuted on a sub-tree",\r
- JOptionPane.WARNING_MESSAGE );\r
+ .showMessageDialog( this,\r
+ "This operation can only be performed on a complete tree, not on the currently displayed sub-tree only.",\r
+ "Operation can not be exectuted on a sub-tree",\r
+ JOptionPane.WARNING_MESSAGE );\r
return true;\r
}\r
}\r
}\r
}\r
\r
- void static printPhylogenyToPdf( final String file_name ) {\r
- if ( !getOptions().isPrintUsingActualSize() ) {\r
- getCurrentTreePanel()\r
- .calcParametersForPainting( getOptions().getPrintSizeX(), getOptions().getPrintSizeY() );\r
- getCurrentTreePanel().resetPreferredSize();\r
- getCurrentTreePanel().repaint();\r
+ static void printPhylogenyToPdf( final String file_name,\r
+ final Options opts,\r
+ final TreePanel tp,\r
+ final Component comp ) {\r
+ if ( !opts.isPrintUsingActualSize() ) {\r
+ tp.calcParametersForPainting( opts.getPrintSizeX(), opts.getPrintSizeY() );\r
+ tp.resetPreferredSize();\r
+ tp.repaint();\r
}\r
String pdf_written_to = "";\r
boolean error = false;\r
try {\r
- if ( getOptions().isPrintUsingActualSize() ) {\r
- pdf_written_to = PdfExporter.writePhylogenyToPdf( file_name,\r
- getCurrentTreePanel(),\r
- getCurrentTreePanel().getWidth(),\r
- getCurrentTreePanel().getHeight() );\r
+ if ( opts.isPrintUsingActualSize() ) {\r
+ pdf_written_to = PdfExporter.writePhylogenyToPdf( file_name, tp, tp.getWidth(), tp.getHeight() );\r
}\r
else {\r
- pdf_written_to = PdfExporter.writePhylogenyToPdf( file_name, getCurrentTreePanel(), getOptions()\r
- .getPrintSizeX(), getOptions().getPrintSizeY() );\r
+ pdf_written_to = PdfExporter.writePhylogenyToPdf( file_name,\r
+ tp,\r
+ opts.getPrintSizeX(),\r
+ opts.getPrintSizeY() );\r
}\r
}\r
catch ( final IOException e ) {\r
error = true;\r
- JOptionPane.showMessageDialog( this, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE );\r
+ JOptionPane.showMessageDialog( comp, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE );\r
}\r
if ( !error ) {\r
if ( !ForesterUtil.isEmpty( pdf_written_to ) ) {\r
- JOptionPane.showMessageDialog( this,\r
+ JOptionPane.showMessageDialog( comp,\r
"Wrote PDF to: " + pdf_written_to,\r
"Information",\r
JOptionPane.INFORMATION_MESSAGE );\r
}\r
else {\r
- JOptionPane.showMessageDialog( this,\r
+ JOptionPane.showMessageDialog( comp,\r
"There was an unknown problem when attempting to write to PDF file: \""\r
+ file_name + "\"",\r
- "Error",\r
- JOptionPane.ERROR_MESSAGE );\r
+ "Error",\r
+ JOptionPane.ERROR_MESSAGE );\r
}\r
}\r
- if ( !getOptions().isPrintUsingActualSize() ) {\r
- getControlPanel().showWhole();\r
+ if ( !opts.isPrintUsingActualSize() ) {\r
+ tp.getControlPanel().showWhole();\r
}\r
}\r
\r
void updateOptions( final Options options ) {\r
options.setAntialiasScreen( ( _screen_antialias_cbmi != null ) && _screen_antialias_cbmi.isSelected() );\r
options.setBackgroundColorGradient( ( _background_gradient_cbmi != null )\r
- && _background_gradient_cbmi.isSelected() );\r
+ && _background_gradient_cbmi.isSelected() );\r
options.setShowDomainLabels( ( _show_domain_labels != null ) && _show_domain_labels.isSelected() );\r
options.setShowAnnotationRefSource( ( _show_annotation_ref_source != null )\r
- && _show_annotation_ref_source.isSelected() );\r
+ && _show_annotation_ref_source.isSelected() );\r
options.setAbbreviateScientificTaxonNames( ( _abbreviate_scientific_names != null )\r
- && _abbreviate_scientific_names.isSelected() );\r
+ && _abbreviate_scientific_names.isSelected() );\r
options.setColorLabelsSameAsParentBranch( ( _color_labels_same_as_parent_branch != null )\r
- && _color_labels_same_as_parent_branch.isSelected() );\r
+ && _color_labels_same_as_parent_branch.isSelected() );\r
options.setShowDefaultNodeShapesInternal( ( _show_default_node_shapes_internal_cbmi != null )\r
- && _show_default_node_shapes_internal_cbmi.isSelected() );\r
+ && _show_default_node_shapes_internal_cbmi.isSelected() );\r
options.setShowDefaultNodeShapesExternal( ( _show_default_node_shapes_external_cbmi != null )\r
- && _show_default_node_shapes_external_cbmi.isSelected() );\r
+ && _show_default_node_shapes_external_cbmi.isSelected() );\r
options.setShowDefaultNodeShapesForMarkedNodes( ( _show_default_node_shapes_for_marked_cbmi != null )\r
- && _show_default_node_shapes_for_marked_cbmi.isSelected() );\r
+ && _show_default_node_shapes_for_marked_cbmi.isSelected() );\r
if ( ( _non_lined_up_cladograms_rbmi != null ) && ( _non_lined_up_cladograms_rbmi.isSelected() ) ) {\r
options.setCladogramType( CLADOGRAM_TYPE.NON_LINED_UP );\r
}\r
options.setCladogramType( CLADOGRAM_TYPE.EXT_NODE_SUM_DEP );\r
}\r
options.setSearchCaseSensitive( ( _search_case_senstive_cbmi != null )\r
- && _search_case_senstive_cbmi.isSelected() );\r
+ && _search_case_senstive_cbmi.isSelected() );\r
if ( ( _show_scale_cbmi != null ) && _show_scale_cbmi.isEnabled() ) {\r
options.setShowScale( _show_scale_cbmi.isSelected() );\r
}\r
}\r
options.setShowOverview( ( _show_overview_cbmi != null ) && _show_overview_cbmi.isSelected() );\r
options.setShowConfidenceStddev( ( _show_confidence_stddev_cbmi != null )\r
- && _show_confidence_stddev_cbmi.isSelected() );\r
+ && _show_confidence_stddev_cbmi.isSelected() );\r
if ( ( _color_by_taxonomic_group_cbmi != null ) && _color_by_taxonomic_group_cbmi.isEnabled() ) {\r
options.setColorByTaxonomicGroup( _color_by_taxonomic_group_cbmi.isSelected() );\r
}\r
options.setPrintUsingActualSize( ( _print_using_actual_size_cbmi != null )\r
- && ( _print_using_actual_size_cbmi.isSelected() ) );\r
+ && ( _print_using_actual_size_cbmi.isSelected() ) );\r
options.setGraphicsExportUsingActualSize( ( _graphics_export_using_actual_size_cbmi != null )\r
- && ( _graphics_export_using_actual_size_cbmi.isSelected() ) );\r
+ && ( _graphics_export_using_actual_size_cbmi.isSelected() ) );\r
options.setAntialiasPrint( ( _antialias_print_cbmi != null ) && _antialias_print_cbmi.isSelected() );\r
if ( ( _use_brackets_for_conf_in_nh_export_cbmi != null )\r
&& _use_brackets_for_conf_in_nh_export_cbmi.isSelected() ) {\r
options.setNhConversionSupportValueStyle( NH_CONVERSION_SUPPORT_VALUE_STYLE.NONE );\r
}\r
options.setPrintBlackAndWhite( ( _print_black_and_white_cbmi != null )\r
- && _print_black_and_white_cbmi.isSelected() );\r
+ && _print_black_and_white_cbmi.isSelected() );\r
options.setInternalNumberAreConfidenceForNhParsing( ( _internal_number_are_confidence_for_nh_parsing_cbmi != null )\r
- && _internal_number_are_confidence_for_nh_parsing_cbmi.isSelected() );\r
+ && _internal_number_are_confidence_for_nh_parsing_cbmi.isSelected() );\r
if ( ( _extract_taxonomy_pfam_strict_rbmi != null ) && _extract_taxonomy_pfam_strict_rbmi.isSelected() ) {\r
options.setTaxonomyExtraction( TAXONOMY_EXTRACTION.PFAM_STYLE_STRICT );\r
}\r
options.setTaxonomyExtraction( TAXONOMY_EXTRACTION.NO );\r
}\r
options.setReplaceUnderscoresInNhParsing( ( _replace_underscores_cbmi != null )\r
- && _replace_underscores_cbmi.isSelected() );\r
+ && _replace_underscores_cbmi.isSelected() );\r
options.setAllowErrorsInDistanceToParent( ( _allow_errors_in_distance_to_parent_cbmi != null )\r
- && _allow_errors_in_distance_to_parent_cbmi.isSelected() );\r
+ && _allow_errors_in_distance_to_parent_cbmi.isSelected() );\r
options.setMatchWholeTermsOnly( ( _search_whole_words_only_cbmi != null )\r
- && _search_whole_words_only_cbmi.isSelected() );\r
+ && _search_whole_words_only_cbmi.isSelected() );\r
options.setSearchWithRegex( ( _search_with_regex_cbmi != null ) && _search_with_regex_cbmi.isSelected() );\r
options.setInverseSearchResult( ( _inverse_search_result_cbmi != null )\r
- && _inverse_search_result_cbmi.isSelected() );\r
+ && _inverse_search_result_cbmi.isSelected() );\r
if ( _graphics_export_visible_only_cbmi != null ) {\r
options.setGraphicsExportVisibleOnly( _graphics_export_visible_only_cbmi.isSelected() );\r
if ( _graphics_export_visible_only_cbmi.isSelected() && ( _graphics_export_using_actual_size_cbmi != null ) ) {\r
title = "\"" + getMainPanel().getCurrentPhylogeny().getName() + "\" in " + title;\r
}\r
showTextFrame( _mainpanel.getCurrentPhylogeny().toNewHampshire( getOptions()\r
- .getNhConversionSupportValueStyle() ),\r
- title );\r
+ .getNhConversionSupportValueStyle() ),\r
+ title );\r
}\r
}\r
\r
JOptionPane.showMessageDialog( this,\r
"There was an unknown problem when attempting to write to an image file: \""\r
+ file_name + "\"",\r
- "Error",\r
- JOptionPane.ERROR_MESSAGE );\r
+ "Error",\r
+ JOptionPane.ERROR_MESSAGE );\r
}\r
}\r
_contentpane.repaint();\r
\r
static File writeToPdf( final Phylogeny t,\r
final MainPanel mp,\r
- JFileChooser writetopdf_filechooser,\r
- File curr_dir,\r
- Container contentpane ,\r
- Component component ) {\r
+ final JFileChooser writetopdf_filechooser,\r
+ final File curr_dir,\r
+ final Container contentpane,\r
+ final Component component ) {\r
if ( ( t == null ) || t.isEmpty() ) {\r
return null;\r
}\r
String initial_filename = "";\r
- if (mp.getCurrentTreePanel().getTreeFile() != null ) {\r
+ if ( mp.getCurrentTreePanel().getTreeFile() != null ) {\r
initial_filename = mp.getCurrentTreePanel().getTreeFile().toString();\r
}\r
if ( initial_filename.indexOf( '.' ) > 0 ) {\r
}\r
final int result = writetopdf_filechooser.showSaveDialog( contentpane );\r
File file = writetopdf_filechooser.getSelectedFile();\r
- // setCurrentDir( writetopdf_filechooser.getCurrentDirectory() );\r
+ // setCurrentDir( writetopdf_filechooser.getCurrentDirectory() );\r
final File new_current_dir = writetopdf_filechooser.getCurrentDirectory();\r
if ( ( file != null ) && ( result == JFileChooser.APPROVE_OPTION ) ) {\r
if ( !file.toString().toLowerCase().endsWith( ".pdf" ) ) {\r
return null;\r
}\r
}\r
- printPhylogenyToPdf( file.toString() );\r
+ printPhylogenyToPdf( file.toString(), mp.getOptions(), mp.getCurrentTreePanel(), component );\r
}\r
return new_current_dir;\r
}\r
}\r
if ( ( nodes == null ) || nodes.isEmpty() ) {\r
JOptionPane\r
- .showMessageDialog( this,\r
- "Need to select nodes, either via direct selection or via the \"Search\" function",\r
- "No nodes selected for annotation",\r
- JOptionPane.ERROR_MESSAGE );\r
+ .showMessageDialog( this,\r
+ "Need to select nodes, either via direct selection or via the \"Search\" function",\r
+ "No nodes selected for annotation",\r
+ JOptionPane.ERROR_MESSAGE );\r
return;\r
}\r
final Phylogeny phy = getMainPanel().getCurrentPhylogeny();\r
my_panel,\r
"Enter the sequence annotation(s) for the "\r
+ nodes.size() + " selected nodes",\r
- JOptionPane.OK_CANCEL_OPTION );\r
+ JOptionPane.OK_CANCEL_OPTION );\r
if ( result == JOptionPane.OK_OPTION ) {\r
String ref = ref_field.getText();\r
String desc = desc_filed.getText();\r
for( final PhylogenyNode n : nodes ) {\r
ForesterUtil.ensurePresenceOfSequence( n );\r
final Annotation ann = ForesterUtil.isEmpty( ref ) ? new Annotation()\r
- : new Annotation( ref );\r
+ : new Annotation( ref );\r
if ( !ForesterUtil.isEmpty( desc ) ) {\r
ann.setDesc( desc );\r
}\r
.showInputDialog( this,\r
"Please enter the minimum for confidence values to be displayed.\n"\r
+ "[current value: " + getOptions().getMinConfidenceValue() + "]\n",\r
- "Minimal Confidence Value",\r
- JOptionPane.QUESTION_MESSAGE,\r
- null,\r
- null,\r
- getOptions().getMinConfidenceValue() );\r
+ "Minimal Confidence Value",\r
+ JOptionPane.QUESTION_MESSAGE,\r
+ null,\r
+ null,\r
+ getOptions().getMinConfidenceValue() );\r
if ( !ForesterUtil.isEmpty( s ) ) {\r
boolean success = true;\r
double m = 0.0;\r
}\r
if ( ( nodes == null ) || nodes.isEmpty() ) {\r
JOptionPane\r
- .showMessageDialog( this,\r
- "Need to select external nodes, either via direct selection or via the \"Search\" function",\r
- "No external nodes selected to " + function.toLowerCase(),\r
- JOptionPane.ERROR_MESSAGE );\r
+ .showMessageDialog( this,\r
+ "Need to select external nodes, either via direct selection or via the \"Search\" function",\r
+ "No external nodes selected to " + function.toLowerCase(),\r
+ JOptionPane.ERROR_MESSAGE );\r
return;\r
}\r
final int todo = nodes.size();\r
return;\r
}\r
final int result = JOptionPane.showConfirmDialog( null, function + " " + todo\r
- + " external node(s), from a total of " + ext + " external nodes," + "\nresulting in tree with " + res\r
- + " nodes?", function + " external nodes", JOptionPane.OK_CANCEL_OPTION );\r
+ + " external node(s), from a total of " + ext + " external nodes," + "\nresulting in tree with " + res\r
+ + " nodes?", function + " external nodes", JOptionPane.OK_CANCEL_OPTION );\r
if ( result == JOptionPane.OK_OPTION ) {\r
if ( !delete ) {\r
final List<PhylogenyNode> to_delete = new ArrayList<PhylogenyNode>();\r
return _previous_node_annotation_ref;\r
}\r
\r
- static void print( final TreePanel tp,\r
- final Options op,\r
- \r
- final Component c\r
- ) {\r
- if ( ( tp == null ) || ( tp.getPhylogeny() == null )\r
- || tp.getPhylogeny().isEmpty() ) {\r
+ static void print( final TreePanel tp, final Options op, final Component c ) {\r
+ if ( ( tp == null ) || ( tp.getPhylogeny() == null ) || tp.getPhylogeny().isEmpty() ) {\r
return;\r
}\r
if ( !op.isPrintUsingActualSize() ) {\r
- tp.calcParametersForPainting( op.getPrintSizeX() - 80,\r
- op.getPrintSizeY() - 140 );\r
+ tp.calcParametersForPainting( op.getPrintSizeX() - 80, op.getPrintSizeY() - 140 );\r
tp.resetPreferredSize();\r
tp.repaint();\r
}\r
"Please enter the default size for node shapes.\n"\r
+ "[current value: "\r
+ options.getDefaultNodeShapeSize() + "]\n",\r
- "Node Shape Size",\r
- JOptionPane.QUESTION_MESSAGE,\r
- null,\r
- null,\r
- options.getDefaultNodeShapeSize() );\r
+ "Node Shape Size",\r
+ JOptionPane.QUESTION_MESSAGE,\r
+ null,\r
+ null,\r
+ options.getDefaultNodeShapeSize() );\r
if ( !ForesterUtil.isEmpty( s ) ) {\r
boolean success = true;\r
double m = 0.0;\r
static void setTextColorChooseMenuItem( final JMenuItem mi, final TreePanel tree_panel ) {\r
if ( ( tree_panel != null ) && ( tree_panel.getTreeColorSet() != null ) ) {\r
mi.setText( "Select Color Scheme... (current: " + tree_panel.getTreeColorSet().getCurrentColorSchemeName()\r
- + ")" );\r
+ + ")" );\r
}\r
else {\r
mi.setText( "Select Color Scheme..." );\r