comparison src/org/tn5250j/framework/tn5250/Screen5250.java @ 108:ae3092cd9cbf

use hash map rather than linear search thru arrays
author Carl Byington <carl@five-ten-sg.com>
date Wed, 18 Jun 2014 12:00:45 -0700
parents afe6962769b9
children 6a0ad4d384ea
comparison
equal deleted inserted replaced
107:afe6962769b9 108:ae3092cd9cbf
32 import java.text.NumberFormat; 32 import java.text.NumberFormat;
33 import java.text.ParseException; 33 import java.text.ParseException;
34 import java.util.Vector; 34 import java.util.Vector;
35 35
36 import org.tn5250j.TN5250jConstants; 36 import org.tn5250j.TN5250jConstants;
37
37 import android.util.Log; 38 import android.util.Log;
39 import de.mud.terminal.VDUBuffer;
38 import de.mud.terminal.vt320; 40 import de.mud.terminal.vt320;
39 import de.mud.terminal.VDUBuffer;
40 41
41 42
42 public class Screen5250 { 43 public class Screen5250 {
43 private static final String TAG = "Screen5250"; 44 private static final String TAG = "Screen5250";
44 private ScreenFields screenFields; 45 private ScreenFields screenFields;
558 * @see #sendKeys 559 * @see #sendKeys
559 * @param mnem string mnemonic value 560 * @param mnem string mnemonic value
560 * @return key value of Mnemonic 561 * @return key value of Mnemonic
561 */ 562 */
562 private int getMnemonicValue(String mnem) { 563 private int getMnemonicValue(String mnem) {
563 if (mnemonicMap.containsKey(mnem)) return mnemonicsMap.get(mnem); 564 if (mnemonicMap.containsKey(mnem)) return mnemonicMap.get(mnem);
564 return 0; 565 return 0;
565 } 566 }
566 567
567 protected void setPrehelpState(boolean setErrorCode, boolean lockKeyboard, 568 protected void setPrehelpState(boolean setErrorCode, boolean lockKeyboard,
568 boolean unlockIfLocked) { 569 boolean unlockIfLocked) {
3839 char ch = planes.getChar(p); 3840 char ch = planes.getChar(p);
3840 char co = planes.getCharColor(p); 3841 char co = planes.getCharColor(p);
3841 char at = planes.getCharExtended(p); 3842 char at = planes.getCharExtended(p);
3842 boolean ia = planes.isAttributePlace(p); 3843 boolean ia = planes.isAttributePlace(p);
3843 if (ch < ' ') ch = ' '; 3844 if (ch < ' ') ch = ' ';
3844 int bg = vt320color[(int)((co >> 8) & 0x0f)] + 1; 3845 int bg = vt320color[(co >> 8) & 0x0f] + 1;
3845 int fg = vt320color[(int)(co & 0x0f)] + 1; 3846 int fg = vt320color[co & 0x0f] + 1;
3846 int ul = (int)(at & EXTENDED_5250_UNDERLINE); 3847 int ul = at & EXTENDED_5250_UNDERLINE;
3847 int nd = (int)(at & EXTENDED_5250_NON_DSP); 3848 int nd = at & EXTENDED_5250_NON_DSP;
3848 int vt_attr = (fg << VDUBuffer.COLOR_FG_SHIFT) + (bg << VDUBuffer.COLOR_BG_SHIFT); 3849 int vt_attr = (fg << VDUBuffer.COLOR_FG_SHIFT) + (bg << VDUBuffer.COLOR_BG_SHIFT);
3849 if (ul > 0) vt_attr |= VDUBuffer.UNDERLINE; 3850 if (ul > 0) vt_attr |= VDUBuffer.UNDERLINE;
3850 if (ia || (nd > 0)) vt_attr |= VDUBuffer.INVISIBLE; 3851 if (ia || (nd > 0)) vt_attr |= VDUBuffer.INVISIBLE;
3851 buffer.putChar(c, r, ch, vt_attr); 3852 buffer.putChar(c, r, ch, vt_attr);
3852 } 3853 }