Revision: 5769
          http://sourceforge.net/p/jump-pilot/code/5769
Author:   michaudm
Date:     2018-04-17 19:31:45 +0000 (Tue, 17 Apr 2018)
Log Message:
-----------
Open WritableDataStoreDataSource API a bit more to third party extensions.

Modified Paths:
--------------
    core/trunk/src/org/openjump/OpenJumpConfiguration.java
    
core/trunk/src/org/openjump/core/ui/plugin/datastore/AddWritableDataStoreLayerPanel.java
    
core/trunk/src/org/openjump/core/ui/plugin/datastore/AddWritableDataStoreLayerWizard.java

Modified: core/trunk/src/org/openjump/OpenJumpConfiguration.java
===================================================================
--- core/trunk/src/org/openjump/OpenJumpConfiguration.java      2018-04-17 
11:45:55 UTC (rev 5768)
+++ core/trunk/src/org/openjump/OpenJumpConfiguration.java      2018-04-17 
19:31:45 UTC (rev 5769)
@@ -148,8 +148,8 @@
     // [mmichaud 2013-11-08] add new AddWritableDataStoreLayerWizard
       AddWritableDataStoreLayerWizard addWritableDataStoreLayerWizard =
               new AddWritableDataStoreLayerWizard(
-              workbenchContext, DataStoreTransactionManager.getTxInstance(
-                      
"org.openjump.core.ui.plugin.datastore.transaction.DataStoreTransactionManager"));
+              workbenchContext,
+              
"org.openjump.core.ui.plugin.datastore.transaction.DataStoreTransactionManager");
       OpenWizardPlugIn.addWizard(workbenchContext, 
addWritableDataStoreLayerWizard);
     
     // [mmichaud 2012-09-01] changed how RasterImageLayerRendererFactory is 
initialized to fix bug 3526653

Modified: 
core/trunk/src/org/openjump/core/ui/plugin/datastore/AddWritableDataStoreLayerPanel.java
===================================================================
--- 
core/trunk/src/org/openjump/core/ui/plugin/datastore/AddWritableDataStoreLayerPanel.java
    2018-04-17 11:45:55 UTC (rev 5768)
+++ 
core/trunk/src/org/openjump/core/ui/plugin/datastore/AddWritableDataStoreLayerPanel.java
    2018-04-17 19:31:45 UTC (rev 5769)
@@ -87,12 +87,12 @@
                 ((String)datasetComboBox.getSelectedItem()).trim() : null;
     }
 
