logging-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sde...@apache.org
Subject svn commit: r954329 - in /logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw: ApplicationPreferenceModel.java ApplicationPreferenceModelPanel.java LogUI.java
Date Sun, 13 Jun 2010 23:26:56 GMT
Author: sdeboy
Date: Sun Jun 13 23:26:56 2010
New Revision: 954329

URL: http://svn.apache.org/viewvc?rev=954329&view=rev
Log:
If command-line config URL is provided, display that value in autoconfig field but persist
the last-saved config URL field (allows switching between command-line URL and default auto-config
URL configurations)

Modified:
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModel.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModelPanel.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModel.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModel.java?rev=954329&r1=954328&r2=954329&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModel.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModel.java
Sun Jun 13 23:26:56 2010
@@ -59,6 +59,11 @@ public class ApplicationPreferenceModel 
     private Vector configurationURLs=new Vector();
 
     private String configurationURL = "";
+
+    /**
+     * Remember current config if provided via means other than configurationURL (command
line arg, etc)
+     */
+    private transient String bypassConfigurationURL = null;
     /**
      *    this means for Receivers that require optional jars that can't be delivered
      *    by the Web start classloader, we need to be able to remove the SecurityManager
in place
@@ -197,7 +202,10 @@ public class ApplicationPreferenceModel 
       if (configurationURLs != null) {
         setConfigurationURLs(configurationURLs);
       }
-      setConfigurationURL(model.getConfigurationURL());
+      //only set current config URL if bypass is null
+      if (model.getBypassConfigurationURL() == null) {
+        setConfigurationURL(model.getConfigurationURL());
+      }
       setLastUsedVersion(model.getLastUsedVersion());
       setOkToRemoveSecurityManager(model.isOkToRemoveSecurityManager());
       Color searchForeground = model.getSearchForegroundColor();
@@ -399,13 +407,29 @@ public class ApplicationPreferenceModel 
     {
         return this.configurationURL;
     }
+
+    public final String getBypassConfigurationURL() {
+        return bypassConfigurationURL;
+    }
+    /*
+      Set to null to un-bypass
+     */
+    public void setBypassConfigurationURL(String bypassConfigurationURL) {
+        //don't change configuration URL..configurationURL is persisted on app exit
+        if (bypassConfigurationURL != null && bypassConfigurationURL.trim().equals(""))
{
+            this.bypassConfigurationURL = null;
+        }
+        this.bypassConfigurationURL = bypassConfigurationURL;
+    }
+
     /**
      * @param configurationURL The configurationURL to set.
      */
     public final void setConfigurationURL(String configurationURL)
     {
         //don't add empty entries, but allow the current configuration URL to be set to an
empty string
-        Object oldValue = this.configurationURL;
+        Object oldValue = this.bypassConfigurationURL != null? this.bypassConfigurationURL:this.configurationURL;
+        bypassConfigurationURL = null;
         if (configurationURL == null || configurationURL.trim().equals("")) {
             this.configurationURL = "";
             firePropertyChange("configurationURL", oldValue, this.configurationURL);

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModelPanel.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModelPanel.java?rev=954329&r1=954328&r2=954329&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModelPanel.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModelPanel.java
Sun Jun 13 23:26:56 2010
@@ -553,7 +553,8 @@ public static void main(String[] args) {
             }
             return true;
         }});
-        configurationURL.setSelectedItem(committedPreferenceModel.getConfigurationURL());
+        String configToDisplay = committedPreferenceModel.getBypassConfigurationURL() !=
null?committedPreferenceModel.getBypassConfigurationURL():committedPreferenceModel.getConfigurationURL();
+        configurationURL.setSelectedItem(configToDisplay);
     }
 
     private void initSliderComponent() {

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java?rev=954329&r1=954328&r2=954329&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java (original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java Sun Jun 13 23:26:56
2010
@@ -279,7 +279,7 @@ public class LogUI extends JFrame implem
     SettingsManager.getInstance().configure(new ApplicationPreferenceModelSaver(model));
     //if a configuration URL param was provided, set the configuration URL field to null
     if (configurationURLAppArg != null) {
-        model.setConfigurationURL("");
+        model.setBypassConfigurationURL(configurationURLAppArg);
     }
 
     applyLookAndFeel(model.getLookAndFeelClassName());



Mime
View raw message