Revision: 16220
          http://gate.svn.sourceforge.net/gate/?rev=16220&view=rev
Author:   markagreenwood
Date:     2012-11-02 08:17:58 +0000 (Fri, 02 Nov 2012)
Log Message:
-----------
tided up the gui and hopefully sorted the deprecation warnings

Modified Paths:
--------------
    gate/trunk/src/gate/SimpleCorpus.java
    gate/trunk/src/gate/corpora/CorpusImpl.java
    gate/trunk/src/gate/corpora/SerialCorpusImpl.java
    gate/trunk/src/gate/gui/NameBearerHandle.java
    gate/trunk/src/gate/gui/SingleConcatenatedFileInputDialog.java

Modified: gate/trunk/src/gate/SimpleCorpus.java
===================================================================
--- gate/trunk/src/gate/SimpleCorpus.java       2012-11-02 07:41:13 UTC (rev 
16219)
+++ gate/trunk/src/gate/SimpleCorpus.java       2012-11-02 08:17:58 UTC (rev 
16220)
@@ -128,6 +128,7 @@
    *         of bytes
    */
   @Deprecated
+  @SuppressWarnings("deprecation")
   public long populate(URL singleConcatenatedFile, String documentRootElement,
           String encoding, int numberOfDocumentsToExtract,
           String documentNamePrefix, gate.corpora.DocType documentType) throws 
IOException,

Modified: gate/trunk/src/gate/corpora/CorpusImpl.java
===================================================================
--- gate/trunk/src/gate/corpora/CorpusImpl.java 2012-11-02 07:41:13 UTC (rev 
16219)
+++ gate/trunk/src/gate/corpora/CorpusImpl.java 2012-11-02 08:17:58 UTC (rev 
16220)
@@ -513,6 +513,7 @@
    * @throws java.io.IOException
    */
   @Deprecated
+  @SuppressWarnings("deprecation")
   public static long populate(Corpus corpus, URL singleConcatenatedFile,
       String documentRootElement, String encoding,
       int numberOfDocumentsToExtract, String documentNamePrefix,
@@ -657,12 +658,9 @@
             
             documentString = new StringBuilder();
             if(sListener != null) sListener.statusChanged(docName + " 
created!");
-
-            //TODO where do the 7 and 6 come from!
-            if(line.length() > index + 7) {
-              line = line.substring(index + 6);
-            }
-            else line = br.readLine();
+           
+            line = line.substring(index + documentRootElement.length() + 3);
+            if (line.trim().equals("")) line = br.readLine();
           }
         }
       }
@@ -690,6 +688,7 @@
    *         of bytes
    */
   @Deprecated
+  @SuppressWarnings("deprecation")
   public long populate(URL singleConcatenatedFile, String documentRootElement,
           String encoding, int numberOfFilesToExtract,
           String documentNamePrefix, DocType documentType) throws IOException,

Modified: gate/trunk/src/gate/corpora/SerialCorpusImpl.java
===================================================================
--- gate/trunk/src/gate/corpora/SerialCorpusImpl.java   2012-11-02 07:41:13 UTC 
(rev 16219)
+++ gate/trunk/src/gate/corpora/SerialCorpusImpl.java   2012-11-02 08:17:58 UTC 
(rev 16220)
@@ -404,6 +404,7 @@
    *         of bytes
    */
   @Deprecated
+  @SuppressWarnings("deprecation")
   public long populate(URL singleConcatenatedFile, String documentRootElement,
           String encoding, int numberOfFilesToExtract,
           String documentNamePrefix, DocType documentType) throws IOException,

