changeset 6:1b9e27659ef7 tn5250

adding tn5250 files
author Carl Byington <carl@five-ten-sg.com>
date Thu, 22 May 2014 13:10:44 -0700
parents cbdff98c45ea
children 3248b46f3973
files src/org/tn5250j/event/ScreenOIAListener.java src/org/tn5250j/framework/tn5250/ScreenPlanes.java src/org/tn5250j/framework/tn5250/tnvt.java
diffstat 3 files changed, 47 insertions(+), 389 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/tn5250j/event/ScreenOIAListener.java	Thu May 22 13:10:44 2014 -0700
@@ -0,0 +1,45 @@
+/**
+ *
+ * <p>Title: ScreenOIAListener</p>
+ * <p>Description: Main interface to draw the graphical image of the screen</p>
+ * <p>Copyright: Copyright (c) 2000 - 2002</p>
+ * <p>
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this software; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307 USA
+ * </p>
+ * @author Kenneth J. Pouncey
+ * @version 0.5
+ */
+
+package org.tn5250j.event;
+
+import org.tn5250j.framework.tn5250.ScreenOIA;
+
+public interface ScreenOIAListener {
+
+  public static final int OIA_CHANGED_INSERT_MODE = 0;
+  public static final int OIA_CHANGED_KEYS_BUFFERED = 1;
+  public static final int OIA_CHANGED_KEYBOARD_LOCKED = 2;
+  public static final int OIA_CHANGED_MESSAGELIGHT = 3;
+  public static final int OIA_CHANGED_SCRIPT = 4;
+  public static final int OIA_CHANGED_BELL = 5;
+  public static final int OIA_CHANGED_CLEAR_SCREEN = 6;
+  public static final int OIA_CHANGED_INPUTINHIBITED = 7;
+  public static final int OIA_CHANGED_CURSOR = 8;
+
+
+   public void onOIAChanged(ScreenOIA oia, int change);
+
+}
--- a/src/org/tn5250j/framework/tn5250/ScreenPlanes.java	Thu May 22 12:38:09 2014 -0700
+++ b/src/org/tn5250j/framework/tn5250/ScreenPlanes.java	Thu May 22 13:10:44 2014 -0700
@@ -29,8 +29,6 @@
 
 import java.util.Properties;
 
-import org.tn5250j.ExternalProgramConfig;
-
 public class ScreenPlanes {
 
 	private final Screen5250 scr;
@@ -758,361 +756,6 @@
 		return numBytes;
 	}
 