-    GeometryColumn getGeometryColumn() {
+    public GeometryColumn getGeometryColumn() {
         return geometryAttributeComboBox.getSelectedItem() != null ?
                 ((GeometryColumn)geometryAttributeComboBox.getSelectedItem()) 
: null;
     }
 
-    private PrimaryKeyColumn getIdentifierColumn() throws Exception {
+    public PrimaryKeyColumn getIdentifierColumn() throws Exception {
         Object selectedItem = identifierAttributeComboBox.getSelectedItem();
         if (selectedItem != null) {
             if (selectedItem instanceof PrimaryKeyColumn) {
@@ -105,12 +105,12 @@
         }
     }
 
-    String getGeometryAttributeName() {
+    public String getGeometryAttributeName() {
         return geometryAttributeComboBox.getSelectedItem() != null ?
                 getGeometryColumn().getName().trim() : null;
     }
 
-    String getIdentifierAttributeName() throws Exception {
+    public String getIdentifierAttributeName() throws Exception {
         return identifierAttributeComboBox.getSelectedItem() != null ?
                 getIdentifierColumn().getName().trim() : null;
     }
@@ -118,7 +118,7 @@
     /**
      * @return Integer.MAX_VALUE if the user has left the Max Features text 
field blank.
      */
-    Integer getMaxFeatures() {
+    public Integer getMaxFeatures() {
         if (maxFeaturesTextField.getText() == null) return Integer.MAX_VALUE;
         if (maxFeaturesTextField.getText().trim().length() == 0) return 
Integer.MAX_VALUE;
         if (maxFeaturesTextField.getText().trim().equals("-")) return 
Integer.MAX_VALUE;
@@ -125,12 +125,12 @@
         return new Integer(maxFeaturesTextField.getText().trim());
     }
 
-    String getWhereClause() {
+    public String getWhereClause() {
         return getWhereClauseProper().toLowerCase().startsWith("where") ?
                 getWhereClauseProper().substring("where".length()).trim() : 
getWhereClauseProper();
     }
 
-    String getWhereClauseProper() {
+    public String getWhereClauseProper() {
         return whereTextArea.getText().trim();
     }
 
@@ -142,7 +142,7 @@
     //    getCachingCheckBox().setSelected( caching );
     //}
 
-    boolean isLimitedToView() {
+    public boolean isLimitedToView() {
         return getLimitedToViewCheckBox().isSelected();
     }
 
@@ -150,7 +150,7 @@
         getLimitedToViewCheckBox().setSelected( limitedToView );
     }
 
-    boolean isManageConfictsActive() {
+    public boolean isManageConfictsActive() {
         return getManageConflictsCheckBox().isSelected();
     }
 

Modified: 
core/trunk/src/org/openjump/core/ui/plugin/datastore/AddWritableDataStoreLayerWizard.java
===================================================================
--- 
core/trunk/src/org/openjump/core/ui/plugin/datastore/AddWritableDataStoreLayerWizard.java
   2018-04-17 11:45:55 UTC (rev 5768)
+++ 
core/trunk/src/org/openjump/core/ui/plugin/datastore/AddWritableDataStoreLayerWizard.java
   2018-04-17 19:31:45 UTC (rev 5769)
@@ -38,7 +38,7 @@
 
     private AddWritableDataStoreLayerWizardPanel dataStoreWizardPanel;
 
-    private DataStoreTransactionManager txManager;
+    private String txManagerName;
 
     private WorkbenchContext workbenchContext;
 
@@ -48,10 +48,10 @@
             String name,
             ImageIcon icon,
             WorkbenchContext workbenchContext,
-            DataStoreTransactionManager txManager) {
+            String txManagerName) {
         super(name, icon,
                 AddWritableDataStoreLayerWizardPanel.class.getName());
-        this.txManager = txManager;
+        this.txManagerName = txManagerName;
         this.workbenchContext = workbenchContext;
         dataStoreWizardPanel = new 
AddWritableDataStoreLayerWizardPanel(workbenchContext);
         addPanel(dataStoreWizardPanel);
@@ -60,10 +60,10 @@
     }
 
     public AddWritableDataStoreLayerWizard(WorkbenchContext workbenchContext,
-            DataStoreTransactionManager txManager) {
+            String txManagerName) {
         super(I18N.get(KEY), IconLoader.icon("database_writable_add.png"),
                 AddWritableDataStoreLayerWizardPanel.class.getName());
-        this.txManager = txManager;
+        this.txManagerName = txManagerName;
         this.workbenchContext = workbenchContext;
         dataStoreWizardPanel = new 
AddWritableDataStoreLayerWizardPanel(workbenchContext);
         addPanel(dataStoreWizardPanel);
@@ -115,7 +115,7 @@
         }
     }
 
-    private Layer createLayer(final AddWritableDataStoreLayerPanel panel,
+    protected Layer createLayer(final AddWritableDataStoreLayerPanel panel,
                               TaskMonitor monitor) throws Exception {
 
         String datasetName = panel.getDatasetName();
@@ -138,7 +138,7 @@
                 DataStoreDataSourceFactory.createWritableDataStoreDataSource(
                         connectionDescriptor, datasetName, 
geometryAttributeName,
                         identifierAttributeName, true,
-                        
"org.openjump.core.ui.plugin.datastore.transaction.DataStoreTransactionManager",
+                        txManagerName,
                         workbenchContext);
         ds.setMaxFeature(limit);
         ds.setWhereClause(whereClause);
@@ -177,7 +177,11 @@
 
             layerManager.setFiringEvents(true); // added by michaudm on 
2009-04-05
         }
-        finally {layerManager.setFiringEvents(true);}
+        finally {
+            layerManager.setFiringEvents(true);
+        }
+        DataStoreTransactionManager txManager =
+                DataStoreTransactionManager.getTxInstance(txManagerName);
         txManager.registerLayer(layer, workbenchContext.getTask());
         return layer;
     }


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to