private Color _vector_data_mean_color = Color.WHITE;
private double _vector_data_height = 12;
private int _vector_data_width = 120;
+ private boolean _line_up_renderable_node_data;
+ private boolean _right_align_domains;
+
static {
for( final String font_name : Constants.DEFAULT_FONT_CHOICES ) {
if ( Arrays.binarySearch( AptxUtil.getAvailableFontFamiliesSorted(), font_name ) >= 0 ) {
+ "] for [ext_descendents_data_to_return_on]" );
}
}
- //
+
else if ( key.equals( "vector_data_min_color" ) ) {
_vector_data_min_color = Color.decode( ( String ) st.nextElement() );
}
else if ( key.equals( "vector_data_mean_color" ) ) {
_vector_data_mean_color = Color.decode( ( String ) st.nextElement() );
}
- //
+
else if ( key.equals( "vector_data_width" ) ) {
_vector_data_width = parseShort( ( String ) st.nextElement() );
if ( _vector_data_width < 1 ) {
_vector_data_height = 12;
}
}
- //
+
+ else if ( key.equals( "line_up_renderable_data" ) ) {
+ setLineUpRendarableNodeData( parseBoolean( ( String ) st.nextElement() ) );
+ }
+
+ else if ( key.equals( "right_align_domain_architectures" ) ) {
+ setRightLineUpDomains( parseBoolean( ( String ) st.nextElement() ) );
+ }
+
+
else if ( st.countTokens() >= 2 ) { // counts the tokens that are not
// yet retrieved!
int key_index = -1;
public int getVectorDataWidth() {
return _vector_data_width;
}
+
+ final public boolean isLineUpRendarableNodeData() {
+
+ return _line_up_renderable_node_data;
+ }
+
+ final public boolean isRightLineUpDomains() {
+
+ return _right_align_domains;
+ }
+
+ final public void setLineUpRendarableNodeData( final boolean line_up_renderable_node_data) {
+
+ _line_up_renderable_node_data = line_up_renderable_node_data;
+ }
+
+ final public void setRightLineUpDomains( final boolean right_align_domains ) {
+
+ _right_align_domains = right_align_domains;
+ }
+
+
}
import java.util.NoSuchElementException;\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
}\r
}\r
else if ( o == _line_up_renderable_data_cbmi ) {\r
+ if ( !_line_up_renderable_data_cbmi.isSelected() ) {\r
+ _right_line_up_domains_cbmi.setSelected( false );\r
+ }\r
updateOptions( getOptions() );\r
}\r
else if ( o == _right_line_up_domains_cbmi ) {\r
+ if ( _right_line_up_domains_cbmi.isSelected() ) {\r
+ _line_up_renderable_data_cbmi.setSelected( true );\r
+ }\r
updateOptions( getOptions() );\r
}\r
\r
ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );\r
}\r
}\r
+ \r
else {\r
if ( _load_phylogeny_from_webservice_menu_items != null ) {\r
for( int i = 0; i < _load_phylogeny_from_webservice_menu_items.length; ++i ) {\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
- \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
private float _x_correction_factor = 0.0f;
private float _x_distance = 0.0f;
private float _y_distance = 0.0f;
+ private int _length_of_longest_text;
+ private int _longest_domain;
// private Image offscreenImage;
// private Graphics offscreenGraphics;
// private Dimension offscreenDimension;
}
}
}
+ _length_of_longest_text = calcLengthOfLongestText();
}
int ext_nodes = _phylogeny.getRoot().getNumberOfExternalNodes();
final int max_depth = PhylogenyMethods.calculateMaxDepth( _phylogeny );
}
int longest = 30;
int longest_txt = 0;
+ _longest_domain = 0;
PhylogenyNode longest_txt_node = _phylogeny.getFirstExternalNode();
for( final PhylogenyNode node : _phylogeny.getExternalNodes() ) {
int sum = 0;
final DomainArchitecture d = node.getNodeData().getSequence().getDomainArchitecture();
sum += ( ( _domain_structure_width / ( ( RenderableDomainArchitecture ) d ).getOriginalSize()
.getWidth() ) * d.getTotalLength() ) + 10;
+ if ( d.getTotalLength() > _longest_domain ) {
+ _longest_domain = d.getTotalLength();
+ }
}
if ( sum >= max_length ) {
_longest_ext_node_info = max_length;
if ( ( !getControlPanel().isShowInternalData() && !node.isExternal() ) ) {
return;
}
- int length_of_longest_text = -1;
if ( getControlPanel().isShowDomainArchitectures() && node.getNodeData().isHasSequence()
&& ( node.getNodeData().getSequence().getDomainArchitecture() != null ) ) {
RenderableDomainArchitecture rds = null;
rds.setRenderingHeight( h > 1 ? h : 2 );
if ( getControlPanel().isDrawPhylogram() ) {
if ( getOptions().isLineUpRendarableNodeData() ) {
- length_of_longest_text = calcLengthOfLongestText();
-
- rds.render( getMaxDistanceToRoot() * getXcorrectionFactor() + length_of_longest_text, node.getYcoord() - ( h / 2 ), g, this, to_pdf );
+ if ( getOptions().isRightLineUpDomains() ) {
+ rds.render( getMaxDistanceToRoot() * getXcorrectionFactor() + _length_of_longest_text
+ + ( _longest_domain - rds.getTotalLength() )
+ * rds.getRenderingFactorWidth(),
+ node.getYcoord() - ( h / 2 ),
+ g,
+ this,
+ to_pdf );
+ }
+ else {
+ rds.render( getMaxDistanceToRoot() * getXcorrectionFactor() + _length_of_longest_text,
+ node.getYcoord() - ( h / 2 ),
+ g,
+ this,
+ to_pdf );
+ }
}
else {
rds.render( node.getXcoord() + x, node.getYcoord() - ( h / 2 ), g, this, to_pdf );
}
}
else {
- length_of_longest_text = calcLengthOfLongestText();
- rds.render( getPhylogeny().getFirstExternalNode().getXcoord() + length_of_longest_text,
- node.getYcoord() - ( h / 2 ),
- g,
- this,
- to_pdf );
+ if ( getOptions().isRightLineUpDomains() ) {
+ rds.render( getPhylogeny().getFirstExternalNode().getXcoord() + _length_of_longest_text
+ - 20 + ( _longest_domain - rds.getTotalLength() )
+ * rds.getRenderingFactorWidth(),
+ node.getYcoord() - ( h / 2 ),
+ g,
+ this,
+ to_pdf );
+ }
+ else {
+ rds.render( getPhylogeny().getFirstExternalNode().getXcoord() + _length_of_longest_text,
+ node.getYcoord() - ( h / 2 ),
+ g,
+ this,
+ to_pdf );
+ }
}
}
}
rv.render( node.getXcoord() + x + domain_add, node.getYcoord() - 3, g, this, to_pdf );
}
else {
- if ( length_of_longest_text < 0 ) {
- length_of_longest_text = calcLengthOfLongestText();
- }
- rv.render( getPhylogeny().getFirstExternalNode().getXcoord() + length_of_longest_text + domain_add,
+ rv.render( getPhylogeny().getFirstExternalNode().getXcoord() + _length_of_longest_text + domain_add,
node.getYcoord() - 3,
g,
this,
}
}
- private int calcLengthOfLongestText() {
+ final private int calcLengthOfLongestText() {
final StringBuilder sb = new StringBuilder();
nodeDataAsSB( _ext_node_with_longest_txt_info, sb );
if ( _ext_node_with_longest_txt_info.getNodeData().isHasTaxonomy() ) {
nodeTaxonomyDataAsSB( _ext_node_with_longest_txt_info.getNodeData().getTaxonomy(), sb );
}
- return getFontMetricsForLargeDefaultFont().stringWidth( sb.toString() + " " );
+ return getFontMetricsForLargeDefaultFont().stringWidth( sb.toString() );
}
final private void paintOvRectangle( final Graphics2D g ) {