-	protected boolean checkHotSpots () {
-
-		Screen5250 s = scr;
-		int lenScreen = scr.getScreenLength();
-		boolean hs = false;
-		boolean retHS = false;
-		StringBuffer hsMore = s.getHSMore();
-		StringBuffer hsBottom = s.getHSBottom();
-
-		for (int x = 0; x < lenScreen; x++) {
-
-			hs =false;
-			if (s.isInField(x,false))
-				continue;
-
-			// First check for PF keys
-			if (x > 0 && screen[x] == 'F') {
-				if (screen[x + 1] >= '0' &&
-						screen[x + 1] <= '9' &&
-						screen[x - 1] <= ' ' &&
-						(screenExtended[x] & EXTENDED_5250_NON_DSP) == 0) {
-
-					if (screen[x + 2] >= '0' &&
-							screen[x + 2] <= '9' &&
-							(screen[x + 3] == '=' ||
-									screen[x + 3] == '-' ||
-									screen[x + 3] == '/') )
-						hs = true;
-					else
-						if (   screen[x + 2] == '=' ||
-								screen[x + 3] == '-' ||
-								screen[x + 3] == '/')
-							hs = true;
-
-					if (hs) {
-						screenGUI[x] = BUTTON_LEFT;
-
-						int ns = 0;
-						int row = x / numCols;
-						while (ns < 2 && ++x / numCols == row) {
-							if (screen[x] <= ' ')
-								ns++;
-							else
-								ns = 0;
-							if (ns <2)
-								screenGUI[x] = BUTTON_MIDDLE;
-
-						}
-
-						// now lets go back and take out gui's that do not belong
-						while (screen[--x] <= ' ') {
-							screenGUI[x] = NO_GUI;
-						}
-						screenGUI[x] = BUTTON_RIGHT;
-
-					}
-				}
-			}
-
-			// now lets check for menus
-			if (!hs && x > 0 && x < lenScreen - 2 &&
-					screen[x] == '.' &&
-					screenGUI[x] == NO_GUI &&
-					(screenExtended[x] & EXTENDED_5250_UNDERLINE) == 0 &&
-					(screenExtended[x] & EXTENDED_5250_NON_DSP) == 0
-			) {
-
-				int os = 0;
-				if ((os = isOption(screen,x,lenScreen,2,3,'.') )> 0) {
-					hs = true;
-
-					int stop = x;
-					int ns = 0;
-					int row = stop / numCols;
-
-					while (++stop / numCols == row &&
-							(screen[stop] >= ' ' ||
-									screen[stop] == 0x0) ) {
-
-						if (screen[stop] <= ' ') {
-							ns++;
-						}
-						else
-							ns = 0;
-
-						if (screen[stop] == '.') {
-							int io = 0;
-							if ((io = isOption(screen,stop,lenScreen,2,3,'.')) > 0) {
-
-								stop = io;
-								break;
-							}
-						}
-
-						if (ns > 3)
-							break;
-					}
-
-					screenGUI[++os] = BUTTON_LEFT;
-					s.setDirty(os);
-
-					while (++os < stop) {
-						screenGUI[os] = BUTTON_MIDDLE;
-						s.setDirty(os);
-					}
-
-					// now lets go back and take out gui's that do not belong
-					while (screen[--stop] <= ' ') {
-						screenGUI[stop] = NO_GUI;
-						s.setDirty(stop);
-					}
-					screenGUI[stop] = BUTTON_RIGHT;
-					s.setDirty(stop);
-
-				}
-			}
-
-			// now lets check for options.
-			if (!hs && x > 0 && x < lenScreen - 2 &&
-					screen[x] == '=' &&
-					screenGUI[x] == NO_GUI &&
-					(screenExtended[x] & EXTENDED_5250_UNDERLINE) == 0 &&
-					(screenExtended[x] & EXTENDED_5250_NON_DSP) == 0
-			) {
-
-				int os = 0;
-				if ((os = isOption(screen,x,lenScreen,2,2,'=') )> 0) {
-					hs = true;
-
-					int stop = x;
-					int ns = 0;
-					int row = stop / numCols;
-
-					while (++stop / numCols == row &&
-							screen[stop] >= ' ') {
-
-						if (screen[stop] == ' ') {
-							ns++;
-						}
-						else
-							ns = 0;
-
-						if (screen[stop] == '=') {
-							int io = 0;
-							if ((io = isOption(screen,stop,lenScreen,2,2,'=')) > 0) {
-
-								stop = io;
-								break;
-							}
-						}
-
-						if (ns > 2)
-							break;
-					}
-
-					screenGUI[++os] = BUTTON_LEFT;
-					s.setDirty(os);
-
-					while (++os < stop) {
-						screenGUI[os] = BUTTON_MIDDLE;
-						s.setDirty(os);
-
-					}
-
-					// now lets go back and take out gui's that do not belong
-					while (screen[--stop] <= ' ') {
-						screenGUI[stop] = NO_GUI;
-						s.setDirty(stop);
-
-					}
-					screenGUI[stop] = BUTTON_RIGHT;
-					s.setDirty(stop);
-				}
-			}
-
-			// now lets check for More... .
-
-			if (!hs && x > 2 && x < lenScreen - hsMore.length() &&
-					screen[x] == hsMore.charAt(0) &&
-					screen[x - 1] <= ' ' &&
-					screen[x - 2] <= ' ' &&
-					screenGUI[x] == NO_GUI &&
-					(screenExtended[x] & EXTENDED_5250_NON_DSP) == 0
-			) {
-
-				boolean mFlag = true;
-				int ms = hsMore.length();
-				int mc = 0;
-				while (++mc < ms) {
-					if (screen[x+mc] != hsMore.charAt(mc)) {
-						mFlag = false;
-						break;
-					}
-
-				}
-
-				if (mFlag) {
-					hs = true;
-
-					screenGUI[x] = BUTTON_LEFT_DN;
-
-					while (--ms > 0) {
-						screenGUI[++x] = BUTTON_MIDDLE_DN;
-
-					}
-					screenGUI[x] = BUTTON_RIGHT_DN;
-				}
-			}
-
-			// now lets check for Bottom .
-			if (!hs && x > 2 && x < lenScreen - hsBottom.length() &&
-					screen[x] == hsBottom.charAt(0) &&
-					screen[x - 1]  <= ' ' &&
-					screen[x - 2] <= ' ' &&
-					screenGUI[x] == NO_GUI &&
-					(screenExtended[x] & EXTENDED_5250_NON_DSP) == 0
-			) {
-
-				boolean mFlag = true;
-				int bs = hsBottom.length();
-				int bc = 0;
-				while (++bc < bs) {
-					if (screen[x+bc] != hsBottom.charAt(bc)) {
-						mFlag = false;
-						break;
-					}
-
-				}
-
-				if (mFlag) {
-					hs = true;
-
-					screenGUI[x] = BUTTON_LEFT_UP;
-
-					while (--bs > 0) {
-						screenGUI[++x] = BUTTON_MIDDLE_UP;
-
-					}
-					screenGUI[x] = BUTTON_RIGHT_UP;
-				}
-			}
-
-			// Submitted by Richard Houston of RLH Consulting rhouston@rlhc.net
-			// now lets check for HTTP:// or HTTPS://.
-			if (!hs && x > 0 && x < lenScreen - 7 &&
-					Character.toLowerCase(screen[x]) == 'h' &&
-					screen[x - 1] <= ' ' &&
-					screenGUI[x] == NO_GUI &&
-					(screenExtended[x] & EXTENDED_5250_NON_DSP) == 0
-			) {
-
-				if (Character.toLowerCase(screen[x+1]) == 't' &&
-						Character.toLowerCase(screen[x+2]) == 't' &&
-						Character.toLowerCase(screen[x+3]) == 'p' &&
-						screen[x+4] == ':' &&
-						screen[x+5] == '/' &&
-						screen[x+6] == '/' ) {
-
-					hs = true;
-
-					screenGUI[x] = BUTTON_LEFT_EB;
-
-					while (screen[++x] > ' ') {
-						screenGUI[x] = BUTTON_MIDDLE_EB;
-
-					}
-
-					screenGUI[--x] = BUTTON_RIGHT_EB;
-				}
-
-				else if (Character.toLowerCase(screen[x+1]) == 't' &&
-						Character.toLowerCase(screen[x+2]) == 't' &&
-						Character.toLowerCase(screen[x+3]) == 'p' &&
-						Character.toLowerCase(screen[x+4]) == 's' &&
-						screen[x+5] == ':' &&
-						screen[x+6] == '/' &&
-						screen[x+7] == '/' ) {
-
-					hs = true;
-
-					screenGUI[x] = BUTTON_LEFT_EB;
-
-					while (screen[++x] > ' ') {
-						screenGUI[x] = BUTTON_MIDDLE_EB;
-
-					}
-
-					screenGUI[--x] = BUTTON_RIGHT_EB;
-				}
-
-			}
-			// now lets check for MAILTO: .
-			else if (!hs && x > 0 && x < lenScreen - 7 &&
-					Character.toLowerCase(screen[x]) == 'm' &&
-					screen[x - 1] <= ' ' &&
-					screenGUI[x] == NO_GUI &&
-					(screenExtended[x] & EXTENDED_5250_NON_DSP) == 0
-			) {
-
-				if (Character.toLowerCase(screen[x+1]) == 'a' &&
-						Character.toLowerCase(screen[x+2]) == 'i' &&
-						Character.toLowerCase(screen[x+3]) == 'l' &&
-						Character.toLowerCase(screen[x+4]) == 't' &&
-						Character.toLowerCase(screen[x+5]) == 'o' &&
-						screen[x+6] == ':') {
-
-					hs = true;
-
-					screenGUI[x] = BUTTON_LEFT_EB;
-
-					while (screen[++x] > ' ') {
-						screenGUI[x] = BUTTON_MIDDLE_EB;
-
-					}
-					screenGUI[--x] = BUTTON_RIGHT_EB;
-				}
-			}
-			// now lets check for External Program: .
-			else if (!hs && x > 0 && x < lenScreen - 7 &&
-					screen[x - 1] <= ' ' &&
-					screenGUI[x] == NO_GUI &&
-					(screenExtended[x] & EXTENDED_5250_NON_DSP) == 0
-			) {
-				Properties etnProps = ExternalProgramConfig.getInstance().getEtnPgmProps();
-				String count = etnProps.getProperty("etn.pgm.support.total.num");
-				if(count != null && count.length() > 0){
-					int total = Integer.parseInt(count);
-					for(int i=1;i<=total;i++){
-						String program = etnProps.getProperty("etn.pgm."+i+".command.name");
-						String key="";
-						if(x + program.length() >= screen.length) break;
-						for(int j=0;j<=program.length();j++){
-							key+=screen[x+j];
-						}
-						if(key.toLowerCase().equals(program.toLowerCase()+":")) {
-							hs = true;
-							screenGUI[x] = BUTTON_LEFT_EB;
-							while (screen[++x] > ' ') {
-								screenGUI[x] = BUTTON_MIDDLE_EB;
-							}
-							screenGUI[--x] = BUTTON_RIGHT_EB;
-							break;
-						}
-					}
-				}
-			}
-
-			if (!retHS && hs)
-				retHS = true;
-
-		}
-
-		return retHS;
-	}
-
 	private int isOption(char[] screen,
 			int x,
 			int lenScreen,
--- a/src/org/tn5250j/framework/tn5250/tnvt.java	Thu May 22 12:38:09 2014 -0700
+++ b/src/org/tn5250j/framework/tn5250/tnvt.java	Thu May 22 13:10:44 2014 -0700
@@ -79,7 +79,6 @@
 import java.util.concurrent.BlockingQueue;
 
 import javax.net.ssl.SSLSocket;
-import javax.swing.SwingUtilities;
 
 import org.tn5250j.Session5250;
 import org.tn5250j.TN5250jConstants;
@@ -287,16 +286,10 @@
 			this.port = port;
 
 			try {
-				SwingUtilities.invokeAndWait(new Runnable() {
-					public void run() {
-						screen52.getOIA().setInputInhibited(ScreenOIA.INPUTINHIBITED_SYSTEM_WAIT,
+				screen52.getOIA().setInputInhibited(ScreenOIA.INPUTINHIBITED_SYSTEM_WAIT,
 								ScreenOIA.OIA_LEVEL_INPUT_INHIBITED,"X - Connecting");
-					}
-				});
-
 			} catch (Exception exc) {
 				log.warn("setStatus(ON) " + exc.getMessage());
-
 			}
 
 			//         sock = new Socket(s, port);
@@ -341,13 +334,8 @@
 			pthread.start();
 
 			try {
-				SwingUtilities.invokeAndWait(new Runnable() {
-					public void run() {
-						screen52.getOIA().setInputInhibited(ScreenOIA.INPUTINHIBITED_NOTINHIBITED,
+				screen52.getOIA().setInputInhibited(ScreenOIA.INPUTINHIBITED_NOTINHIBITED,
 								ScreenOIA.OIA_LEVEL_INPUT_INHIBITED);
-					}
-				});
-
 			} catch (Exception exc) {
 				log.warn("setStatus(OFF) " + exc.getMessage());
 			}
@@ -1137,27 +1125,9 @@
 			if (screen52.isUsingGuiInterface())
 				screen52.drawFields();
 
-			//      if (screen52.screen[0][1].getChar() == '#' &&
-			//         screen52.screen[0][2].getChar() == '!')
-			//         execCmd();
-			//      else {
-
-			//			if (screen52.isHotSpots()) {
-			//				screen52.checkHotSpots();
-			//			}
-
 			try {
 				if (!strpccmd) {
-					//               SwingUtilities.invokeAndWait(
-					//                  new Runnable () {
-					//                     public void run() {
-					//                        screen52.updateDirty();
-					//                     }
-					//                  }
-					//               );
 					screen52.updateDirty();
-					//				controller.validate();
-					//				log.debug("update dirty");
 				} else {
 					strpccmd();
 				}