tn5250j/src/org/tn5250j Configure.java,1.8,1.9
"Kenneth J. Pouncey" <[email protected]> Sat, 26 Jun 2004 05:45:33 +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-serv13373
Modified Files:
Configure.java
Log Message:
Added new check box to use the AS400 toolbox codepages
Index: Configure.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/Configure.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** Configure.java 23 Jan 2004 12:41:50 -0000 1.8
--- Configure.java 26 Jun 2004 05:45:31 -0000 1.9
***************
*** 1,3 ****
- package org.tn5250j;
/**
* Title: tn5250J
--- 1,2 ----
***************
*** 25,28 ****
--- 24,28 ----
*
*/
+ package org.tn5250j;
import java.awt.*;
***************
*** 31,34 ****
--- 31,35 ----
import java.awt.event.*;
import java.util.*;
+ import java.util.jar.*;
import org.tn5250j.tools.*;
***************
*** 46,49 ****
--- 47,51 ----
static JTextField fpn = null;
static JComboBox cpb = null;
+ static JCheckBox jtb = null;
static JCheckBox ec = null;
static JCheckBox tc = null;
***************
*** 82,87 ****
heartBeat = new JCheckBox(LangTool.getString("conf.labelHeartBeat"));
cpb = new JComboBox();
! String[] availCP = CharMappings.getAvailableCodePages();
cpb.addItem(LangTool.getString("conf.labelDefault"));
--- 84,98 ----
heartBeat = new JCheckBox(LangTool.getString("conf.labelHeartBeat"));
+ jtb = new JCheckBox("AS/400 Toolbox");
+ jtb.addItemListener(new java.awt.event.ItemListener() {
+ public void itemStateChanged(ItemEvent e) {
+ doCPStateChanged(e);
+ }
+ });
+
cpb = new JComboBox();
!
! String[] availCP = getAvailableCodePages();
!
cpb.addItem(LangTool.getString("conf.labelDefault"));
***************
*** 107,110 ****
--- 118,122 ----
ec.setSelected(true);
tc.setSelected(true);
+ jtb.setSelected(false);
sdNormal.setSelected(true);
deamon.setSelected(true);
***************
*** 145,150 ****
else
fpn = new JTextField(20);
! if (isSpecified("-cp",args))
! cpb.setSelectedItem(getParm("-cp",args));
if (isSpecified("-e",args))
ec.setSelected(true);
--- 157,174 ----
else
fpn = new JTextField(20);
! if (isSpecified("-cp",args)) {
! String codepage = getParm("-cp",args);
! String[] acps = CharMappings.getAvailableCodePages();
! jtb.setSelected(true);
! for (int x = 0; x < acps.length; x++) {
!
! if (acps[x].equals(codepage))
! jtb.setSelected(false);
!
! }
! cpb.setSelectedItem(codepage);
!
! }
!
if (isSpecified("-e",args))
ec.setSelected(true);
***************
*** 206,209 ****
--- 230,239 ----
else
heartBeat.setSelected(false);
+
+ if (isSpecified("-hb",args))
+ heartBeat.setSelected(true);
+ else
+ heartBeat.setSelected(false);
+
}
***************
*** 309,317 ****
// code page panel
JPanel cp = new JPanel();
! BoxLayout cpLayout = new BoxLayout(cp,BoxLayout.Y_AXIS);
cp.setLayout(cpLayout);
cp.setBorder(BorderFactory.createTitledBorder(
LangTool.getString("conf.labelCodePage")));
cp.add(cpb);
// emulation mode panel
--- 339,348 ----
// code page panel
JPanel cp = new JPanel();
! BoxLayout cpLayout = new BoxLayout(cp,BoxLayout.X_AXIS);
cp.setLayout(cpLayout);
cp.setBorder(BorderFactory.createTitledBorder(
LangTool.getString("conf.labelCodePage")));
cp.add(cpb);
+ cp.add(jtb);
// emulation mode panel
***************
*** 430,433 ****
--- 461,480 ----
}
+
+ /**
+ * Return the list of availble code pages depending on which character
+ * mapping flag is set.
+ *
+ * @return list of available code pages
+ *
+ */
+ private static String[] getAvailableCodePages() {
+
+ if (jtb.isSelected())
+ return CharMappings.getAvailableCodePages(CharMappings.TOOLBOX_CP);
+ else
+ return CharMappings.getAvailableCodePages();
+ }
+
/**
* React to the configuration action button to perform to Add or Edit the
***************
*** 464,467 ****
--- 511,530 ----
}
+ /**
+ * Available Code Page selection state change
+ *
+ * @param e Item event to react to changes
+ */
+ private static void doCPStateChanged(ItemEvent e) {
+
+ String[] availCP = getAvailableCodePages();
+ cpb.removeAllItems();
+ cpb.addItem(LangTool.getString("conf.labelDefault"));
+
+ for (int x = 0; x < availCP.length; x++) {
+ cpb.addItem(availCP[x]);
+ }
+ }
+
private static void addLabelComponent(String text,Component comp,Container container) {
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com