cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r911006 - in /cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler: dialog/codegen/GeneratorController.java editor/SelectQueryOrderingTab.java
Date Wed, 17 Feb 2010 14:55:14 GMT
Author: oltka
Date: Wed Feb 17 14:55:13 2010
New Revision: 911006

URL: http://svn.apache.org/viewvc?rev=911006&view=rev
Log:
CAY-1327 Migrate HSQLDB modeler preferences to Java preferences API

Modified:
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorController.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/SelectQueryOrderingTab.java

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorController.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorController.java?rev=911006&r1=911005&r2=911006&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorController.java
(original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorController.java
Wed Feb 17 14:55:13 2010
@@ -23,6 +23,7 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
+import java.util.prefs.Preferences;
 
 import javax.swing.JButton;
 import javax.swing.JFileChooser;
@@ -44,8 +45,6 @@
 import org.apache.cayenne.modeler.pref.FSPath;
 import org.apache.cayenne.modeler.util.CayenneController;
 import org.apache.cayenne.modeler.util.CodeValidationUtil;
-import org.apache.cayenne.pref.Domain;
-import org.apache.cayenne.pref.PreferenceDetail;
 import org.apache.cayenne.swing.BindingBuilder;
 import org.apache.cayenne.util.Util;
 import org.apache.cayenne.validation.BeanValidationFailure;
@@ -154,19 +153,12 @@
         generator.addEntities(entities);
         generator.addEmbeddables(getParentController().getSelectedEmbeddables());
         generator.addQueries(getParentController().getDataMap().getQueries());
+        
+        Preferences preferences = application.getPreferencesNode(ClassGenerationAction.class,
"").node(GeneralPreferences.ENCODING_PREFERENCE);
 
-        // configure encoding from preferences
-        Domain generatorPrefs = Application
-                .getInstance()
-                .getPreferenceDomain()
-                .getSubdomain(ClassGenerationAction.class);
-
-        PreferenceDetail detail = generatorPrefs.getDetail(
-                GeneralPreferences.ENCODING_PREFERENCE,
-                false);
-        if (detail != null) {
-            generator.setEncoding(detail
-                    .getProperty(GeneralPreferences.ENCODING_PREFERENCE));
+        if (preferences != null) {
+            generator.setEncoding(preferences
+                    .get(GeneralPreferences.ENCODING_PREFERENCE, null));
         }
 
         generator.setDestDir(outputDir);

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/SelectQueryOrderingTab.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/SelectQueryOrderingTab.java?rev=911006&r1=911005&r2=911006&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/SelectQueryOrderingTab.java
(original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/SelectQueryOrderingTab.java
Wed Feb 17 14:55:13 2010
@@ -26,6 +26,7 @@
 import java.awt.event.ActionListener;
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
+import java.util.prefs.Preferences;
 
 import javax.swing.JButton;
 import javax.swing.JComponent;
@@ -50,8 +51,6 @@
 import org.apache.cayenne.modeler.util.ModelerUtil;
 import org.apache.cayenne.modeler.util.MultiColumnBrowser;
 import org.apache.cayenne.modeler.util.UIUtil;
-import org.apache.cayenne.pref.Domain;
-import org.apache.cayenne.pref.PreferenceDetail;
 import org.apache.cayenne.query.Ordering;
 import org.apache.cayenne.query.Query;
 import org.apache.cayenne.query.SelectQuery;
@@ -98,12 +97,10 @@
         messagePanel = new JPanel(new BorderLayout());
         cardLayout = new CardLayout();
 
-        PreferenceDetail detail = getDomain().getDetail(
-                getDividerLocationProperty(),
-                false);
+        Preferences detail = Application.getInstance().getPreferencesNode(this.getClass(),
"");
 
         int defLocation = Application.getFrame().getHeight() / 2;
-        int location = detail != null ? detail.getIntProperty(
+        int location = detail != null ? detail.getInt(
                 getDividerLocationProperty(),
                 defLocation) : defLocation;
 
@@ -396,10 +393,8 @@
         if (JSplitPane.DIVIDER_LOCATION_PROPERTY.equals(evt.getPropertyName())) {
             int value = (Integer) evt.getNewValue();
 
-            PreferenceDetail detail = getDomain().getDetail(
-                    getDividerLocationProperty(),
-                    true);
-            detail.setIntProperty(getDividerLocationProperty(), value);
+            Preferences detail = Application.getInstance().getPreferencesNode(this.getClass(),
"");
+            detail.putInt(getDividerLocationProperty(), value);
         }
     }
 
@@ -409,9 +404,4 @@
     protected String getDividerLocationProperty() {
         return SPLIT_DIVIDER_LOCATION_PROPERTY;
     }
-
-    protected Domain getDomain() {
-        // note: getClass() returns different values for Orderings and Prefetches tabs
-        return Application.getInstance().getPreferenceDomain().getSubdomain(getClass());
-    }
 }



Mime
View raw message