Mercurial > 510Connectbot
diff src/org/tn5250j/framework/tn5250/ScreenPlanes.java @ 6:1b9e27659ef7 tn5250
adding tn5250 files
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Thu, 22 May 2014 13:10:44 -0700 |
parents | e8d2a24e85c6 |
children | bf01d1eec5c6 |
line wrap: on
line diff
--- 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,