in progress
[jalview.git] / forester / java / src / org / forester / archaeopteryx / Configuration.java
index 2333e77..0e6b05f 100644 (file)
@@ -8,7 +8,7 @@
 // and Howard Hughes Medical Institute
 // Copyright (C) 2003-2007 Ethalinda K.S. Cannon
 // All rights reserved
-// 
+//
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
@@ -18,7 +18,7 @@
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 // Lesser General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU Lesser General Public
 // License along with this library; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
@@ -51,11 +51,14 @@ import org.forester.util.ForesterUtil;
 
 public final class Configuration {
 
+    public enum UI {
+        NATIVE, CROSSPLATFORM, NIMBUS, UNKNOWN
+    }
     static final String                     VALIDATE_AGAINST_PHYLOXML_XSD_SCHEMA                   = "validate_against_phyloxml_xsd_schema";
     private static final String             WEB_LINK_KEY                                           = "web_link";
     private static final String             DISPLAY_COLOR_KEY                                      = "display_color";
     private static final int                DEPRECATED                                             = -2;
-    private TRIPLET                         _native_ui                                             = TRIPLET.FALSE;
+    private UI                              _ui                                                    = UI.UNKNOWN;
     private boolean                         _use_tabbed_display                                    = false;
     private boolean                         _hide_controls_and_menus                               = false;
     private CLADOGRAM_TYPE                  _cladogram_type                                        = Constants.CLADOGRAM_TYPE_DEFAULT;
@@ -183,7 +186,6 @@ public final class Configuration {
     private static Hashtable<String, Color> _annotation_colors;
     boolean                                 verbose                                                = Constants.VERBOSE_DEFAULT;
     private NODE_LABEL_DIRECTION            _node_label_direction                                  = NODE_LABEL_DIRECTION.HORIZONTAL;
-    private TRIPLET                         _use_native_ui;
     private Color                           _gui_background_color                                  = Constants.GUI_BACKGROUND_DEFAULT;
     private Color                           _gui_checkbox_text_color                               = Constants.CHECKBOX_TEXT_COLOR_DEFAULT;
     private Color                           _gui_checkbox_and_button_active_color                  = Constants.CHECKBOX_AND_BUTTON_ACTIVE_COLOR_DEFAULT;
@@ -462,7 +464,7 @@ public final class Configuration {
         return _graphics_export_y;
     }
 
-    int getDefaultBootstrapSamples() {
+    public int getDefaultBootstrapSamples() {
         return _default_bootstrap_samples;
     }
 
@@ -583,18 +585,10 @@ public final class Configuration {
     }
 
     final boolean isUseNativeUI() {
-        if ( ( _use_native_ui == null ) || ( _use_native_ui == TRIPLET.UNKNOWN ) ) {
-            if ( ( _native_ui == TRIPLET.UNKNOWN ) && Util.isMac() && Util.isJava15() ) {
-                _use_native_ui = TRIPLET.TRUE;
-            }
-            else if ( _native_ui == TRIPLET.TRUE ) {
-                _use_native_ui = TRIPLET.TRUE;
-            }
-            else {
-                _use_native_ui = TRIPLET.FALSE;
-            }
+        if ( ( _ui == UI.UNKNOWN ) && Util.isMac() && Util.isJava15() ) {
+            _ui = UI.NATIVE;
         }
-        return _use_native_ui == TRIPLET.TRUE;
+        return _ui == UI.NATIVE;
     }
 
     /**
@@ -793,18 +787,18 @@ public final class Configuration {
         else if ( key.equals( "native_ui" ) ) {
             final String my_str = ( ( String ) st.nextElement() ).trim().toLowerCase();
             if ( my_str.equals( "yes" ) || my_str.equals( "true" ) ) {
-                _native_ui = TRIPLET.TRUE;
+                _ui = UI.NATIVE;
             }
             else if ( my_str.equals( "no" ) || my_str.equals( "false" ) ) {
-                _native_ui = TRIPLET.FALSE;
+                _ui = UI.CROSSPLATFORM;
             }
             else if ( my_str.equals( "?" ) ) {
-                _native_ui = TRIPLET.UNKNOWN;
+                _ui = UI.UNKNOWN;
             }
             else {
                 ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not parse yes/no/? value from [" + my_str
                         + "]" );
-                _native_ui = TRIPLET.FALSE;
+                _ui = UI.UNKNOWN;
             }
         }
         else if ( key.equals( VALIDATE_AGAINST_PHYLOXML_XSD_SCHEMA ) ) {
@@ -1235,8 +1229,9 @@ public final class Configuration {
                 }
                 else if ( key.equals( WEB_LINK_KEY ) ) {
                     if ( st.countTokens() == 3 ) {
-                        createWebLink( ( String ) st.nextElement(), ( String ) st.nextElement(), ( String ) st
-                                .nextElement() );
+                        createWebLink( ( String ) st.nextElement(),
+                                       ( String ) st.nextElement(),
+                                       ( String ) st.nextElement() );
                     }
                     else {
                         ForesterUtil.printWarningMessage( Constants.PRG_NAME,