tn5250j/src/org/tn5250j/tools GUIGraphicsUtils.java,1.5,1.6 Macronizer.java,1.9,1.10 XTFRFile.java,1.15,1.16

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

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

Index: GUIGraphicsUtils.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/tools/GUIGraphicsUtils.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** GUIGraphicsUtils.java	9 Jul 2003 18:55:39 -0000	1.5
--- GUIGraphicsUtils.java	31 Mar 2004 12:25:09 -0000	1.6
***************
*** 43,46 ****
--- 43,47 ----
  import javax.swing.ImageIcon;
  import java.net.URL;
+ import java.awt.print.*;
  
  import org.tn5250j.tools.system.OperatingSystem;

Index: XTFRFile.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/tools/XTFRFile.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** XTFRFile.java	20 Jan 2004 15:53:28 -0000	1.15
--- XTFRFile.java	31 Mar 2004 12:25:09 -0000	1.16
***************
*** 49,52 ****
--- 49,53 ----
  import org.tn5250j.gui.TN5250jFrame;
  import org.tn5250j.gui.TN5250jFileChooser;
+ import org.tn5250j.gui.TN5250jFileFilter;
  
  public class XTFRFile
***************
*** 110,115 ****
  	public XTFRFile(Frame parent, tnvt pvt, Session session) {
  
! 		//super(parent);
! 		super();
  		setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
  		this.session = session;
--- 111,141 ----
  	public XTFRFile(Frame parent, tnvt pvt, Session session) {
  
!       this(parent, pvt, session, null);
! //		setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
! //		this.session = session;
! //		vt = pvt;
! //		ftpProtocol = new FTP5250Prot(vt);
! //		ftpProtocol.addFTPStatusListener(this);
! //		axtfr = new AS400Xtfr(vt);
! //		axtfr.addFTPStatusListener(this);
! //		createProgressMonitor();
! //		initFileFilters();
! //		initXTFRInfo(null);
! //
! //		addWindowListener(new WindowAdapter() {
! //
! //			public void windowClosing(WindowEvent we) {
! //				if (ftpProtocol.isConnected())
! //					ftpProtocol.disconnect();
! //			}
! //
! //		});
! //
! //		messageProgress = LangTool.getString("xtfr.messageProgress");
! //		setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
! 	}
! 
! 	public XTFRFile(Frame parent, tnvt pvt, Session session, Properties XTFRProps) {
! 
  		setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
  		this.session = session;
***************
*** 121,125 ****
  		createProgressMonitor();
  		initFileFilters();
! 		initXTFRInfo();
  
  		addWindowListener(new WindowAdapter() {
--- 147,151 ----
  		createProgressMonitor();
  		initFileFilters();
! 		initXTFRInfo(XTFRProps);
  
  		addWindowListener(new WindowAdapter() {
***************
*** 252,255 ****
--- 278,295 ----
  	public void actionPerformed(ActionEvent e) {
  
+       // process the save transfer information button
+    	if (e.getActionCommand().equals("SAVE")) {
+ 
+          saveXTFRInfo();
+ 
+    	}
+ 
+       // process the save transfer information button
+    	if (e.getActionCommand().equals("LOAD")) {
+ 
+          loadXTFRInfo();
+ 
+    	}
+ 
  		if (e.getActionCommand().equals("XTFR")
  			|| e.getActionCommand().equals("EMAIL")) {
***************
*** 494,498 ****
  	 * of the transfer
  	 */
! 	private void initXTFRInfo() {
  
  		// create some reusable borders and layouts
--- 534,538 ----
  	 * of the transfer
  	 */
! 	private void initXTFRInfo(Properties XTFRProps) {
  
  		// create some reusable borders and layouts
***************
*** 763,766 ****
--- 803,820 ----
  		op.add(emailButton);
  
+       // add transfer save information button
+ 		JButton saveButton =
+ 			new JButton(LangTool.getString("xtfr.labelXTFRSave"));
+ 		saveButton.addActionListener(this);
+ 		saveButton.setActionCommand("SAVE");
+ 		op.add(saveButton);
+ 
+       // add transfer load information button
+ 		JButton loadButton =
+ 			new JButton(LangTool.getString("xtfr.labelXTFRLoad"));
+ 		loadButton.addActionListener(this);
+ 		loadButton.setActionCommand("LOAD");
+ 		op.add(loadButton);
+ 
  		mp.add(sp, BorderLayout.CENTER);
  		mp.add(op, BorderLayout.SOUTH);
***************
*** 781,785 ****
  		as400QueryP.add(scrollPane, BorderLayout.CENTER);
  
! 		initXTFRFields();
  
  		// pack it and center it on the screen
--- 835,839 ----
  		as400QueryP.add(scrollPane, BorderLayout.CENTER);
  
! 		initXTFRFields(XTFRProps);
  
  		// pack it and center it on the screen
***************
*** 800,807 ****
  	}
  
! 	private void initXTFRFields() {
  
! 		SessionConfig config = session.getConfiguration();
! 		Properties props = config.getProperties();
  
  		if (props.containsKey("xtfr.fileName"))
--- 854,863 ----
  	}
  
! 	private void initXTFRFields(Properties props) {
  
!       if (props == null) {
!          SessionConfig config = session.getConfiguration();
!          props = config.getProperties();
!       }
  
  		if (props.containsKey("xtfr.fileName"))
***************
*** 853,856 ****
--- 909,964 ----
  		Properties props = config.getProperties();
  
+       saveXTFRFields(props);
+ //		if (hostFile.getText().trim().length() > 0)
+ //			props.setProperty("xtfr.fileName", hostFile.getText().trim());
+ //		else
+ //			props.remove("xtfr.fileName");
+ //
+ //		if (user.getText().trim().length() > 0)
+ //			props.setProperty("xtfr.user", user.getText().trim());
+ //		else
+ //			props.remove("xtfr.user");
+ //
+ //		if (useQuery.isSelected())
+ //			props.setProperty("xtfr.useQuery", "true");
+ //		else
+ //			props.remove("xtfr.useQuery");
+ //
+ //		if (queryStatement.getText().trim().length() > 0)
+ //			props.setProperty(
+ //				"xtfr.queryStatement",
+ //				queryStatement.getText().trim());
+ //		else
+ //			props.remove("xtfr.queryStatement");
+ //
+ //		if (allFields.isSelected())
+ //			props.setProperty("xtfr.allFields", "true");
+ //		else
+ //			props.remove("xtfr.allFields");
+ //
+ //		if (txtDesc.isSelected())
+ //			props.setProperty("xtfr.txtDesc", "true");
+ //		else
+ //			props.remove("xtfr.txtDesc");
+ //
+ //		props.setProperty(
+ //			"xtfr.fileFormat",
+ //			(String) fileFormat.getSelectedItem());
+ //
+ //		if (localFile.getText().trim().length() > 0)
+ //			props.setProperty("xtfr.localFile", localFile.getText().trim());
+ //		else
+ //			props.remove("xtfr.localFile");
+ //
+ //		props.setProperty(
+ //			"xtfr.decimalSeparator",
+ //			(String) decimalSeparator.getSelectedItem());
+ 
+ 		config.setModified();
+ 
+ 	}
+ 
+ 	private void saveXTFRFields(Properties props) {
+ 
  		if (hostFile.getText().trim().length() > 0)
  			props.setProperty("xtfr.fileName", hostFile.getText().trim());
***************
*** 898,902 ****
  			(String) decimalSeparator.getSelectedItem());
  
! 		config.setModified();
  
  	}
--- 1006,1087 ----
  			(String) decimalSeparator.getSelectedItem());
  
! 	}
! 
! 	private void saveXTFRInfo() {
! 
!       Properties xtfrProps = new Properties();
!       xtfrProps.setProperty("xtfr.destination","FROM");
!       this.saveXTFRFields(xtfrProps);
! 		String workingDir = System.getProperty("user.dir");
! 		TN5250jFileChooser pcFileChooser = new TN5250jFileChooser(workingDir);
! 
!       // set the file filters for the file chooser
!       TN5250jFileFilter filter = new TN5250jFileFilter("dtf","Transfer from AS/400");
! 
!       pcFileChooser.addChoosableFileFilter(filter );
! 
! 		int ret = pcFileChooser.showSaveDialog(this);
! 
! 		// check to see if something was actually chosen
! 		if (ret == JFileChooser.APPROVE_OPTION) {
! 
! 			File file = pcFileChooser.getSelectedFile();
! 
!          file = new File(filter.setExtension(file));
! 
!          try {
!             FileOutputStream out = new FileOutputStream(file);
!                // save off the width and height to be restored later
!             xtfrProps.store(out,"------ Transfer Details --------");
! 
!             out.flush();
!             out.close();
!          }
!          catch (FileNotFoundException fnfe) {}
!          catch (IOException ioe) {}
! 
! 
! 		}
! 
! 	}
! 
! 	private void loadXTFRInfo() {
! 
!       Properties xtfrProps = new Properties();
! //      xtfrProps.setProperty("xtfr.destination","FROM");
! //      this.saveXTFRFields(xtfrProps);
! 		String workingDir = System.getProperty("user.dir");
! 		TN5250jFileChooser pcFileChooser = new TN5250jFileChooser(workingDir);
! 
!       // set the file filters for the file chooser
!       TN5250jFileFilter filter = new TN5250jFileFilter("dtf","Transfer from AS/400");
! 
!       pcFileChooser.addChoosableFileFilter(filter );
! 
! 		int ret = pcFileChooser.showOpenDialog(this);
! 
! 		// check to see if something was actually chosen
! 		if (ret == JFileChooser.APPROVE_OPTION) {
! 
! 			File file = pcFileChooser.getSelectedFile();
! 
!          try {
!             FileInputStream in = new FileInputStream(file);
!                // save off the width and height to be restored later
!             xtfrProps.load(in);
! 
!             in.close();
!          }
!          catch (FileNotFoundException fnfe) {}
!          catch (IOException ioe) {}
! 
! 
! 		}
! 
!       if (xtfrProps.containsKey("xtfr.destination") &&
!                (xtfrProps.get("xtfr.destination").equals("FROM"))) {
! 
!          this.initXTFRFields(xtfrProps);
!       }
  
  	}

Index: Macronizer.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/tools/Macronizer.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** Macronizer.java	30 Nov 2003 11:01:10 -0000	1.9
--- Macronizer.java	31 Mar 2004 12:25:09 -0000	1.10
***************
*** 223,226 ****
--- 223,227 ----
        }
     }
+ 
     private static boolean checkScripts() {
  



-------------------------------------------------------
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