Modified: gate/trunk/src/gate/gui/NameBearerHandle.java
===================================================================
--- gate/trunk/src/gate/gui/NameBearerHandle.java       2012-11-02 07:41:13 UTC 
(rev 16219)
+++ gate/trunk/src/gate/gui/NameBearerHandle.java       2012-11-02 08:17:58 UTC 
(rev 16220)
@@ -1557,7 +1557,7 @@
     }
 
     public void actionPerformed(ActionEvent e) {
-      scfInputDialog.setEncoding("");
+      scfInputDialog.reset();
       final boolean answer = OkCancelDialog.showDialog(window, scfInputDialog,
               "Populate from Single Concatenated File");
       Runnable runnable = new Runnable() {

Modified: gate/trunk/src/gate/gui/SingleConcatenatedFileInputDialog.java
===================================================================
--- gate/trunk/src/gate/gui/SingleConcatenatedFileInputDialog.java      
2012-11-02 07:41:13 UTC (rev 16219)
+++ gate/trunk/src/gate/gui/SingleConcatenatedFileInputDialog.java      
2012-11-02 08:17:58 UTC (rev 16220)
@@ -89,7 +89,7 @@
     constraints.gridy = 1;
     constraints.gridwidth = 4;
     constraints.fill = GridBagConstraints.HORIZONTAL;
-    add(encodingTextField = new JTextField(15), constraints);
+    add(encodingTextField = new JTextField(40), constraints);
 
     // third row
     constraints = new GridBagConstraints();
@@ -106,7 +106,7 @@
     constraints.gridy = 2;
     constraints.gridwidth = 4;
     constraints.fill = GridBagConstraints.HORIZONTAL;
-    add(documentRootElementTextField = new JTextField("DOC", 15), constraints);
+    add(documentRootElementTextField = new JTextField("DOC", 40), constraints);
 
     // fourth row
     constraints = new GridBagConstraints();
@@ -123,12 +123,7 @@
     constraints.gridy = 3;
     constraints.gridwidth = 4;
     constraints.fill = GridBagConstraints.HORIZONTAL;
-    Object[] mimeTypes = DocumentFormat.getSupportedMimeTypes().toArray();
-    Arrays.sort(mimeTypes);
-    documentTypeComboBox = new JComboBox(mimeTypes);
-    documentTypeComboBox.setEditable(false);
-    documentTypeComboBox.setSelectedItem("text/html");
-    add(documentTypeComboBox, constraints);
+    add(documentMimeTypeTextField = new JTextField("text/html", 40), 
constraints);
 
     // fifth row
     constraints = new GridBagConstraints();
@@ -145,7 +140,7 @@
     constraints.gridy = 4;
     constraints.gridwidth = 4;
     constraints.fill = GridBagConstraints.HORIZONTAL;
-    add(numOfDocumentsToFetchTextField = new JTextField("-1", 15), 
constraints);
+    add(numOfDocumentsToFetchTextField = new JTextField("-1", 40), 
constraints);
 
     // sixth row
     constraints = new GridBagConstraints();
@@ -162,7 +157,7 @@
     constraints.gridy = 5;
     constraints.gridwidth = 4;
     constraints.fill = GridBagConstraints.HORIZONTAL;
-    add(documentNamePrefixTextField = new JTextField("Document", 15),
+    add(documentNamePrefixTextField = new JTextField("Document", 40),
             constraints);
   }
 
@@ -253,14 +248,14 @@
    * Gets the selected document type.
    */
   public String getDocumentMimeType() {
-    return (String)this.documentTypeComboBox.getSelectedItem();
+    return this.documentMimeTypeTextField.getText();
   }
 
   /**
    * Sets the document type
    */
   public void setDocumentMimeType(String mimeType) {
-    this.documentTypeComboBox.setSelectedItem(mimeType);
+    this.documentMimeTypeTextField.setText(mimeType);
   }
 
   /**
@@ -288,6 +283,10 @@
   public void setNumOfDocumentsToFetch(int numOfDocumentsToFetch) {
     this.numOfDocumentsToFetchTextField.setText("" + numOfDocumentsToFetch);
   }
+  
+  public void reset() {
+    setEncoding("");
+  }
 
   /**
    * Test code
@@ -336,7 +335,7 @@
   /**
    * Dropdown box with available document types
    */
-  JComboBox documentTypeComboBox;
+  JTextField documentMimeTypeTextField;
 
   /**
    * Number of documents to extract from the big document

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


------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
_______________________________________________
GATE-cvs mailing list
GATE-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to