tn5250j/src/org/tn5250j My5250.java,1.43,1.44

"Kenneth J. Pouncey" <[email protected]> Fri, 08 Jul 2005 06:06:56 +0000
Newsgroups gmane.comp.java.tn5250j.cvs
Message-ID <[email protected]>
Update of /cvsroot/tn5250j/tn5250j/src/org/tn5250j
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23807/src/org/tn5250j

Modified Files:
	My5250.java 
Log Message:
Show last view changes

Index: My5250.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/My5250.java,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -d -r1.43 -r1.44
*** My5250.java	18 Jun 2005 09:25:14 -0000	1.43
--- My5250.java	8 Jul 2005 06:06:53 -0000	1.44
***************
*** 271,275 ****
           }
  
!           /**
             * @todo this crap needs to be rewritten it is a mess
             */
--- 271,275 ----
           }
  
!          /**
             * @todo this crap needs to be rewritten it is a mess
             */
***************
*** 312,315 ****
--- 312,322 ----
        }
  
+       if (m.sessionArgs == null && sessions.containsKey("emul.view") &&
+             sessions.containsKey("emul.startLastView")) {
+          String[] sargs = new String[NUM_PARMS];
+          parseArgs(sessions.getProperty("emul.view"), sargs);
+          m.sessionArgs = sargs;
+       }
+       
        if (m.sessionArgs != null) {
  
***************
*** 319,336 ****
           Vector session_params = new Vector();
  
!          for (int x = 0; x < args.length; x++) {
  
!             if (args[x].equals("-s")) {
!                x++;
!                if (args[x] != null && sessions.containsKey(args[x])) {
!                   os400_sessions.addElement(args[x]);
                 }else{
!                   x--;
!                   session_params.addElement(args[x]);
                 }
-             }else{
-                session_params.addElement(args[x]);
              }
- 
           }
  
--- 326,344 ----
           Vector session_params = new Vector();
  
!          for (int x = 0; x < m.sessionArgs.length; x++) {
  
!             if (m.sessionArgs[x] != null) {
!                if (m.sessionArgs[x].equals("-s")) {
!                   x++;
!                   if (m.sessionArgs[x] != null && sessions.containsKey(m.sessionArgs[x])) {
!                      os400_sessions.addElement(m.sessionArgs[x]);
!                   }else{
!                      x--;
!                      session_params.addElement(m.sessionArgs[x]);
!                   }
                 }else{
!                   session_params.addElement(m.sessionArgs[x]);
                 }
              }
           }
  
***************
*** 345,350 ****
              if (!m.frame1.isVisible()) {
                 m.splash.updateProgress(++m.step);
-                m.splash.setVisible(false);
                 m.frame1.setVisible(true);
                 m.frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
              }
--- 353,358 ----
              if (!m.frame1.isVisible()) {
                 m.splash.updateProgress(++m.step);
                 m.frame1.setVisible(true);
+                m.splash.setVisible(false);
                 m.frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
              }
***************
*** 484,488 ****
     private String getConnectSession () {
  
-       splash.setVisible(false);
        Connect sc = new Connect(frame1,LangTool.getString("ss.title"),sessions);
  
--- 492,495 ----
***************
*** 584,589 ****
           }
  
-          splash.setVisible(false);
           frame1.setVisible(true);
           frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
        }
--- 591,596 ----
           }
  
           frame1.setVisible(true);
+          splash.setVisible(false);
           frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
        }
***************
*** 592,597 ****
              splash.updateProgress(++step);
              newView();
-             splash.setVisible(false);
              frame1.setVisible(true);
              frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
  
--- 599,604 ----
              splash.updateProgress(++step);
              newView();
              frame1.setVisible(true);
+             splash.setVisible(false);
              frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
  
***************
*** 642,647 ****
        }
  
- //      frame1.setIcons(focused,unfocused);
- 
        frames.add(frame1);
  
--- 649,652 ----
***************
*** 673,680 ****
--- 678,688 ----
        int x = 0;
  
