From b79b32bb7a7f0f7a70343acadb8c33e094a3c485 Mon Sep 17 00:00:00 2001 From: "cmzmasek@gmail.com" Date: Fri, 4 Mar 2011 01:11:09 +0000 Subject: [PATCH] new UI types? --- .../org/forester/archaeopteryx/Configuration.java | 28 +++++++++----------- .../archaeopteryx/MainFrameApplication.java | 3 ++- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/forester/java/src/org/forester/archaeopteryx/Configuration.java b/forester/java/src/org/forester/archaeopteryx/Configuration.java index d9a657d..66047c6 100644 --- a/forester/java/src/org/forester/archaeopteryx/Configuration.java +++ b/forester/java/src/org/forester/archaeopteryx/Configuration.java @@ -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 _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 ) ) { diff --git a/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java b/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java index 5c26a5a..3b5c39f 100644 --- a/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java +++ b/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java @@ -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() ); -- 1.7.10.2