tn5250j/src/org/tn5250j Connect.java,1.13,1.14 SessionPopup.java,1.3,1.4

[email protected]
Newsgroups gmane.comp.java.tn5250j.cvs
Message-ID <[email protected]>
Update of /cvsroot/tn5250j/tn5250j/src/org/tn5250j
In directory sc8-pr-cvs1:/tmp/cvs-serv12950/src/org/tn5250j

Modified Files:
	Connect.java SessionPopup.java 
Log Message:
Update for SendEmail features

Index: Connect.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/Connect.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** Connect.java	30 Nov 2003 10:19:01 -0000	1.13
--- Connect.java	2 Dec 2003 13:14:47 -0000	1.14
***************
*** 50,53 ****
--- 50,54 ----
  import java.util.Properties;
  import java.util.Vector;
+ import java.util.*;
  
  import javax.swing.AbstractAction;
***************
*** 77,80 ****
--- 78,82 ----
  import javax.swing.event.ListSelectionListener;
  import javax.swing.table.AbstractTableModel;
+ 
  import org.tn5250j.gui.JSortTable;
  import org.tn5250j.gui.SortTableModel;
***************
*** 82,85 ****
--- 84,88 ----
  import org.tn5250j.tools.LangTool;
  import org.tn5250j.gui.TN5250jMultiSelectList;
+ import org.tn5250j.interfaces.OptionAccessFactory;
  
  public class Connect
***************
*** 93,98 ****
  	JPanel interfacePanel = new JPanel();
  	JPanel sessionOpts = new JPanel();
! 	JPanel sessionOptPanel = new JPanel(new FlowLayout(
! 		FlowLayout.CENTER, 30, 10));
  	JPanel emulOptPanel = new JPanel();
  	JPanel emptyPane = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 10));
--- 96,100 ----
  	JPanel interfacePanel = new JPanel();
  	JPanel sessionOpts = new JPanel();
! 	JPanel sessionOptPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 30, 10));
  	JPanel emulOptPanel = new JPanel();
  	JPanel emptyPane = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 10));
***************
*** 130,133 ****
--- 132,137 ----
  	BorderLayout borderLayout = new BorderLayout();
  
+    TN5250jMultiSelectList accessOptions;
+ 
  	//  Selection value for connection
  	String connectKey = null;
***************
*** 168,178 ****
  		optionTabs.addChangeListener(this);
  
! 		optionTabs.addTab(
! 			LangTool.getString("ss.labelConnections"),
! 			sessionPanel);
  		optionTabs.addTab(LangTool.getString("ss.labelOptions1"), emulOptPanel);
  
        createAccessPanel();
! 		optionTabs.addTab("Option Access", accessPanel);
  
  		// add the panels to our dialog
--- 172,180 ----
  		optionTabs.addChangeListener(this);
  
! 		optionTabs.addTab(LangTool.getString("ss.labelConnections"),sessionPanel);
  		optionTabs.addTab(LangTool.getString("ss.labelOptions1"), emulOptPanel);
  
        createAccessPanel();
! 		optionTabs.addTab(LangTool.getString("ss.labelOptions2"), accessPanel);
  
  		// add the panels to our dialog
***************
*** 447,472 ****
     private void createAccessPanel() {
  
!       TN5250jMultiSelectList sel = new TN5250jMultiSelectList();
!       Vector v = new Vector();
!       for (int x = 0;x < 40; x++) {
  
!          v.add("option " + x);
  
        }
  
!       sel.setListData(v);
  
!       int[] indexes = {5,15,20};
  
!       sel.setSelectedIndices(indexes);
!       sel.setSourceColumnHeader("Active");
!       sel.setSelectionColumnHeader("In Active");
  
-       sel.setSourceHeader("Active");
-       sel.setSelectionHeader("In Active");
  		// create emulator options panel
  		accessPanel.setLayout(new BorderLayout());
  
!       accessPanel.add(sel,BorderLayout.CENTER);
  
     }
