Revision: 18352
          http://sourceforge.net/p/gate/code/18352
Author:   markagreenwood
Date:     2014-09-22 11:55:28 +0000 (Mon, 22 Sep 2014)
Log Message:
-----------
only create the GUI when we need it so that we do so on the EDT

Modified Paths:
--------------
    gate/trunk/plugins/Format_CSV/src/gate/corpora/CSVImporter.java

Modified: gate/trunk/plugins/Format_CSV/src/gate/corpora/CSVImporter.java
===================================================================
--- gate/trunk/plugins/Format_CSV/src/gate/corpora/CSVImporter.java     
2014-09-22 01:19:44 UTC (rev 18351)
+++ gate/trunk/plugins/Format_CSV/src/gate/corpora/CSVImporter.java     
2014-09-22 11:55:28 UTC (rev 18352)
@@ -61,32 +61,51 @@
 @CreoleResource(name = "CSV Corpus Populater", tool = true, autoinstances = 
@AutoInstance, comment = "Populate a corpus from CSV files", helpURL = 
"http://gate.ac.uk/userguide/sec:creole:csv";)
 public class CSVImporter extends ResourceHelper {
 
-  private static JComponent dialog = new JPanel();
+  private static JComponent dialog = null;
 
-  private static SpinnerNumberModel textColModel = new SpinnerNumberModel(0, 0,
-      Integer.MAX_VALUE, 1);
+  private static SpinnerNumberModel textColModel = null;
 
-  private static JCheckBox cboFeatures = new JCheckBox(
-      "1st Row Contains Column Labels", true);
+  private static JCheckBox cboFeatures = null;
 
-  private static JCheckBox cboDocuments = new JCheckBox(
-      "Create One Document Per Row", false);
+  private static JCheckBox cboDocuments = null;
 
-  private static JTextField txtURL = new JTextField(30);
+  private static JTextField txtURL = null;
 
-  private static JTextField txtSeparator = new JTextField(",", 3);
+  private static JTextField txtSeparator = null;
 
-  private static JTextField txtQuoteChar = new JTextField("\"", 3);
+  private static JTextField txtQuoteChar = null;
   
-  private static JTextField txtEncoding = new JTextField("UTF-8");
+  private static JTextField txtEncoding = null;
 
   private static FileFilter CSV_FILE_FILTER = new ExtensionFileFilter(
       "CSV Files (*.csv)", "csv");
 
-  static {
+  private static void buildDialog() {
     // we'll use the same dialog instance regardless of the corpus we are
     // populating so we'll create a single static instance
 
+    if (dialog != null) return;
+    
+    dialog = new JPanel();
+    
+    textColModel = new SpinnerNumberModel(0, 0,
+        Integer.MAX_VALUE, 1);
+    
+    cboFeatures = new JCheckBox(
+        "1st Row Contains Column Labels", true);
+
+    cboDocuments = new JCheckBox(
+        "Create One Document Per Row", false);
+
+    txtURL = new JTextField(30);
+
+    txtSeparator = new JTextField(",", 3);
+
+    txtQuoteChar = new JTextField("\"", 3);
+    
+    txtEncoding = new JTextField("UTF-8");
+
+    
     dialog.setLayout(new GridBagLayout());
 
     GridBagConstraints constraints = new GridBagConstraints();
@@ -226,6 +245,8 @@
       @Override
       public void actionPerformed(ActionEvent e) {
 
+        buildDialog();
+        
         // display the populater dialog and return if it is cancelled
         if(JOptionPane.showConfirmDialog(null, dialog,
             "Populate From CSV File", JOptionPane.OK_CANCEL_OPTION,

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
GATE-cvs mailing list
GATE-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to