return true;
}
- final static boolean isMac() {
- try {
- final String s = ForesterUtil.OS_NAME.toLowerCase();
- return s.startsWith( "mac" );
- }
- catch ( final Exception e ) {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME, "minor error: " + e );
- return false;
- }
- }
-
final static boolean isUsOrCanada() {
try {
if ( ( Locale.getDefault().equals( Locale.CANADA ) ) || ( Locale.getDefault().equals( Locale.US ) ) ) {
return false;
}
- final static boolean isWindows() {
- try {
- final String s = ForesterUtil.OS_NAME.toLowerCase();
- return s.indexOf( "win" ) > -1;
- }
- catch ( final Exception e ) {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME, "minor error: " + e );
- return false;
- }
- }
-
final static void lookAtSomeTreePropertiesForAptxControlSettings( final Phylogeny t,
final ControlPanel atv_control,
final Configuration configuration ) {
if ( os.toLowerCase().startsWith( "win" ) ) {
Runtime.getRuntime().exec( "rundll32 url.dll,FileProtocolHandler " + url );
}
- else if ( isMac() ) {
+ else if ( ForesterUtil.isMac() ) {
final Class<?> file_mgr = Class.forName( "com.apple.eio.FileManager" );
final Method open_url = file_mgr.getDeclaredMethod( "openURL", new Class[] { String.class } );
open_url.invoke( null, new Object[] { url } );
}
boolean isAntialiasScreen() {
- if ( AptxUtil.isMac() ) {
- // Apple Macintosh graphics are slow, turn off anti-alias.
- return false;
- }
+ // if ( AptxUtil.isMac() ) {
+ // Apple Macintosh graphics are slow, turn off anti-alias.
+ // return false;
+ //}
return _antialias_screen;
}
}
final boolean isUseNativeUI() {
- if ( ( _ui == UI.UNKNOWN ) && AptxUtil.isMac() ) {
+ if ( ( _ui == UI.UNKNOWN ) && ForesterUtil.isMac() ) {
_ui = UI.NATIVE;
}
return _ui == UI.NATIVE;
}
}
else if ( key.equals( "species_color" ) ) {
- getSpeciesColors().put( ( ( String ) st.nextElement() ).replace( '_', ' ' ), Color.decode( ( String ) st.nextElement() ) );
+ getSpeciesColors().put( ( ( String ) st.nextElement() ).replace( '_', ' ' ),
+ Color.decode( ( String ) st.nextElement() ) );
}
else if ( key.equals( "domain_color" ) ) {
getDomainColors().put( ( String ) st.nextElement(), Color.decode( ( String ) st.nextElement() ) );
public final static boolean __SYNTH_LF = false; // TODO remove me
public final static boolean ALLOW_DDBJ_BLAST = false;
public final static String PRG_NAME = "Archaeopteryx";
- final static String VERSION = "0.9811 A1ST";
- final static String PRG_DATE = "130327";
+ final static String VERSION = "0.9812 A1ST";
+ final static String PRG_DATE = "130401";
final static String DEFAULT_CONFIGURATION_FILE_NAME = "_aptx_configuration_file";
final static String[] DEFAULT_FONT_CHOICES = { "Arial", "Helvetica",
"Verdana", "Tahoma", "Dialog", "Lucida Sans", "SansSerif", "Sans-serif", "Sans" };
_zoom_in_y.setToolTipText( "To zoom in vertically [Shift+cursor-up]" );
_zoom_out_x.setToolTipText( "To zoom out horizontally [Shift+cursor-left]" );
_zoom_out_y.setToolTipText( "To zoom out vertically [Shift+cursor-down]" );
- if ( getConfiguration().isUseNativeUI() && AptxUtil.isMac() ) {
+ if ( getConfiguration().isUseNativeUI() && ForesterUtil.isMac() ) {
_zoom_out_x.setPreferredSize( new Dimension( 55, 10 ) );
_zoom_in_x.setPreferredSize( new Dimension( 55, 10 ) );
}
private File getCurrentDir() {
if ( ( _current_dir == null ) || !_current_dir.canRead() ) {
- if ( ForesterUtil.isWindowns() ) {
+ if ( ForesterUtil.isWindows() ) {
try {
_current_dir = new File( WindowsUtils.getCurrentUserDesktopPath() );
}
import java.io.IOException;
import org.forester.phylogeny.Phylogeny;
+import org.forester.util.ForesterUtil;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
document.open();
final DefaultFontMapper mapper = new DefaultFontMapper();
FontFactory.registerDirectories();
- if ( AptxUtil.isWindows() ) {
+ if ( ForesterUtil.isWindows() ) {
mapper.insertDirectory( "C:\\WINDOWS\\Fonts\\" );
}
- else if ( AptxUtil.isMac() ) {
+ else if ( ForesterUtil.isMac() ) {
mapper.insertDirectory( "/Library/Fonts/" );
mapper.insertDirectory( "/System/Library/Fonts/" );
}
public final class TreePanel extends JPanel implements ActionListener, MouseWheelListener, Printable {
+ private static final BasicStroke STROKE_2 = new BasicStroke( 2f );
+ private static final BasicStroke STROKE_1 = new BasicStroke( 1f );
+ private static final BasicStroke STROKE_075 = new BasicStroke( 0.75f );
+ private static final BasicStroke STROKE_05 = new BasicStroke( 0.5f );
+ private static final BasicStroke STROKE_025 = new BasicStroke( 0.25f );
+ private static final BasicStroke STROKE_01 = new BasicStroke( 0.1f );
+ private static final BasicStroke STROKE_005 = new BasicStroke( 0.05f );
private static final float PI = ( float ) ( Math.PI );
private static final double TWO_PI = 2 * Math.PI;
private static final float ONEHALF_PI = ( float ) ( 1.5 * Math.PI );
if ( !ForesterUtil.isEmpty( tax.getTaxonomyCode() ) ) {
c = getControlPanel().getSpeciesColors().get( tax.getTaxonomyCode() );
}
- if ( c == null && !ForesterUtil.isEmpty( tax.getScientificName() ) ) {
+ if ( ( c == null ) && !ForesterUtil.isEmpty( tax.getScientificName() ) ) {
c = getControlPanel().getSpeciesColors().get( tax.getScientificName() );
}
if ( c == null ) {
c = AptxUtil.calculateColorFromString( tax.getTaxonomyCode() );
getControlPanel().getSpeciesColors().put( tax.getTaxonomyCode(), c );
}
- else {
+ else {
c = AptxUtil.calculateColorFromString( tax.getScientificName() );
getControlPanel().getSpeciesColors().put( tax.getScientificName(), c );
}
g.fillRect( graphics_file_x, graphics_file_y, graphics_file_width, graphics_file_height );
}
}
- g.setStroke( new BasicStroke( 1 ) );
+ setupStroke( g );
}
else {
g.setStroke( new BasicStroke( getOptions().getPrintLineWidth() ) );
return Blast.isContainsQueryForBlast( node );
}
+ final private String isCanOpenSeqWeb( final PhylogenyNode node ) {
+ String v = ForesterUtil.extractUniProtKbProteinSeqIdentifier( node );
+ if ( ForesterUtil.isEmpty( v ) ) {
+ v = ForesterUtil.extractGenbankAccessor( node );
+ }
+ if ( ForesterUtil.isEmpty( v ) ) {
+ v = ForesterUtil.extractRefSeqAccessorAccessor( node );
+ }
+ if ( ForesterUtil.isEmpty( v ) ) {
+ v = ForesterUtil.extractGInumber( node );
+ }
+ return v;
+ }
+
final private boolean isCanOpenTaxWeb( final PhylogenyNode node ) {
if ( node.getNodeData().isHasTaxonomy()
&& ( ( !ForesterUtil.isEmpty( node.getNodeData().getTaxonomy().getScientificName() ) )
}
}
- final private String isCanOpenSeqWeb( final PhylogenyNode node ) {
- String v = ForesterUtil.extractUniProtKbProteinSeqIdentifier( node );
- if ( ForesterUtil.isEmpty( v ) ) {
- v = ForesterUtil.extractGenbankAccessor( node );
- }
- if ( ForesterUtil.isEmpty( v ) ) {
- v = ForesterUtil.extractRefSeqAccessorAccessor( node );
- }
- if ( ForesterUtil.isEmpty( v ) ) {
- v = ForesterUtil.extractGInumber( node );
- }
- return v;
- }
-
final private void openSeqWeb( final PhylogenyNode node ) {
if ( ForesterUtil.isEmpty( isCanOpenSeqWeb( node ) ) ) {
cannotOpenBrowserWarningMessage( "sequence" );
.getWidth() ) ) ) );
_phylogeny.getRoot().setYSecondary( ( getVisibleRect().y + getOvYStart() ) );
final Stroke s = g.getStroke();
- g.setStroke( new BasicStroke( 0.5f ) ); //TODO
+ g.setStroke( STROKE_05 );
for( final PhylogenyNode element : _nodes_in_preorder ) {
paintNodeLite( g, element );
}
_scale_label = scale_label;
}
+ private final void setupStroke( final Graphics2D g ) {
+ if ( getYdistance() < 0.001 ) {
+ g.setStroke( STROKE_005 );
+ }
+ else if ( getYdistance() < 0.01 ) {
+ g.setStroke( STROKE_01 );
+ }
+ else if ( getYdistance() < 0.5 ) {
+ g.setStroke( STROKE_025 );
+ }
+ else if ( getYdistance() < 1 ) {
+ g.setStroke( STROKE_05 );
+ }
+ else if ( getYdistance() < 2 ) {
+ g.setStroke( STROKE_075 );
+ }
+ else if ( getYdistance() < 20 ) {
+ g.setStroke( STROKE_1 );
+ }
+ else {
+ g.setStroke( STROKE_2 );
+ }
+ }
+
final private void setUpUrtFactor() {
final int d = getVisibleRect().width < getVisibleRect().height ? getVisibleRect().width
: getVisibleRect().height;
public final class ForesterConstants {
- public final static String FORESTER_VERSION = "1.026";
- public final static String FORESTER_DATE = "130326";
+ public final static String FORESTER_VERSION = "1.027";
+ public final static String FORESTER_DATE = "130401";
public final static String PHYLO_XML_VERSION = "1.10";
public final static String PHYLO_XML_LOCATION = "http://www.phyloxml.org";
public final static String PHYLO_XML_XSD = "phyloxml.xsd";
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.forester.archaeopteryx.Constants;
import org.forester.phylogeny.PhylogenyNode;
import org.forester.phylogeny.data.Distribution;
import org.forester.phylogeny.data.Sequence;
return isReadableFile( new File( s ) );
}
- public static boolean isWindowns() {
- return ForesterUtil.OS_NAME.toLowerCase().indexOf( "win" ) > -1;
+ public final static boolean isWindows() {
+ try {
+ return OS_NAME.toLowerCase().indexOf( "win" ) > -1;
+ }
+ catch ( final Exception e ) {
+ ForesterUtil.printWarningMessage( Constants.PRG_NAME, "minor error: " + e );
+ return false;
+ }
+ }
+
+ public final static boolean isMac() {
+ try {
+ return OS_NAME.toLowerCase().startsWith( "mac" );
+ }
+ catch ( final Exception e ) {
+ ForesterUtil.printWarningMessage( Constants.PRG_NAME, "minor error: " + e );
+ return false;
+ }
}
final public static String isWritableFile( final File f ) {