--- 449,489 ----
     private void createAccessPanel() {
  
!       accessOptions = new TN5250jMultiSelectList();
  
!       Vector options = OptionAccessFactory.getInstance().getOptions();
  
+       // set up a hashtable of option descriptions to options
+       Hashtable ht = new Hashtable(options.size());
+       for (int x = 0; x < options.size(); x++) {
+          ht.put(LangTool.getString("key."+options.get(x)),options.get(x));
        }
  
!       // get the sorted descriptions of the options
!       Vector descriptions = OptionAccessFactory.getInstance().getOptionDescriptions();
  
!       // set the option descriptions
!       accessOptions.setListData(descriptions);
  
!       // we now mark the invalid options
!       int num = OptionAccessFactory.getInstance().getNumberOfRestrictedOptions();
!       int[] si = new int[num];
!       int i = 0;
!       for (int x = 0;x < descriptions.size();x++) {
!          if (!OptionAccessFactory.getInstance().isValidOption(
!                   (String)ht.get(descriptions.get(x))  ) )
!             si[i++] = x;
!       }
! 
!       accessOptions.setSelectedIndices(si);
! //      accessOptions.setSourceColumnHeader("Active");
! //      accessOptions.setSelectionColumnHeader("In Active");
! 
!       accessOptions.setSourceHeader(LangTool.getString("ss.labelActive"));
!       accessOptions.setSelectionHeader(LangTool.getString("ss.labelRestricted"));
  
  		// create emulator options panel
  		accessPanel.setLayout(new BorderLayout());
  
!       accessPanel.add(accessOptions,BorderLayout.CENTER);
  
     }
***************
*** 587,595 ****
--- 604,636 ----
  	private void saveProps() {
  
+       setOptionAccess();
+ 
  		ConfigureFactory.getInstance().saveSettings(
  			GlobalConfigure.SESSIONS,
  			"------ Session Information --------");
  
+       OptionAccessFactory.getInstance().reload();
  	}
