tn5250j/src/org/tn5250j/spoolfile SpoolExporter.java,1.12,1.13

Patrick Bielen <[email protected]> Wed, 31 Mar 2004 12:25:11 +0000
Newsgroups gmane.comp.java.tn5250j.cvs
Message-ID <[email protected]>
Update of /cvsroot/tn5250j/tn5250j/src/org/tn5250j/spoolfile
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23849/src/org/tn5250j/spoolfile

Modified Files:
	SpoolExporter.java 
Log Message:
Submitted by: Kenneth
Various updates to update CVS with actual code

Index: SpoolExporter.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/spoolfile/SpoolExporter.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** SpoolExporter.java	11 Nov 2003 14:37:00 -0000	1.12
--- SpoolExporter.java	31 Mar 2004 12:25:09 -0000	1.13
***************
*** 1,3 ****
- package org.tn5250j.spoolfile;
  /**
   * Title: SpoolExporter.java
--- 1,2 ----
***************
*** 25,28 ****
--- 24,28 ----
   *
   */
+ package org.tn5250j.spoolfile;
  
  import java.awt.*;
***************
*** 42,46 ****
  import org.tn5250j.Session;
  
! public class SpoolExporter extends JFrame {
  
     SpoolFilterPane filter;
--- 42,46 ----
  import org.tn5250j.Session;
  
! public class SpoolExporter extends TN5250jFrame {
  
     SpoolFilterPane filter;
***************
*** 71,74 ****
--- 71,76 ----
     Vector names = new Vector();
  
+    SpooledFileList splfList;
+ 
     public SpoolExporter(tnvt vt, Session session) {
  
***************
*** 166,181 ****
        this.getContentPane().add(status, BorderLayout.SOUTH);
  
!       pack();
! 
!       //Center the window
!       Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
!       Dimension frameSize = getSize();
!       if (frameSize.height > screenSize.height)
!          frameSize.height = screenSize.height;
!       if (frameSize.width > screenSize.width)
!          frameSize.width = screenSize.width;
  
!       setLocation((screenSize.width - frameSize.width) / 2,
!                      (screenSize.height - frameSize.height) / 2);
  
        addWindowListener(new WindowAdapter() {
--- 168,186 ----
        this.getContentPane().add(status, BorderLayout.SOUTH);
  
!       packFrame = true;
!       this.centerFrame();
  
! //      pack();
! //
! //      //Center the window
! //      Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
! //      Dimension frameSize = getSize();
! //      if (frameSize.height > screenSize.height)
! //         frameSize.height = screenSize.height;
! //      if (frameSize.width > screenSize.width)
! //         frameSize.width = screenSize.width;
! //
! //      setLocation((screenSize.width - frameSize.width) / 2,
! //                     (screenSize.height - frameSize.height) / 2);
  
        addWindowListener(new WindowAdapter() {
***************
*** 186,192 ****
  
              // close the system connection
!             if (system != null)
!                system.disconnectAllServices();
  
              setVisible(false);
              dispose();
--- 191,203 ----
  
              // close the system connection
!             if (system != null) {
!                // close the spool file list if allocated
!                if (splfList != null) {
!                   splfList.close();
!                   splfList = null;
!                }
  
+                system.disconnectAllServices();
+             }
              setVisible(false);
              dispose();
***************
*** 255,259 ****
  
        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
!       SpooledFileList splfList = null;
  
        try {
--- 266,278 ----
  
        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
! //      SpooledFileList splfList = null;
!       if ( splfList != null ) {
!          splfList.removePrintObjectListListener(stm);
!          splfList.close();
!          splfList = null;
!       }
! 
!       // clear our data
!       data.clear();
  
        try {
***************
*** 276,280 ****
  
           // retrieve the output queues
!          splfList.openSynchronously();
  
           // if we have something update the status
--- 295,299 ----
  
           // retrieve the output queues
! //         splfList.openSynchronously();
  
           // if we have something update the status
***************
*** 285,289 ****
  
           // load the data into our sortable data model
!          int numProcessed = loadDataModel(splfList);
  
           // set the spool list to be displayed
--- 304,308 ----
  
           // load the data into our sortable data model
! //         int numProcessed = loadDataModel(splfList);
  
           // set the spool list to be displayed
***************
*** 299,308 ****
           }
  
           // if we have something update the status
           if (splfList != null) {
!             updateStatus(numProcessed + " " + LangTool.getString("spool.count"));
           }
  
!          splfList.close();
  
        }
--- 318,330 ----
           }
  
+          splfList.openAsynchronously();
+          splfList.addPrintObjectListListener(stm);
+ 
           // if we have something update the status
           if (splfList != null) {
!             updateStatus(splfList.size() + " " + LangTool.getString("spool.count"));
           }
  
! //         splfList.close();
  
        }
***************
*** 311,315 ****
        }
  
!       setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
     }
  
--- 333,337 ----
        }
  
! //      setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
     }
  
***************
*** 319,382 ****
      * @param splfList Spooled File List to load from
      */
!    private int loadDataModel(SpooledFileList splfList) {
! 
!       // clear our data
!       data.clear();
! 
!       // if there is nothing then do nothing
!       if (splfList == null)
!          return 0;
! 
!       int splfListSize = splfList.size();
! 
!       // if we have no spooled files then display nothing
!       if (splfListSize <= 0)
!          return 0;
! 
!       String text = status.getText();
! 
!       boolean spoolFilter = filter.getSpoolName().length() > 0;
!       String spoolName = filter.getSpoolName();
!       int numSpooled = splfList.size();
!       int numProcessed = 0;
! 
!       // iterate throw the spooled file list and load the values into our
!       //  data vector
!       int count = 0;
!       Enumeration enumm = (splfList.getObjects());
!       while(enumm.hasMoreElements()) {
!          SpooledFile p = (SpooledFile)enumm.nextElement();
!          Vector row = new Vector();
! 
!          updateStatus(text + " " + ++count + " of " + numSpooled);
! 
!          if (spoolFilter && !spoolName.equals(p.getName()))
!             continue;
! 
!          numProcessed++;
! 
!          row.add(p.getName());
! 
!          loadIntegerAttribute(p, row, PrintObject.ATTR_SPLFNUM);
!          loadStringAttribute(p, row, PrintObject.ATTR_JOBNAME);
!          loadStringAttribute(p, row, PrintObject.ATTR_JOBUSER);
!          loadStringAttribute(p, row, PrintObject.ATTR_JOBNUMBER);
!          loadStringAttribute(p, row, PrintObject.ATTR_OUTPUT_QUEUE);
!          loadStringAttribute(p, row, PrintObject.ATTR_USERDATA);
!          loadStringAttribute(p, row, PrintObject.ATTR_SPLFSTATUS);
!          loadIntegerAttribute(p, row, PrintObject.ATTR_PAGES);
!          loadIntegerAttribute(p, row, PrintObject.ATTR_CURPAGE);
!          loadIntegerAttribute(p, row, PrintObject.ATTR_COPIES);
!          loadStringAttribute(p, row, PrintObject.ATTR_FORMTYPE);
!          loadStringAttribute(p, row, PrintObject.ATTR_OUTPTY);
!          loadCreateDateTime(p, row);
!          loadIntegerAttribute(p, row, PrintObject.ATTR_NUMBYTES);
! 
!          // now add our row of columns into our data
!          data.add(row);
!       }
! 
!       return numProcessed;
!    }
  
     /**
--- 341,404 ----
      * @param splfList Spooled File List to load from
      */
! //      private int loadDataModel(SpooledFileList splfList) {
! //
! //         // clear our data
! //         data.clear();
! //
! //         // if there is nothing then do nothing
! //         if (splfList == null)
! //            return 0;
! //
! //         int splfListSize = splfList.size();
! //
! //         // if we have no spooled files then display nothing
! //         if (splfListSize <= 0)
! //            return 0;
! //
! //         String text = status.getText();
! //
! //         boolean spoolFilter = filter.getSpoolName().length() > 0;
! //         String spoolName = filter.getSpoolName();
! //         int numSpooled = splfList.size();
! //         int numProcessed = 0;
! //
! //         // iterate throw the spooled file list and load the values into our
! //         //  data vector
! //         int count = 0;
! //         Enumeration enumm = (splfList.getObjects());
! //         while(enumm.hasMoreElements()) {
! //            SpooledFile p = (SpooledFile)enumm.nextElement();
! //            Vector row = new Vector();
! //
! //            updateStatus(text + " " + ++count + " of " + numSpooled);
! //
! //            if (spoolFilter && !spoolName.equals(p.getName()))
! //               continue;
! //
! //            numProcessed++;
! //
! //            row.add(p.getName());
! //
! //            loadIntegerAttribute(p, row, PrintObject.ATTR_SPLFNUM);
! //            loadStringAttribute(p, row, PrintObject.ATTR_JOBNAME);
! //            loadStringAttribute(p, row, PrintObject.ATTR_JOBUSER);
! //            loadStringAttribute(p, row, PrintObject.ATTR_JOBNUMBER);
! //            loadStringAttribute(p, row, PrintObject.ATTR_OUTPUT_QUEUE);
! //            loadStringAttribute(p, row, PrintObject.ATTR_USERDATA);
! //            loadStringAttribute(p, row, PrintObject.ATTR_SPLFSTATUS);
! //            loadIntegerAttribute(p, row, PrintObject.ATTR_PAGES);
! //            loadIntegerAttribute(p, row, PrintObject.ATTR_CURPAGE);
! //            loadIntegerAttribute(p, row, PrintObject.ATTR_COPIES);
! //            loadStringAttribute(p, row, PrintObject.ATTR_FORMTYPE);
! //            loadStringAttribute(p, row, PrintObject.ATTR_OUTPTY);
! //            loadCreateDateTime(p, row);
! //            loadIntegerAttribute(p, row, PrintObject.ATTR_NUMBYTES);
! //
! //            // now add our row of columns into our data
! //            data.add(row);
! //         }
! //
! //         return numProcessed;
! //      }
  
     /**
***************
*** 748,752 ****
      *
      */
!    class SpoolTableModel extends DefaultSortTableModel {
  
        String[] cols;
--- 770,774 ----
      *
      */
!    class SpoolTableModel extends DefaultSortTableModel implements PrintObjectListListener {
  
        String[] cols;
***************
*** 798,801 ****
--- 820,907 ----
        }
  
+       public void listClosed(PrintObjectListEvent e) {
+ //                System.out.println("list closed");
+ 
+          SwingUtilities.invokeLater(new Thread() {
+             public void run() {
+                fireTableDataChanged();
+             }
+          });
+       }
+ 
+       public void listCompleted(PrintObjectListEvent e) {
+ //                System.out.println("list completed");
+          setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ 
+          SwingUtilities.invokeLater(new Thread() {
+             public void run() {
+                fireTableDataChanged();
+             }
+          });
+       }
+ 
+       public void listErrorOccurred(PrintObjectListEvent e) {
+ 
+          System.err.println("list error occurred : " + e.getException().getMessage());
+ 
+          SwingUtilities.invokeLater(new Thread() {
+             public void run() {
+                fireTableDataChanged();
+             }
+          });
+       }
+ 
+       public void listObjectAdded(PrintObjectListEvent e) {
+ //         System.out.println("list object added");
+          boolean spoolFilter = filter.getSpoolName().length() > 0;
+          String spoolName = filter.getSpoolName();
+          SpooledFile p = (SpooledFile)e.getObject();
+ 
+          Vector row = new Vector();
+ 
+          // do not process if the name is not equal to the filter.
+          if (spoolFilter && !spoolName.equals(p.getName()))
+             return;
+ 
+          row.add(p.getName());
+ 
+          loadIntegerAttribute(p, row, PrintObject.ATTR_SPLFNUM);
+          loadStringAttribute(p, row, PrintObject.ATTR_JOBNAME);
+          loadStringAttribute(p, row, PrintObject.ATTR_JOBUSER);
+          loadStringAttribute(p, row, PrintObject.ATTR_JOBNUMBER);
+          loadStringAttribute(p, row, PrintObject.ATTR_OUTPUT_QUEUE);
+          loadStringAttribute(p, row, PrintObject.ATTR_USERDATA);
+          loadStringAttribute(p, row, PrintObject.ATTR_SPLFSTATUS);
+          loadIntegerAttribute(p, row, PrintObject.ATTR_PAGES);
+          loadIntegerAttribute(p, row, PrintObject.ATTR_CURPAGE);
+          loadIntegerAttribute(p, row, PrintObject.ATTR_COPIES);
+          loadStringAttribute(p, row, PrintObject.ATTR_FORMTYPE);
+          loadStringAttribute(p, row, PrintObject.ATTR_OUTPTY);
+          loadCreateDateTime(p, row);
+          loadIntegerAttribute(p, row, PrintObject.ATTR_NUMBYTES);
+ 
+          //  We need to synchronize here so we will not get any errors if the
+          //   user hits a column header to sort by.
+          synchronized (data) {
+             // now add our row of columns into our data
+             data.add(row);
+          }
+ 
+          SwingUtilities.invokeLater(new Thread() {
+             public void run() {
+                  fireTableDataChanged();
+                  updateStatus(data.size() + " " + LangTool.getString("spool.count"));
+             }
+          });
+       }
+ 
+       public void listOpened(PrintObjectListEvent e) {
+          System.out.println("list opened");
+          SwingUtilities.invokeLater(new Thread() {
+             public void run() {
+               fireTableDataChanged();
+             }
+          });
+       }
     }
  



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click