+       String views = "";
        while (view.getSessionViewCount() > 0) {
  
           jf = view.getSessionAt(0);
  
+          views += "-s " + jf.getSessionName() + " ";
+          
           log.info("session found and closing down");
           view.removeSessionView(jf);
***************
*** 683,687 ****
           log.info("socket closed");
           jf = null;
! 
        }
  
--- 691,695 ----
           log.info("socket closed");
           jf = null;
!          
        }
  
***************
*** 697,700 ****
--- 705,709 ----
        log.info("number of active sessions we have after shutting down " + sess.getCount());
  
+       log.info("view settings " + views);
        if (sess.getCount() == 0) {
  
***************
*** 702,705 ****
--- 711,716 ----
           sessions.setProperty("emul.height",Integer.toString(view.getHeight()));
  
+          sessions.setProperty("emul.view",views);
+ 
           // save off the session settings before closing down
           ConfigureFactory.getInstance().saveSettings(ConfigureFactory.SESSIONS,
***************
*** 739,743 ****
     }
  
!    protected void parseArgs(String theStringList, String[] s) {
        int x = 0;
        StringTokenizer tokenizer = new StringTokenizer(theStringList, " ");
--- 750,754 ----
     }
  
!    static protected void parseArgs(String theStringList, String[] s) {
        int x = 0;
        StringTokenizer tokenizer = new StringTokenizer(theStringList, " ");
***************
*** 859,861 ****
--- 870,951 ----
     }
  
+    /**
+     * This routine will read our jar file and extract the image data from
+     *    the jar file.  If the file is found it will then create the image
+     *    data from the data bytes read
+     *
+     * I think I got this example from the JavaWorld site or maybe from another
+     * magazine I can not remember.  I took it from another program I had written
+     * which had the same functionality.
+     *
+     */
+ //   protected ImageIcon createImageIcon(String image) {
+ //
+ //      String jarFileName = "my5250.jar";
+ //      int zeSize = 0;
+ //      byte[] b= null;
+ //      ImageIcon ii = null;
+ //
+ //      try {
+ //
+ //         ZipFile zf = new ZipFile("my5250.jar");
+ //
+ //         Enumeration e = zf.entries();
+ //         ZipEntry ze = null;
+ //
+ //         while (e.hasMoreElements()) {
+ //
+ //            ze = (ZipEntry)e.nextElement();
+ //            if (ze.getName().equals(image)) {
+ //               zeSize = (int)ze.getSize();
+ //            }
+ //         }
+ //
+ //         // extract the resource if found
+ //         FileInputStream fis=new FileInputStream(jarFileName);
+ //         BufferedInputStream bis=new BufferedInputStream(fis);
+ //         ZipInputStream zis=new ZipInputStream(bis);
+ //         ze=null;
+ //
+ //         while ((ze=zis.getNextEntry())!=null) {
+ //            if (ze.isDirectory()) {
+ //               continue;
+ //            }
+ //
+ //            // check if the resource entry read is the one we are looking for
+ //            if (ze.getName().equals(image)) {
+ //               int size=(int)ze.getSize();
+ //
+ //               // -1 means unknown size so default to one found from above.
+ //               if (size==-1) {
+ //                  size = zeSize;
+ //               }
+ //
+ //               b=new byte[(int)size];
+ //               int rb=0;
+ //               int chunk=0;
+ //               while (((int)size - rb) > 0) {
+ //                  chunk=zis.read(b,rb,(int)size - rb);
+ //                  if (chunk==-1) {
+ //                     break;
+ //                  }
+ //                  rb+=chunk;
+ //               }
+ //               ii = new ImageIcon(b);
+ //            }
+ //         }
+ //         zis.close();
+ //         fis.close();
+ //
+ //      }
+ //      catch( ZipException zexc) {
+ //         System.out.println("ze " + zexc.getMessage());
+ //      }
+ //      catch( IOException ioe) {
+ //         System.out.println("ioe " + ioe.getMessage());
+ //      }
+ //
+ //      return ii;
+ //   }
+ 
  }



-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP, 
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar