cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mgen...@apache.org
Subject [32/50] cayenne-modeler git commit: Added Use Shared Cache to Data Domain.
Date Thu, 05 Jan 2017 22:09:40 GMT
Added Use Shared Cache to Data Domain.


Project: http://git-wip-us.apache.org/repos/asf/cayenne-modeler/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne-modeler/commit/1067ef92
Tree: http://git-wip-us.apache.org/repos/asf/cayenne-modeler/tree/1067ef92
Diff: http://git-wip-us.apache.org/repos/asf/cayenne-modeler/diff/1067ef92

Branch: refs/heads/master
Commit: 1067ef92d81323ae8fbdb63d351cec398f76f6eb
Parents: 6cdb50e
Author: mrg <blacknext@gmail.com>
Authored: Sun Oct 9 10:57:13 2016 -0400
Committer: mrg <blacknext@gmail.com>
Committed: Sun Oct 9 10:57:13 2016 -0400

----------------------------------------------------------------------
 .../modeler/adapters/DataDomainAdapter.java     | 24 ++++++++-----
 .../modeler/layout/DataDomainLayout.java        |  3 ++
 .../cayenne/modeler/project/CayenneProject.java | 37 ++++++++++++--------
 .../resources/layouts/DataDomainLayout.fxml     |  4 +--
 4 files changed, 43 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne-modeler/blob/1067ef92/src/main/java/org/apache/cayenne/modeler/adapters/DataDomainAdapter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/cayenne/modeler/adapters/DataDomainAdapter.java b/src/main/java/org/apache/cayenne/modeler/adapters/DataDomainAdapter.java
index da1490c..c169968 100644
--- a/src/main/java/org/apache/cayenne/modeler/adapters/DataDomainAdapter.java
+++ b/src/main/java/org/apache/cayenne/modeler/adapters/DataDomainAdapter.java
@@ -36,6 +36,7 @@ public class DataDomainAdapter extends CayennePropertyAdapter // implements
Adap
     private static final String DATA_DOMAIN_NAME   = "dataDomainName";
     private static final String VALIDATING_OBJECTS = "dataDomainValidatingObjects";
     private static final String OBJECT_CACHE_SIZE  = "sizeOfObjectCache";
+    private static final String USE_SHARED_CACHE   = "usingSharedCache";
 
     private final CayenneProject cayenneProject;
 
@@ -45,9 +46,9 @@ public class DataDomainAdapter extends CayennePropertyAdapter // implements
Adap
     private StringProperty  nameProperty;
     private BooleanProperty validatingObjectsProperty;
 
