new UI types?
authorcmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Fri, 4 Mar 2011 01:11:09 +0000 (01:11 +0000)
committercmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Fri, 4 Mar 2011 01:11:09 +0000 (01:11 +0000)
forester/java/src/org/forester/archaeopteryx/Configuration.java
forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java

index d9a657d..66047c6 100644 (file)
@@ -51,11 +51,14 @@ import org.forester.util.ForesterUtil;
 
 public final class Configuration {
 
+    public enum UI {
+        NATIVE, SYSTEM, 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;
@@ -583,18 +585,12 @@ 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 ) {
+            if ( Util.isMac() && Util.isJava15() ) {
+                _ui = UI.NATIVE;
             }
         }
-        return _use_native_ui == TRIPLET.TRUE;
+        return _ui == UI.NATIVE;
     }
 
     /**
@@ -793,18 +789,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.SYSTEM;
             }
             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 ) ) {
index 5c26a5a..3b5c39f 100644 (file)
@@ -230,7 +230,8 @@ public final class MainFrameApplication extends MainFrame {
         }
         try {
             if ( _configuration.isUseNativeUI() ) {
-                UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() );
+                //  UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() );
+                UIManager.setLookAndFeel( "com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel" );
             }
             else {
                 UIManager.setLookAndFeel( UIManager.getCrossPlatformLookAndFeelClassName() );