+ 
+    private void setOptionAccess() {
+ 
+       Vector options = OptionAccessFactory.getInstance().getOptions();
+ 
+       // set up a hashtable of option descriptions to options
+       Hashtable ht = new Hashtable(options.size());
+       for (int x = 0; x < options.size(); x++) {
+          ht.put(LangTool.getString("key."+options.get(x)),options.get(x));
+       }
+ 
+       // get the sorted descriptions of the options
+       Vector descriptions = OptionAccessFactory.getInstance().getOptionDescriptions();
+ 
+       Object[] restrict = accessOptions.getSelectedValues();
+       String s = "";
+       for (int x = 0; x < restrict.length; x++) {
+          s +=ht.get(restrict[x]) + ";";
+       }
+       props.setProperty("emul.restricted",s);
+    }
  
  	private void addLabelComponent(

Index: SessionPopup.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/SessionPopup.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** SessionPopup.java	1 Dec 2003 15:18:55 -0000	1.3
--- SessionPopup.java	2 Dec 2003 13:14:47 -0000	1.4
***************
*** 36,42 ****
  import org.tn5250j.keyboard.configure.KeyConfigure;
  import org.tn5250j.mailtools.SendEMailDialog;
  
  /**
!  * Custom 
   */
  public class SessionPopup implements TN5250jConstants {
--- 36,43 ----
  import org.tn5250j.keyboard.configure.KeyConfigure;
  import org.tn5250j.mailtools.SendEMailDialog;
+ import org.tn5250j.interfaces.OptionAccessFactory;
  
  /**
!  * Custom
   */
  public class SessionPopup implements TN5250jConstants {
***************
*** 176,205 ****
                 }
             };
           kbMenu.add(action);
  
           kbMenu.addSeparator();
  
!          action = new AbstractAction(LangTool.getString("key.[attn]")) {
!                public void actionPerformed(ActionEvent e) {
!                   screen.sendKeys("[attn]");
!                }
!            };
!          kbMenu.add(createMenuItem(action,MNEMONIC_ATTN));
  
!          action = new AbstractAction(LangTool.getString("key.[reset]")) {
!                public void actionPerformed(ActionEvent e) {
!                   screen.sendKeys("[reset]");
!                }
!            };
!          kbMenu.add(createMenuItem(action,MNEMONIC_RESET));
  
!          action = new AbstractAction(LangTool.getString("key.[sysreq]")) {
!                public void actionPerformed(ActionEvent e) {
!                   screen.sendKeys("[sysreq]");
!                }
!            };
!          kbMenu.add(createMenuItem(action,MNEMONIC_SYSREQ));
  
-          if (screen.isMessageWait()) {
              action = new AbstractAction(LangTool.getString("popup.displayMessages")) {
                    public void actionPerformed(ActionEvent e) {
--- 177,214 ----
                 }
             };
+ 
           kbMenu.add(action);
  
           kbMenu.addSeparator();
  
!          createKeyboardItem(kbMenu,MNEMONIC_ATTN);
  
! //         action = new AbstractAction(LangTool.getString("key.[attn]")) {
! //               public void actionPerformed(ActionEvent e) {
! //                  screen.sendKeys("[attn]");
! //               }
! //           };
! //
! //         kbMenu.add(createMenuItem(action,MNEMONIC_ATTN));
  
!          createKeyboardItem(kbMenu,MNEMONIC_RESET);
! //         action = new AbstractAction(LangTool.getString("key.[reset]")) {
! //               public void actionPerformed(ActionEvent e) {
! //                  screen.sendKeys("[reset]");
! //               }
! //           };
! //         kbMenu.add(createMenuItem(action,MNEMONIC_RESET));
! 
!          createKeyboardItem(kbMenu,MNEMONIC_SYSREQ);
! //         action = new AbstractAction(LangTool.getString("key.[sysreq]")) {
! //               public void actionPerformed(ActionEvent e) {
! //                  screen.sendKeys("[sysreq]");
! //               }
! //           };
! //         kbMenu.add(createMenuItem(action,MNEMONIC_SYSREQ));
! 
!          if (screen.isMessageWait() &&
!                OptionAccessFactory.getInstance().isValidOption(MNEMONIC_DISP_MESSAGES)) {
  
              action = new AbstractAction(LangTool.getString("popup.displayMessages")) {
                    public void actionPerformed(ActionEvent e) {
***************
*** 213,271 ****
           kbMenu.addSeparator();
  
!          action = new AbstractAction(LangTool.getString("key.[dupfield]")) {
!                public void actionPerformed(ActionEvent e) {
!                   screen.sendKeys("[dupfield]");
!                }
!            };
!          kbMenu.add(createMenuItem(action,MNEMONIC_DUP_FIELD));
  
!          action = new AbstractAction(LangTool.getString("key.[help]")) {
!                public void actionPerformed(ActionEvent e) {
!                   screen.sendKeys("[help]");
!                }
!            };
!          kbMenu.add(createMenuItem(action,MNEMONIC_HELP));
  
!          action = new AbstractAction(LangTool.getString("key.[eraseeof]")) {
!                public void actionPerformed(ActionEvent e) {
!                   screen.sendKeys("[eraseeof]");
!                }
!            };
!          kbMenu.add(createMenuItem(action,MNEMONIC_ERASE_EOF));
  
!          action = new AbstractAction(LangTool.getString("key.[field+]")) {
!                public void actionPerformed(ActionEvent e) {
!                   screen.sendKeys("[field+]");
!                }
!            };
!          kbMenu.add(createMenuItem(action,MNEMONIC_FIELD_PLUS));
  
  
!          action = new AbstractAction(LangTool.getString("key.[field-]")) {
!                public void actionPerformed(ActionEvent e) {
!                   screen.sendKeys("[field-]");
!                }
!            };
!          kbMenu.add(createMenuItem(action,MNEMONIC_FIELD_MINUS));
  
  
!          action = new AbstractAction(LangTool.getString("key.[newline]")) {
!                public void actionPerformed(ActionEvent e) {
!                   screen.sendKeys("[newline]");
!                }
!            };
!          kbMenu.add(createMenuItem(action,MNEMONIC_NEW_LINE));
  
  
!          action = new AbstractAction(LangTool.getString("popup.hostPrint")) {
!                public void actionPerformed(ActionEvent e) {
!                   vt.hostPrint(1);
!                }
!            };
!          kbMenu.add(createMenuItem(action,MNEMONIC_PRINT));
  
           createShortCutItems(kbMenu);
  
!          if (screen.isMessageWait()) {
              action = new AbstractAction(LangTool.getString("popup.displayMessages")) {
                    public void actionPerformed(ActionEvent e) {
--- 222,293 ----
           kbMenu.addSeparator();
  
!          createKeyboardItem(kbMenu,MNEMONIC_DUP_FIELD);
  
! //         action = new AbstractAction(LangTool.getString("key.[dupfield]")) {
! //               public void actionPerformed(ActionEvent e) {
! //                  screen.sendKeys("[dupfield]");
! //               }
! //           };
! //         kbMenu.add(createMenuItem(action,MNEMONIC_DUP_FIELD));
  
!          createKeyboardItem(kbMenu,MNEMONIC_HELP);
! //         action = new AbstractAction(LangTool.getString("key.[help]")) {
! //               public void actionPerformed(ActionEvent e) {
! //                  screen.sendKeys("[help]");
! //               }
! //           };
! //         kbMenu.add(createMenuItem(action,MNEMONIC_HELP));
  
!          createKeyboardItem(kbMenu,MNEMONIC_ERASE_EOF);
! //         action = new AbstractAction(LangTool.getString("key.[eraseeof]")) {
! //               public void actionPerformed(ActionEvent e) {
! //                  screen.sendKeys("[eraseeof]");
! //               }
! //           };
! //         kbMenu.add(createMenuItem(action,MNEMONIC_ERASE_EOF));
  
+          createKeyboardItem(kbMenu,MNEMONIC_FIELD_PLUS);
  
! //         action = new AbstractAction(LangTool.getString("key.[field+]")) {
! //               public void actionPerformed(ActionEvent e) {
! //                  screen.sendKeys("[field+]");
! //               }
! //           };
! //         kbMenu.add(createMenuItem(action,MNEMONIC_FIELD_PLUS));
  
  
!          createKeyboardItem(kbMenu,MNEMONIC_FIELD_MINUS);
  
+ //         action = new AbstractAction(LangTool.getString("key.[field-]")) {
+ //               public void actionPerformed(ActionEvent e) {
+ //                  screen.sendKeys("[field-]");
+ //               }
+ //           };
+ //         kbMenu.add(createMenuItem(action,MNEMONIC_FIELD_MINUS));
  
! 
!          createKeyboardItem(kbMenu,MNEMONIC_NEW_LINE);
! //         action = new AbstractAction(LangTool.getString("key.[newline]")) {
! //               public void actionPerformed(ActionEvent e) {
! //                  screen.sendKeys("[newline]");
! //               }
! //           };
! //         kbMenu.add(createMenuItem(action,MNEMONIC_NEW_LINE));
! 
! 
!          if (OptionAccessFactory.getInstance().isValidOption(MNEMONIC_PRINT)) {
!             action = new AbstractAction(LangTool.getString("popup.hostPrint")) {
!                   public void actionPerformed(ActionEvent e) {
!                      vt.hostPrint(1);
!                   }
!               };
!             kbMenu.add(createMenuItem(action,MNEMONIC_PRINT));
!          }
  
           createShortCutItems(kbMenu);
  
!          if (screen.isMessageWait() &&
!             OptionAccessFactory.getInstance().isValidOption(MNEMONIC_DISP_MESSAGES)) {
! 
              action = new AbstractAction(LangTool.getString("popup.displayMessages")) {
                    public void actionPerformed(ActionEvent e) {
***************
*** 295,306 ****
           popup.add(createMenuItem(action,""));
  
!          action = new AbstractAction(LangTool.getString("popup.settings")) {
!                public void actionPerformed(ActionEvent e) {
!                   session.doAttributes();
!                  session.getFocusForMe();
!                }
!            };
!          popup.add(createMenuItem(action,MNEMONIC_DISP_ATTRIBUTES));
  
  
           popup.addSeparator();
--- 317,331 ----
           popup.add(createMenuItem(action,""));
  
!          if (OptionAccessFactory.getInstance().isValidOption(MNEMONIC_DISP_ATTRIBUTES)) {
  
+             action = new AbstractAction(LangTool.getString("popup.settings")) {
+                   public void actionPerformed(ActionEvent e) {
+                      session.doAttributes();
+                     session.getFocusForMe();
+                   }
+               };
+             popup.add(createMenuItem(action,MNEMONIC_DISP_ATTRIBUTES));
+ 
+          }
  
           popup.addSeparator();
***************
*** 348,368 ****
           JMenu xtfrMenu = new JMenu(LangTool.getString("popup.export"));
  
!          action = new AbstractAction(LangTool.getString("popup.xtfrFile")) {
!                public void actionPerformed(ActionEvent e) {
!                   doMeTransfer();
!                   session.getFocusForMe();
!                }
!            };
  
!          xtfrMenu.add(createMenuItem(action,MNEMONIC_FILE_TRANSFER));
  
!          action = new AbstractAction(LangTool.getString("popup.xtfrSpool")) {
!                public void actionPerformed(ActionEvent e) {
!                   doMeSpool();
!                   session.getFocusForMe();
!                }
!            };
  
!          xtfrMenu.add(action);
  
           popup.add(xtfrMenu);
--- 373,399 ----
           JMenu xtfrMenu = new JMenu(LangTool.getString("popup.export"));
  
!          if (OptionAccessFactory.getInstance().isValidOption(MNEMONIC_FILE_TRANSFER)) {
  
!             action = new AbstractAction(LangTool.getString("popup.xtfrFile")) {
!                   public void actionPerformed(ActionEvent e) {
!                      doMeTransfer();
!                      session.getFocusForMe();
!                   }
!               };
  
!             xtfrMenu.add(createMenuItem(action,MNEMONIC_FILE_TRANSFER));
!          }
  
!          if (OptionAccessFactory.getInstance().isValidOption(MNEMONIC_SPOOL_FILE)) {
! 
!             action = new AbstractAction(LangTool.getString("popup.xtfrSpool")) {
!                   public void actionPerformed(ActionEvent e) {
!                      doMeSpool();
!                      session.getFocusForMe();
!                   }
!               };
! 
!             xtfrMenu.add(action);
!          }
  
           popup.add(xtfrMenu);
***************
*** 371,392 ****
           popup.add(sendMenu);
  
! 		action = new AbstractAction(LangTool.getString("popup.quickmail")) {
! 					   public void actionPerformed(ActionEvent e) {
! 						  sendScreenEMail();
! 						 session.getFocusForMe();
! 					   }
! 				   };
! 
! 		sendMenu.add(action);
! 
! 
!          action = new AbstractAction(LangTool.getString("popup.email")) {
                 public void actionPerformed(ActionEvent e) {
!                   sendScreenEMail();
                   session.getFocusForMe();
                 }
!            };
  
!          sendMenu.add(createMenuItem(action,MNEMONIC_E_MAIL));
  
           action = new AbstractAction(LangTool.getString("popup.file")) {
--- 402,425 ----
           popup.add(sendMenu);
  
! 		   action = new AbstractAction(LangTool.getString("popup.quickmail")) {
                 public void actionPerformed(ActionEvent e) {
!                  sendQuickEMail();
                   session.getFocusForMe();
                 }
!             };
  
! 		   sendMenu.add(action);
! 
!          if (OptionAccessFactory.getInstance().isValidOption(MNEMONIC_E_MAIL)) {
! 
!             action = new AbstractAction(LangTool.getString("popup.email")) {
!                   public void actionPerformed(ActionEvent e) {
!                      sendScreenEMail();
!                     session.getFocusForMe();
!                   }
!               };
! 
!             sendMenu.add(createMenuItem(action,MNEMONIC_E_MAIL));
!          }
  
           action = new AbstractAction(LangTool.getString("popup.file")) {
***************
*** 410,451 ****
        }
  
!       action = new AbstractAction(LangTool.getString("popup.connections")) {
!             public void actionPerformed(ActionEvent e) {
!                session.doConnections();
!             }
!         };
! 
!       popup.add(createMenuItem(action,MNEMONIC_OPEN_NEW));
! 
!       popup.addSeparator();
  
!       if (vt.isConnected()) {
!          action = new AbstractAction(LangTool.getString("popup.disconnect")) {
                 public void actionPerformed(ActionEvent e) {
!                   changeConnection();
!                   session.getFocusForMe();
                 }
             };
        }
-       else {
  
!          action = new AbstractAction(LangTool.getString("popup.connect")) {
                 public void actionPerformed(ActionEvent e) {
!                   changeConnection();
!                  session.getFocusForMe();
                 }
             };
  
  
        }
-       popup.add(createMenuItem(action,MNEMONIC_TOGGLE_CONNECTION));
- 
-       action = new AbstractAction(LangTool.getString("popup.close")) {
-             public void actionPerformed(ActionEvent e) {
-                session.closeSession();
-             }
-         };
- 
-       popup.add(createMenuItem(action,MNEMONIC_CLOSE));
  
        GUIGraphicsUtils.positionPopup(me.getComponent(),popup,
--- 443,495 ----
        }
  
!       if (OptionAccessFactory.getInstance().isValidOption(MNEMONIC_OPEN_NEW)) {
  
!          action = new AbstractAction(LangTool.getString("popup.connections")) {
                 public void actionPerformed(ActionEvent e) {
!                   session.doConnections();
                 }
             };
+ 
+          popup.add(createMenuItem(action,MNEMONIC_OPEN_NEW));
        }
  
!       popup.addSeparator();
! 
!       if (OptionAccessFactory.getInstance().isValidOption(MNEMONIC_TOGGLE_CONNECTION)) {
! 
!          if (vt.isConnected()) {
!             action = new AbstractAction(LangTool.getString("popup.disconnect")) {
!                   public void actionPerformed(ActionEvent e) {
!                      changeConnection();
!                      session.getFocusForMe();
!                   }
!               };
!          }
!          else {
! 
!             action = new AbstractAction(LangTool.getString("popup.connect")) {
!                   public void actionPerformed(ActionEvent e) {
!                      changeConnection();
!                     session.getFocusForMe();
!                   }
!               };
! 
! 
!          }
! 
!          popup.add(createMenuItem(action,MNEMONIC_TOGGLE_CONNECTION));
!       }
! 
!       if (OptionAccessFactory.getInstance().isValidOption(MNEMONIC_CLOSE)) {
! 
!          action = new AbstractAction(LangTool.getString("popup.close")) {
                 public void actionPerformed(ActionEvent e) {
!                   session.closeSession();
                 }
             };
  
+          popup.add(createMenuItem(action,MNEMONIC_CLOSE));
  
        }
  
        GUIGraphicsUtils.positionPopup(me.getComponent(),popup,
***************
*** 454,457 ****
--- 498,516 ----
     }
  
+    private void createKeyboardItem (JMenu menu, String key) {
+ 
+       if (OptionAccessFactory.getInstance().isValidOption(key)) {
+          final String key2 = key;
+          Action action = new AbstractAction(LangTool.getString("key." + key)) {
+                public void actionPerformed(ActionEvent e) {
+                   screen.sendKeys(key2);
+                }
+            };
+ 
+          menu.add(createMenuItem(action,key));
+       }
+ 
+    }
+ 
     private void addMacros(JMenu menu) {
  
***************
*** 460,463 ****
--- 519,523 ----
  
     private JMenuItem createMenuItem(Action action, String accelKey) {
+ 
        JMenuItem mi;
  
***************
*** 702,708 ****
     }
  
!    public void sendScreenEMail() {
  
        new SendEMailDialog((JFrame)SwingUtilities.getRoot(session),session);
     }
  
--- 762,773 ----
     }
  
!    private void sendScreenEMail() {
  
        new SendEMailDialog((JFrame)SwingUtilities.getRoot(session),session);
+    }
+ 
+    private void sendQuickEMail() {
+ 
+       new SendEMailDialog((JFrame)SwingUtilities.getRoot(session),session,false);
     }
  




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.