-    private IntegerProperty sizeOfObjectCache;
-    private BooleanProperty useSharedCache;
-    private BooleanProperty remoteChangeNotifications;
+    private IntegerProperty sizeOfObjectCacheProperty;
+    private BooleanProperty useSharedCacheProperty;
+    private BooleanProperty remoteChangeNotificationsProperty;
 
     public DataDomainAdapter(final CayenneProject cayenneProject)
     {
@@ -60,7 +61,8 @@ public class DataDomainAdapter extends CayennePropertyAdapter // implements
Adap
         {
             nameProperty              = JavaBeanStringPropertyBuilder.create().bean(cayenneProject).name(DATA_DOMAIN_NAME).build();
             validatingObjectsProperty = JavaBeanBooleanPropertyBuilder.create().bean(cayenneProject).name(VALIDATING_OBJECTS).build();
-            sizeOfObjectCache         = JavaBeanIntegerPropertyBuilder.create().bean(cayenneProject).name(OBJECT_CACHE_SIZE).build();
+            sizeOfObjectCacheProperty = JavaBeanIntegerPropertyBuilder.create().bean(cayenneProject).name(OBJECT_CACHE_SIZE).build();
+            useSharedCacheProperty    = JavaBeanBooleanPropertyBuilder.create().bean(cayenneProject).name(USE_SHARED_CACHE).build();
         }
         catch (final NoSuchMethodException e)
         {
@@ -73,12 +75,16 @@ public class DataDomainAdapter extends CayennePropertyAdapter // implements
Adap
     public void setName(final String value) { nameProperty.set(value); }
 
     public BooleanProperty validatingObjectsProperty() { return validatingObjectsProperty;
}
-    public Boolean getValidatingObjectsProperty() { return validatingObjectsProperty.get();
}
-    public void setValidatingObjectsProperty(final Boolean value) { validatingObjectsProperty.set(value);
}
+    public Boolean getValidatingObjects() { return validatingObjectsProperty.get(); }
+    public void setValidatingObjects(final Boolean value) { validatingObjectsProperty.set(value);
}
 
-    public IntegerProperty sizeOfObjectCacheProperty() { return sizeOfObjectCache; }
-    public Integer getSizeOfObjectCache() { return sizeOfObjectCache.get(); }
-    public void setSizeOfObjectCache(final Integer value) { sizeOfObjectCache.set(value);
}
+    public IntegerProperty sizeOfObjectCacheProperty() { return sizeOfObjectCacheProperty;
}
+    public Integer getSizeOfObjectCache() { return sizeOfObjectCacheProperty.get(); }
+    public void setSizeOfObjectCache(final Integer value) { sizeOfObjectCacheProperty.set(value);
}
+
+    public BooleanProperty useSharedCacheProperty() { return useSharedCacheProperty; }
+    public Boolean getUseSharedCache() { return useSharedCacheProperty.get(); }
+    public void setUseSharedCache(final Boolean value) { useSharedCacheProperty.set(value);
}
 
     public List<DataMapAdapter> getDataMapAdapters()
     {

http://git-wip-us.apache.org/repos/asf/cayenne-modeler/blob/1067ef92/src/main/java/org/apache/cayenne/modeler/layout/DataDomainLayout.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/cayenne/modeler/layout/DataDomainLayout.java b/src/main/java/org/apache/cayenne/modeler/layout/DataDomainLayout.java
index 816ea74..ff8a021 100644
--- a/src/main/java/org/apache/cayenne/modeler/layout/DataDomainLayout.java
+++ b/src/main/java/org/apache/cayenne/modeler/layout/DataDomainLayout.java
@@ -56,6 +56,8 @@ public class DataDomainLayout
     @FXML
     private Spinner<Integer> objectCacheSizeSpinner;
 
+    @FXML
+    private CheckBox useSharedCacheCheckBox, remoteChangeNotificationsCheckBox;
 
     private DataDomainAdapter dataDomainAdapter;
 
@@ -92,6 +94,7 @@ public class DataDomainLayout
         objectValidationCheckBox.selectedProperty().bindBidirectional(dataDomainAdapter.validatingObjectsProperty());
 
         objectCacheSizeSpinner.getValueFactory().valueProperty().bindBidirectional(dataDomainAdapter.sizeOfObjectCacheProperty().asObject());
+        useSharedCacheCheckBox.selectedProperty().bindBidirectional(dataDomainAdapter.useSharedCacheProperty());
     }
 
     public void beginEditingNotCalled()

http://git-wip-us.apache.org/repos/asf/cayenne-modeler/blob/1067ef92/src/main/java/org/apache/cayenne/modeler/project/CayenneProject.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/cayenne/modeler/project/CayenneProject.java b/src/main/java/org/apache/cayenne/modeler/project/CayenneProject.java
index 61fef37..e5a31ba 100644
--- a/src/main/java/org/apache/cayenne/modeler/project/CayenneProject.java
+++ b/src/main/java/org/apache/cayenne/modeler/project/CayenneProject.java
@@ -136,17 +136,12 @@ public class CayenneProject
 
     public boolean isDataDomainValidatingObjects()
     {
-        return getDomainBooleanProperty(DataDomain.VALIDATING_OBJECTS_ON_COMMIT_PROPERTY,
-                                        Boolean.toString(DataDomain.VALIDATING_OBJECTS_ON_COMMIT_DEFAULT));
+        return getDomainBooleanProperty(DataDomain.VALIDATING_OBJECTS_ON_COMMIT_PROPERTY,
DataDomain.VALIDATING_OBJECTS_ON_COMMIT_DEFAULT);
     }
 
     public void setDataDomainValidatingObjects(final boolean validatingObjects)
     {
-        final String value = validatingObjects ? "true" : "false";
-
-        setDomainProperty(DataDomain.VALIDATING_OBJECTS_ON_COMMIT_PROPERTY,
-                          value,
-                          Boolean.toString(DataDomain.VALIDATING_OBJECTS_ON_COMMIT_DEFAULT));
+        setDomainBooleanProperty(DataDomain.VALIDATING_OBJECTS_ON_COMMIT_PROPERTY, validatingObjects,
DataDomain.VALIDATING_OBJECTS_ON_COMMIT_DEFAULT);
     }
 
     public Integer getSizeOfObjectCache()
@@ -156,7 +151,17 @@ public class CayenneProject
 
     public void setSizeOfObjectCache(Integer cacheSize)
     {
-        setDomainProperty(DataRowStore.SNAPSHOT_CACHE_SIZE_PROPERTY, String.valueOf(cacheSize),
DataRowStore.SNAPSHOT_CACHE_SIZE_PROPERTY);
+        setDomainStringProperty(DataRowStore.SNAPSHOT_CACHE_SIZE_PROPERTY, String.valueOf(cacheSize),
DataRowStore.SNAPSHOT_CACHE_SIZE_PROPERTY);
+    }
+
+    public boolean isUsingSharedCache()
+    {
+        return getDomainBooleanProperty(DataDomain.SHARED_CACHE_ENABLED_PROPERTY, DataDomain.SHARED_CACHE_ENABLED_DEFAULT);
+    }
+
+    public void setUsingSharedCache(final boolean usingSharedCache)
+    {
+        setDomainBooleanProperty(DataDomain.SHARED_CACHE_ENABLED_PROPERTY, usingSharedCache,
DataDomain.SHARED_CACHE_ENABLED_DEFAULT);
     }
 
     public Collection<DataMap> getDataMaps()
@@ -173,7 +178,7 @@ public class CayenneProject
      * Helper method that updates domain properties. If a value equals to
      * default, null value is used instead.
      */
-    protected void setDomainProperty(final String property, String value, final String defaultValue)
+    private void setDomainStringProperty(final String property, String value, final String
defaultValue)
     {
         if (getDataDomain() == null)
             return;
@@ -199,7 +204,7 @@ public class CayenneProject
         }
     }
 
-    public String getDomainProperty(final String property, final String defaultValue)
+    private String getDomainProperty(final String property, final String defaultValue)
     {
         if (getDataDomain() == null)
             return null;
@@ -208,12 +213,17 @@ public class CayenneProject
         return value != null ? value : defaultValue;
     }
 
-    public boolean getDomainBooleanProperty(final String property, final String defaultValue)
+    private boolean getDomainBooleanProperty(final String property, final boolean defaultValue)
     {
-        return "true".equalsIgnoreCase(getDomainProperty(property, defaultValue));
+        return "true".equalsIgnoreCase(getDomainProperty(property, Boolean.toString(defaultValue)));
     }
 
-    public int getDomainIntegerProperty(final String property, final int defaultValue)
+    private void setDomainBooleanProperty(final String property, final boolean value, final
boolean defaultValue)
+    {
+        setDomainStringProperty(property, Boolean.toString(value), Boolean.toString(defaultValue));
+    }
+
+    private int getDomainIntegerProperty(final String property, final int defaultValue)
     {
         try
         {
@@ -225,7 +235,6 @@ public class CayenneProject
         }
     }
 
-
     public DataDomainAdapter getDataDomainAdapter()
     {
         return dataDomainAdapter;

http://git-wip-us.apache.org/repos/asf/cayenne-modeler/blob/1067ef92/src/main/resources/layouts/DataDomainLayout.fxml
----------------------------------------------------------------------
diff --git a/src/main/resources/layouts/DataDomainLayout.fxml b/src/main/resources/layouts/DataDomainLayout.fxml
index 7ec5519..04e63bc 100644
--- a/src/main/resources/layouts/DataDomainLayout.fxml
+++ b/src/main/resources/layouts/DataDomainLayout.fxml
@@ -72,10 +72,10 @@
                <children>
                   <Label alignment="CENTER_RIGHT" text="Size of Object Cache: " />
                   <Spinner fx:id="objectCacheSizeSpinner" editable="true" maxWidth="-Infinity"
minWidth="-Infinity" prefWidth="200.0" GridPane.columnIndex="1" />
-                  <CheckBox mnemonicParsing="false" text="Use Shared Cache" GridPane.columnIndex="1"
GridPane.rowIndex="1" />
+                  <CheckBox fx:id="useSharedCacheCheckBox" mnemonicParsing="false" text="Use
Shared Cache" GridPane.columnIndex="1" GridPane.rowIndex="1" />
                   <HBox alignment="CENTER_LEFT" GridPane.columnIndex="1" GridPane.rowIndex="2">
                      <children>
-                        <CheckBox mnemonicParsing="false" text="Remote Change Notifications"
/>
+                        <CheckBox fx:id="remoteChangeNotificationsCheckBox" mnemonicParsing="false"
text="Remote Change Notifications" />
                         <Pane prefWidth="30.0" />
                         <Button mnemonicParsing="false" text="Configure..." />
                      </children>


Mime
View raw message