Revision: 6037
          http://sourceforge.net/p/jump-pilot/code/6037
Author:   edso
Date:     2018-12-27 13:03:59 +0000 (Thu, 27 Dec 2018)
Log Message:
-----------
speedup SaveToPostGISPlugIn by delaying gui init
      from
      [INFO] 13:59:36.400 Loading Plugin [...].SaveToPostGISPlugIn took 0.43s 
      to
      [INFO] 14:00:26.666 Loading Plugin [...].SaveToPostGISPlugIn took 0.01s

Modified Paths:
--------------
    core/trunk/ChangeLog
    
core/trunk/src/org/openjump/core/ui/plugin/datastore/postgis/PostGISSaveDataSourceQueryChooser.java
    
core/trunk/src/org/openjump/core/ui/plugin/datastore/postgis/SaveToPostGISPlugIn.java

Modified: core/trunk/ChangeLog
===================================================================
--- core/trunk/ChangeLog        2018-12-27 12:39:26 UTC (rev 6036)
+++ core/trunk/ChangeLog        2018-12-27 13:03:59 UTC (rev 6037)
@@ -10,6 +10,11 @@
   * PLUS: add jaxb xml libs, which were removed from jdk9+, currently only
     needed by ViewManager extension, document extension and needed deps in
     readme.txt
+  * speedup SaveToPostGISPlugIn by delaying gui init
+      from
+      [INFO] 13:59:36.400 Loading Plugin [...].SaveToPostGISPlugIn took 0.43s 
+      to
+      [INFO] 14:00:26.666 Loading Plugin [...].SaveToPostGISPlugIn took 0.01s
 
 2018-12-22 Giuseppe Aruta.
    * Updated OpenKLEM to ver 20181222, correct some bugs

Modified: 
core/trunk/src/org/openjump/core/ui/plugin/datastore/postgis/PostGISSaveDataSourceQueryChooser.java
===================================================================
--- 
core/trunk/src/org/openjump/core/ui/plugin/datastore/postgis/PostGISSaveDataSourceQueryChooser.java
 2018-12-27 12:39:26 UTC (rev 6036)
+++ 
core/trunk/src/org/openjump/core/ui/plugin/datastore/postgis/PostGISSaveDataSourceQueryChooser.java
 2018-12-27 13:03:59 UTC (rev 6037)
@@ -36,16 +36,16 @@
     
     public static final String KEY = 
PostGISSaveDataSourceQueryChooser.class.getName();
     
-       static final String ERROR = I18N.get(KEY + ".error");
-       static final String NO_CONNECTION_CHOOSEN     = I18N.get(KEY + 
".no-connection-choosen");
-       static final String NO_TABLE_CHOOSEN          = I18N.get(KEY + 
".no-table-choosen");
-       static final String CONNECTION_IS_NOT_POSTGIS = I18N.get(KEY + 
".selected-connection-is-not-postgis");
-       static final String UNIQUE_IDENTIFIER_NEEDED  = I18N.get(KEY + 
".unique-identifier-is-needed");
-    
-       private PlugInContext context;
-    private PostGISSaveDriverPanel panel;
+    static final String ERROR = I18N.get(KEY + ".error");
+    static final String NO_CONNECTION_CHOOSEN = I18N.get(KEY + 
".no-connection-choosen");
+    static final String NO_TABLE_CHOOSEN = I18N.get(KEY + ".no-table-choosen");
+    static final String CONNECTION_IS_NOT_POSTGIS = I18N.get(KEY + 
".selected-connection-is-not-postgis");
+    static final String UNIQUE_IDENTIFIER_NEEDED = I18N.get(KEY + 
".unique-identifier-is-needed");
+
+    private PlugInContext context;
+    private PostGISSaveDriverPanel pgpanel = null;
     private SaveToPostGISDataSource dataSource;
-    private Map<String,Object> properties;
+    private Map<String,Object> properties = new HashMap<String,Object>();
   
     /**
      * Creates a new query chooser.
@@ -54,17 +54,17 @@
     public PostGISSaveDataSourceQueryChooser(SaveToPostGISDataSource 
dataSource, PlugInContext context) {
         this.dataSource = dataSource;
         this.context = context;
-        panel = new PostGISSaveDriverPanel(context);
-        properties = new HashMap<String,Object>();
     }
-  
+
     /**
      * @see 
com.vividsolutions.jump.workbench.datasource.DataSourceQueryChooser#getComponent()
      */
     public Component getComponent() {
-        return panel; 
+      if (pgpanel == null)
+        pgpanel = new PostGISSaveDriverPanel(context);
+      return pgpanel; 
     }
-  
+
     /**
      * Since the ui does not allow for loading of multiple tables, 
      * the returned collection only contains a single element.
@@ -91,6 +91,7 @@
      * @see 
com.vividsolutions.jump.workbench.datasource.DataSourceQueryChooser#isInputValid()
      */
     public boolean isInputValid() {
+        PostGISSaveDriverPanel panel = (PostGISSaveDriverPanel) getComponent();
         if (panel.getConnectionDescriptor() == null) { 
                 JOptionPane.showMessageDialog(panel, 
                     NO_CONNECTION_CHOOSEN,
@@ -130,6 +131,8 @@
      * Reads all the connection + query properties from the ui.
      */
     protected Map getProperties() {
+        PostGISSaveDriverPanel panel = (PostGISSaveDriverPanel) getComponent();
+      
         if (properties == null) properties = new HashMap<String,Object>();
         properties.put(SaveToPostGISDataSource.CONNECTION_DESCRIPTOR_KEY, 
panel.getConnectionDescriptor());
         properties.put(SaveToPostGISDataSource.TABLE_KEY, 
panel.getTableName());

Modified: 
core/trunk/src/org/openjump/core/ui/plugin/datastore/postgis/SaveToPostGISPlugIn.java
===================================================================
--- 
core/trunk/src/org/openjump/core/ui/plugin/datastore/postgis/SaveToPostGISPlugIn.java
       2018-12-27 12:39:26 UTC (rev 6036)
+++ 
core/trunk/src/org/openjump/core/ui/plugin/datastore/postgis/SaveToPostGISPlugIn.java
       2018-12-27 13:03:59 UTC (rev 6037)
@@ -40,11 +40,11 @@
         SaveToPostGISDataSource dataSource = new 
SaveToPostGISDataSource(context.getWorkbenchContext());
         //dataSource.setWorkbenchContext(context.getWorkbenchContext());
         saveChooser = new PostGISSaveDataSourceQueryChooser(dataSource, 
context);
-        
+
         DataSourceQueryChooserManager.get(
           context.getWorkbenchContext().getWorkbench().getBlackboard()
         ).addSaveDataSourceQueryChooser(saveChooser);
-        
+
         //PostGISOpenWizard postGISOpenWizard = new 
PostGISOpenWizard(context.getWorkbenchContext());
         //OpenWizardPlugIn.addWizard(context.getWorkbenchContext(), 
postGISOpenWizard);
     }



_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to