rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
meta
stringlengths
141
403
return Integer.parseInt((String)appProps.get(prop));
if (appProps.containsKey(prop)) { try { int i = Integer.parseInt((String)appProps.get(prop)); return i; } catch (NumberFormatException ne) { return 0; } } else return 0;
protected final int getIntProperty(String prop) { return Integer.parseInt((String)appProps.get(prop)); }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
setCursorOff();
private void gotoNextWord() { int pos = lastPos; setCursorOff(); if (screen[lastPos].getChar() > ' ') { advancePos(); // get the next space character while (screen[lastPos].getChar() > ' ' && pos != lastPos ) { advancePos(); } } else advancePos(); // now that we are positioned on the next space character get the // next none space character while (screen[lastPos].getChar() <= ' ' && pos != lastPos) { advancePos(); } setCursorOn(); }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
setCursorOn();
private void gotoNextWord() { int pos = lastPos; setCursorOff(); if (screen[lastPos].getChar() > ' ') { advancePos(); // get the next space character while (screen[lastPos].getChar() > ' ' && pos != lastPos ) { advancePos(); } } else advancePos(); // now that we are positioned on the next space character get the // next none space character while (screen[lastPos].getChar() <= ' ' && pos != lastPos) { advancePos(); } setCursorOn(); }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
setCursorOff();
private void gotoPrevWord() { int pos = lastPos; setCursorOff(); changePos(-1); // position previous white space character while (screen[lastPos].getChar() <= ' ') { changePos(-1); if (pos == lastPos) break; } changePos(-1); // get the previous space character while (screen[lastPos].getChar() > ' ' && pos != lastPos) { changePos(-1); } // and position one position more should give us the beginning of word advancePos(); setCursorOn(); }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
setCursorOn();
private void gotoPrevWord() { int pos = lastPos; setCursorOff(); changePos(-1); // position previous white space character while (screen[lastPos].getChar() <= ' ') { changePos(-1); if (pos == lastPos) break; } changePos(-1); // get the previous space character while (screen[lastPos].getChar() > ' ' && pos != lastPos) { changePos(-1); } // and position one position more should give us the beginning of word advancePos(); setCursorOn(); }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
if (appProps.containsKey("cursorBottOffset")) { cursorBottOffset = getIntProperty("cursorBottOffset"); }
public void loadProps(Properties props) { appProps = props; loadColors(); if (appProps.containsKey("colSeparator")) { if (getStringProperty("colSeparator").equals("Line")) colSepLine = 0; if (getStringProperty("colSeparator").equals("ShortLine")) colSepLine = 1; if (getStringProperty("colSeparator").equals("Dot")) colSepLine = 2; } if (appProps.containsKey("showAttr")) { if (getStringProperty("showAttr").equals("Hex")) showHex = true; } if (appProps.containsKey("guiInterface")) { if (getStringProperty("guiInterface").equals("Yes")) guiInterface = true; else guiInterface = false; } if (appProps.containsKey("guiShowUnderline")) { if (getStringProperty("guiShowUnderline").equals("Yes")) guiShowUnderline = true; else guiShowUnderline = false; } if (appProps.containsKey("hotspots")) { if (getStringProperty("hotspots").equals("Yes")) hotSpots = true; else hotSpots = false; } if (appProps.containsKey("hsMore")) { if (getStringProperty("hsMore").length() > 0) { hsMore.setLength(0); hsMore.append(getStringProperty("hsMore")); } } if (appProps.containsKey("hsBottom")) { if (getStringProperty("hsBottom").length() > 0) { hsBottom.setLength(0); hsBottom.append(getStringProperty("hsBottom")); } } if (appProps.containsKey("colSeparator")) { if (getStringProperty("colSeparator").equals("Line")) colSepLine = 0; if (getStringProperty("colSeparator").equals("ShortLine")) colSepLine = 1; if (getStringProperty("colSeparator").equals("Dot")) colSepLine = 2; } if (appProps.containsKey("cursorSize")) { if (getStringProperty("cursorSize").equals("Full")) cursorSize = 2; if (getStringProperty("cursorSize").equals("Half")) cursorSize = 1; if (getStringProperty("cursorSize").equals("Line")) cursorSize = 0; } if (appProps.containsKey("crossHair")) { if (getStringProperty("crossHair").equals("None")) crossHair = 0; if (getStringProperty("crossHair").equals("Horz")) crossHair = 1; if (getStringProperty("crossHair").equals("Vert")) crossHair = 2; if (getStringProperty("crossHair").equals("Both")) crossHair = 3; } if (appProps.containsKey("fontScaleHeight")) { sfh = getFloatProperty("fontScaleHeight"); } if (appProps.containsKey("fontScaleWidth")) { sfw = getFloatProperty("fontScaleWidth"); } if (appProps.containsKey("fontPointSize")) { ps132 = getFloatProperty("fontPointSize"); } }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
setCursorOff();
protected final void pasteMe(boolean special) { Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard(); Transferable content = cb.getContents(this); setCursorOff(); try { StringBuffer sb = new StringBuffer((String)content.getTransferData(DataFlavor.stringFlavor)); StringBuffer pd = new StringBuffer(); int r = getRow(lastPos); int nextChar = 0; int nChars = sb.length(); boolean omitLF = false; boolean done = false; screenFields.saveCurrentField(); int lr = getRow(lastPos); int lc = getCol(lastPos); resetDirty(lastPos); while (!done) { if (nextChar >= nChars) { /* EOF */ done = true; break; } pd.setLength(0); boolean eol = false; char c = 0; int i; /* Skip a leftover '\n', if necessary */ if (omitLF && (sb.charAt(nextChar) == '\n')) nextChar++; boolean skipLF = false; omitLF = false; charLoop: for (i = nextChar; i < nChars; i++) { c = sb.charAt(i); if ((c == '\n') || (c == '\r')) { eol = true; break charLoop; } } int startChar = nextChar; nextChar = i; pd.append(sb.substring(startChar, startChar + (i - startChar))); if (eol) { nextChar++; if (c == '\r') { skipLF = true; } } System.out.println("pasted >" + pd + "<"); int col = getCol(lastPos); int t = numCols - col; if (t > pd.length()) t = pd.length(); int p = 0; char pc; boolean setIt; while (t-- > 0) { pc = pd.charAt(p); setIt = true; if (special && (!Character.isLetter(pc) && !Character.isDigit(pc))) setIt = false; if (isInField(r,col) && setIt) { screen[getPos(r,col)].setChar(pc); setDirty(r,col); screenFields.setCurrentFieldMDT(); } p++; if (setIt) col++; } r++; } screenFields.restoreCurrentField(); updateDirty(); goto_XY(lr+1,lc+1); } catch (Throwable exc) { System.err.println(exc); } setCursorOn(); }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
setCursorOn();
protected final void pasteMe(boolean special) { Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard(); Transferable content = cb.getContents(this); setCursorOff(); try { StringBuffer sb = new StringBuffer((String)content.getTransferData(DataFlavor.stringFlavor)); StringBuffer pd = new StringBuffer(); int r = getRow(lastPos); int nextChar = 0; int nChars = sb.length(); boolean omitLF = false; boolean done = false; screenFields.saveCurrentField(); int lr = getRow(lastPos); int lc = getCol(lastPos); resetDirty(lastPos); while (!done) { if (nextChar >= nChars) { /* EOF */ done = true; break; } pd.setLength(0); boolean eol = false; char c = 0; int i; /* Skip a leftover '\n', if necessary */ if (omitLF && (sb.charAt(nextChar) == '\n')) nextChar++; boolean skipLF = false; omitLF = false; charLoop: for (i = nextChar; i < nChars; i++) { c = sb.charAt(i); if ((c == '\n') || (c == '\r')) { eol = true; break charLoop; } } int startChar = nextChar; nextChar = i; pd.append(sb.substring(startChar, startChar + (i - startChar))); if (eol) { nextChar++; if (c == '\r') { skipLF = true; } } System.out.println("pasted >" + pd + "<"); int col = getCol(lastPos); int t = numCols - col; if (t > pd.length()) t = pd.length(); int p = 0; char pc; boolean setIt; while (t-- > 0) { pc = pd.charAt(p); setIt = true; if (special && (!Character.isLetter(pc) && !Character.isDigit(pc))) setIt = false; if (isInField(r,col) && setIt) { screen[getPos(r,col)].setChar(pc); setDirty(r,col); screenFields.setCurrentFieldMDT(); } p++; if (setIt) col++; } r++; } screenFields.restoreCurrentField(); updateDirty(); goto_XY(lr+1,lc+1); } catch (Throwable exc) { System.err.println(exc); } setCursorOn(); }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
gui.revalidate();
public void propertyChange(PropertyChangeEvent pce) { String pn = pce.getPropertyName(); boolean resetAttr = false; if (pn.equals("colorBg")) { colorBg = (Color)pce.getNewValue(); resetAttr = true; } if (pn.equals("colorBlue")) { colorBlue = (Color)pce.getNewValue(); resetAttr = true; } if (pn.equals("colorTurq")) { colorTurq = (Color)pce.getNewValue(); resetAttr = true; } if (pn.equals("colorRed")) { colorRed = (Color)pce.getNewValue(); resetAttr = true; } if (pn.equals("colorWhite")) { colorWhite = (Color)pce.getNewValue(); resetAttr = true; } if (pn.equals("colorYellow")) { colorYellow = (Color)pce.getNewValue(); resetAttr = true; } if (pn.equals("colorGreen")) { colorGreen = (Color)pce.getNewValue(); resetAttr = true; } if (pn.equals("colorPink")) { colorPink = (Color)pce.getNewValue(); resetAttr = true; } if (pn.equals("colorGUIField")) { colorGUIField = (Color)pce.getNewValue(); resetAttr = true; } if (pn.equals("colorCursor")) { colorCursor = (Color)pce.getNewValue(); resetAttr = true; } if (pn.equals("colorSep")) { colorSep = (Color)pce.getNewValue(); resetAttr = true; } if (pn.equals("colorHexAttr")) { colorHexAttr = (Color)pce.getNewValue(); resetAttr = true; } if (pn.equals("cursorSize")) { if (pce.getNewValue().equals("Full")) cursorSize = 2; if (pce.getNewValue().equals("Half")) cursorSize = 1; if (pce.getNewValue().equals("Line")) cursorSize = 0; } if (pn.equals("crossHair")) { if (pce.getNewValue().equals("None")) crossHair = 0; if (pce.getNewValue().equals("Horz")) crossHair = 1; if (pce.getNewValue().equals("Vert")) crossHair = 2; if (pce.getNewValue().equals("Both")) crossHair = 3; } if (pn.equals("colSeparator")) { if (pce.getNewValue().equals("Line")) colSepLine = 0; if (pce.getNewValue().equals("ShortLine")) colSepLine = 1; if (pce.getNewValue().equals("Dot")) colSepLine = 2; } if (pn.equals("showAttr")) { if (pce.getNewValue().equals("Hex")) showHex = true; else showHex= false; } if (pn.equals("guiInterface")) { if (pce.getNewValue().equals("Yes")) guiInterface = true; else guiInterface = false; } if (pn.equals("guiShowUnderline")) { if (pce.getNewValue().equals("Yes")) guiShowUnderline = true; else guiShowUnderline = false; } if (pn.equals("hotspots")) { if (pce.getNewValue().equals("Yes")) hotSpots = true; else hotSpots = false; } if (pn.equals("hsMore")) { hsMore.setLength(0); hsMore.append((String)pce.getNewValue()); } if (pn.equals("hsBottom")) { hsBottom.setLength(0); hsBottom.append((String)pce.getNewValue()); } if (pn.equals("font")) { font = new Font((String)pce.getNewValue(),Font.PLAIN,14); updateFont = true; } if (pn.equals("fontScaleHeight")) {// try { sfh = Float.parseFloat((String)pce.getNewValue()); updateFont = true;// } } if (pn.equals("fontScaleWidth")) {// try { sfw = Float.parseFloat((String)pce.getNewValue()); updateFont = true;// } } if (pn.equals("fontPointSize")) {// try { ps132 = Float.parseFloat((String)pce.getNewValue()); updateFont = true;// } } if (updateFont) { Rectangle r = gui.getDrawingBounds(); resizeScreenArea(r.width,r.height); updateFont = false; } if (resetAttr) { for (int y = 0;y < lenScreen; y++) { screen[y].setAttribute(screen[y].getCharAttr()); } bi.drawOIA(fmWidth,fmHeight,numRows,numCols,font,colorBg,colorBlue); } gui.repaint(); gui.revalidate(); }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
if (!cursorActive) setCursorOn();
public void sendKeys(String text) {// if (text == null) {// return;// } if (isStatusErrorCode() && !resetRequired) { resetError(); if (!cursorActive) setCursorOn(); } if (keyboardLocked) { if(text.equals("[reset]") || text.equals("[sysreq]") || text.equals("[attn]")) { simulateMnemonic(getMnemonicValue(text)); } else { if (isStatusErrorCode()) { Toolkit.getDefaultToolkit().beep(); return; } keysBuffered = true; setKBIndicatorOn(); if(bufferedKeys == null){ bufferedKeys = text; return; } else { bufferedKeys += text; return; } } } else { if (keysBuffered) { if (bufferedKeys != null) { text = bufferedKeys + text; } keysBuffered = false; setKBIndicatorOff(); bufferedKeys = null; } // check to see if position is in a field and if it is then change // current field to that field isInField(lastPos,true); if (text.length() == 1 && !text.equals("[") && !text.equals("]")) { simulateKeyStroke(text.charAt(0)); } else { strokenizer.setKeyStrokes(text); String s; boolean done = false; while (strokenizer.hasMoreKeyStrokes() && !keyboardLocked && !isStatusErrorCode() && !done) { s = strokenizer.nextKeyStroke(); if (s.length() == 1) { simulateKeyStroke(s.charAt(0)); setCursorOn(); } else { if (s != null) { simulateMnemonic(getMnemonicValue(s)); } else System.out.println(" send keys mnemonic " + s); } if (keyboardLocked) { bufferedKeys = strokenizer.getUnprocessedKeyStroked(); if (bufferedKeys != null) { keysBuffered = true; setKBIndicatorOn(); } done = true; } } } } }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
keysBuffered = false; setKBIndicatorOff();
keysBuffered = false; setKBIndicatorOff();
public void sendKeys(String text) {// if (text == null) {// return;// } if (isStatusErrorCode() && !resetRequired) { resetError(); if (!cursorActive) setCursorOn(); } if (keyboardLocked) { if(text.equals("[reset]") || text.equals("[sysreq]") || text.equals("[attn]")) { simulateMnemonic(getMnemonicValue(text)); } else { if (isStatusErrorCode()) { Toolkit.getDefaultToolkit().beep(); return; } keysBuffered = true; setKBIndicatorOn(); if(bufferedKeys == null){ bufferedKeys = text; return; } else { bufferedKeys += text; return; } } } else { if (keysBuffered) { if (bufferedKeys != null) { text = bufferedKeys + text; } keysBuffered = false; setKBIndicatorOff(); bufferedKeys = null; } // check to see if position is in a field and if it is then change // current field to that field isInField(lastPos,true); if (text.length() == 1 && !text.equals("[") && !text.equals("]")) { simulateKeyStroke(text.charAt(0)); } else { strokenizer.setKeyStrokes(text); String s; boolean done = false; while (strokenizer.hasMoreKeyStrokes() && !keyboardLocked && !isStatusErrorCode() && !done) { s = strokenizer.nextKeyStroke(); if (s.length() == 1) { simulateKeyStroke(s.charAt(0)); setCursorOn(); } else { if (s != null) { simulateMnemonic(getMnemonicValue(s)); } else System.out.println(" send keys mnemonic " + s); } if (keyboardLocked) { bufferedKeys = strokenizer.getUnprocessedKeyStroked(); if (bufferedKeys != null) { keysBuffered = true; setKBIndicatorOn(); } done = true; } } } } }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
while (strokenizer.hasMoreKeyStrokes() && !keyboardLocked && !isStatusErrorCode() && !done) {
setCursorActive(false); while (!done) { if (strokenizer.hasMoreKeyStrokes()) {
public void sendKeys(String text) {// if (text == null) {// return;// } if (isStatusErrorCode() && !resetRequired) { resetError(); if (!cursorActive) setCursorOn(); } if (keyboardLocked) { if(text.equals("[reset]") || text.equals("[sysreq]") || text.equals("[attn]")) { simulateMnemonic(getMnemonicValue(text)); } else { if (isStatusErrorCode()) { Toolkit.getDefaultToolkit().beep(); return; } keysBuffered = true; setKBIndicatorOn(); if(bufferedKeys == null){ bufferedKeys = text; return; } else { bufferedKeys += text; return; } } } else { if (keysBuffered) { if (bufferedKeys != null) { text = bufferedKeys + text; } keysBuffered = false; setKBIndicatorOff(); bufferedKeys = null; } // check to see if position is in a field and if it is then change // current field to that field isInField(lastPos,true); if (text.length() == 1 && !text.equals("[") && !text.equals("]")) { simulateKeyStroke(text.charAt(0)); } else { strokenizer.setKeyStrokes(text); String s; boolean done = false; while (strokenizer.hasMoreKeyStrokes() && !keyboardLocked && !isStatusErrorCode() && !done) { s = strokenizer.nextKeyStroke(); if (s.length() == 1) { simulateKeyStroke(s.charAt(0)); setCursorOn(); } else { if (s != null) { simulateMnemonic(getMnemonicValue(s)); } else System.out.println(" send keys mnemonic " + s); } if (keyboardLocked) { bufferedKeys = strokenizer.getUnprocessedKeyStroked(); if (bufferedKeys != null) { keysBuffered = true; setKBIndicatorOn(); } done = true; } } } } }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
setCursorOn();
public void sendKeys(String text) {// if (text == null) {// return;// } if (isStatusErrorCode() && !resetRequired) { resetError(); if (!cursorActive) setCursorOn(); } if (keyboardLocked) { if(text.equals("[reset]") || text.equals("[sysreq]") || text.equals("[attn]")) { simulateMnemonic(getMnemonicValue(text)); } else { if (isStatusErrorCode()) { Toolkit.getDefaultToolkit().beep(); return; } keysBuffered = true; setKBIndicatorOn(); if(bufferedKeys == null){ bufferedKeys = text; return; } else { bufferedKeys += text; return; } } } else { if (keysBuffered) { if (bufferedKeys != null) { text = bufferedKeys + text; } keysBuffered = false; setKBIndicatorOff(); bufferedKeys = null; } // check to see if position is in a field and if it is then change // current field to that field isInField(lastPos,true); if (text.length() == 1 && !text.equals("[") && !text.equals("]")) { simulateKeyStroke(text.charAt(0)); } else { strokenizer.setKeyStrokes(text); String s; boolean done = false; while (strokenizer.hasMoreKeyStrokes() && !keyboardLocked && !isStatusErrorCode() && !done) { s = strokenizer.nextKeyStroke(); if (s.length() == 1) { simulateKeyStroke(s.charAt(0)); setCursorOn(); } else { if (s != null) { simulateMnemonic(getMnemonicValue(s)); } else System.out.println(" send keys mnemonic " + s); } if (keyboardLocked) { bufferedKeys = strokenizer.getUnprocessedKeyStroked(); if (bufferedKeys != null) { keysBuffered = true; setKBIndicatorOn(); } done = true; } } } } }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
public void sendKeys(String text) {// if (text == null) {// return;// } if (isStatusErrorCode() && !resetRequired) { resetError(); if (!cursorActive) setCursorOn(); } if (keyboardLocked) { if(text.equals("[reset]") || text.equals("[sysreq]") || text.equals("[attn]")) { simulateMnemonic(getMnemonicValue(text)); } else { if (isStatusErrorCode()) { Toolkit.getDefaultToolkit().beep(); return; } keysBuffered = true; setKBIndicatorOn(); if(bufferedKeys == null){ bufferedKeys = text; return; } else { bufferedKeys += text; return; } } } else { if (keysBuffered) { if (bufferedKeys != null) { text = bufferedKeys + text; } keysBuffered = false; setKBIndicatorOff(); bufferedKeys = null; } // check to see if position is in a field and if it is then change // current field to that field isInField(lastPos,true); if (text.length() == 1 && !text.equals("[") && !text.equals("]")) { simulateKeyStroke(text.charAt(0)); } else { strokenizer.setKeyStrokes(text); String s; boolean done = false; while (strokenizer.hasMoreKeyStrokes() && !keyboardLocked && !isStatusErrorCode() && !done) { s = strokenizer.nextKeyStroke(); if (s.length() == 1) { simulateKeyStroke(s.charAt(0)); setCursorOn(); } else { if (s != null) { simulateMnemonic(getMnemonicValue(s)); } else System.out.println(" send keys mnemonic " + s); } if (keyboardLocked) { bufferedKeys = strokenizer.getUnprocessedKeyStroked(); if (bufferedKeys != null) { keysBuffered = true; setKBIndicatorOn(); } done = true; } } } } }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
else { done = true; } } setCursorActive(true);
public void sendKeys(String text) {// if (text == null) {// return;// } if (isStatusErrorCode() && !resetRequired) { resetError(); if (!cursorActive) setCursorOn(); } if (keyboardLocked) { if(text.equals("[reset]") || text.equals("[sysreq]") || text.equals("[attn]")) { simulateMnemonic(getMnemonicValue(text)); } else { if (isStatusErrorCode()) { Toolkit.getDefaultToolkit().beep(); return; } keysBuffered = true; setKBIndicatorOn(); if(bufferedKeys == null){ bufferedKeys = text; return; } else { bufferedKeys += text; return; } } } else { if (keysBuffered) { if (bufferedKeys != null) { text = bufferedKeys + text; } keysBuffered = false; setKBIndicatorOff(); bufferedKeys = null; } // check to see if position is in a field and if it is then change // current field to that field isInField(lastPos,true); if (text.length() == 1 && !text.equals("[") && !text.equals("]")) { simulateKeyStroke(text.charAt(0)); } else { strokenizer.setKeyStrokes(text); String s; boolean done = false; while (strokenizer.hasMoreKeyStrokes() && !keyboardLocked && !isStatusErrorCode() && !done) { s = strokenizer.nextKeyStroke(); if (s.length() == 1) { simulateKeyStroke(s.charAt(0)); setCursorOn(); } else { if (s != null) { simulateMnemonic(getMnemonicValue(s)); } else System.out.println(" send keys mnemonic " + s); } if (keyboardLocked) { bufferedKeys = strokenizer.getUnprocessedKeyStroked(); if (bufferedKeys != null) { keysBuffered = true; setKBIndicatorOn(); } done = true; } } } } }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
setCursorOn();
public final void setBounds(int width, int height) { resizeScreenArea(width,height); dirty.setBounds(tArea.getBounds()); if (gui.getGraphics() != null) { // do not forget to null out gg2d before update or else there will // be a very hard to trace screen resize problem gg2d = null; updateDirty(); setCursorOn(); } // restore statuses that were on the screen before resize if (isStatusErrorCode()) setStatus(STATUS_ERROR_CODE,STATUS_VALUE_ON,statusString); if (isXSystem()) setStatus(STATUS_SYSTEM,STATUS_VALUE_ON,statusString); if (isMessageWait()) setMessageLightOn(); }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
setCursorActive(true);
public final void setBounds(int width, int height) { resizeScreenArea(width,height); dirty.setBounds(tArea.getBounds()); if (gui.getGraphics() != null) { // do not forget to null out gg2d before update or else there will // be a very hard to trace screen resize problem gg2d = null; updateDirty(); setCursorOn(); } // restore statuses that were on the screen before resize if (isStatusErrorCode()) setStatus(STATUS_ERROR_CODE,STATUS_VALUE_ON,statusString); if (isXSystem()) setStatus(STATUS_SYSTEM,STATUS_VALUE_ON,statusString); if (isMessageWait()) setMessageLightOn(); }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
updateCursorLoc(); updateCursorLoc = false;
updateCursorLoc();
public void setCursorOff() { updateCursorLoc(); updateCursorLoc = false; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
updateCursorLoc = true; if (!keysBuffered) updateCursorLoc();
updateCursorLoc();
public void setCursorOn() { updateCursorLoc = true;// System.out.println("cursor on"); if (!keysBuffered) updateCursorLoc(); }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
public void setKeyboardLocked (boolean k) { keyboardLocked = k; if (!keyboardLocked) { if (keysBuffered) { sendKeys(""); } } }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
public void setKeyboardLocked (boolean k) { keyboardLocked = k; if (!keyboardLocked) { if (keysBuffered) { sendKeys(""); } } }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
setCursorOff();
protected boolean simulateKeyStroke(char c){// if (isStatusErrorCode() && !Character.isISOControl(c) && !keyProcessed) {// if (resetRequired)// return false;// else// resetError();// } boolean updateField = false; boolean numericError = false; boolean updatePos = false; boolean autoEnter = false; if (!Character.isISOControl(c)) { if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { switch (screenFields.getCurrentFieldShift()) { case 0: // Alpha shift case 2: // Numeric Shift case 4: // Kakana Shift updateField = true; break; case 1: // Alpha Only if(Character.isLetter(c) || c == ',' || c == '-' || c == '.' || c == ' ') updateField = true; break; case 3: // Numeric only if(Character.isDigit(c) || c == '+' || c == ',' || c == '-' || c == '.' || c == ' ') updateField = true; else numericError = true; break; case 5: // Digits only if(Character.isDigit(c)) updateField = true; else displayError(ERR_NUMERIC_09); break; case 7: // Signed numeric if(Character.isDigit(c) || c == '+' || c == '-') if (lastPos == screenFields.getCurrentField().endPos() && (c != '+' && c != '-')) displayError(ERR_INVALID_SIGN); else updateField = true; else displayError(ERR_NUMERIC_09); break; } if (updateField) { if (screenFields.isCurrentFieldToUpper()) c = Character.toUpperCase(c); setCursorOff(); updatePos = true; resetDirty(lastPos); if (insertMode) { if (endOfField(false) != screenFields.getCurrentField().endPos()) shiftRight(lastPos); else { displayError(ERR_NO_ROOM_INSERT); updatePos = false; } } if (updatePos) { screenFields.getCurrentField().getKeyPos(getRow(lastPos),getCol(lastPos)); screenFields.getCurrentField().changePos(1); screen[lastPos].setChar(c); screenFields.setCurrentFieldMDT(); // if we have gone passed the end of the field then goto the next field if (!screenFields.withinCurrentField(screenFields.getCurrentFieldPos())) { if (screenFields.isCurrentFieldAutoEnter()) { autoEnter = true; } else if (!screenFields.isCurrentFieldFER()) gotoFieldNext(); } else goto_XY(screenFields.getCurrentField().getCursorRow() + 1,screenFields.getCurrentField().getCursorCol() + 1); } updateImage(dirty); setCursorOn(); if (autoEnter) sendAid(AID_ENTER); } else { if (numericError) { displayError(ERR_NUMERIC_ONLY); } } } else { displayError(ERR_CURSOR_PROTECTED); } } return updatePos; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
setCursorOn();
protected boolean simulateKeyStroke(char c){// if (isStatusErrorCode() && !Character.isISOControl(c) && !keyProcessed) {// if (resetRequired)// return false;// else// resetError();// } boolean updateField = false; boolean numericError = false; boolean updatePos = false; boolean autoEnter = false; if (!Character.isISOControl(c)) { if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { switch (screenFields.getCurrentFieldShift()) { case 0: // Alpha shift case 2: // Numeric Shift case 4: // Kakana Shift updateField = true; break; case 1: // Alpha Only if(Character.isLetter(c) || c == ',' || c == '-' || c == '.' || c == ' ') updateField = true; break; case 3: // Numeric only if(Character.isDigit(c) || c == '+' || c == ',' || c == '-' || c == '.' || c == ' ') updateField = true; else numericError = true; break; case 5: // Digits only if(Character.isDigit(c)) updateField = true; else displayError(ERR_NUMERIC_09); break; case 7: // Signed numeric if(Character.isDigit(c) || c == '+' || c == '-') if (lastPos == screenFields.getCurrentField().endPos() && (c != '+' && c != '-')) displayError(ERR_INVALID_SIGN); else updateField = true; else displayError(ERR_NUMERIC_09); break; } if (updateField) { if (screenFields.isCurrentFieldToUpper()) c = Character.toUpperCase(c); setCursorOff(); updatePos = true; resetDirty(lastPos); if (insertMode) { if (endOfField(false) != screenFields.getCurrentField().endPos()) shiftRight(lastPos); else { displayError(ERR_NO_ROOM_INSERT); updatePos = false; } } if (updatePos) { screenFields.getCurrentField().getKeyPos(getRow(lastPos),getCol(lastPos)); screenFields.getCurrentField().changePos(1); screen[lastPos].setChar(c); screenFields.setCurrentFieldMDT(); // if we have gone passed the end of the field then goto the next field if (!screenFields.withinCurrentField(screenFields.getCurrentFieldPos())) { if (screenFields.isCurrentFieldAutoEnter()) { autoEnter = true; } else if (!screenFields.isCurrentFieldFER()) gotoFieldNext(); } else goto_XY(screenFields.getCurrentField().getCursorRow() + 1,screenFields.getCurrentField().getCursorCol() + 1); } updateImage(dirty); setCursorOn(); if (autoEnter) sendAid(AID_ENTER); } else { if (numericError) { displayError(ERR_NUMERIC_ONLY); } } } else { displayError(ERR_CURSOR_PROTECTED); } } return updatePos; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
setCursorOff();
protected boolean simulateMnemonic(int mnem){ boolean simulated = false; switch (mnem) { case AID_CLEAR : case AID_ENTER : case AID_PF1 : case AID_PF2 : case AID_PF3 : case AID_PF4 : case AID_PF5 : case AID_PF6 : case AID_PF7 : case AID_PF8 : case AID_PF9 : case AID_PF10 : case AID_PF11 : case AID_PF12 : case AID_PF13 : case AID_PF14 : case AID_PF15 : case AID_PF16 : case AID_PF17 : case AID_PF18 : case AID_PF19 : case AID_PF20 : case AID_PF21 : case AID_PF22 : case AID_PF23 : case AID_PF24 : case AID_ROLL_DOWN : case AID_ROLL_UP : case AID_ROLL_LEFT : case AID_ROLL_RIGHT : sendAid(mnem); simulated = true; break; case AID_HELP : sessionVT.sendHelpRequest(); simulated = true; break; case AID_PRINT : sessionVT.hostPrint(1); simulated = true; break; case BACK_SPACE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.getCurrentField().startPos() == lastPos) displayError(ERR_CURSOR_PROTECTED); else { setCursorOff(); screenFields.getCurrentField().getKeyPos(lastPos); screenFields.getCurrentField().changePos(-1); resetDirty(screenFields.getCurrentField().getCurrentPos()); shiftLeft(screenFields.getCurrentField().getCurrentPos()); updateDirty(); setCursorOn(); screenFields.setCurrentFieldMDT(); simulated = true; } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BACK_TAB : if (screenFields.getCurrentField() != null && screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldPrev(); updateDirty(); } else gotoFieldPrev(); if (screenFields.isCurrentFieldContinued()) { do { gotoFieldPrev(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } isInField(lastPos); simulated = true; break; case UP : case MARK_UP : process_XY(lastPos - numCols); simulated = true; break; case DOWN : case MARK_DOWN : process_XY(lastPos + numCols); simulated = true; break; case LEFT : case MARK_LEFT : process_XY(lastPos - 1); simulated = true; break; case RIGHT : case MARK_RIGHT : process_XY(lastPos + 1); simulated = true; break; case NEXTWORD : gotoNextWord(); simulated = true; break; case PREVWORD : gotoPrevWord(); simulated = true; break; case DELETE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().getKeyPos(lastPos); shiftLeft(screenFields.getCurrentFieldPos()); screenFields.setCurrentFieldMDT(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case TAB : if (screenFields.getCurrentField() != null && !screenFields.isCurrentFieldContinued()) { if (screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldNext(); updateDirty(); } else gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.getCurrentField() != null && (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast())); } isInField(lastPos); simulated = true; break; case EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = endOfField(screenFields.getCurrentField().startPos(),true); if (where > 0) { goto_XY((where / numCols) + 1,(where % numCols) + 1); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case ERASE_EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case ERASE_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; lastPos = screenFields.getCurrentField().startPos(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case INSERT : setCursorOff(); // we toggle it insertMode = insertMode ? false : true; setCursorOn(); break; case HOME : // position to the home position set if (lastPos + numCols + 1 != homePos) { goto_XY(homePos - numCols - 1); // now check if we are in a field isInField(lastPos); } else gotoField(1); break; case KEYPAD_0 : simulated = simulateKeyStroke('0'); break; case KEYPAD_1 : simulated = simulateKeyStroke('1'); break; case KEYPAD_2 : simulated = simulateKeyStroke('2'); break; case KEYPAD_3 : simulated = simulateKeyStroke('3'); break; case KEYPAD_4 : simulated = simulateKeyStroke('4'); break; case KEYPAD_5 : simulated = simulateKeyStroke('5'); break; case KEYPAD_6 : simulated = simulateKeyStroke('6'); break; case KEYPAD_7 : simulated = simulateKeyStroke('7'); break; case KEYPAD_8 : simulated = simulateKeyStroke('8'); break; case KEYPAD_9 : simulated = simulateKeyStroke('9'); break; case KEYPAD_PERIOD : simulated = simulateKeyStroke('.'); break; case KEYPAD_COMMA : simulated = simulateKeyStroke(','); break; case KEYPAD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } simulated = true; updateDirty(); if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_EXIT : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_PLUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { setCursorOff(); screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = screenFields.getCurrentField().startPos(); if (where > 0) { goto_XY(where); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case SYSREQ : sessionVT.systemRequest(); simulated = true; break; case RESET : if (isStatusErrorCode()) { resetError(); isInField(lastPos); updateDirty(); setCursorOn(); } else { setPrehelpState(false,isKeyboardLocked(),false); } simulated = true; break; case COPY : copyMe(); break; case PASTE : pasteMe(false); break; case ATTN : sessionVT.sendAttentionKey(); simulated = true; break; case DUP_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.isCurrentFieldDupEnabled()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().setFieldChar(lastPos,(char)0x1C); screenFields.setCurrentFieldMDT(); gotoFieldNext(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_DUP_KEY_NOT_ALLOWED); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case NEW_LINE : if (screenFields.getSize() > 0) { int startRow = getRow(lastPos) + 1; int startPos = lastPos; boolean isthere = false; setCursorOff(); if (startRow == getRows()) startRow = 0; goto_XY(++startRow,1); if (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { while (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { // lets keep going advancePos(); // Have we looped the screen? if (lastPos == startPos) { // if so then go back to starting point goto_XY(startPos); break; } } } setCursorOn(); } simulated = true; break; case JUMP_NEXT_SESS : gui.nextSession(); simulated = true; break; case JUMP_PREV_SESS : gui.prevSession(); simulated = true; break; default : System.out.println(" Mnemonic not supported " + mnem); break; } return simulated; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
setCursorOn();
protected boolean simulateMnemonic(int mnem){ boolean simulated = false; switch (mnem) { case AID_CLEAR : case AID_ENTER : case AID_PF1 : case AID_PF2 : case AID_PF3 : case AID_PF4 : case AID_PF5 : case AID_PF6 : case AID_PF7 : case AID_PF8 : case AID_PF9 : case AID_PF10 : case AID_PF11 : case AID_PF12 : case AID_PF13 : case AID_PF14 : case AID_PF15 : case AID_PF16 : case AID_PF17 : case AID_PF18 : case AID_PF19 : case AID_PF20 : case AID_PF21 : case AID_PF22 : case AID_PF23 : case AID_PF24 : case AID_ROLL_DOWN : case AID_ROLL_UP : case AID_ROLL_LEFT : case AID_ROLL_RIGHT : sendAid(mnem); simulated = true; break; case AID_HELP : sessionVT.sendHelpRequest(); simulated = true; break; case AID_PRINT : sessionVT.hostPrint(1); simulated = true; break; case BACK_SPACE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.getCurrentField().startPos() == lastPos) displayError(ERR_CURSOR_PROTECTED); else { setCursorOff(); screenFields.getCurrentField().getKeyPos(lastPos); screenFields.getCurrentField().changePos(-1); resetDirty(screenFields.getCurrentField().getCurrentPos()); shiftLeft(screenFields.getCurrentField().getCurrentPos()); updateDirty(); setCursorOn(); screenFields.setCurrentFieldMDT(); simulated = true; } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BACK_TAB : if (screenFields.getCurrentField() != null && screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldPrev(); updateDirty(); } else gotoFieldPrev(); if (screenFields.isCurrentFieldContinued()) { do { gotoFieldPrev(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } isInField(lastPos); simulated = true; break; case UP : case MARK_UP : process_XY(lastPos - numCols); simulated = true; break; case DOWN : case MARK_DOWN : process_XY(lastPos + numCols); simulated = true; break; case LEFT : case MARK_LEFT : process_XY(lastPos - 1); simulated = true; break; case RIGHT : case MARK_RIGHT : process_XY(lastPos + 1); simulated = true; break; case NEXTWORD : gotoNextWord(); simulated = true; break; case PREVWORD : gotoPrevWord(); simulated = true; break; case DELETE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().getKeyPos(lastPos); shiftLeft(screenFields.getCurrentFieldPos()); screenFields.setCurrentFieldMDT(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case TAB : if (screenFields.getCurrentField() != null && !screenFields.isCurrentFieldContinued()) { if (screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldNext(); updateDirty(); } else gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.getCurrentField() != null && (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast())); } isInField(lastPos); simulated = true; break; case EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = endOfField(screenFields.getCurrentField().startPos(),true); if (where > 0) { goto_XY((where / numCols) + 1,(where % numCols) + 1); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case ERASE_EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case ERASE_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; lastPos = screenFields.getCurrentField().startPos(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case INSERT : setCursorOff(); // we toggle it insertMode = insertMode ? false : true; setCursorOn(); break; case HOME : // position to the home position set if (lastPos + numCols + 1 != homePos) { goto_XY(homePos - numCols - 1); // now check if we are in a field isInField(lastPos); } else gotoField(1); break; case KEYPAD_0 : simulated = simulateKeyStroke('0'); break; case KEYPAD_1 : simulated = simulateKeyStroke('1'); break; case KEYPAD_2 : simulated = simulateKeyStroke('2'); break; case KEYPAD_3 : simulated = simulateKeyStroke('3'); break; case KEYPAD_4 : simulated = simulateKeyStroke('4'); break; case KEYPAD_5 : simulated = simulateKeyStroke('5'); break; case KEYPAD_6 : simulated = simulateKeyStroke('6'); break; case KEYPAD_7 : simulated = simulateKeyStroke('7'); break; case KEYPAD_8 : simulated = simulateKeyStroke('8'); break; case KEYPAD_9 : simulated = simulateKeyStroke('9'); break; case KEYPAD_PERIOD : simulated = simulateKeyStroke('.'); break; case KEYPAD_COMMA : simulated = simulateKeyStroke(','); break; case KEYPAD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } simulated = true; updateDirty(); if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_EXIT : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_PLUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { setCursorOff(); screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = screenFields.getCurrentField().startPos(); if (where > 0) { goto_XY(where); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case SYSREQ : sessionVT.systemRequest(); simulated = true; break; case RESET : if (isStatusErrorCode()) { resetError(); isInField(lastPos); updateDirty(); setCursorOn(); } else { setPrehelpState(false,isKeyboardLocked(),false); } simulated = true; break; case COPY : copyMe(); break; case PASTE : pasteMe(false); break; case ATTN : sessionVT.sendAttentionKey(); simulated = true; break; case DUP_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.isCurrentFieldDupEnabled()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().setFieldChar(lastPos,(char)0x1C); screenFields.setCurrentFieldMDT(); gotoFieldNext(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_DUP_KEY_NOT_ALLOWED); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case NEW_LINE : if (screenFields.getSize() > 0) { int startRow = getRow(lastPos) + 1; int startPos = lastPos; boolean isthere = false; setCursorOff(); if (startRow == getRows()) startRow = 0; goto_XY(++startRow,1); if (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { while (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { // lets keep going advancePos(); // Have we looped the screen? if (lastPos == startPos) { // if so then go back to starting point goto_XY(startPos); break; } } } setCursorOn(); } simulated = true; break; case JUMP_NEXT_SESS : gui.nextSession(); simulated = true; break; case JUMP_PREV_SESS : gui.prevSession(); simulated = true; break; default : System.out.println(" Mnemonic not supported " + mnem); break; } return simulated; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
setCursorOff();
protected boolean simulateMnemonic(int mnem){ boolean simulated = false; switch (mnem) { case AID_CLEAR : case AID_ENTER : case AID_PF1 : case AID_PF2 : case AID_PF3 : case AID_PF4 : case AID_PF5 : case AID_PF6 : case AID_PF7 : case AID_PF8 : case AID_PF9 : case AID_PF10 : case AID_PF11 : case AID_PF12 : case AID_PF13 : case AID_PF14 : case AID_PF15 : case AID_PF16 : case AID_PF17 : case AID_PF18 : case AID_PF19 : case AID_PF20 : case AID_PF21 : case AID_PF22 : case AID_PF23 : case AID_PF24 : case AID_ROLL_DOWN : case AID_ROLL_UP : case AID_ROLL_LEFT : case AID_ROLL_RIGHT : sendAid(mnem); simulated = true; break; case AID_HELP : sessionVT.sendHelpRequest(); simulated = true; break; case AID_PRINT : sessionVT.hostPrint(1); simulated = true; break; case BACK_SPACE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.getCurrentField().startPos() == lastPos) displayError(ERR_CURSOR_PROTECTED); else { setCursorOff(); screenFields.getCurrentField().getKeyPos(lastPos); screenFields.getCurrentField().changePos(-1); resetDirty(screenFields.getCurrentField().getCurrentPos()); shiftLeft(screenFields.getCurrentField().getCurrentPos()); updateDirty(); setCursorOn(); screenFields.setCurrentFieldMDT(); simulated = true; } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BACK_TAB : if (screenFields.getCurrentField() != null && screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldPrev(); updateDirty(); } else gotoFieldPrev(); if (screenFields.isCurrentFieldContinued()) { do { gotoFieldPrev(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } isInField(lastPos); simulated = true; break; case UP : case MARK_UP : process_XY(lastPos - numCols); simulated = true; break; case DOWN : case MARK_DOWN : process_XY(lastPos + numCols); simulated = true; break; case LEFT : case MARK_LEFT : process_XY(lastPos - 1); simulated = true; break; case RIGHT : case MARK_RIGHT : process_XY(lastPos + 1); simulated = true; break; case NEXTWORD : gotoNextWord(); simulated = true; break; case PREVWORD : gotoPrevWord(); simulated = true; break; case DELETE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().getKeyPos(lastPos); shiftLeft(screenFields.getCurrentFieldPos()); screenFields.setCurrentFieldMDT(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case TAB : if (screenFields.getCurrentField() != null && !screenFields.isCurrentFieldContinued()) { if (screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldNext(); updateDirty(); } else gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.getCurrentField() != null && (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast())); } isInField(lastPos); simulated = true; break; case EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = endOfField(screenFields.getCurrentField().startPos(),true); if (where > 0) { goto_XY((where / numCols) + 1,(where % numCols) + 1); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case ERASE_EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case ERASE_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; lastPos = screenFields.getCurrentField().startPos(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case INSERT : setCursorOff(); // we toggle it insertMode = insertMode ? false : true; setCursorOn(); break; case HOME : // position to the home position set if (lastPos + numCols + 1 != homePos) { goto_XY(homePos - numCols - 1); // now check if we are in a field isInField(lastPos); } else gotoField(1); break; case KEYPAD_0 : simulated = simulateKeyStroke('0'); break; case KEYPAD_1 : simulated = simulateKeyStroke('1'); break; case KEYPAD_2 : simulated = simulateKeyStroke('2'); break; case KEYPAD_3 : simulated = simulateKeyStroke('3'); break; case KEYPAD_4 : simulated = simulateKeyStroke('4'); break; case KEYPAD_5 : simulated = simulateKeyStroke('5'); break; case KEYPAD_6 : simulated = simulateKeyStroke('6'); break; case KEYPAD_7 : simulated = simulateKeyStroke('7'); break; case KEYPAD_8 : simulated = simulateKeyStroke('8'); break; case KEYPAD_9 : simulated = simulateKeyStroke('9'); break; case KEYPAD_PERIOD : simulated = simulateKeyStroke('.'); break; case KEYPAD_COMMA : simulated = simulateKeyStroke(','); break; case KEYPAD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } simulated = true; updateDirty(); if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_EXIT : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_PLUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { setCursorOff(); screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = screenFields.getCurrentField().startPos(); if (where > 0) { goto_XY(where); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case SYSREQ : sessionVT.systemRequest(); simulated = true; break; case RESET : if (isStatusErrorCode()) { resetError(); isInField(lastPos); updateDirty(); setCursorOn(); } else { setPrehelpState(false,isKeyboardLocked(),false); } simulated = true; break; case COPY : copyMe(); break; case PASTE : pasteMe(false); break; case ATTN : sessionVT.sendAttentionKey(); simulated = true; break; case DUP_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.isCurrentFieldDupEnabled()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().setFieldChar(lastPos,(char)0x1C); screenFields.setCurrentFieldMDT(); gotoFieldNext(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_DUP_KEY_NOT_ALLOWED); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case NEW_LINE : if (screenFields.getSize() > 0) { int startRow = getRow(lastPos) + 1; int startPos = lastPos; boolean isthere = false; setCursorOff(); if (startRow == getRows()) startRow = 0; goto_XY(++startRow,1); if (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { while (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { // lets keep going advancePos(); // Have we looped the screen? if (lastPos == startPos) { // if so then go back to starting point goto_XY(startPos); break; } } } setCursorOn(); } simulated = true; break; case JUMP_NEXT_SESS : gui.nextSession(); simulated = true; break; case JUMP_PREV_SESS : gui.prevSession(); simulated = true; break; default : System.out.println(" Mnemonic not supported " + mnem); break; } return simulated; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
setCursorOn();
protected boolean simulateMnemonic(int mnem){ boolean simulated = false; switch (mnem) { case AID_CLEAR : case AID_ENTER : case AID_PF1 : case AID_PF2 : case AID_PF3 : case AID_PF4 : case AID_PF5 : case AID_PF6 : case AID_PF7 : case AID_PF8 : case AID_PF9 : case AID_PF10 : case AID_PF11 : case AID_PF12 : case AID_PF13 : case AID_PF14 : case AID_PF15 : case AID_PF16 : case AID_PF17 : case AID_PF18 : case AID_PF19 : case AID_PF20 : case AID_PF21 : case AID_PF22 : case AID_PF23 : case AID_PF24 : case AID_ROLL_DOWN : case AID_ROLL_UP : case AID_ROLL_LEFT : case AID_ROLL_RIGHT : sendAid(mnem); simulated = true; break; case AID_HELP : sessionVT.sendHelpRequest(); simulated = true; break; case AID_PRINT : sessionVT.hostPrint(1); simulated = true; break; case BACK_SPACE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.getCurrentField().startPos() == lastPos) displayError(ERR_CURSOR_PROTECTED); else { setCursorOff(); screenFields.getCurrentField().getKeyPos(lastPos); screenFields.getCurrentField().changePos(-1); resetDirty(screenFields.getCurrentField().getCurrentPos()); shiftLeft(screenFields.getCurrentField().getCurrentPos()); updateDirty(); setCursorOn(); screenFields.setCurrentFieldMDT(); simulated = true; } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BACK_TAB : if (screenFields.getCurrentField() != null && screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldPrev(); updateDirty(); } else gotoFieldPrev(); if (screenFields.isCurrentFieldContinued()) { do { gotoFieldPrev(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } isInField(lastPos); simulated = true; break; case UP : case MARK_UP : process_XY(lastPos - numCols); simulated = true; break; case DOWN : case MARK_DOWN : process_XY(lastPos + numCols); simulated = true; break; case LEFT : case MARK_LEFT : process_XY(lastPos - 1); simulated = true; break; case RIGHT : case MARK_RIGHT : process_XY(lastPos + 1); simulated = true; break; case NEXTWORD : gotoNextWord(); simulated = true; break; case PREVWORD : gotoPrevWord(); simulated = true; break; case DELETE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().getKeyPos(lastPos); shiftLeft(screenFields.getCurrentFieldPos()); screenFields.setCurrentFieldMDT(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case TAB : if (screenFields.getCurrentField() != null && !screenFields.isCurrentFieldContinued()) { if (screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldNext(); updateDirty(); } else gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.getCurrentField() != null && (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast())); } isInField(lastPos); simulated = true; break; case EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = endOfField(screenFields.getCurrentField().startPos(),true); if (where > 0) { goto_XY((where / numCols) + 1,(where % numCols) + 1); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case ERASE_EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case ERASE_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; lastPos = screenFields.getCurrentField().startPos(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case INSERT : setCursorOff(); // we toggle it insertMode = insertMode ? false : true; setCursorOn(); break; case HOME : // position to the home position set if (lastPos + numCols + 1 != homePos) { goto_XY(homePos - numCols - 1); // now check if we are in a field isInField(lastPos); } else gotoField(1); break; case KEYPAD_0 : simulated = simulateKeyStroke('0'); break; case KEYPAD_1 : simulated = simulateKeyStroke('1'); break; case KEYPAD_2 : simulated = simulateKeyStroke('2'); break; case KEYPAD_3 : simulated = simulateKeyStroke('3'); break; case KEYPAD_4 : simulated = simulateKeyStroke('4'); break; case KEYPAD_5 : simulated = simulateKeyStroke('5'); break; case KEYPAD_6 : simulated = simulateKeyStroke('6'); break; case KEYPAD_7 : simulated = simulateKeyStroke('7'); break; case KEYPAD_8 : simulated = simulateKeyStroke('8'); break; case KEYPAD_9 : simulated = simulateKeyStroke('9'); break; case KEYPAD_PERIOD : simulated = simulateKeyStroke('.'); break; case KEYPAD_COMMA : simulated = simulateKeyStroke(','); break; case KEYPAD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } simulated = true; updateDirty(); if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_EXIT : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_PLUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { setCursorOff(); screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = screenFields.getCurrentField().startPos(); if (where > 0) { goto_XY(where); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case SYSREQ : sessionVT.systemRequest(); simulated = true; break; case RESET : if (isStatusErrorCode()) { resetError(); isInField(lastPos); updateDirty(); setCursorOn(); } else { setPrehelpState(false,isKeyboardLocked(),false); } simulated = true; break; case COPY : copyMe(); break; case PASTE : pasteMe(false); break; case ATTN : sessionVT.sendAttentionKey(); simulated = true; break; case DUP_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.isCurrentFieldDupEnabled()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().setFieldChar(lastPos,(char)0x1C); screenFields.setCurrentFieldMDT(); gotoFieldNext(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_DUP_KEY_NOT_ALLOWED); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case NEW_LINE : if (screenFields.getSize() > 0) { int startRow = getRow(lastPos) + 1; int startPos = lastPos; boolean isthere = false; setCursorOff(); if (startRow == getRows()) startRow = 0; goto_XY(++startRow,1); if (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { while (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { // lets keep going advancePos(); // Have we looped the screen? if (lastPos == startPos) { // if so then go back to starting point goto_XY(startPos); break; } } } setCursorOn(); } simulated = true; break; case JUMP_NEXT_SESS : gui.nextSession(); simulated = true; break; case JUMP_PREV_SESS : gui.prevSession(); simulated = true; break; default : System.out.println(" Mnemonic not supported " + mnem); break; } return simulated; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
setCursorOff();
protected boolean simulateMnemonic(int mnem){ boolean simulated = false; switch (mnem) { case AID_CLEAR : case AID_ENTER : case AID_PF1 : case AID_PF2 : case AID_PF3 : case AID_PF4 : case AID_PF5 : case AID_PF6 : case AID_PF7 : case AID_PF8 : case AID_PF9 : case AID_PF10 : case AID_PF11 : case AID_PF12 : case AID_PF13 : case AID_PF14 : case AID_PF15 : case AID_PF16 : case AID_PF17 : case AID_PF18 : case AID_PF19 : case AID_PF20 : case AID_PF21 : case AID_PF22 : case AID_PF23 : case AID_PF24 : case AID_ROLL_DOWN : case AID_ROLL_UP : case AID_ROLL_LEFT : case AID_ROLL_RIGHT : sendAid(mnem); simulated = true; break; case AID_HELP : sessionVT.sendHelpRequest(); simulated = true; break; case AID_PRINT : sessionVT.hostPrint(1); simulated = true; break; case BACK_SPACE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.getCurrentField().startPos() == lastPos) displayError(ERR_CURSOR_PROTECTED); else { setCursorOff(); screenFields.getCurrentField().getKeyPos(lastPos); screenFields.getCurrentField().changePos(-1); resetDirty(screenFields.getCurrentField().getCurrentPos()); shiftLeft(screenFields.getCurrentField().getCurrentPos()); updateDirty(); setCursorOn(); screenFields.setCurrentFieldMDT(); simulated = true; } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BACK_TAB : if (screenFields.getCurrentField() != null && screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldPrev(); updateDirty(); } else gotoFieldPrev(); if (screenFields.isCurrentFieldContinued()) { do { gotoFieldPrev(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } isInField(lastPos); simulated = true; break; case UP : case MARK_UP : process_XY(lastPos - numCols); simulated = true; break; case DOWN : case MARK_DOWN : process_XY(lastPos + numCols); simulated = true; break; case LEFT : case MARK_LEFT : process_XY(lastPos - 1); simulated = true; break; case RIGHT : case MARK_RIGHT : process_XY(lastPos + 1); simulated = true; break; case NEXTWORD : gotoNextWord(); simulated = true; break; case PREVWORD : gotoPrevWord(); simulated = true; break; case DELETE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().getKeyPos(lastPos); shiftLeft(screenFields.getCurrentFieldPos()); screenFields.setCurrentFieldMDT(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case TAB : if (screenFields.getCurrentField() != null && !screenFields.isCurrentFieldContinued()) { if (screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldNext(); updateDirty(); } else gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.getCurrentField() != null && (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast())); } isInField(lastPos); simulated = true; break; case EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = endOfField(screenFields.getCurrentField().startPos(),true); if (where > 0) { goto_XY((where / numCols) + 1,(where % numCols) + 1); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case ERASE_EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case ERASE_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; lastPos = screenFields.getCurrentField().startPos(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case INSERT : setCursorOff(); // we toggle it insertMode = insertMode ? false : true; setCursorOn(); break; case HOME : // position to the home position set if (lastPos + numCols + 1 != homePos) { goto_XY(homePos - numCols - 1); // now check if we are in a field isInField(lastPos); } else gotoField(1); break; case KEYPAD_0 : simulated = simulateKeyStroke('0'); break; case KEYPAD_1 : simulated = simulateKeyStroke('1'); break; case KEYPAD_2 : simulated = simulateKeyStroke('2'); break; case KEYPAD_3 : simulated = simulateKeyStroke('3'); break; case KEYPAD_4 : simulated = simulateKeyStroke('4'); break; case KEYPAD_5 : simulated = simulateKeyStroke('5'); break; case KEYPAD_6 : simulated = simulateKeyStroke('6'); break; case KEYPAD_7 : simulated = simulateKeyStroke('7'); break; case KEYPAD_8 : simulated = simulateKeyStroke('8'); break; case KEYPAD_9 : simulated = simulateKeyStroke('9'); break; case KEYPAD_PERIOD : simulated = simulateKeyStroke('.'); break; case KEYPAD_COMMA : simulated = simulateKeyStroke(','); break; case KEYPAD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } simulated = true; updateDirty(); if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_EXIT : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_PLUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { setCursorOff(); screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = screenFields.getCurrentField().startPos(); if (where > 0) { goto_XY(where); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case SYSREQ : sessionVT.systemRequest(); simulated = true; break; case RESET : if (isStatusErrorCode()) { resetError(); isInField(lastPos); updateDirty(); setCursorOn(); } else { setPrehelpState(false,isKeyboardLocked(),false); } simulated = true; break; case COPY : copyMe(); break; case PASTE : pasteMe(false); break; case ATTN : sessionVT.sendAttentionKey(); simulated = true; break; case DUP_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.isCurrentFieldDupEnabled()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().setFieldChar(lastPos,(char)0x1C); screenFields.setCurrentFieldMDT(); gotoFieldNext(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_DUP_KEY_NOT_ALLOWED); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case NEW_LINE : if (screenFields.getSize() > 0) { int startRow = getRow(lastPos) + 1; int startPos = lastPos; boolean isthere = false; setCursorOff(); if (startRow == getRows()) startRow = 0; goto_XY(++startRow,1); if (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { while (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { // lets keep going advancePos(); // Have we looped the screen? if (lastPos == startPos) { // if so then go back to starting point goto_XY(startPos); break; } } } setCursorOn(); } simulated = true; break; case JUMP_NEXT_SESS : gui.nextSession(); simulated = true; break; case JUMP_PREV_SESS : gui.prevSession(); simulated = true; break; default : System.out.println(" Mnemonic not supported " + mnem); break; } return simulated; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
setCursorOn();
protected boolean simulateMnemonic(int mnem){ boolean simulated = false; switch (mnem) { case AID_CLEAR : case AID_ENTER : case AID_PF1 : case AID_PF2 : case AID_PF3 : case AID_PF4 : case AID_PF5 : case AID_PF6 : case AID_PF7 : case AID_PF8 : case AID_PF9 : case AID_PF10 : case AID_PF11 : case AID_PF12 : case AID_PF13 : case AID_PF14 : case AID_PF15 : case AID_PF16 : case AID_PF17 : case AID_PF18 : case AID_PF19 : case AID_PF20 : case AID_PF21 : case AID_PF22 : case AID_PF23 : case AID_PF24 : case AID_ROLL_DOWN : case AID_ROLL_UP : case AID_ROLL_LEFT : case AID_ROLL_RIGHT : sendAid(mnem); simulated = true; break; case AID_HELP : sessionVT.sendHelpRequest(); simulated = true; break; case AID_PRINT : sessionVT.hostPrint(1); simulated = true; break; case BACK_SPACE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.getCurrentField().startPos() == lastPos) displayError(ERR_CURSOR_PROTECTED); else { setCursorOff(); screenFields.getCurrentField().getKeyPos(lastPos); screenFields.getCurrentField().changePos(-1); resetDirty(screenFields.getCurrentField().getCurrentPos()); shiftLeft(screenFields.getCurrentField().getCurrentPos()); updateDirty(); setCursorOn(); screenFields.setCurrentFieldMDT(); simulated = true; } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BACK_TAB : if (screenFields.getCurrentField() != null && screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldPrev(); updateDirty(); } else gotoFieldPrev(); if (screenFields.isCurrentFieldContinued()) { do { gotoFieldPrev(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } isInField(lastPos); simulated = true; break; case UP : case MARK_UP : process_XY(lastPos - numCols); simulated = true; break; case DOWN : case MARK_DOWN : process_XY(lastPos + numCols); simulated = true; break; case LEFT : case MARK_LEFT : process_XY(lastPos - 1); simulated = true; break; case RIGHT : case MARK_RIGHT : process_XY(lastPos + 1); simulated = true; break; case NEXTWORD : gotoNextWord(); simulated = true; break; case PREVWORD : gotoPrevWord(); simulated = true; break; case DELETE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().getKeyPos(lastPos); shiftLeft(screenFields.getCurrentFieldPos()); screenFields.setCurrentFieldMDT(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case TAB : if (screenFields.getCurrentField() != null && !screenFields.isCurrentFieldContinued()) { if (screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldNext(); updateDirty(); } else gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.getCurrentField() != null && (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast())); } isInField(lastPos); simulated = true; break; case EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = endOfField(screenFields.getCurrentField().startPos(),true); if (where > 0) { goto_XY((where / numCols) + 1,(where % numCols) + 1); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case ERASE_EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case ERASE_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; lastPos = screenFields.getCurrentField().startPos(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case INSERT : setCursorOff(); // we toggle it insertMode = insertMode ? false : true; setCursorOn(); break; case HOME : // position to the home position set if (lastPos + numCols + 1 != homePos) { goto_XY(homePos - numCols - 1); // now check if we are in a field isInField(lastPos); } else gotoField(1); break; case KEYPAD_0 : simulated = simulateKeyStroke('0'); break; case KEYPAD_1 : simulated = simulateKeyStroke('1'); break; case KEYPAD_2 : simulated = simulateKeyStroke('2'); break; case KEYPAD_3 : simulated = simulateKeyStroke('3'); break; case KEYPAD_4 : simulated = simulateKeyStroke('4'); break; case KEYPAD_5 : simulated = simulateKeyStroke('5'); break; case KEYPAD_6 : simulated = simulateKeyStroke('6'); break; case KEYPAD_7 : simulated = simulateKeyStroke('7'); break; case KEYPAD_8 : simulated = simulateKeyStroke('8'); break; case KEYPAD_9 : simulated = simulateKeyStroke('9'); break; case KEYPAD_PERIOD : simulated = simulateKeyStroke('.'); break; case KEYPAD_COMMA : simulated = simulateKeyStroke(','); break; case KEYPAD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } simulated = true; updateDirty(); if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_EXIT : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_PLUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { setCursorOff(); screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = screenFields.getCurrentField().startPos(); if (where > 0) { goto_XY(where); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case SYSREQ : sessionVT.systemRequest(); simulated = true; break; case RESET : if (isStatusErrorCode()) { resetError(); isInField(lastPos); updateDirty(); setCursorOn(); } else { setPrehelpState(false,isKeyboardLocked(),false); } simulated = true; break; case COPY : copyMe(); break; case PASTE : pasteMe(false); break; case ATTN : sessionVT.sendAttentionKey(); simulated = true; break; case DUP_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.isCurrentFieldDupEnabled()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().setFieldChar(lastPos,(char)0x1C); screenFields.setCurrentFieldMDT(); gotoFieldNext(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_DUP_KEY_NOT_ALLOWED); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case NEW_LINE : if (screenFields.getSize() > 0) { int startRow = getRow(lastPos) + 1; int startPos = lastPos; boolean isthere = false; setCursorOff(); if (startRow == getRows()) startRow = 0; goto_XY(++startRow,1); if (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { while (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { // lets keep going advancePos(); // Have we looped the screen? if (lastPos == startPos) { // if so then go back to starting point goto_XY(startPos); break; } } } setCursorOn(); } simulated = true; break; case JUMP_NEXT_SESS : gui.nextSession(); simulated = true; break; case JUMP_PREV_SESS : gui.prevSession(); simulated = true; break; default : System.out.println(" Mnemonic not supported " + mnem); break; } return simulated; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
setCursorOff();
protected boolean simulateMnemonic(int mnem){ boolean simulated = false; switch (mnem) { case AID_CLEAR : case AID_ENTER : case AID_PF1 : case AID_PF2 : case AID_PF3 : case AID_PF4 : case AID_PF5 : case AID_PF6 : case AID_PF7 : case AID_PF8 : case AID_PF9 : case AID_PF10 : case AID_PF11 : case AID_PF12 : case AID_PF13 : case AID_PF14 : case AID_PF15 : case AID_PF16 : case AID_PF17 : case AID_PF18 : case AID_PF19 : case AID_PF20 : case AID_PF21 : case AID_PF22 : case AID_PF23 : case AID_PF24 : case AID_ROLL_DOWN : case AID_ROLL_UP : case AID_ROLL_LEFT : case AID_ROLL_RIGHT : sendAid(mnem); simulated = true; break; case AID_HELP : sessionVT.sendHelpRequest(); simulated = true; break; case AID_PRINT : sessionVT.hostPrint(1); simulated = true; break; case BACK_SPACE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.getCurrentField().startPos() == lastPos) displayError(ERR_CURSOR_PROTECTED); else { setCursorOff(); screenFields.getCurrentField().getKeyPos(lastPos); screenFields.getCurrentField().changePos(-1); resetDirty(screenFields.getCurrentField().getCurrentPos()); shiftLeft(screenFields.getCurrentField().getCurrentPos()); updateDirty(); setCursorOn(); screenFields.setCurrentFieldMDT(); simulated = true; } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BACK_TAB : if (screenFields.getCurrentField() != null && screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldPrev(); updateDirty(); } else gotoFieldPrev(); if (screenFields.isCurrentFieldContinued()) { do { gotoFieldPrev(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } isInField(lastPos); simulated = true; break; case UP : case MARK_UP : process_XY(lastPos - numCols); simulated = true; break; case DOWN : case MARK_DOWN : process_XY(lastPos + numCols); simulated = true; break; case LEFT : case MARK_LEFT : process_XY(lastPos - 1); simulated = true; break; case RIGHT : case MARK_RIGHT : process_XY(lastPos + 1); simulated = true; break; case NEXTWORD : gotoNextWord(); simulated = true; break; case PREVWORD : gotoPrevWord(); simulated = true; break; case DELETE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().getKeyPos(lastPos); shiftLeft(screenFields.getCurrentFieldPos()); screenFields.setCurrentFieldMDT(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case TAB : if (screenFields.getCurrentField() != null && !screenFields.isCurrentFieldContinued()) { if (screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldNext(); updateDirty(); } else gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.getCurrentField() != null && (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast())); } isInField(lastPos); simulated = true; break; case EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = endOfField(screenFields.getCurrentField().startPos(),true); if (where > 0) { goto_XY((where / numCols) + 1,(where % numCols) + 1); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case ERASE_EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case ERASE_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; lastPos = screenFields.getCurrentField().startPos(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case INSERT : setCursorOff(); // we toggle it insertMode = insertMode ? false : true; setCursorOn(); break; case HOME : // position to the home position set if (lastPos + numCols + 1 != homePos) { goto_XY(homePos - numCols - 1); // now check if we are in a field isInField(lastPos); } else gotoField(1); break; case KEYPAD_0 : simulated = simulateKeyStroke('0'); break; case KEYPAD_1 : simulated = simulateKeyStroke('1'); break; case KEYPAD_2 : simulated = simulateKeyStroke('2'); break; case KEYPAD_3 : simulated = simulateKeyStroke('3'); break; case KEYPAD_4 : simulated = simulateKeyStroke('4'); break; case KEYPAD_5 : simulated = simulateKeyStroke('5'); break; case KEYPAD_6 : simulated = simulateKeyStroke('6'); break; case KEYPAD_7 : simulated = simulateKeyStroke('7'); break; case KEYPAD_8 : simulated = simulateKeyStroke('8'); break; case KEYPAD_9 : simulated = simulateKeyStroke('9'); break; case KEYPAD_PERIOD : simulated = simulateKeyStroke('.'); break; case KEYPAD_COMMA : simulated = simulateKeyStroke(','); break; case KEYPAD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } simulated = true; updateDirty(); if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_EXIT : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_PLUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { setCursorOff(); screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = screenFields.getCurrentField().startPos(); if (where > 0) { goto_XY(where); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case SYSREQ : sessionVT.systemRequest(); simulated = true; break; case RESET : if (isStatusErrorCode()) { resetError(); isInField(lastPos); updateDirty(); setCursorOn(); } else { setPrehelpState(false,isKeyboardLocked(),false); } simulated = true; break; case COPY : copyMe(); break; case PASTE : pasteMe(false); break; case ATTN : sessionVT.sendAttentionKey(); simulated = true; break; case DUP_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.isCurrentFieldDupEnabled()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().setFieldChar(lastPos,(char)0x1C); screenFields.setCurrentFieldMDT(); gotoFieldNext(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_DUP_KEY_NOT_ALLOWED); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case NEW_LINE : if (screenFields.getSize() > 0) { int startRow = getRow(lastPos) + 1; int startPos = lastPos; boolean isthere = false; setCursorOff(); if (startRow == getRows()) startRow = 0; goto_XY(++startRow,1); if (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { while (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { // lets keep going advancePos(); // Have we looped the screen? if (lastPos == startPos) { // if so then go back to starting point goto_XY(startPos); break; } } } setCursorOn(); } simulated = true; break; case JUMP_NEXT_SESS : gui.nextSession(); simulated = true; break; case JUMP_PREV_SESS : gui.prevSession(); simulated = true; break; default : System.out.println(" Mnemonic not supported " + mnem); break; } return simulated; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
setCursorOn();
protected boolean simulateMnemonic(int mnem){ boolean simulated = false; switch (mnem) { case AID_CLEAR : case AID_ENTER : case AID_PF1 : case AID_PF2 : case AID_PF3 : case AID_PF4 : case AID_PF5 : case AID_PF6 : case AID_PF7 : case AID_PF8 : case AID_PF9 : case AID_PF10 : case AID_PF11 : case AID_PF12 : case AID_PF13 : case AID_PF14 : case AID_PF15 : case AID_PF16 : case AID_PF17 : case AID_PF18 : case AID_PF19 : case AID_PF20 : case AID_PF21 : case AID_PF22 : case AID_PF23 : case AID_PF24 : case AID_ROLL_DOWN : case AID_ROLL_UP : case AID_ROLL_LEFT : case AID_ROLL_RIGHT : sendAid(mnem); simulated = true; break; case AID_HELP : sessionVT.sendHelpRequest(); simulated = true; break; case AID_PRINT : sessionVT.hostPrint(1); simulated = true; break; case BACK_SPACE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.getCurrentField().startPos() == lastPos) displayError(ERR_CURSOR_PROTECTED); else { setCursorOff(); screenFields.getCurrentField().getKeyPos(lastPos); screenFields.getCurrentField().changePos(-1); resetDirty(screenFields.getCurrentField().getCurrentPos()); shiftLeft(screenFields.getCurrentField().getCurrentPos()); updateDirty(); setCursorOn(); screenFields.setCurrentFieldMDT(); simulated = true; } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BACK_TAB : if (screenFields.getCurrentField() != null && screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldPrev(); updateDirty(); } else gotoFieldPrev(); if (screenFields.isCurrentFieldContinued()) { do { gotoFieldPrev(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } isInField(lastPos); simulated = true; break; case UP : case MARK_UP : process_XY(lastPos - numCols); simulated = true; break; case DOWN : case MARK_DOWN : process_XY(lastPos + numCols); simulated = true; break; case LEFT : case MARK_LEFT : process_XY(lastPos - 1); simulated = true; break; case RIGHT : case MARK_RIGHT : process_XY(lastPos + 1); simulated = true; break; case NEXTWORD : gotoNextWord(); simulated = true; break; case PREVWORD : gotoPrevWord(); simulated = true; break; case DELETE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().getKeyPos(lastPos); shiftLeft(screenFields.getCurrentFieldPos()); screenFields.setCurrentFieldMDT(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case TAB : if (screenFields.getCurrentField() != null && !screenFields.isCurrentFieldContinued()) { if (screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldNext(); updateDirty(); } else gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.getCurrentField() != null && (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast())); } isInField(lastPos); simulated = true; break; case EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = endOfField(screenFields.getCurrentField().startPos(),true); if (where > 0) { goto_XY((where / numCols) + 1,(where % numCols) + 1); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case ERASE_EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case ERASE_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; lastPos = screenFields.getCurrentField().startPos(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case INSERT : setCursorOff(); // we toggle it insertMode = insertMode ? false : true; setCursorOn(); break; case HOME : // position to the home position set if (lastPos + numCols + 1 != homePos) { goto_XY(homePos - numCols - 1); // now check if we are in a field isInField(lastPos); } else gotoField(1); break; case KEYPAD_0 : simulated = simulateKeyStroke('0'); break; case KEYPAD_1 : simulated = simulateKeyStroke('1'); break; case KEYPAD_2 : simulated = simulateKeyStroke('2'); break; case KEYPAD_3 : simulated = simulateKeyStroke('3'); break; case KEYPAD_4 : simulated = simulateKeyStroke('4'); break; case KEYPAD_5 : simulated = simulateKeyStroke('5'); break; case KEYPAD_6 : simulated = simulateKeyStroke('6'); break; case KEYPAD_7 : simulated = simulateKeyStroke('7'); break; case KEYPAD_8 : simulated = simulateKeyStroke('8'); break; case KEYPAD_9 : simulated = simulateKeyStroke('9'); break; case KEYPAD_PERIOD : simulated = simulateKeyStroke('.'); break; case KEYPAD_COMMA : simulated = simulateKeyStroke(','); break; case KEYPAD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } simulated = true; updateDirty(); if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_EXIT : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_PLUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { setCursorOff(); screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = screenFields.getCurrentField().startPos(); if (where > 0) { goto_XY(where); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case SYSREQ : sessionVT.systemRequest(); simulated = true; break; case RESET : if (isStatusErrorCode()) { resetError(); isInField(lastPos); updateDirty(); setCursorOn(); } else { setPrehelpState(false,isKeyboardLocked(),false); } simulated = true; break; case COPY : copyMe(); break; case PASTE : pasteMe(false); break; case ATTN : sessionVT.sendAttentionKey(); simulated = true; break; case DUP_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.isCurrentFieldDupEnabled()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().setFieldChar(lastPos,(char)0x1C); screenFields.setCurrentFieldMDT(); gotoFieldNext(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_DUP_KEY_NOT_ALLOWED); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case NEW_LINE : if (screenFields.getSize() > 0) { int startRow = getRow(lastPos) + 1; int startPos = lastPos; boolean isthere = false; setCursorOff(); if (startRow == getRows()) startRow = 0; goto_XY(++startRow,1); if (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { while (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { // lets keep going advancePos(); // Have we looped the screen? if (lastPos == startPos) { // if so then go back to starting point goto_XY(startPos); break; } } } setCursorOn(); } simulated = true; break; case JUMP_NEXT_SESS : gui.nextSession(); simulated = true; break; case JUMP_PREV_SESS : gui.prevSession(); simulated = true; break; default : System.out.println(" Mnemonic not supported " + mnem); break; } return simulated; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
setCursorOff();
protected boolean simulateMnemonic(int mnem){ boolean simulated = false; switch (mnem) { case AID_CLEAR : case AID_ENTER : case AID_PF1 : case AID_PF2 : case AID_PF3 : case AID_PF4 : case AID_PF5 : case AID_PF6 : case AID_PF7 : case AID_PF8 : case AID_PF9 : case AID_PF10 : case AID_PF11 : case AID_PF12 : case AID_PF13 : case AID_PF14 : case AID_PF15 : case AID_PF16 : case AID_PF17 : case AID_PF18 : case AID_PF19 : case AID_PF20 : case AID_PF21 : case AID_PF22 : case AID_PF23 : case AID_PF24 : case AID_ROLL_DOWN : case AID_ROLL_UP : case AID_ROLL_LEFT : case AID_ROLL_RIGHT : sendAid(mnem); simulated = true; break; case AID_HELP : sessionVT.sendHelpRequest(); simulated = true; break; case AID_PRINT : sessionVT.hostPrint(1); simulated = true; break; case BACK_SPACE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.getCurrentField().startPos() == lastPos) displayError(ERR_CURSOR_PROTECTED); else { setCursorOff(); screenFields.getCurrentField().getKeyPos(lastPos); screenFields.getCurrentField().changePos(-1); resetDirty(screenFields.getCurrentField().getCurrentPos()); shiftLeft(screenFields.getCurrentField().getCurrentPos()); updateDirty(); setCursorOn(); screenFields.setCurrentFieldMDT(); simulated = true; } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BACK_TAB : if (screenFields.getCurrentField() != null && screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldPrev(); updateDirty(); } else gotoFieldPrev(); if (screenFields.isCurrentFieldContinued()) { do { gotoFieldPrev(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } isInField(lastPos); simulated = true; break; case UP : case MARK_UP : process_XY(lastPos - numCols); simulated = true; break; case DOWN : case MARK_DOWN : process_XY(lastPos + numCols); simulated = true; break; case LEFT : case MARK_LEFT : process_XY(lastPos - 1); simulated = true; break; case RIGHT : case MARK_RIGHT : process_XY(lastPos + 1); simulated = true; break; case NEXTWORD : gotoNextWord(); simulated = true; break; case PREVWORD : gotoPrevWord(); simulated = true; break; case DELETE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().getKeyPos(lastPos); shiftLeft(screenFields.getCurrentFieldPos()); screenFields.setCurrentFieldMDT(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case TAB : if (screenFields.getCurrentField() != null && !screenFields.isCurrentFieldContinued()) { if (screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldNext(); updateDirty(); } else gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.getCurrentField() != null && (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast())); } isInField(lastPos); simulated = true; break; case EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = endOfField(screenFields.getCurrentField().startPos(),true); if (where > 0) { goto_XY((where / numCols) + 1,(where % numCols) + 1); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case ERASE_EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case ERASE_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; lastPos = screenFields.getCurrentField().startPos(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case INSERT : setCursorOff(); // we toggle it insertMode = insertMode ? false : true; setCursorOn(); break; case HOME : // position to the home position set if (lastPos + numCols + 1 != homePos) { goto_XY(homePos - numCols - 1); // now check if we are in a field isInField(lastPos); } else gotoField(1); break; case KEYPAD_0 : simulated = simulateKeyStroke('0'); break; case KEYPAD_1 : simulated = simulateKeyStroke('1'); break; case KEYPAD_2 : simulated = simulateKeyStroke('2'); break; case KEYPAD_3 : simulated = simulateKeyStroke('3'); break; case KEYPAD_4 : simulated = simulateKeyStroke('4'); break; case KEYPAD_5 : simulated = simulateKeyStroke('5'); break; case KEYPAD_6 : simulated = simulateKeyStroke('6'); break; case KEYPAD_7 : simulated = simulateKeyStroke('7'); break; case KEYPAD_8 : simulated = simulateKeyStroke('8'); break; case KEYPAD_9 : simulated = simulateKeyStroke('9'); break; case KEYPAD_PERIOD : simulated = simulateKeyStroke('.'); break; case KEYPAD_COMMA : simulated = simulateKeyStroke(','); break; case KEYPAD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } simulated = true; updateDirty(); if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_EXIT : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_PLUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { setCursorOff(); screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = screenFields.getCurrentField().startPos(); if (where > 0) { goto_XY(where); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case SYSREQ : sessionVT.systemRequest(); simulated = true; break; case RESET : if (isStatusErrorCode()) { resetError(); isInField(lastPos); updateDirty(); setCursorOn(); } else { setPrehelpState(false,isKeyboardLocked(),false); } simulated = true; break; case COPY : copyMe(); break; case PASTE : pasteMe(false); break; case ATTN : sessionVT.sendAttentionKey(); simulated = true; break; case DUP_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.isCurrentFieldDupEnabled()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().setFieldChar(lastPos,(char)0x1C); screenFields.setCurrentFieldMDT(); gotoFieldNext(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_DUP_KEY_NOT_ALLOWED); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case NEW_LINE : if (screenFields.getSize() > 0) { int startRow = getRow(lastPos) + 1; int startPos = lastPos; boolean isthere = false; setCursorOff(); if (startRow == getRows()) startRow = 0; goto_XY(++startRow,1); if (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { while (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { // lets keep going advancePos(); // Have we looped the screen? if (lastPos == startPos) { // if so then go back to starting point goto_XY(startPos); break; } } } setCursorOn(); } simulated = true; break; case JUMP_NEXT_SESS : gui.nextSession(); simulated = true; break; case JUMP_PREV_SESS : gui.prevSession(); simulated = true; break; default : System.out.println(" Mnemonic not supported " + mnem); break; } return simulated; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
setCursorOn();
protected boolean simulateMnemonic(int mnem){ boolean simulated = false; switch (mnem) { case AID_CLEAR : case AID_ENTER : case AID_PF1 : case AID_PF2 : case AID_PF3 : case AID_PF4 : case AID_PF5 : case AID_PF6 : case AID_PF7 : case AID_PF8 : case AID_PF9 : case AID_PF10 : case AID_PF11 : case AID_PF12 : case AID_PF13 : case AID_PF14 : case AID_PF15 : case AID_PF16 : case AID_PF17 : case AID_PF18 : case AID_PF19 : case AID_PF20 : case AID_PF21 : case AID_PF22 : case AID_PF23 : case AID_PF24 : case AID_ROLL_DOWN : case AID_ROLL_UP : case AID_ROLL_LEFT : case AID_ROLL_RIGHT : sendAid(mnem); simulated = true; break; case AID_HELP : sessionVT.sendHelpRequest(); simulated = true; break; case AID_PRINT : sessionVT.hostPrint(1); simulated = true; break; case BACK_SPACE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.getCurrentField().startPos() == lastPos) displayError(ERR_CURSOR_PROTECTED); else { setCursorOff(); screenFields.getCurrentField().getKeyPos(lastPos); screenFields.getCurrentField().changePos(-1); resetDirty(screenFields.getCurrentField().getCurrentPos()); shiftLeft(screenFields.getCurrentField().getCurrentPos()); updateDirty(); setCursorOn(); screenFields.setCurrentFieldMDT(); simulated = true; } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BACK_TAB : if (screenFields.getCurrentField() != null && screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldPrev(); updateDirty(); } else gotoFieldPrev(); if (screenFields.isCurrentFieldContinued()) { do { gotoFieldPrev(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } isInField(lastPos); simulated = true; break; case UP : case MARK_UP : process_XY(lastPos - numCols); simulated = true; break; case DOWN : case MARK_DOWN : process_XY(lastPos + numCols); simulated = true; break; case LEFT : case MARK_LEFT : process_XY(lastPos - 1); simulated = true; break; case RIGHT : case MARK_RIGHT : process_XY(lastPos + 1); simulated = true; break; case NEXTWORD : gotoNextWord(); simulated = true; break; case PREVWORD : gotoPrevWord(); simulated = true; break; case DELETE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().getKeyPos(lastPos); shiftLeft(screenFields.getCurrentFieldPos()); screenFields.setCurrentFieldMDT(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case TAB : if (screenFields.getCurrentField() != null && !screenFields.isCurrentFieldContinued()) { if (screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldNext(); updateDirty(); } else gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.getCurrentField() != null && (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast())); } isInField(lastPos); simulated = true; break; case EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = endOfField(screenFields.getCurrentField().startPos(),true); if (where > 0) { goto_XY((where / numCols) + 1,(where % numCols) + 1); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case ERASE_EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case ERASE_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; lastPos = screenFields.getCurrentField().startPos(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case INSERT : setCursorOff(); // we toggle it insertMode = insertMode ? false : true; setCursorOn(); break; case HOME : // position to the home position set if (lastPos + numCols + 1 != homePos) { goto_XY(homePos - numCols - 1); // now check if we are in a field isInField(lastPos); } else gotoField(1); break; case KEYPAD_0 : simulated = simulateKeyStroke('0'); break; case KEYPAD_1 : simulated = simulateKeyStroke('1'); break; case KEYPAD_2 : simulated = simulateKeyStroke('2'); break; case KEYPAD_3 : simulated = simulateKeyStroke('3'); break; case KEYPAD_4 : simulated = simulateKeyStroke('4'); break; case KEYPAD_5 : simulated = simulateKeyStroke('5'); break; case KEYPAD_6 : simulated = simulateKeyStroke('6'); break; case KEYPAD_7 : simulated = simulateKeyStroke('7'); break; case KEYPAD_8 : simulated = simulateKeyStroke('8'); break; case KEYPAD_9 : simulated = simulateKeyStroke('9'); break; case KEYPAD_PERIOD : simulated = simulateKeyStroke('.'); break; case KEYPAD_COMMA : simulated = simulateKeyStroke(','); break; case KEYPAD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } simulated = true; updateDirty(); if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_EXIT : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_PLUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { setCursorOff(); screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = screenFields.getCurrentField().startPos(); if (where > 0) { goto_XY(where); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case SYSREQ : sessionVT.systemRequest(); simulated = true; break; case RESET : if (isStatusErrorCode()) { resetError(); isInField(lastPos); updateDirty(); setCursorOn(); } else { setPrehelpState(false,isKeyboardLocked(),false); } simulated = true; break; case COPY : copyMe(); break; case PASTE : pasteMe(false); break; case ATTN : sessionVT.sendAttentionKey(); simulated = true; break; case DUP_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.isCurrentFieldDupEnabled()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().setFieldChar(lastPos,(char)0x1C); screenFields.setCurrentFieldMDT(); gotoFieldNext(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_DUP_KEY_NOT_ALLOWED); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case NEW_LINE : if (screenFields.getSize() > 0) { int startRow = getRow(lastPos) + 1; int startPos = lastPos; boolean isthere = false; setCursorOff(); if (startRow == getRows()) startRow = 0; goto_XY(++startRow,1); if (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { while (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { // lets keep going advancePos(); // Have we looped the screen? if (lastPos == startPos) { // if so then go back to starting point goto_XY(startPos); break; } } } setCursorOn(); } simulated = true; break; case JUMP_NEXT_SESS : gui.nextSession(); simulated = true; break; case JUMP_PREV_SESS : gui.prevSession(); simulated = true; break; default : System.out.println(" Mnemonic not supported " + mnem); break; } return simulated; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
setCursorOff();
protected boolean simulateMnemonic(int mnem){ boolean simulated = false; switch (mnem) { case AID_CLEAR : case AID_ENTER : case AID_PF1 : case AID_PF2 : case AID_PF3 : case AID_PF4 : case AID_PF5 : case AID_PF6 : case AID_PF7 : case AID_PF8 : case AID_PF9 : case AID_PF10 : case AID_PF11 : case AID_PF12 : case AID_PF13 : case AID_PF14 : case AID_PF15 : case AID_PF16 : case AID_PF17 : case AID_PF18 : case AID_PF19 : case AID_PF20 : case AID_PF21 : case AID_PF22 : case AID_PF23 : case AID_PF24 : case AID_ROLL_DOWN : case AID_ROLL_UP : case AID_ROLL_LEFT : case AID_ROLL_RIGHT : sendAid(mnem); simulated = true; break; case AID_HELP : sessionVT.sendHelpRequest(); simulated = true; break; case AID_PRINT : sessionVT.hostPrint(1); simulated = true; break; case BACK_SPACE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.getCurrentField().startPos() == lastPos) displayError(ERR_CURSOR_PROTECTED); else { setCursorOff(); screenFields.getCurrentField().getKeyPos(lastPos); screenFields.getCurrentField().changePos(-1); resetDirty(screenFields.getCurrentField().getCurrentPos()); shiftLeft(screenFields.getCurrentField().getCurrentPos()); updateDirty(); setCursorOn(); screenFields.setCurrentFieldMDT(); simulated = true; } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BACK_TAB : if (screenFields.getCurrentField() != null && screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldPrev(); updateDirty(); } else gotoFieldPrev(); if (screenFields.isCurrentFieldContinued()) { do { gotoFieldPrev(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } isInField(lastPos); simulated = true; break; case UP : case MARK_UP : process_XY(lastPos - numCols); simulated = true; break; case DOWN : case MARK_DOWN : process_XY(lastPos + numCols); simulated = true; break; case LEFT : case MARK_LEFT : process_XY(lastPos - 1); simulated = true; break; case RIGHT : case MARK_RIGHT : process_XY(lastPos + 1); simulated = true; break; case NEXTWORD : gotoNextWord(); simulated = true; break; case PREVWORD : gotoPrevWord(); simulated = true; break; case DELETE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().getKeyPos(lastPos); shiftLeft(screenFields.getCurrentFieldPos()); screenFields.setCurrentFieldMDT(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case TAB : if (screenFields.getCurrentField() != null && !screenFields.isCurrentFieldContinued()) { if (screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldNext(); updateDirty(); } else gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.getCurrentField() != null && (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast())); } isInField(lastPos); simulated = true; break; case EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = endOfField(screenFields.getCurrentField().startPos(),true); if (where > 0) { goto_XY((where / numCols) + 1,(where % numCols) + 1); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case ERASE_EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case ERASE_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; lastPos = screenFields.getCurrentField().startPos(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case INSERT : setCursorOff(); // we toggle it insertMode = insertMode ? false : true; setCursorOn(); break; case HOME : // position to the home position set if (lastPos + numCols + 1 != homePos) { goto_XY(homePos - numCols - 1); // now check if we are in a field isInField(lastPos); } else gotoField(1); break; case KEYPAD_0 : simulated = simulateKeyStroke('0'); break; case KEYPAD_1 : simulated = simulateKeyStroke('1'); break; case KEYPAD_2 : simulated = simulateKeyStroke('2'); break; case KEYPAD_3 : simulated = simulateKeyStroke('3'); break; case KEYPAD_4 : simulated = simulateKeyStroke('4'); break; case KEYPAD_5 : simulated = simulateKeyStroke('5'); break; case KEYPAD_6 : simulated = simulateKeyStroke('6'); break; case KEYPAD_7 : simulated = simulateKeyStroke('7'); break; case KEYPAD_8 : simulated = simulateKeyStroke('8'); break; case KEYPAD_9 : simulated = simulateKeyStroke('9'); break; case KEYPAD_PERIOD : simulated = simulateKeyStroke('.'); break; case KEYPAD_COMMA : simulated = simulateKeyStroke(','); break; case KEYPAD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } simulated = true; updateDirty(); if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_EXIT : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_PLUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { setCursorOff(); screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = screenFields.getCurrentField().startPos(); if (where > 0) { goto_XY(where); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case SYSREQ : sessionVT.systemRequest(); simulated = true; break; case RESET : if (isStatusErrorCode()) { resetError(); isInField(lastPos); updateDirty(); setCursorOn(); } else { setPrehelpState(false,isKeyboardLocked(),false); } simulated = true; break; case COPY : copyMe(); break; case PASTE : pasteMe(false); break; case ATTN : sessionVT.sendAttentionKey(); simulated = true; break; case DUP_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.isCurrentFieldDupEnabled()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().setFieldChar(lastPos,(char)0x1C); screenFields.setCurrentFieldMDT(); gotoFieldNext(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_DUP_KEY_NOT_ALLOWED); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case NEW_LINE : if (screenFields.getSize() > 0) { int startRow = getRow(lastPos) + 1; int startPos = lastPos; boolean isthere = false; setCursorOff(); if (startRow == getRows()) startRow = 0; goto_XY(++startRow,1); if (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { while (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { // lets keep going advancePos(); // Have we looped the screen? if (lastPos == startPos) { // if so then go back to starting point goto_XY(startPos); break; } } } setCursorOn(); } simulated = true; break; case JUMP_NEXT_SESS : gui.nextSession(); simulated = true; break; case JUMP_PREV_SESS : gui.prevSession(); simulated = true; break; default : System.out.println(" Mnemonic not supported " + mnem); break; } return simulated; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
setCursorOn();
protected boolean simulateMnemonic(int mnem){ boolean simulated = false; switch (mnem) { case AID_CLEAR : case AID_ENTER : case AID_PF1 : case AID_PF2 : case AID_PF3 : case AID_PF4 : case AID_PF5 : case AID_PF6 : case AID_PF7 : case AID_PF8 : case AID_PF9 : case AID_PF10 : case AID_PF11 : case AID_PF12 : case AID_PF13 : case AID_PF14 : case AID_PF15 : case AID_PF16 : case AID_PF17 : case AID_PF18 : case AID_PF19 : case AID_PF20 : case AID_PF21 : case AID_PF22 : case AID_PF23 : case AID_PF24 : case AID_ROLL_DOWN : case AID_ROLL_UP : case AID_ROLL_LEFT : case AID_ROLL_RIGHT : sendAid(mnem); simulated = true; break; case AID_HELP : sessionVT.sendHelpRequest(); simulated = true; break; case AID_PRINT : sessionVT.hostPrint(1); simulated = true; break; case BACK_SPACE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.getCurrentField().startPos() == lastPos) displayError(ERR_CURSOR_PROTECTED); else { setCursorOff(); screenFields.getCurrentField().getKeyPos(lastPos); screenFields.getCurrentField().changePos(-1); resetDirty(screenFields.getCurrentField().getCurrentPos()); shiftLeft(screenFields.getCurrentField().getCurrentPos()); updateDirty(); setCursorOn(); screenFields.setCurrentFieldMDT(); simulated = true; } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BACK_TAB : if (screenFields.getCurrentField() != null && screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldPrev(); updateDirty(); } else gotoFieldPrev(); if (screenFields.isCurrentFieldContinued()) { do { gotoFieldPrev(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } isInField(lastPos); simulated = true; break; case UP : case MARK_UP : process_XY(lastPos - numCols); simulated = true; break; case DOWN : case MARK_DOWN : process_XY(lastPos + numCols); simulated = true; break; case LEFT : case MARK_LEFT : process_XY(lastPos - 1); simulated = true; break; case RIGHT : case MARK_RIGHT : process_XY(lastPos + 1); simulated = true; break; case NEXTWORD : gotoNextWord(); simulated = true; break; case PREVWORD : gotoPrevWord(); simulated = true; break; case DELETE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().getKeyPos(lastPos); shiftLeft(screenFields.getCurrentFieldPos()); screenFields.setCurrentFieldMDT(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case TAB : if (screenFields.getCurrentField() != null && !screenFields.isCurrentFieldContinued()) { if (screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldNext(); updateDirty(); } else gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.getCurrentField() != null && (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast())); } isInField(lastPos); simulated = true; break; case EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = endOfField(screenFields.getCurrentField().startPos(),true); if (where > 0) { goto_XY((where / numCols) + 1,(where % numCols) + 1); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case ERASE_EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case ERASE_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; lastPos = screenFields.getCurrentField().startPos(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case INSERT : setCursorOff(); // we toggle it insertMode = insertMode ? false : true; setCursorOn(); break; case HOME : // position to the home position set if (lastPos + numCols + 1 != homePos) { goto_XY(homePos - numCols - 1); // now check if we are in a field isInField(lastPos); } else gotoField(1); break; case KEYPAD_0 : simulated = simulateKeyStroke('0'); break; case KEYPAD_1 : simulated = simulateKeyStroke('1'); break; case KEYPAD_2 : simulated = simulateKeyStroke('2'); break; case KEYPAD_3 : simulated = simulateKeyStroke('3'); break; case KEYPAD_4 : simulated = simulateKeyStroke('4'); break; case KEYPAD_5 : simulated = simulateKeyStroke('5'); break; case KEYPAD_6 : simulated = simulateKeyStroke('6'); break; case KEYPAD_7 : simulated = simulateKeyStroke('7'); break; case KEYPAD_8 : simulated = simulateKeyStroke('8'); break; case KEYPAD_9 : simulated = simulateKeyStroke('9'); break; case KEYPAD_PERIOD : simulated = simulateKeyStroke('.'); break; case KEYPAD_COMMA : simulated = simulateKeyStroke(','); break; case KEYPAD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } simulated = true; updateDirty(); if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_EXIT : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_PLUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { setCursorOff(); screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = screenFields.getCurrentField().startPos(); if (where > 0) { goto_XY(where); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case SYSREQ : sessionVT.systemRequest(); simulated = true; break; case RESET : if (isStatusErrorCode()) { resetError(); isInField(lastPos); updateDirty(); setCursorOn(); } else { setPrehelpState(false,isKeyboardLocked(),false); } simulated = true; break; case COPY : copyMe(); break; case PASTE : pasteMe(false); break; case ATTN : sessionVT.sendAttentionKey(); simulated = true; break; case DUP_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.isCurrentFieldDupEnabled()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().setFieldChar(lastPos,(char)0x1C); screenFields.setCurrentFieldMDT(); gotoFieldNext(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_DUP_KEY_NOT_ALLOWED); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case NEW_LINE : if (screenFields.getSize() > 0) { int startRow = getRow(lastPos) + 1; int startPos = lastPos; boolean isthere = false; setCursorOff(); if (startRow == getRows()) startRow = 0; goto_XY(++startRow,1); if (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { while (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { // lets keep going advancePos(); // Have we looped the screen? if (lastPos == startPos) { // if so then go back to starting point goto_XY(startPos); break; } } } setCursorOn(); } simulated = true; break; case JUMP_NEXT_SESS : gui.nextSession(); simulated = true; break; case JUMP_PREV_SESS : gui.prevSession(); simulated = true; break; default : System.out.println(" Mnemonic not supported " + mnem); break; } return simulated; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
setCursorOff();
protected boolean simulateMnemonic(int mnem){ boolean simulated = false; switch (mnem) { case AID_CLEAR : case AID_ENTER : case AID_PF1 : case AID_PF2 : case AID_PF3 : case AID_PF4 : case AID_PF5 : case AID_PF6 : case AID_PF7 : case AID_PF8 : case AID_PF9 : case AID_PF10 : case AID_PF11 : case AID_PF12 : case AID_PF13 : case AID_PF14 : case AID_PF15 : case AID_PF16 : case AID_PF17 : case AID_PF18 : case AID_PF19 : case AID_PF20 : case AID_PF21 : case AID_PF22 : case AID_PF23 : case AID_PF24 : case AID_ROLL_DOWN : case AID_ROLL_UP : case AID_ROLL_LEFT : case AID_ROLL_RIGHT : sendAid(mnem); simulated = true; break; case AID_HELP : sessionVT.sendHelpRequest(); simulated = true; break; case AID_PRINT : sessionVT.hostPrint(1); simulated = true; break; case BACK_SPACE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.getCurrentField().startPos() == lastPos) displayError(ERR_CURSOR_PROTECTED); else { setCursorOff(); screenFields.getCurrentField().getKeyPos(lastPos); screenFields.getCurrentField().changePos(-1); resetDirty(screenFields.getCurrentField().getCurrentPos()); shiftLeft(screenFields.getCurrentField().getCurrentPos()); updateDirty(); setCursorOn(); screenFields.setCurrentFieldMDT(); simulated = true; } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BACK_TAB : if (screenFields.getCurrentField() != null && screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldPrev(); updateDirty(); } else gotoFieldPrev(); if (screenFields.isCurrentFieldContinued()) { do { gotoFieldPrev(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } isInField(lastPos); simulated = true; break; case UP : case MARK_UP : process_XY(lastPos - numCols); simulated = true; break; case DOWN : case MARK_DOWN : process_XY(lastPos + numCols); simulated = true; break; case LEFT : case MARK_LEFT : process_XY(lastPos - 1); simulated = true; break; case RIGHT : case MARK_RIGHT : process_XY(lastPos + 1); simulated = true; break; case NEXTWORD : gotoNextWord(); simulated = true; break; case PREVWORD : gotoPrevWord(); simulated = true; break; case DELETE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().getKeyPos(lastPos); shiftLeft(screenFields.getCurrentFieldPos()); screenFields.setCurrentFieldMDT(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case TAB : if (screenFields.getCurrentField() != null && !screenFields.isCurrentFieldContinued()) { if (screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldNext(); updateDirty(); } else gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.getCurrentField() != null && (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast())); } isInField(lastPos); simulated = true; break; case EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = endOfField(screenFields.getCurrentField().startPos(),true); if (where > 0) { goto_XY((where / numCols) + 1,(where % numCols) + 1); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case ERASE_EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case ERASE_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; lastPos = screenFields.getCurrentField().startPos(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case INSERT : setCursorOff(); // we toggle it insertMode = insertMode ? false : true; setCursorOn(); break; case HOME : // position to the home position set if (lastPos + numCols + 1 != homePos) { goto_XY(homePos - numCols - 1); // now check if we are in a field isInField(lastPos); } else gotoField(1); break; case KEYPAD_0 : simulated = simulateKeyStroke('0'); break; case KEYPAD_1 : simulated = simulateKeyStroke('1'); break; case KEYPAD_2 : simulated = simulateKeyStroke('2'); break; case KEYPAD_3 : simulated = simulateKeyStroke('3'); break; case KEYPAD_4 : simulated = simulateKeyStroke('4'); break; case KEYPAD_5 : simulated = simulateKeyStroke('5'); break; case KEYPAD_6 : simulated = simulateKeyStroke('6'); break; case KEYPAD_7 : simulated = simulateKeyStroke('7'); break; case KEYPAD_8 : simulated = simulateKeyStroke('8'); break; case KEYPAD_9 : simulated = simulateKeyStroke('9'); break; case KEYPAD_PERIOD : simulated = simulateKeyStroke('.'); break; case KEYPAD_COMMA : simulated = simulateKeyStroke(','); break; case KEYPAD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } simulated = true; updateDirty(); if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_EXIT : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_PLUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { setCursorOff(); screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = screenFields.getCurrentField().startPos(); if (where > 0) { goto_XY(where); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case SYSREQ : sessionVT.systemRequest(); simulated = true; break; case RESET : if (isStatusErrorCode()) { resetError(); isInField(lastPos); updateDirty(); setCursorOn(); } else { setPrehelpState(false,isKeyboardLocked(),false); } simulated = true; break; case COPY : copyMe(); break; case PASTE : pasteMe(false); break; case ATTN : sessionVT.sendAttentionKey(); simulated = true; break; case DUP_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.isCurrentFieldDupEnabled()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().setFieldChar(lastPos,(char)0x1C); screenFields.setCurrentFieldMDT(); gotoFieldNext(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_DUP_KEY_NOT_ALLOWED); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case NEW_LINE : if (screenFields.getSize() > 0) { int startRow = getRow(lastPos) + 1; int startPos = lastPos; boolean isthere = false; setCursorOff(); if (startRow == getRows()) startRow = 0; goto_XY(++startRow,1); if (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { while (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { // lets keep going advancePos(); // Have we looped the screen? if (lastPos == startPos) { // if so then go back to starting point goto_XY(startPos); break; } } } setCursorOn(); } simulated = true; break; case JUMP_NEXT_SESS : gui.nextSession(); simulated = true; break; case JUMP_PREV_SESS : gui.prevSession(); simulated = true; break; default : System.out.println(" Mnemonic not supported " + mnem); break; } return simulated; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
setCursorOn();
protected boolean simulateMnemonic(int mnem){ boolean simulated = false; switch (mnem) { case AID_CLEAR : case AID_ENTER : case AID_PF1 : case AID_PF2 : case AID_PF3 : case AID_PF4 : case AID_PF5 : case AID_PF6 : case AID_PF7 : case AID_PF8 : case AID_PF9 : case AID_PF10 : case AID_PF11 : case AID_PF12 : case AID_PF13 : case AID_PF14 : case AID_PF15 : case AID_PF16 : case AID_PF17 : case AID_PF18 : case AID_PF19 : case AID_PF20 : case AID_PF21 : case AID_PF22 : case AID_PF23 : case AID_PF24 : case AID_ROLL_DOWN : case AID_ROLL_UP : case AID_ROLL_LEFT : case AID_ROLL_RIGHT : sendAid(mnem); simulated = true; break; case AID_HELP : sessionVT.sendHelpRequest(); simulated = true; break; case AID_PRINT : sessionVT.hostPrint(1); simulated = true; break; case BACK_SPACE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.getCurrentField().startPos() == lastPos) displayError(ERR_CURSOR_PROTECTED); else { setCursorOff(); screenFields.getCurrentField().getKeyPos(lastPos); screenFields.getCurrentField().changePos(-1); resetDirty(screenFields.getCurrentField().getCurrentPos()); shiftLeft(screenFields.getCurrentField().getCurrentPos()); updateDirty(); setCursorOn(); screenFields.setCurrentFieldMDT(); simulated = true; } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BACK_TAB : if (screenFields.getCurrentField() != null && screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldPrev(); updateDirty(); } else gotoFieldPrev(); if (screenFields.isCurrentFieldContinued()) { do { gotoFieldPrev(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } isInField(lastPos); simulated = true; break; case UP : case MARK_UP : process_XY(lastPos - numCols); simulated = true; break; case DOWN : case MARK_DOWN : process_XY(lastPos + numCols); simulated = true; break; case LEFT : case MARK_LEFT : process_XY(lastPos - 1); simulated = true; break; case RIGHT : case MARK_RIGHT : process_XY(lastPos + 1); simulated = true; break; case NEXTWORD : gotoNextWord(); simulated = true; break; case PREVWORD : gotoPrevWord(); simulated = true; break; case DELETE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().getKeyPos(lastPos); shiftLeft(screenFields.getCurrentFieldPos()); screenFields.setCurrentFieldMDT(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case TAB : if (screenFields.getCurrentField() != null && !screenFields.isCurrentFieldContinued()) { if (screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldNext(); updateDirty(); } else gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.getCurrentField() != null && (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast())); } isInField(lastPos); simulated = true; break; case EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = endOfField(screenFields.getCurrentField().startPos(),true); if (where > 0) { goto_XY((where / numCols) + 1,(where % numCols) + 1); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case ERASE_EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case ERASE_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; lastPos = screenFields.getCurrentField().startPos(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case INSERT : setCursorOff(); // we toggle it insertMode = insertMode ? false : true; setCursorOn(); break; case HOME : // position to the home position set if (lastPos + numCols + 1 != homePos) { goto_XY(homePos - numCols - 1); // now check if we are in a field isInField(lastPos); } else gotoField(1); break; case KEYPAD_0 : simulated = simulateKeyStroke('0'); break; case KEYPAD_1 : simulated = simulateKeyStroke('1'); break; case KEYPAD_2 : simulated = simulateKeyStroke('2'); break; case KEYPAD_3 : simulated = simulateKeyStroke('3'); break; case KEYPAD_4 : simulated = simulateKeyStroke('4'); break; case KEYPAD_5 : simulated = simulateKeyStroke('5'); break; case KEYPAD_6 : simulated = simulateKeyStroke('6'); break; case KEYPAD_7 : simulated = simulateKeyStroke('7'); break; case KEYPAD_8 : simulated = simulateKeyStroke('8'); break; case KEYPAD_9 : simulated = simulateKeyStroke('9'); break; case KEYPAD_PERIOD : simulated = simulateKeyStroke('.'); break; case KEYPAD_COMMA : simulated = simulateKeyStroke(','); break; case KEYPAD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } simulated = true; updateDirty(); if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_EXIT : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_PLUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { setCursorOff(); screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = screenFields.getCurrentField().startPos(); if (where > 0) { goto_XY(where); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case SYSREQ : sessionVT.systemRequest(); simulated = true; break; case RESET : if (isStatusErrorCode()) { resetError(); isInField(lastPos); updateDirty(); setCursorOn(); } else { setPrehelpState(false,isKeyboardLocked(),false); } simulated = true; break; case COPY : copyMe(); break; case PASTE : pasteMe(false); break; case ATTN : sessionVT.sendAttentionKey(); simulated = true; break; case DUP_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.isCurrentFieldDupEnabled()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().setFieldChar(lastPos,(char)0x1C); screenFields.setCurrentFieldMDT(); gotoFieldNext(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_DUP_KEY_NOT_ALLOWED); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case NEW_LINE : if (screenFields.getSize() > 0) { int startRow = getRow(lastPos) + 1; int startPos = lastPos; boolean isthere = false; setCursorOff(); if (startRow == getRows()) startRow = 0; goto_XY(++startRow,1); if (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { while (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { // lets keep going advancePos(); // Have we looped the screen? if (lastPos == startPos) { // if so then go back to starting point goto_XY(startPos); break; } } } setCursorOn(); } simulated = true; break; case JUMP_NEXT_SESS : gui.nextSession(); simulated = true; break; case JUMP_PREV_SESS : gui.prevSession(); simulated = true; break; default : System.out.println(" Mnemonic not supported " + mnem); break; } return simulated; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
setCursorOff();
protected boolean simulateMnemonic(int mnem){ boolean simulated = false; switch (mnem) { case AID_CLEAR : case AID_ENTER : case AID_PF1 : case AID_PF2 : case AID_PF3 : case AID_PF4 : case AID_PF5 : case AID_PF6 : case AID_PF7 : case AID_PF8 : case AID_PF9 : case AID_PF10 : case AID_PF11 : case AID_PF12 : case AID_PF13 : case AID_PF14 : case AID_PF15 : case AID_PF16 : case AID_PF17 : case AID_PF18 : case AID_PF19 : case AID_PF20 : case AID_PF21 : case AID_PF22 : case AID_PF23 : case AID_PF24 : case AID_ROLL_DOWN : case AID_ROLL_UP : case AID_ROLL_LEFT : case AID_ROLL_RIGHT : sendAid(mnem); simulated = true; break; case AID_HELP : sessionVT.sendHelpRequest(); simulated = true; break; case AID_PRINT : sessionVT.hostPrint(1); simulated = true; break; case BACK_SPACE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.getCurrentField().startPos() == lastPos) displayError(ERR_CURSOR_PROTECTED); else { setCursorOff(); screenFields.getCurrentField().getKeyPos(lastPos); screenFields.getCurrentField().changePos(-1); resetDirty(screenFields.getCurrentField().getCurrentPos()); shiftLeft(screenFields.getCurrentField().getCurrentPos()); updateDirty(); setCursorOn(); screenFields.setCurrentFieldMDT(); simulated = true; } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BACK_TAB : if (screenFields.getCurrentField() != null && screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldPrev(); updateDirty(); } else gotoFieldPrev(); if (screenFields.isCurrentFieldContinued()) { do { gotoFieldPrev(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } isInField(lastPos); simulated = true; break; case UP : case MARK_UP : process_XY(lastPos - numCols); simulated = true; break; case DOWN : case MARK_DOWN : process_XY(lastPos + numCols); simulated = true; break; case LEFT : case MARK_LEFT : process_XY(lastPos - 1); simulated = true; break; case RIGHT : case MARK_RIGHT : process_XY(lastPos + 1); simulated = true; break; case NEXTWORD : gotoNextWord(); simulated = true; break; case PREVWORD : gotoPrevWord(); simulated = true; break; case DELETE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().getKeyPos(lastPos); shiftLeft(screenFields.getCurrentFieldPos()); screenFields.setCurrentFieldMDT(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case TAB : if (screenFields.getCurrentField() != null && !screenFields.isCurrentFieldContinued()) { if (screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldNext(); updateDirty(); } else gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.getCurrentField() != null && (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast())); } isInField(lastPos); simulated = true; break; case EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = endOfField(screenFields.getCurrentField().startPos(),true); if (where > 0) { goto_XY((where / numCols) + 1,(where % numCols) + 1); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case ERASE_EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case ERASE_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; lastPos = screenFields.getCurrentField().startPos(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case INSERT : setCursorOff(); // we toggle it insertMode = insertMode ? false : true; setCursorOn(); break; case HOME : // position to the home position set if (lastPos + numCols + 1 != homePos) { goto_XY(homePos - numCols - 1); // now check if we are in a field isInField(lastPos); } else gotoField(1); break; case KEYPAD_0 : simulated = simulateKeyStroke('0'); break; case KEYPAD_1 : simulated = simulateKeyStroke('1'); break; case KEYPAD_2 : simulated = simulateKeyStroke('2'); break; case KEYPAD_3 : simulated = simulateKeyStroke('3'); break; case KEYPAD_4 : simulated = simulateKeyStroke('4'); break; case KEYPAD_5 : simulated = simulateKeyStroke('5'); break; case KEYPAD_6 : simulated = simulateKeyStroke('6'); break; case KEYPAD_7 : simulated = simulateKeyStroke('7'); break; case KEYPAD_8 : simulated = simulateKeyStroke('8'); break; case KEYPAD_9 : simulated = simulateKeyStroke('9'); break; case KEYPAD_PERIOD : simulated = simulateKeyStroke('.'); break; case KEYPAD_COMMA : simulated = simulateKeyStroke(','); break; case KEYPAD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } simulated = true; updateDirty(); if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_EXIT : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_PLUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { setCursorOff(); screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = screenFields.getCurrentField().startPos(); if (where > 0) { goto_XY(where); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case SYSREQ : sessionVT.systemRequest(); simulated = true; break; case RESET : if (isStatusErrorCode()) { resetError(); isInField(lastPos); updateDirty(); setCursorOn(); } else { setPrehelpState(false,isKeyboardLocked(),false); } simulated = true; break; case COPY : copyMe(); break; case PASTE : pasteMe(false); break; case ATTN : sessionVT.sendAttentionKey(); simulated = true; break; case DUP_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.isCurrentFieldDupEnabled()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().setFieldChar(lastPos,(char)0x1C); screenFields.setCurrentFieldMDT(); gotoFieldNext(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_DUP_KEY_NOT_ALLOWED); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case NEW_LINE : if (screenFields.getSize() > 0) { int startRow = getRow(lastPos) + 1; int startPos = lastPos; boolean isthere = false; setCursorOff(); if (startRow == getRows()) startRow = 0; goto_XY(++startRow,1); if (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { while (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { // lets keep going advancePos(); // Have we looped the screen? if (lastPos == startPos) { // if so then go back to starting point goto_XY(startPos); break; } } } setCursorOn(); } simulated = true; break; case JUMP_NEXT_SESS : gui.nextSession(); simulated = true; break; case JUMP_PREV_SESS : gui.prevSession(); simulated = true; break; default : System.out.println(" Mnemonic not supported " + mnem); break; } return simulated; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
setCursorOn();
protected boolean simulateMnemonic(int mnem){ boolean simulated = false; switch (mnem) { case AID_CLEAR : case AID_ENTER : case AID_PF1 : case AID_PF2 : case AID_PF3 : case AID_PF4 : case AID_PF5 : case AID_PF6 : case AID_PF7 : case AID_PF8 : case AID_PF9 : case AID_PF10 : case AID_PF11 : case AID_PF12 : case AID_PF13 : case AID_PF14 : case AID_PF15 : case AID_PF16 : case AID_PF17 : case AID_PF18 : case AID_PF19 : case AID_PF20 : case AID_PF21 : case AID_PF22 : case AID_PF23 : case AID_PF24 : case AID_ROLL_DOWN : case AID_ROLL_UP : case AID_ROLL_LEFT : case AID_ROLL_RIGHT : sendAid(mnem); simulated = true; break; case AID_HELP : sessionVT.sendHelpRequest(); simulated = true; break; case AID_PRINT : sessionVT.hostPrint(1); simulated = true; break; case BACK_SPACE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.getCurrentField().startPos() == lastPos) displayError(ERR_CURSOR_PROTECTED); else { setCursorOff(); screenFields.getCurrentField().getKeyPos(lastPos); screenFields.getCurrentField().changePos(-1); resetDirty(screenFields.getCurrentField().getCurrentPos()); shiftLeft(screenFields.getCurrentField().getCurrentPos()); updateDirty(); setCursorOn(); screenFields.setCurrentFieldMDT(); simulated = true; } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BACK_TAB : if (screenFields.getCurrentField() != null && screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldPrev(); updateDirty(); } else gotoFieldPrev(); if (screenFields.isCurrentFieldContinued()) { do { gotoFieldPrev(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } isInField(lastPos); simulated = true; break; case UP : case MARK_UP : process_XY(lastPos - numCols); simulated = true; break; case DOWN : case MARK_DOWN : process_XY(lastPos + numCols); simulated = true; break; case LEFT : case MARK_LEFT : process_XY(lastPos - 1); simulated = true; break; case RIGHT : case MARK_RIGHT : process_XY(lastPos + 1); simulated = true; break; case NEXTWORD : gotoNextWord(); simulated = true; break; case PREVWORD : gotoPrevWord(); simulated = true; break; case DELETE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().getKeyPos(lastPos); shiftLeft(screenFields.getCurrentFieldPos()); screenFields.setCurrentFieldMDT(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case TAB : if (screenFields.getCurrentField() != null && !screenFields.isCurrentFieldContinued()) { if (screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldNext(); updateDirty(); } else gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.getCurrentField() != null && (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast())); } isInField(lastPos); simulated = true; break; case EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = endOfField(screenFields.getCurrentField().startPos(),true); if (where > 0) { goto_XY((where / numCols) + 1,(where % numCols) + 1); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case ERASE_EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case ERASE_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; lastPos = screenFields.getCurrentField().startPos(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case INSERT : setCursorOff(); // we toggle it insertMode = insertMode ? false : true; setCursorOn(); break; case HOME : // position to the home position set if (lastPos + numCols + 1 != homePos) { goto_XY(homePos - numCols - 1); // now check if we are in a field isInField(lastPos); } else gotoField(1); break; case KEYPAD_0 : simulated = simulateKeyStroke('0'); break; case KEYPAD_1 : simulated = simulateKeyStroke('1'); break; case KEYPAD_2 : simulated = simulateKeyStroke('2'); break; case KEYPAD_3 : simulated = simulateKeyStroke('3'); break; case KEYPAD_4 : simulated = simulateKeyStroke('4'); break; case KEYPAD_5 : simulated = simulateKeyStroke('5'); break; case KEYPAD_6 : simulated = simulateKeyStroke('6'); break; case KEYPAD_7 : simulated = simulateKeyStroke('7'); break; case KEYPAD_8 : simulated = simulateKeyStroke('8'); break; case KEYPAD_9 : simulated = simulateKeyStroke('9'); break; case KEYPAD_PERIOD : simulated = simulateKeyStroke('.'); break; case KEYPAD_COMMA : simulated = simulateKeyStroke(','); break; case KEYPAD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } simulated = true; updateDirty(); if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_EXIT : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_PLUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { setCursorOff(); screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = screenFields.getCurrentField().startPos(); if (where > 0) { goto_XY(where); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case SYSREQ : sessionVT.systemRequest(); simulated = true; break; case RESET : if (isStatusErrorCode()) { resetError(); isInField(lastPos); updateDirty(); setCursorOn(); } else { setPrehelpState(false,isKeyboardLocked(),false); } simulated = true; break; case COPY : copyMe(); break; case PASTE : pasteMe(false); break; case ATTN : sessionVT.sendAttentionKey(); simulated = true; break; case DUP_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.isCurrentFieldDupEnabled()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().setFieldChar(lastPos,(char)0x1C); screenFields.setCurrentFieldMDT(); gotoFieldNext(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_DUP_KEY_NOT_ALLOWED); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case NEW_LINE : if (screenFields.getSize() > 0) { int startRow = getRow(lastPos) + 1; int startPos = lastPos; boolean isthere = false; setCursorOff(); if (startRow == getRows()) startRow = 0; goto_XY(++startRow,1); if (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { while (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { // lets keep going advancePos(); // Have we looped the screen? if (lastPos == startPos) { // if so then go back to starting point goto_XY(startPos); break; } } } setCursorOn(); } simulated = true; break; case JUMP_NEXT_SESS : gui.nextSession(); simulated = true; break; case JUMP_PREV_SESS : gui.prevSession(); simulated = true; break; default : System.out.println(" Mnemonic not supported " + mnem); break; } return simulated; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
setCursorOn();
protected boolean simulateMnemonic(int mnem){ boolean simulated = false; switch (mnem) { case AID_CLEAR : case AID_ENTER : case AID_PF1 : case AID_PF2 : case AID_PF3 : case AID_PF4 : case AID_PF5 : case AID_PF6 : case AID_PF7 : case AID_PF8 : case AID_PF9 : case AID_PF10 : case AID_PF11 : case AID_PF12 : case AID_PF13 : case AID_PF14 : case AID_PF15 : case AID_PF16 : case AID_PF17 : case AID_PF18 : case AID_PF19 : case AID_PF20 : case AID_PF21 : case AID_PF22 : case AID_PF23 : case AID_PF24 : case AID_ROLL_DOWN : case AID_ROLL_UP : case AID_ROLL_LEFT : case AID_ROLL_RIGHT : sendAid(mnem); simulated = true; break; case AID_HELP : sessionVT.sendHelpRequest(); simulated = true; break; case AID_PRINT : sessionVT.hostPrint(1); simulated = true; break; case BACK_SPACE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.getCurrentField().startPos() == lastPos) displayError(ERR_CURSOR_PROTECTED); else { setCursorOff(); screenFields.getCurrentField().getKeyPos(lastPos); screenFields.getCurrentField().changePos(-1); resetDirty(screenFields.getCurrentField().getCurrentPos()); shiftLeft(screenFields.getCurrentField().getCurrentPos()); updateDirty(); setCursorOn(); screenFields.setCurrentFieldMDT(); simulated = true; } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BACK_TAB : if (screenFields.getCurrentField() != null && screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldPrev(); updateDirty(); } else gotoFieldPrev(); if (screenFields.isCurrentFieldContinued()) { do { gotoFieldPrev(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } isInField(lastPos); simulated = true; break; case UP : case MARK_UP : process_XY(lastPos - numCols); simulated = true; break; case DOWN : case MARK_DOWN : process_XY(lastPos + numCols); simulated = true; break; case LEFT : case MARK_LEFT : process_XY(lastPos - 1); simulated = true; break; case RIGHT : case MARK_RIGHT : process_XY(lastPos + 1); simulated = true; break; case NEXTWORD : gotoNextWord(); simulated = true; break; case PREVWORD : gotoPrevWord(); simulated = true; break; case DELETE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().getKeyPos(lastPos); shiftLeft(screenFields.getCurrentFieldPos()); screenFields.setCurrentFieldMDT(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case TAB : if (screenFields.getCurrentField() != null && !screenFields.isCurrentFieldContinued()) { if (screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldNext(); updateDirty(); } else gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.getCurrentField() != null && (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast())); } isInField(lastPos); simulated = true; break; case EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = endOfField(screenFields.getCurrentField().startPos(),true); if (where > 0) { goto_XY((where / numCols) + 1,(where % numCols) + 1); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case ERASE_EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case ERASE_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; lastPos = screenFields.getCurrentField().startPos(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case INSERT : setCursorOff(); // we toggle it insertMode = insertMode ? false : true; setCursorOn(); break; case HOME : // position to the home position set if (lastPos + numCols + 1 != homePos) { goto_XY(homePos - numCols - 1); // now check if we are in a field isInField(lastPos); } else gotoField(1); break; case KEYPAD_0 : simulated = simulateKeyStroke('0'); break; case KEYPAD_1 : simulated = simulateKeyStroke('1'); break; case KEYPAD_2 : simulated = simulateKeyStroke('2'); break; case KEYPAD_3 : simulated = simulateKeyStroke('3'); break; case KEYPAD_4 : simulated = simulateKeyStroke('4'); break; case KEYPAD_5 : simulated = simulateKeyStroke('5'); break; case KEYPAD_6 : simulated = simulateKeyStroke('6'); break; case KEYPAD_7 : simulated = simulateKeyStroke('7'); break; case KEYPAD_8 : simulated = simulateKeyStroke('8'); break; case KEYPAD_9 : simulated = simulateKeyStroke('9'); break; case KEYPAD_PERIOD : simulated = simulateKeyStroke('.'); break; case KEYPAD_COMMA : simulated = simulateKeyStroke(','); break; case KEYPAD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } simulated = true; updateDirty(); if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_EXIT : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_PLUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { setCursorOff(); screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = screenFields.getCurrentField().startPos(); if (where > 0) { goto_XY(where); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case SYSREQ : sessionVT.systemRequest(); simulated = true; break; case RESET : if (isStatusErrorCode()) { resetError(); isInField(lastPos); updateDirty(); setCursorOn(); } else { setPrehelpState(false,isKeyboardLocked(),false); } simulated = true; break; case COPY : copyMe(); break; case PASTE : pasteMe(false); break; case ATTN : sessionVT.sendAttentionKey(); simulated = true; break; case DUP_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.isCurrentFieldDupEnabled()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().setFieldChar(lastPos,(char)0x1C); screenFields.setCurrentFieldMDT(); gotoFieldNext(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_DUP_KEY_NOT_ALLOWED); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case NEW_LINE : if (screenFields.getSize() > 0) { int startRow = getRow(lastPos) + 1; int startPos = lastPos; boolean isthere = false; setCursorOff(); if (startRow == getRows()) startRow = 0; goto_XY(++startRow,1); if (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { while (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { // lets keep going advancePos(); // Have we looped the screen? if (lastPos == startPos) { // if so then go back to starting point goto_XY(startPos); break; } } } setCursorOn(); } simulated = true; break; case JUMP_NEXT_SESS : gui.nextSession(); simulated = true; break; case JUMP_PREV_SESS : gui.prevSession(); simulated = true; break; default : System.out.println(" Mnemonic not supported " + mnem); break; } return simulated; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
setCursorOff();
protected boolean simulateMnemonic(int mnem){ boolean simulated = false; switch (mnem) { case AID_CLEAR : case AID_ENTER : case AID_PF1 : case AID_PF2 : case AID_PF3 : case AID_PF4 : case AID_PF5 : case AID_PF6 : case AID_PF7 : case AID_PF8 : case AID_PF9 : case AID_PF10 : case AID_PF11 : case AID_PF12 : case AID_PF13 : case AID_PF14 : case AID_PF15 : case AID_PF16 : case AID_PF17 : case AID_PF18 : case AID_PF19 : case AID_PF20 : case AID_PF21 : case AID_PF22 : case AID_PF23 : case AID_PF24 : case AID_ROLL_DOWN : case AID_ROLL_UP : case AID_ROLL_LEFT : case AID_ROLL_RIGHT : sendAid(mnem); simulated = true; break; case AID_HELP : sessionVT.sendHelpRequest(); simulated = true; break; case AID_PRINT : sessionVT.hostPrint(1); simulated = true; break; case BACK_SPACE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.getCurrentField().startPos() == lastPos) displayError(ERR_CURSOR_PROTECTED); else { setCursorOff(); screenFields.getCurrentField().getKeyPos(lastPos); screenFields.getCurrentField().changePos(-1); resetDirty(screenFields.getCurrentField().getCurrentPos()); shiftLeft(screenFields.getCurrentField().getCurrentPos()); updateDirty(); setCursorOn(); screenFields.setCurrentFieldMDT(); simulated = true; } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BACK_TAB : if (screenFields.getCurrentField() != null && screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldPrev(); updateDirty(); } else gotoFieldPrev(); if (screenFields.isCurrentFieldContinued()) { do { gotoFieldPrev(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } isInField(lastPos); simulated = true; break; case UP : case MARK_UP : process_XY(lastPos - numCols); simulated = true; break; case DOWN : case MARK_DOWN : process_XY(lastPos + numCols); simulated = true; break; case LEFT : case MARK_LEFT : process_XY(lastPos - 1); simulated = true; break; case RIGHT : case MARK_RIGHT : process_XY(lastPos + 1); simulated = true; break; case NEXTWORD : gotoNextWord(); simulated = true; break; case PREVWORD : gotoPrevWord(); simulated = true; break; case DELETE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().getKeyPos(lastPos); shiftLeft(screenFields.getCurrentFieldPos()); screenFields.setCurrentFieldMDT(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case TAB : if (screenFields.getCurrentField() != null && !screenFields.isCurrentFieldContinued()) { if (screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldNext(); updateDirty(); } else gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.getCurrentField() != null && (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast())); } isInField(lastPos); simulated = true; break; case EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = endOfField(screenFields.getCurrentField().startPos(),true); if (where > 0) { goto_XY((where / numCols) + 1,(where % numCols) + 1); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case ERASE_EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case ERASE_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; lastPos = screenFields.getCurrentField().startPos(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case INSERT : setCursorOff(); // we toggle it insertMode = insertMode ? false : true; setCursorOn(); break; case HOME : // position to the home position set if (lastPos + numCols + 1 != homePos) { goto_XY(homePos - numCols - 1); // now check if we are in a field isInField(lastPos); } else gotoField(1); break; case KEYPAD_0 : simulated = simulateKeyStroke('0'); break; case KEYPAD_1 : simulated = simulateKeyStroke('1'); break; case KEYPAD_2 : simulated = simulateKeyStroke('2'); break; case KEYPAD_3 : simulated = simulateKeyStroke('3'); break; case KEYPAD_4 : simulated = simulateKeyStroke('4'); break; case KEYPAD_5 : simulated = simulateKeyStroke('5'); break; case KEYPAD_6 : simulated = simulateKeyStroke('6'); break; case KEYPAD_7 : simulated = simulateKeyStroke('7'); break; case KEYPAD_8 : simulated = simulateKeyStroke('8'); break; case KEYPAD_9 : simulated = simulateKeyStroke('9'); break; case KEYPAD_PERIOD : simulated = simulateKeyStroke('.'); break; case KEYPAD_COMMA : simulated = simulateKeyStroke(','); break; case KEYPAD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } simulated = true; updateDirty(); if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_EXIT : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_PLUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { setCursorOff(); screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = screenFields.getCurrentField().startPos(); if (where > 0) { goto_XY(where); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case SYSREQ : sessionVT.systemRequest(); simulated = true; break; case RESET : if (isStatusErrorCode()) { resetError(); isInField(lastPos); updateDirty(); setCursorOn(); } else { setPrehelpState(false,isKeyboardLocked(),false); } simulated = true; break; case COPY : copyMe(); break; case PASTE : pasteMe(false); break; case ATTN : sessionVT.sendAttentionKey(); simulated = true; break; case DUP_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.isCurrentFieldDupEnabled()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().setFieldChar(lastPos,(char)0x1C); screenFields.setCurrentFieldMDT(); gotoFieldNext(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_DUP_KEY_NOT_ALLOWED); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case NEW_LINE : if (screenFields.getSize() > 0) { int startRow = getRow(lastPos) + 1; int startPos = lastPos; boolean isthere = false; setCursorOff(); if (startRow == getRows()) startRow = 0; goto_XY(++startRow,1); if (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { while (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { // lets keep going advancePos(); // Have we looped the screen? if (lastPos == startPos) { // if so then go back to starting point goto_XY(startPos); break; } } } setCursorOn(); } simulated = true; break; case JUMP_NEXT_SESS : gui.nextSession(); simulated = true; break; case JUMP_PREV_SESS : gui.prevSession(); simulated = true; break; default : System.out.println(" Mnemonic not supported " + mnem); break; } return simulated; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
setCursorOn();
protected boolean simulateMnemonic(int mnem){ boolean simulated = false; switch (mnem) { case AID_CLEAR : case AID_ENTER : case AID_PF1 : case AID_PF2 : case AID_PF3 : case AID_PF4 : case AID_PF5 : case AID_PF6 : case AID_PF7 : case AID_PF8 : case AID_PF9 : case AID_PF10 : case AID_PF11 : case AID_PF12 : case AID_PF13 : case AID_PF14 : case AID_PF15 : case AID_PF16 : case AID_PF17 : case AID_PF18 : case AID_PF19 : case AID_PF20 : case AID_PF21 : case AID_PF22 : case AID_PF23 : case AID_PF24 : case AID_ROLL_DOWN : case AID_ROLL_UP : case AID_ROLL_LEFT : case AID_ROLL_RIGHT : sendAid(mnem); simulated = true; break; case AID_HELP : sessionVT.sendHelpRequest(); simulated = true; break; case AID_PRINT : sessionVT.hostPrint(1); simulated = true; break; case BACK_SPACE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.getCurrentField().startPos() == lastPos) displayError(ERR_CURSOR_PROTECTED); else { setCursorOff(); screenFields.getCurrentField().getKeyPos(lastPos); screenFields.getCurrentField().changePos(-1); resetDirty(screenFields.getCurrentField().getCurrentPos()); shiftLeft(screenFields.getCurrentField().getCurrentPos()); updateDirty(); setCursorOn(); screenFields.setCurrentFieldMDT(); simulated = true; } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BACK_TAB : if (screenFields.getCurrentField() != null && screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldPrev(); updateDirty(); } else gotoFieldPrev(); if (screenFields.isCurrentFieldContinued()) { do { gotoFieldPrev(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } isInField(lastPos); simulated = true; break; case UP : case MARK_UP : process_XY(lastPos - numCols); simulated = true; break; case DOWN : case MARK_DOWN : process_XY(lastPos + numCols); simulated = true; break; case LEFT : case MARK_LEFT : process_XY(lastPos - 1); simulated = true; break; case RIGHT : case MARK_RIGHT : process_XY(lastPos + 1); simulated = true; break; case NEXTWORD : gotoNextWord(); simulated = true; break; case PREVWORD : gotoPrevWord(); simulated = true; break; case DELETE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().getKeyPos(lastPos); shiftLeft(screenFields.getCurrentFieldPos()); screenFields.setCurrentFieldMDT(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case TAB : if (screenFields.getCurrentField() != null && !screenFields.isCurrentFieldContinued()) { if (screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldNext(); updateDirty(); } else gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.getCurrentField() != null && (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast())); } isInField(lastPos); simulated = true; break; case EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = endOfField(screenFields.getCurrentField().startPos(),true); if (where > 0) { goto_XY((where / numCols) + 1,(where % numCols) + 1); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case ERASE_EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case ERASE_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; lastPos = screenFields.getCurrentField().startPos(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case INSERT : setCursorOff(); // we toggle it insertMode = insertMode ? false : true; setCursorOn(); break; case HOME : // position to the home position set if (lastPos + numCols + 1 != homePos) { goto_XY(homePos - numCols - 1); // now check if we are in a field isInField(lastPos); } else gotoField(1); break; case KEYPAD_0 : simulated = simulateKeyStroke('0'); break; case KEYPAD_1 : simulated = simulateKeyStroke('1'); break; case KEYPAD_2 : simulated = simulateKeyStroke('2'); break; case KEYPAD_3 : simulated = simulateKeyStroke('3'); break; case KEYPAD_4 : simulated = simulateKeyStroke('4'); break; case KEYPAD_5 : simulated = simulateKeyStroke('5'); break; case KEYPAD_6 : simulated = simulateKeyStroke('6'); break; case KEYPAD_7 : simulated = simulateKeyStroke('7'); break; case KEYPAD_8 : simulated = simulateKeyStroke('8'); break; case KEYPAD_9 : simulated = simulateKeyStroke('9'); break; case KEYPAD_PERIOD : simulated = simulateKeyStroke('.'); break; case KEYPAD_COMMA : simulated = simulateKeyStroke(','); break; case KEYPAD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } simulated = true; updateDirty(); if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_EXIT : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_PLUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { setCursorOff(); screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = screenFields.getCurrentField().startPos(); if (where > 0) { goto_XY(where); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case SYSREQ : sessionVT.systemRequest(); simulated = true; break; case RESET : if (isStatusErrorCode()) { resetError(); isInField(lastPos); updateDirty(); setCursorOn(); } else { setPrehelpState(false,isKeyboardLocked(),false); } simulated = true; break; case COPY : copyMe(); break; case PASTE : pasteMe(false); break; case ATTN : sessionVT.sendAttentionKey(); simulated = true; break; case DUP_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.isCurrentFieldDupEnabled()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().setFieldChar(lastPos,(char)0x1C); screenFields.setCurrentFieldMDT(); gotoFieldNext(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_DUP_KEY_NOT_ALLOWED); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case NEW_LINE : if (screenFields.getSize() > 0) { int startRow = getRow(lastPos) + 1; int startPos = lastPos; boolean isthere = false; setCursorOff(); if (startRow == getRows()) startRow = 0; goto_XY(++startRow,1); if (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { while (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { // lets keep going advancePos(); // Have we looped the screen? if (lastPos == startPos) { // if so then go back to starting point goto_XY(startPos); break; } } } setCursorOn(); } simulated = true; break; case JUMP_NEXT_SESS : gui.nextSession(); simulated = true; break; case JUMP_PREV_SESS : gui.prevSession(); simulated = true; break; default : System.out.println(" Mnemonic not supported " + mnem); break; } return simulated; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
setCursorOff();
protected boolean simulateMnemonic(int mnem){ boolean simulated = false; switch (mnem) { case AID_CLEAR : case AID_ENTER : case AID_PF1 : case AID_PF2 : case AID_PF3 : case AID_PF4 : case AID_PF5 : case AID_PF6 : case AID_PF7 : case AID_PF8 : case AID_PF9 : case AID_PF10 : case AID_PF11 : case AID_PF12 : case AID_PF13 : case AID_PF14 : case AID_PF15 : case AID_PF16 : case AID_PF17 : case AID_PF18 : case AID_PF19 : case AID_PF20 : case AID_PF21 : case AID_PF22 : case AID_PF23 : case AID_PF24 : case AID_ROLL_DOWN : case AID_ROLL_UP : case AID_ROLL_LEFT : case AID_ROLL_RIGHT : sendAid(mnem); simulated = true; break; case AID_HELP : sessionVT.sendHelpRequest(); simulated = true; break; case AID_PRINT : sessionVT.hostPrint(1); simulated = true; break; case BACK_SPACE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.getCurrentField().startPos() == lastPos) displayError(ERR_CURSOR_PROTECTED); else { setCursorOff(); screenFields.getCurrentField().getKeyPos(lastPos); screenFields.getCurrentField().changePos(-1); resetDirty(screenFields.getCurrentField().getCurrentPos()); shiftLeft(screenFields.getCurrentField().getCurrentPos()); updateDirty(); setCursorOn(); screenFields.setCurrentFieldMDT(); simulated = true; } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BACK_TAB : if (screenFields.getCurrentField() != null && screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldPrev(); updateDirty(); } else gotoFieldPrev(); if (screenFields.isCurrentFieldContinued()) { do { gotoFieldPrev(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } isInField(lastPos); simulated = true; break; case UP : case MARK_UP : process_XY(lastPos - numCols); simulated = true; break; case DOWN : case MARK_DOWN : process_XY(lastPos + numCols); simulated = true; break; case LEFT : case MARK_LEFT : process_XY(lastPos - 1); simulated = true; break; case RIGHT : case MARK_RIGHT : process_XY(lastPos + 1); simulated = true; break; case NEXTWORD : gotoNextWord(); simulated = true; break; case PREVWORD : gotoPrevWord(); simulated = true; break; case DELETE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().getKeyPos(lastPos); shiftLeft(screenFields.getCurrentFieldPos()); screenFields.setCurrentFieldMDT(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case TAB : if (screenFields.getCurrentField() != null && !screenFields.isCurrentFieldContinued()) { if (screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldNext(); updateDirty(); } else gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.getCurrentField() != null && (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast())); } isInField(lastPos); simulated = true; break; case EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = endOfField(screenFields.getCurrentField().startPos(),true); if (where > 0) { goto_XY((where / numCols) + 1,(where % numCols) + 1); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case ERASE_EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case ERASE_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; lastPos = screenFields.getCurrentField().startPos(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case INSERT : setCursorOff(); // we toggle it insertMode = insertMode ? false : true; setCursorOn(); break; case HOME : // position to the home position set if (lastPos + numCols + 1 != homePos) { goto_XY(homePos - numCols - 1); // now check if we are in a field isInField(lastPos); } else gotoField(1); break; case KEYPAD_0 : simulated = simulateKeyStroke('0'); break; case KEYPAD_1 : simulated = simulateKeyStroke('1'); break; case KEYPAD_2 : simulated = simulateKeyStroke('2'); break; case KEYPAD_3 : simulated = simulateKeyStroke('3'); break; case KEYPAD_4 : simulated = simulateKeyStroke('4'); break; case KEYPAD_5 : simulated = simulateKeyStroke('5'); break; case KEYPAD_6 : simulated = simulateKeyStroke('6'); break; case KEYPAD_7 : simulated = simulateKeyStroke('7'); break; case KEYPAD_8 : simulated = simulateKeyStroke('8'); break; case KEYPAD_9 : simulated = simulateKeyStroke('9'); break; case KEYPAD_PERIOD : simulated = simulateKeyStroke('.'); break; case KEYPAD_COMMA : simulated = simulateKeyStroke(','); break; case KEYPAD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } simulated = true; updateDirty(); if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_EXIT : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_PLUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { setCursorOff(); screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = screenFields.getCurrentField().startPos(); if (where > 0) { goto_XY(where); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case SYSREQ : sessionVT.systemRequest(); simulated = true; break; case RESET : if (isStatusErrorCode()) { resetError(); isInField(lastPos); updateDirty(); setCursorOn(); } else { setPrehelpState(false,isKeyboardLocked(),false); } simulated = true; break; case COPY : copyMe(); break; case PASTE : pasteMe(false); break; case ATTN : sessionVT.sendAttentionKey(); simulated = true; break; case DUP_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.isCurrentFieldDupEnabled()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().setFieldChar(lastPos,(char)0x1C); screenFields.setCurrentFieldMDT(); gotoFieldNext(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_DUP_KEY_NOT_ALLOWED); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case NEW_LINE : if (screenFields.getSize() > 0) { int startRow = getRow(lastPos) + 1; int startPos = lastPos; boolean isthere = false; setCursorOff(); if (startRow == getRows()) startRow = 0; goto_XY(++startRow,1); if (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { while (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { // lets keep going advancePos(); // Have we looped the screen? if (lastPos == startPos) { // if so then go back to starting point goto_XY(startPos); break; } } } setCursorOn(); } simulated = true; break; case JUMP_NEXT_SESS : gui.nextSession(); simulated = true; break; case JUMP_PREV_SESS : gui.prevSession(); simulated = true; break; default : System.out.println(" Mnemonic not supported " + mnem); break; } return simulated; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
setCursorOn();
protected boolean simulateMnemonic(int mnem){ boolean simulated = false; switch (mnem) { case AID_CLEAR : case AID_ENTER : case AID_PF1 : case AID_PF2 : case AID_PF3 : case AID_PF4 : case AID_PF5 : case AID_PF6 : case AID_PF7 : case AID_PF8 : case AID_PF9 : case AID_PF10 : case AID_PF11 : case AID_PF12 : case AID_PF13 : case AID_PF14 : case AID_PF15 : case AID_PF16 : case AID_PF17 : case AID_PF18 : case AID_PF19 : case AID_PF20 : case AID_PF21 : case AID_PF22 : case AID_PF23 : case AID_PF24 : case AID_ROLL_DOWN : case AID_ROLL_UP : case AID_ROLL_LEFT : case AID_ROLL_RIGHT : sendAid(mnem); simulated = true; break; case AID_HELP : sessionVT.sendHelpRequest(); simulated = true; break; case AID_PRINT : sessionVT.hostPrint(1); simulated = true; break; case BACK_SPACE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.getCurrentField().startPos() == lastPos) displayError(ERR_CURSOR_PROTECTED); else { setCursorOff(); screenFields.getCurrentField().getKeyPos(lastPos); screenFields.getCurrentField().changePos(-1); resetDirty(screenFields.getCurrentField().getCurrentPos()); shiftLeft(screenFields.getCurrentField().getCurrentPos()); updateDirty(); setCursorOn(); screenFields.setCurrentFieldMDT(); simulated = true; } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BACK_TAB : if (screenFields.getCurrentField() != null && screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldPrev(); updateDirty(); } else gotoFieldPrev(); if (screenFields.isCurrentFieldContinued()) { do { gotoFieldPrev(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } isInField(lastPos); simulated = true; break; case UP : case MARK_UP : process_XY(lastPos - numCols); simulated = true; break; case DOWN : case MARK_DOWN : process_XY(lastPos + numCols); simulated = true; break; case LEFT : case MARK_LEFT : process_XY(lastPos - 1); simulated = true; break; case RIGHT : case MARK_RIGHT : process_XY(lastPos + 1); simulated = true; break; case NEXTWORD : gotoNextWord(); simulated = true; break; case PREVWORD : gotoPrevWord(); simulated = true; break; case DELETE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().getKeyPos(lastPos); shiftLeft(screenFields.getCurrentFieldPos()); screenFields.setCurrentFieldMDT(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case TAB : if (screenFields.getCurrentField() != null && !screenFields.isCurrentFieldContinued()) { if (screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldNext(); updateDirty(); } else gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.getCurrentField() != null && (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast())); } isInField(lastPos); simulated = true; break; case EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = endOfField(screenFields.getCurrentField().startPos(),true); if (where > 0) { goto_XY((where / numCols) + 1,(where % numCols) + 1); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case ERASE_EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case ERASE_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; lastPos = screenFields.getCurrentField().startPos(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case INSERT : setCursorOff(); // we toggle it insertMode = insertMode ? false : true; setCursorOn(); break; case HOME : // position to the home position set if (lastPos + numCols + 1 != homePos) { goto_XY(homePos - numCols - 1); // now check if we are in a field isInField(lastPos); } else gotoField(1); break; case KEYPAD_0 : simulated = simulateKeyStroke('0'); break; case KEYPAD_1 : simulated = simulateKeyStroke('1'); break; case KEYPAD_2 : simulated = simulateKeyStroke('2'); break; case KEYPAD_3 : simulated = simulateKeyStroke('3'); break; case KEYPAD_4 : simulated = simulateKeyStroke('4'); break; case KEYPAD_5 : simulated = simulateKeyStroke('5'); break; case KEYPAD_6 : simulated = simulateKeyStroke('6'); break; case KEYPAD_7 : simulated = simulateKeyStroke('7'); break; case KEYPAD_8 : simulated = simulateKeyStroke('8'); break; case KEYPAD_9 : simulated = simulateKeyStroke('9'); break; case KEYPAD_PERIOD : simulated = simulateKeyStroke('.'); break; case KEYPAD_COMMA : simulated = simulateKeyStroke(','); break; case KEYPAD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } simulated = true; updateDirty(); if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_EXIT : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_PLUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { setCursorOff(); screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = screenFields.getCurrentField().startPos(); if (where > 0) { goto_XY(where); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case SYSREQ : sessionVT.systemRequest(); simulated = true; break; case RESET : if (isStatusErrorCode()) { resetError(); isInField(lastPos); updateDirty(); setCursorOn(); } else { setPrehelpState(false,isKeyboardLocked(),false); } simulated = true; break; case COPY : copyMe(); break; case PASTE : pasteMe(false); break; case ATTN : sessionVT.sendAttentionKey(); simulated = true; break; case DUP_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.isCurrentFieldDupEnabled()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().setFieldChar(lastPos,(char)0x1C); screenFields.setCurrentFieldMDT(); gotoFieldNext(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_DUP_KEY_NOT_ALLOWED); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case NEW_LINE : if (screenFields.getSize() > 0) { int startRow = getRow(lastPos) + 1; int startPos = lastPos; boolean isthere = false; setCursorOff(); if (startRow == getRows()) startRow = 0; goto_XY(++startRow,1); if (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { while (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { // lets keep going advancePos(); // Have we looped the screen? if (lastPos == startPos) { // if so then go back to starting point goto_XY(startPos); break; } } } setCursorOn(); } simulated = true; break; case JUMP_NEXT_SESS : gui.nextSession(); simulated = true; break; case JUMP_PREV_SESS : gui.prevSession(); simulated = true; break; default : System.out.println(" Mnemonic not supported " + mnem); break; } return simulated; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
if (updateCursorLoc) { cursorActive = cursorActive ? false:true;
if (cursorActive) {
private void updateCursorLoc() { if (updateCursorLoc) { cursorActive = cursorActive ? false:true; int row = getRow(lastPos); int col = getCol(lastPos); bi.drawCursor(this,row,col, fmWidth,fmHeight, insertMode, crossHair, cursorSize,colorCursor, colorBg,colorWhite, font); cursorActive = false; } }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
font);
font,cursorBottOffset);
private void updateCursorLoc() { if (updateCursorLoc) { cursorActive = cursorActive ? false:true; int row = getRow(lastPos); int col = getCol(lastPos); bi.drawCursor(this,row,col, fmWidth,fmHeight, insertMode, crossHair, cursorSize,colorCursor, colorBg,colorWhite, font); cursorActive = false; } }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
cursorActive = false;
private void updateCursorLoc() { if (updateCursorLoc) { cursorActive = cursorActive ? false:true; int row = getRow(lastPos); int col = getCol(lastPos); bi.drawCursor(this,row,col, fmWidth,fmHeight, insertMode, crossHair, cursorSize,colorCursor, colorBg,colorWhite, font); cursorActive = false; } }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
protected synchronized void updateImage(int x, int y , int width, int height) { if (gg2d == null) { gg2d = (Graphics2D)gui.getGraphics();// System.out.println("was null"); } if (bi == null || gg2d == null) return; g2d.setClip(x,y,width,height); if (!cursorActive && x + width <= bi.getWidth(null) && y + height <= (bi.getHeight(null) - fmWidth)) { paintComponent2(g2d); } // fix for jdk1.4 - found this while testing under jdk1.4 // if the height and or the width are equal to zero we skip the // the updating of the image. if (gui.isVisible() && height > 0 && width > 0) { bi.drawImageBuffer(gg2d,x,y,width,height);// gg2d.drawImage(bi.getImageBuffer().getSubimage(x,y,width,height),null,x,y); } }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/be319bbdd8024ad2c91541f2e005828a779a5afe/Screen5250.java/buggy/tn5250j/src/org/tn5250j/Screen5250.java
resized = true;
public BufferedImage getImageBuffer(int width, int height) { synchronized (lock) { if (bi == null || bi.getWidth() != width || bi.getHeight() != height) { // allocate a buffer Image with appropriate size bi = new BufferedImage(width,height,BufferedImage.TYPE_INT_RGB); this.width = width; this.height = height; } // tell waiting threads to wake up lock.notifyAll(); } return bi; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/30f98b37d145e16ed4c5e314b8cf6d272bab1023/GuiGraphicBuffer.java/buggy/tn5250j/src/org/tn5250j/GuiGraphicBuffer.java
protected void getBoundingArea(Rectangle r) {
protected Rectangle getBoundingArea() {
protected void getBoundingArea(Rectangle r) { if((getEndPoint().x > getStartPoint().x) && (getEndPoint().y > getStartPoint().y)) { r.setBounds(getStartPoint().x,getStartPoint().y,getEndPoint().x-getStartPoint().x,getEndPoint().y-getStartPoint().y); } else if((getEndPoint().x < getStartPoint().x) && (getEndPoint().y < getStartPoint().y)) { r.setBounds(getEndPoint().x,getEndPoint().y,getStartPoint().x-getEndPoint().x,getStartPoint().y-getEndPoint().y); } else if((getEndPoint().x > getStartPoint().x) && (getEndPoint().y < getStartPoint().y)) { r.setBounds(getStartPoint().x,getEndPoint().y,getEndPoint().x-getStartPoint().x,getStartPoint().y-getEndPoint().y); } else if((getEndPoint().x < getStartPoint().x) && (getEndPoint().y > getStartPoint().y)) { r.setBounds(getEndPoint().x,getStartPoint().y,getStartPoint().x-getEndPoint().x,getEndPoint().y-getStartPoint().y); }// return r; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/0686de448db01a9cc1b09cae982858a4d418dae8/Gui5250.java/buggy/tn5250j/src/org/tn5250j/Gui5250.java
if((getEndPoint().x > getStartPoint().x) && (getEndPoint().y > getStartPoint().y)) { r.setBounds(getStartPoint().x,getStartPoint().y,getEndPoint().x-getStartPoint().x,getEndPoint().y-getStartPoint().y); } else if((getEndPoint().x < getStartPoint().x) && (getEndPoint().y < getStartPoint().y)) { r.setBounds(getEndPoint().x,getEndPoint().y,getStartPoint().x-getEndPoint().x,getStartPoint().y-getEndPoint().y); } else if((getEndPoint().x > getStartPoint().x) && (getEndPoint().y < getStartPoint().y)) { r.setBounds(getStartPoint().x,getEndPoint().y,getEndPoint().x-getStartPoint().x,getStartPoint().y-getEndPoint().y); } else if((getEndPoint().x < getStartPoint().x) && (getEndPoint().y > getStartPoint().y)) { r.setBounds(getEndPoint().x,getStartPoint().y,getStartPoint().x-getEndPoint().x,getEndPoint().y-getStartPoint().y); }
Rectangle r = new Rectangle(); getBoundingArea(r); return r;
protected void getBoundingArea(Rectangle r) { if((getEndPoint().x > getStartPoint().x) && (getEndPoint().y > getStartPoint().y)) { r.setBounds(getStartPoint().x,getStartPoint().y,getEndPoint().x-getStartPoint().x,getEndPoint().y-getStartPoint().y); } else if((getEndPoint().x < getStartPoint().x) && (getEndPoint().y < getStartPoint().y)) { r.setBounds(getEndPoint().x,getEndPoint().y,getStartPoint().x-getEndPoint().x,getStartPoint().y-getEndPoint().y); } else if((getEndPoint().x > getStartPoint().x) && (getEndPoint().y < getStartPoint().y)) { r.setBounds(getStartPoint().x,getEndPoint().y,getEndPoint().x-getStartPoint().x,getStartPoint().y-getEndPoint().y); } else if((getEndPoint().x < getStartPoint().x) && (getEndPoint().y > getStartPoint().y)) { r.setBounds(getEndPoint().x,getStartPoint().y,getStartPoint().x-getEndPoint().x,getEndPoint().y-getStartPoint().y); }// return r; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/0686de448db01a9cc1b09cae982858a4d418dae8/Gui5250.java/buggy/tn5250j/src/org/tn5250j/Gui5250.java
public int getKeyPos(int pos) {
public int getKeyPos(int row1, int col1) {
public int getKeyPos(int pos) { int y = pos - startPos(); cursorPos = pos; return y; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/a61dbdd53c996e8a76dc4165e5010c2379355b80/ScreenField.java/buggy/tn5250j/src/org/tn5250j/ScreenField.java
int y = pos - startPos(); cursorPos = pos;
int x = ((row1 * s.getCols()) + col1); int y = x - startPos(); cursorPos = x;
public int getKeyPos(int pos) { int y = pos - startPos(); cursorPos = pos; return y; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/a61dbdd53c996e8a76dc4165e5010c2379355b80/ScreenField.java/buggy/tn5250j/src/org/tn5250j/ScreenField.java
public boolean isInField(int pos, boolean chgToField) { ScreenField sf; for (int x = 0;x < sizeFields; x++) { sf = screenFields[x]; if (sf.withinField(pos)) { if (chgToField) { currentField = sf; } return true; } } return false;
public boolean isInField(int pos) { return isInField(pos,true);
public boolean isInField(int pos, boolean chgToField) { ScreenField sf; for (int x = 0;x < sizeFields; x++) { sf = screenFields[x]; if (sf.withinField(pos)) { if (chgToField) { currentField = sf; } return true; } } return false; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/1a742d0be10805d0a2d3a610bd78c953d227d26f/ScreenFields.java/buggy/tn5250j/src/org/tn5250j/ScreenFields.java
public synchronized void drawImageBuffer(Graphics2D gg2d) {
public synchronized void drawImageBuffer(Graphics2D gg2d,int x, int y, int width, int height) {
public synchronized void drawImageBuffer(Graphics2D gg2d) { /** * @todo this is a hack and should be fixed at the root of the problem */ if (gg2d == null) { System.out.println(" we got a null graphic object "); return; } synchronized (lock) { gg2d.drawImage(bi,null,0,0); // tell waiting threads to wake up lock.notifyAll(); } }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/30f98b37d145e16ed4c5e314b8cf6d272bab1023/GuiGraphicBuffer.java/buggy/tn5250j/src/org/tn5250j/GuiGraphicBuffer.java
gg2d.drawImage(bi,null,0,0);
gg2d.drawImage(bi.getSubimage(x,y,width,height),null,x + offLeft,y+ offTop);
public synchronized void drawImageBuffer(Graphics2D gg2d) { /** * @todo this is a hack and should be fixed at the root of the problem */ if (gg2d == null) { System.out.println(" we got a null graphic object "); return; } synchronized (lock) { gg2d.drawImage(bi,null,0,0); // tell waiting threads to wake up lock.notifyAll(); } }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/30f98b37d145e16ed4c5e314b8cf6d272bab1023/GuiGraphicBuffer.java/buggy/tn5250j/src/org/tn5250j/GuiGraphicBuffer.java
public synchronized void drawImageBuffer(Graphics2D gg2d) { /** * @todo this is a hack and should be fixed at the root of the problem */ if (gg2d == null) { System.out.println(" we got a null graphic object "); return; } synchronized (lock) { gg2d.drawImage(bi,null,0,0); // tell waiting threads to wake up lock.notifyAll(); } }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/30f98b37d145e16ed4c5e314b8cf6d272bab1023/GuiGraphicBuffer.java/buggy/tn5250j/src/org/tn5250j/GuiGraphicBuffer.java
resized = true;
public void resize(int width, int height) { if (bi.getWidth() != width || bi.getHeight() != height) { synchronized (lock) { bi = null; bi = new BufferedImage(width,height,BufferedImage.TYPE_INT_RGB); this.width = width; this.height = height; // tell waiting threads to wake up lock.notifyAll(); } } }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/30f98b37d145e16ed4c5e314b8cf6d272bab1023/GuiGraphicBuffer.java/buggy/tn5250j/src/org/tn5250j/GuiGraphicBuffer.java
log.debug("set "+ keyStrokes);
public void setKeyStrokes (String strokes) { if (strokes != null) { keyStrokes.setLength(0);// System.out.println("set "+ keyStrokes); length = strokes.length(); } else { keyStrokes = new StringBuffer(); length = 0; } keyStrokes.append(strokes); index = 0; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/379255347f37d0432228baaff23d41ccb4ad68bd/KeyStrokenizer.java/buggy/tn5250j/src/org/tn5250j/KeyStrokenizer.java
System.out.println(" mnemonic key was incomplete :1 " +
log.warn(" mnemonic key was incomplete :1 " +
public String nextKeyStroke() { String s = ""; boolean gotOne = false; int start = index; if(length > index) { sb.setLength(0); char c = keyStrokes.charAt(index); switch(c) { case '[': sb.append(c); index++; // we need to throw an error here if(index >= length) { System.out.println(" mnemonic key was incomplete :1 " + "at position " + index + " len " + length ); } else { c = keyStrokes.charAt(index); if(c == '[') index++; else { while(!gotOne) { if(c == ']') { // did we find an ending sb.append(c); index++; gotOne = true; } else { sb.append(c); index++; // we need to throw an error here because we did not // find an ending for the potential mnemonic if(index >= length) { System.out.println( " mnemonic key was incomplete ending not found :2 " + "at position " + index); } c = keyStrokes.charAt(index); } } } } break; case ']': index++; if(index >= length) { System.out.println( " mnemonic key was incomplete ending not found :3 " + "at position " + index); sb.append(c); index++; } else { c = keyStrokes.charAt(index); if(c == ']') { sb.append(c); index++; } else { System.out.println( " mnemonic key was incomplete beginning not found :4 " + "at position " + index); } } break; default: sb.append(c); index++; break; } if(sb != null) { s = new String(sb); } }// System.out.println("next "+ keyStrokes); return s; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/379255347f37d0432228baaff23d41ccb4ad68bd/KeyStrokenizer.java/buggy/tn5250j/src/org/tn5250j/KeyStrokenizer.java
System.out.println(
log.warn(
public String nextKeyStroke() { String s = ""; boolean gotOne = false; int start = index; if(length > index) { sb.setLength(0); char c = keyStrokes.charAt(index); switch(c) { case '[': sb.append(c); index++; // we need to throw an error here if(index >= length) { System.out.println(" mnemonic key was incomplete :1 " + "at position " + index + " len " + length ); } else { c = keyStrokes.charAt(index); if(c == '[') index++; else { while(!gotOne) { if(c == ']') { // did we find an ending sb.append(c); index++; gotOne = true; } else { sb.append(c); index++; // we need to throw an error here because we did not // find an ending for the potential mnemonic if(index >= length) { System.out.println( " mnemonic key was incomplete ending not found :2 " + "at position " + index); } c = keyStrokes.charAt(index); } } } } break; case ']': index++; if(index >= length) { System.out.println( " mnemonic key was incomplete ending not found :3 " + "at position " + index); sb.append(c); index++; } else { c = keyStrokes.charAt(index); if(c == ']') { sb.append(c); index++; } else { System.out.println( " mnemonic key was incomplete beginning not found :4 " + "at position " + index); } } break; default: sb.append(c); index++; break; } if(sb != null) { s = new String(sb); } }// System.out.println("next "+ keyStrokes); return s; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/379255347f37d0432228baaff23d41ccb4ad68bd/KeyStrokenizer.java/buggy/tn5250j/src/org/tn5250j/KeyStrokenizer.java
System.out.println(
log.warn(
public String nextKeyStroke() { String s = ""; boolean gotOne = false; int start = index; if(length > index) { sb.setLength(0); char c = keyStrokes.charAt(index); switch(c) { case '[': sb.append(c); index++; // we need to throw an error here if(index >= length) { System.out.println(" mnemonic key was incomplete :1 " + "at position " + index + " len " + length ); } else { c = keyStrokes.charAt(index); if(c == '[') index++; else { while(!gotOne) { if(c == ']') { // did we find an ending sb.append(c); index++; gotOne = true; } else { sb.append(c); index++; // we need to throw an error here because we did not // find an ending for the potential mnemonic if(index >= length) { System.out.println( " mnemonic key was incomplete ending not found :2 " + "at position " + index); } c = keyStrokes.charAt(index); } } } } break; case ']': index++; if(index >= length) { System.out.println( " mnemonic key was incomplete ending not found :3 " + "at position " + index); sb.append(c); index++; } else { c = keyStrokes.charAt(index); if(c == ']') { sb.append(c); index++; } else { System.out.println( " mnemonic key was incomplete beginning not found :4 " + "at position " + index); } } break; default: sb.append(c); index++; break; } if(sb != null) { s = new String(sb); } }// System.out.println("next "+ keyStrokes); return s; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/379255347f37d0432228baaff23d41ccb4ad68bd/KeyStrokenizer.java/buggy/tn5250j/src/org/tn5250j/KeyStrokenizer.java
System.out.println(
log.warn(
public String nextKeyStroke() { String s = ""; boolean gotOne = false; int start = index; if(length > index) { sb.setLength(0); char c = keyStrokes.charAt(index); switch(c) { case '[': sb.append(c); index++; // we need to throw an error here if(index >= length) { System.out.println(" mnemonic key was incomplete :1 " + "at position " + index + " len " + length ); } else { c = keyStrokes.charAt(index); if(c == '[') index++; else { while(!gotOne) { if(c == ']') { // did we find an ending sb.append(c); index++; gotOne = true; } else { sb.append(c); index++; // we need to throw an error here because we did not // find an ending for the potential mnemonic if(index >= length) { System.out.println( " mnemonic key was incomplete ending not found :2 " + "at position " + index); } c = keyStrokes.charAt(index); } } } } break; case ']': index++; if(index >= length) { System.out.println( " mnemonic key was incomplete ending not found :3 " + "at position " + index); sb.append(c); index++; } else { c = keyStrokes.charAt(index); if(c == ']') { sb.append(c); index++; } else { System.out.println( " mnemonic key was incomplete beginning not found :4 " + "at position " + index); } } break; default: sb.append(c); index++; break; } if(sb != null) { s = new String(sb); } }// System.out.println("next "+ keyStrokes); return s; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/379255347f37d0432228baaff23d41ccb4ad68bd/KeyStrokenizer.java/buggy/tn5250j/src/org/tn5250j/KeyStrokenizer.java
log.debug("next "+ keyStrokes);
public String nextKeyStroke() { String s = ""; boolean gotOne = false; int start = index; if(length > index) { sb.setLength(0); char c = keyStrokes.charAt(index); switch(c) { case '[': sb.append(c); index++; // we need to throw an error here if(index >= length) { System.out.println(" mnemonic key was incomplete :1 " + "at position " + index + " len " + length ); } else { c = keyStrokes.charAt(index); if(c == '[') index++; else { while(!gotOne) { if(c == ']') { // did we find an ending sb.append(c); index++; gotOne = true; } else { sb.append(c); index++; // we need to throw an error here because we did not // find an ending for the potential mnemonic if(index >= length) { System.out.println( " mnemonic key was incomplete ending not found :2 " + "at position " + index); } c = keyStrokes.charAt(index); } } } } break; case ']': index++; if(index >= length) { System.out.println( " mnemonic key was incomplete ending not found :3 " + "at position " + index); sb.append(c); index++; } else { c = keyStrokes.charAt(index); if(c == ']') { sb.append(c); index++; } else { System.out.println( " mnemonic key was incomplete beginning not found :4 " + "at position " + index); } } break; default: sb.append(c); index++; break; } if(sb != null) { s = new String(sb); } }// System.out.println("next "+ keyStrokes); return s; }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/379255347f37d0432228baaff23d41ccb4ad68bd/KeyStrokenizer.java/buggy/tn5250j/src/org/tn5250j/KeyStrokenizer.java
public synchronized StringBuffer insert(int offset, char ch)
public synchronized StringBuffer insert(int offset, char[] str, int str_offset, int len)
public synchronized StringBuffer insert(int offset, char ch) { if (offset < 0 || offset > count) throw new StringIndexOutOfBoundsException(offset); ensureCapacity_unsynchronized(count + 1); VMSystem.arraycopy(value, offset, value, offset + 1, count - offset); value[offset] = ch; count++; return this; }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/68a6301301378680519f2b146daec37812a1bc22/StringBuffer.java/buggy/core/src/classpath/java/java/lang/StringBuffer.java
if (offset < 0 || offset > count) throw new StringIndexOutOfBoundsException(offset); ensureCapacity_unsynchronized(count + 1); VMSystem.arraycopy(value, offset, value, offset + 1, count - offset); value[offset] = ch; count++;
if (offset < 0 || offset > count || len < 0 || str_offset < 0 || str_offset > str.length - len) throw new StringIndexOutOfBoundsException(); ensureCapacity_unsynchronized(count + len); VMSystem.arraycopy(value, offset, value, offset + len, count - offset); VMSystem.arraycopy(str, str_offset, value, offset, len); count += len;
public synchronized StringBuffer insert(int offset, char ch) { if (offset < 0 || offset > count) throw new StringIndexOutOfBoundsException(offset); ensureCapacity_unsynchronized(count + 1); VMSystem.arraycopy(value, offset, value, offset + 1, count - offset); value[offset] = ch; count++; return this; }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/68a6301301378680519f2b146daec37812a1bc22/StringBuffer.java/buggy/core/src/classpath/java/java/lang/StringBuffer.java
public int getHeight(ImageObserver io) {
public int getHeight() {
public int getHeight(ImageObserver io) { synchronized (lock) { // tell waiting threads to wake up lock.notifyAll(); return bi.getHeight(io); } }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/30f98b37d145e16ed4c5e314b8cf6d272bab1023/GuiGraphicBuffer.java/buggy/tn5250j/src/org/tn5250j/GuiGraphicBuffer.java
return bi.getHeight(io);
return bi.getHeight();
public int getHeight(ImageObserver io) { synchronized (lock) { // tell waiting threads to wake up lock.notifyAll(); return bi.getHeight(io); } }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/30f98b37d145e16ed4c5e314b8cf6d272bab1023/GuiGraphicBuffer.java/buggy/tn5250j/src/org/tn5250j/GuiGraphicBuffer.java
throw new InvalidMidiDataException ("Invalid status: 0x" + Integer.toHexString(originalStatus));
throw new InvalidMidiDataException("Invalid status: 0x" + Integer.toHexString(originalStatus));
protected final int getDataLength(int status) throws InvalidMidiDataException { int originalStatus = status; if ((status & 0xF0) != 0xF0) status &= 0xF0; switch (status) { case NOTE_OFF: case NOTE_ON: case POLY_PRESSURE: case CONTROL_CHANGE: case PITCH_BEND: case SONG_POSITION_POINTER: return 2; case PROGRAM_CHANGE: case CHANNEL_PRESSURE: case SONG_SELECT: case 0xF5: // FIXME: unofficial bus select. Not in spec?? return 1; case SYSTEM_EXCLUSIVE: return 0; // FIXME: is this correct? case TUNE_REQUEST: case END_OF_EXCLUSIVE: case TIMING_CLOCK: case START: case CONTINUE: case STOP: case ACTIVE_SENSING: case SYSTEM_RESET: return 0; default: throw new InvalidMidiDataException ("Invalid status: 0x" + Integer.toHexString(originalStatus)); } }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/5edad632205aa44aca51004923ae52d754cced11/ShortMessage.java/buggy/core/src/classpath/javax/javax/sound/midi/ShortMessage.java
public TTFFileInput(RandomAccessFile file) throws IOException { this(file, 0, file.length());
public TTFFileInput(RandomAccessFile file, long offset, long length) throws IOException { this.ttf = file; this.offset = offset; this.length = length;
public TTFFileInput(RandomAccessFile file) throws IOException { this(file, 0, file.length()); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/51e4aed2205f326c2698e2154ea7f83ae5dfc2b6/TTFFileInput.java/clean/gui/src/awt/org/jnode/awt/font/truetype/TTFFileInput.java
public GrubBootSector(byte[] src) { super(src);
public GrubBootSector(int size) { super(size);
public GrubBootSector(byte[] src) { super(src); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/51e4aed2205f326c2698e2154ea7f83ae5dfc2b6/GrubBootSector.java/clean/fs/src/fs/org/jnode/fs/fat/GrubBootSector.java
if (insideTimer != null) insideTimer.start();
public void actionPerformed(ActionEvent event) { showTip(); if (insideTimer != null) insideTimer.start(); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/3826e72d9ebe31a854c4d01d6c8f1ec65a8d80fe/ToolTipManager.java/buggy/core/src/classpath/javax/javax/swing/ToolTipManager.java
parent.invalidate(); parent.validate(); parent.repaint();
void hideTip() { if (currentTip == null || ! currentTip.isVisible() || ! enabled) return; currentTip.setVisible(false); if (containerPanel != null) { Container parent = containerPanel.getParent(); if (parent == null) return; parent.remove(containerPanel); parent.invalidate(); parent.validate(); parent.repaint(); parent = currentTip.getParent(); if (parent == null) return; parent.remove(currentTip); containerPanel = null; } if (tooltipWindow != null) { tooltipWindow.hide(); tooltipWindow.dispose(); tooltipWindow = null; } }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/3826e72d9ebe31a854c4d01d6c8f1ec65a8d80fe/ToolTipManager.java/buggy/core/src/classpath/javax/javax/swing/ToolTipManager.java
showTip();
public void mouseEntered(MouseEvent event) { if (currentComponent != null && getContentPaneDeepestComponent(event) == currentComponent) return; currentPoint = event.getPoint(); currentComponent = (Component) event.getSource(); if (exitTimer.isRunning()) { exitTimer.stop(); showTip(); insideTimer.start(); return; } // This should always be stopped unless we have just fake-exited. if (! enterTimer.isRunning()) enterTimer.start(); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/3826e72d9ebe31a854c4d01d6c8f1ec65a8d80fe/ToolTipManager.java/buggy/core/src/classpath/javax/javax/swing/ToolTipManager.java
if (currentTip != null) { if (currentComponent == null) currentComponent = (Component) event.getSource(); String text = ((JComponent) currentComponent).getToolTipText(event); currentTip.setTipText(text); }
public void mouseMoved(MouseEvent event) { currentPoint = event.getPoint(); if (currentTip != null) { if (currentComponent == null) currentComponent = (Component) event.getSource(); String text = ((JComponent) currentComponent).getToolTipText(event); currentTip.setTipText(text); } if (enterTimer.isRunning()) enterTimer.restart(); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/3826e72d9ebe31a854c4d01d6c8f1ec65a8d80fe/ToolTipManager.java/buggy/core/src/classpath/javax/javax/swing/ToolTipManager.java
enterTimer.restart();
enterTimer.restart();
public void mouseMoved(MouseEvent event) { currentPoint = event.getPoint(); if (currentTip != null) { if (currentComponent == null) currentComponent = (Component) event.getSource(); String text = ((JComponent) currentComponent).getToolTipText(event); currentTip.setTipText(text); } if (enterTimer.isRunning()) enterTimer.restart(); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/3826e72d9ebe31a854c4d01d6c8f1ec65a8d80fe/ToolTipManager.java/buggy/core/src/classpath/javax/javax/swing/ToolTipManager.java
if (currentComponent == null) currentComponent = (Component) event.getSource(); currentComponent.invalidate(); currentComponent.validate(); currentComponent.repaint();
public void mousePressed(MouseEvent event) { currentPoint = event.getPoint(); if (enterTimer.isRunning()) enterTimer.restart(); else if (insideTimer.isRunning()) { insideTimer.stop(); hideTip(); } if (currentComponent == null) currentComponent = (Component) event.getSource(); currentComponent.invalidate(); currentComponent.validate(); currentComponent.repaint(); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/3826e72d9ebe31a854c4d01d6c8f1ec65a8d80fe/ToolTipManager.java/buggy/core/src/classpath/javax/javax/swing/ToolTipManager.java
if (! enabled || currentComponent == null)
if (!enabled || currentComponent == null || !currentComponent.isEnabled() || (currentTip != null && currentTip.isVisible()))
void showTip() { if (! enabled || currentComponent == null) return; if (currentTip == null || currentTip.getComponent() != currentComponent && currentComponent instanceof JComponent) currentTip = ((JComponent) currentComponent).createToolTip(); Point p = currentPoint; Dimension dims = currentTip.getPreferredSize(); if (canToolTipFit(currentTip)) { JLayeredPane pane = ((JRootPane) SwingUtilities.getAncestorOfClass(JRootPane.class, currentComponent)) .getLayeredPane(); // This should never happen, but just in case. if (pane == null) return; if (containerPanel != null) hideTip(); if (isLightWeightPopupEnabled()) { containerPanel = new Panel(); JRootPane root = new JRootPane(); root.getContentPane().add(currentTip); containerPanel.add(root); } else { containerPanel = new JPanel(); containerPanel.add(currentTip); } LayoutManager lm = containerPanel.getLayout(); if (lm instanceof FlowLayout) { FlowLayout fm = (FlowLayout) lm; fm.setVgap(0); fm.setHgap(0); } p = getGoodPoint(p, pane, currentTip, dims); pane.add(containerPanel); containerPanel.setBounds(p.x, p.y, dims.width, dims.height); currentTip.setBounds(0, 0, dims.width, dims.height); pane.revalidate(); pane.repaint(); } else { SwingUtilities.convertPointToScreen(p, currentComponent); tooltipWindow = new JWindow(); tooltipWindow.getContentPane().add(currentTip); tooltipWindow.setFocusable(false); tooltipWindow.pack(); tooltipWindow.setBounds(p.x, p.y, dims.width, dims.height); tooltipWindow.show(); } currentTip.setVisible(true); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/3826e72d9ebe31a854c4d01d6c8f1ec65a8d80fe/ToolTipManager.java/buggy/core/src/classpath/javax/javax/swing/ToolTipManager.java
if (currentTip == null || currentTip.getComponent() != currentComponent
if (currentTip == null || currentTip.getComponent() != currentComponent
void showTip() { if (! enabled || currentComponent == null) return; if (currentTip == null || currentTip.getComponent() != currentComponent && currentComponent instanceof JComponent) currentTip = ((JComponent) currentComponent).createToolTip(); Point p = currentPoint; Dimension dims = currentTip.getPreferredSize(); if (canToolTipFit(currentTip)) { JLayeredPane pane = ((JRootPane) SwingUtilities.getAncestorOfClass(JRootPane.class, currentComponent)) .getLayeredPane(); // This should never happen, but just in case. if (pane == null) return; if (containerPanel != null) hideTip(); if (isLightWeightPopupEnabled()) { containerPanel = new Panel(); JRootPane root = new JRootPane(); root.getContentPane().add(currentTip); containerPanel.add(root); } else { containerPanel = new JPanel(); containerPanel.add(currentTip); } LayoutManager lm = containerPanel.getLayout(); if (lm instanceof FlowLayout) { FlowLayout fm = (FlowLayout) lm; fm.setVgap(0); fm.setHgap(0); } p = getGoodPoint(p, pane, currentTip, dims); pane.add(containerPanel); containerPanel.setBounds(p.x, p.y, dims.width, dims.height); currentTip.setBounds(0, 0, dims.width, dims.height); pane.revalidate(); pane.repaint(); } else { SwingUtilities.convertPointToScreen(p, currentComponent); tooltipWindow = new JWindow(); tooltipWindow.getContentPane().add(currentTip); tooltipWindow.setFocusable(false); tooltipWindow.pack(); tooltipWindow.setBounds(p.x, p.y, dims.width, dims.height); tooltipWindow.show(); } currentTip.setVisible(true); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/3826e72d9ebe31a854c4d01d6c8f1ec65a8d80fe/ToolTipManager.java/buggy/core/src/classpath/javax/javax/swing/ToolTipManager.java
if (canToolTipFit(currentTip))
if (parent instanceof JPopupMenu) setLightWeightPopupEnabled(((JPopupMenu) parent).isLightWeightPopupEnabled()); else setLightWeightPopupEnabled(true); if (isLightWeightPopupEnabled())
void showTip() { if (! enabled || currentComponent == null) return; if (currentTip == null || currentTip.getComponent() != currentComponent && currentComponent instanceof JComponent) currentTip = ((JComponent) currentComponent).createToolTip(); Point p = currentPoint; Dimension dims = currentTip.getPreferredSize(); if (canToolTipFit(currentTip)) { JLayeredPane pane = ((JRootPane) SwingUtilities.getAncestorOfClass(JRootPane.class, currentComponent)) .getLayeredPane(); // This should never happen, but just in case. if (pane == null) return; if (containerPanel != null) hideTip(); if (isLightWeightPopupEnabled()) { containerPanel = new Panel(); JRootPane root = new JRootPane(); root.getContentPane().add(currentTip); containerPanel.add(root); } else { containerPanel = new JPanel(); containerPanel.add(currentTip); } LayoutManager lm = containerPanel.getLayout(); if (lm instanceof FlowLayout) { FlowLayout fm = (FlowLayout) lm; fm.setVgap(0); fm.setHgap(0); } p = getGoodPoint(p, pane, currentTip, dims); pane.add(containerPanel); containerPanel.setBounds(p.x, p.y, dims.width, dims.height); currentTip.setBounds(0, 0, dims.width, dims.height); pane.revalidate(); pane.repaint(); } else { SwingUtilities.convertPointToScreen(p, currentComponent); tooltipWindow = new JWindow(); tooltipWindow.getContentPane().add(currentTip); tooltipWindow.setFocusable(false); tooltipWindow.pack(); tooltipWindow.setBounds(p.x, p.y, dims.width, dims.height); tooltipWindow.show(); } currentTip.setVisible(true); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/3826e72d9ebe31a854c4d01d6c8f1ec65a8d80fe/ToolTipManager.java/buggy/core/src/classpath/javax/javax/swing/ToolTipManager.java
JLayeredPane pane = ((JRootPane) SwingUtilities.getAncestorOfClass(JRootPane.class, currentComponent)) .getLayeredPane();
JLayeredPane pane = ((JRootPane) SwingUtilities. getAncestorOfClass(JRootPane.class, currentComponent)). getLayeredPane();
void showTip() { if (! enabled || currentComponent == null) return; if (currentTip == null || currentTip.getComponent() != currentComponent && currentComponent instanceof JComponent) currentTip = ((JComponent) currentComponent).createToolTip(); Point p = currentPoint; Dimension dims = currentTip.getPreferredSize(); if (canToolTipFit(currentTip)) { JLayeredPane pane = ((JRootPane) SwingUtilities.getAncestorOfClass(JRootPane.class, currentComponent)) .getLayeredPane(); // This should never happen, but just in case. if (pane == null) return; if (containerPanel != null) hideTip(); if (isLightWeightPopupEnabled()) { containerPanel = new Panel(); JRootPane root = new JRootPane(); root.getContentPane().add(currentTip); containerPanel.add(root); } else { containerPanel = new JPanel(); containerPanel.add(currentTip); } LayoutManager lm = containerPanel.getLayout(); if (lm instanceof FlowLayout) { FlowLayout fm = (FlowLayout) lm; fm.setVgap(0); fm.setHgap(0); } p = getGoodPoint(p, pane, currentTip, dims); pane.add(containerPanel); containerPanel.setBounds(p.x, p.y, dims.width, dims.height); currentTip.setBounds(0, 0, dims.width, dims.height); pane.revalidate(); pane.repaint(); } else { SwingUtilities.convertPointToScreen(p, currentComponent); tooltipWindow = new JWindow(); tooltipWindow.getContentPane().add(currentTip); tooltipWindow.setFocusable(false); tooltipWindow.pack(); tooltipWindow.setBounds(p.x, p.y, dims.width, dims.height); tooltipWindow.show(); } currentTip.setVisible(true); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/3826e72d9ebe31a854c4d01d6c8f1ec65a8d80fe/ToolTipManager.java/buggy/core/src/classpath/javax/javax/swing/ToolTipManager.java
if (pane == null) return;
if (pane == null) return; if (containerPanel != null) hideTip(); containerPanel = new Panel(); JRootPane root = new JRootPane(); root.getContentPane().add(currentTip); containerPanel.add(root);
void showTip() { if (! enabled || currentComponent == null) return; if (currentTip == null || currentTip.getComponent() != currentComponent && currentComponent instanceof JComponent) currentTip = ((JComponent) currentComponent).createToolTip(); Point p = currentPoint; Dimension dims = currentTip.getPreferredSize(); if (canToolTipFit(currentTip)) { JLayeredPane pane = ((JRootPane) SwingUtilities.getAncestorOfClass(JRootPane.class, currentComponent)) .getLayeredPane(); // This should never happen, but just in case. if (pane == null) return; if (containerPanel != null) hideTip(); if (isLightWeightPopupEnabled()) { containerPanel = new Panel(); JRootPane root = new JRootPane(); root.getContentPane().add(currentTip); containerPanel.add(root); } else { containerPanel = new JPanel(); containerPanel.add(currentTip); } LayoutManager lm = containerPanel.getLayout(); if (lm instanceof FlowLayout) { FlowLayout fm = (FlowLayout) lm; fm.setVgap(0); fm.setHgap(0); } p = getGoodPoint(p, pane, currentTip, dims); pane.add(containerPanel); containerPanel.setBounds(p.x, p.y, dims.width, dims.height); currentTip.setBounds(0, 0, dims.width, dims.height); pane.revalidate(); pane.repaint(); } else { SwingUtilities.convertPointToScreen(p, currentComponent); tooltipWindow = new JWindow(); tooltipWindow.getContentPane().add(currentTip); tooltipWindow.setFocusable(false); tooltipWindow.pack(); tooltipWindow.setBounds(p.x, p.y, dims.width, dims.height); tooltipWindow.show(); } currentTip.setVisible(true); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/3826e72d9ebe31a854c4d01d6c8f1ec65a8d80fe/ToolTipManager.java/buggy/core/src/classpath/javax/javax/swing/ToolTipManager.java
if (containerPanel != null) hideTip(); if (isLightWeightPopupEnabled()) { containerPanel = new Panel(); JRootPane root = new JRootPane(); root.getContentPane().add(currentTip); containerPanel.add(root); } else { containerPanel = new JPanel(); containerPanel.add(currentTip); } LayoutManager lm = containerPanel.getLayout(); if (lm instanceof FlowLayout) { FlowLayout fm = (FlowLayout) lm; fm.setVgap(0); fm.setHgap(0); }
LayoutManager lm = containerPanel.getLayout(); if (lm instanceof FlowLayout) { FlowLayout fm = (FlowLayout) lm; fm.setVgap(0); fm.setHgap(0); }
void showTip() { if (! enabled || currentComponent == null) return; if (currentTip == null || currentTip.getComponent() != currentComponent && currentComponent instanceof JComponent) currentTip = ((JComponent) currentComponent).createToolTip(); Point p = currentPoint; Dimension dims = currentTip.getPreferredSize(); if (canToolTipFit(currentTip)) { JLayeredPane pane = ((JRootPane) SwingUtilities.getAncestorOfClass(JRootPane.class, currentComponent)) .getLayeredPane(); // This should never happen, but just in case. if (pane == null) return; if (containerPanel != null) hideTip(); if (isLightWeightPopupEnabled()) { containerPanel = new Panel(); JRootPane root = new JRootPane(); root.getContentPane().add(currentTip); containerPanel.add(root); } else { containerPanel = new JPanel(); containerPanel.add(currentTip); } LayoutManager lm = containerPanel.getLayout(); if (lm instanceof FlowLayout) { FlowLayout fm = (FlowLayout) lm; fm.setVgap(0); fm.setHgap(0); } p = getGoodPoint(p, pane, currentTip, dims); pane.add(containerPanel); containerPanel.setBounds(p.x, p.y, dims.width, dims.height); currentTip.setBounds(0, 0, dims.width, dims.height); pane.revalidate(); pane.repaint(); } else { SwingUtilities.convertPointToScreen(p, currentComponent); tooltipWindow = new JWindow(); tooltipWindow.getContentPane().add(currentTip); tooltipWindow.setFocusable(false); tooltipWindow.pack(); tooltipWindow.setBounds(p.x, p.y, dims.width, dims.height); tooltipWindow.show(); } currentTip.setVisible(true); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/3826e72d9ebe31a854c4d01d6c8f1ec65a8d80fe/ToolTipManager.java/buggy/core/src/classpath/javax/javax/swing/ToolTipManager.java
p = getGoodPoint(p, pane, currentTip, dims); pane.add(containerPanel); containerPanel.setBounds(p.x, p.y, dims.width, dims.height); currentTip.setBounds(0, 0, dims.width, dims.height); pane.revalidate(); pane.repaint();
p = SwingUtilities.convertPoint(currentComponent, p, pane); p = adjustLocation(p, pane, dims); pane.add(containerPanel); containerPanel.setBounds(p.x, p.y, dims.width, dims.height); currentTip.setBounds(0, 0, dims.width, dims.height); containerPanel.validate(); containerPanel.repaint();
void showTip() { if (! enabled || currentComponent == null) return; if (currentTip == null || currentTip.getComponent() != currentComponent && currentComponent instanceof JComponent) currentTip = ((JComponent) currentComponent).createToolTip(); Point p = currentPoint; Dimension dims = currentTip.getPreferredSize(); if (canToolTipFit(currentTip)) { JLayeredPane pane = ((JRootPane) SwingUtilities.getAncestorOfClass(JRootPane.class, currentComponent)) .getLayeredPane(); // This should never happen, but just in case. if (pane == null) return; if (containerPanel != null) hideTip(); if (isLightWeightPopupEnabled()) { containerPanel = new Panel(); JRootPane root = new JRootPane(); root.getContentPane().add(currentTip); containerPanel.add(root); } else { containerPanel = new JPanel(); containerPanel.add(currentTip); } LayoutManager lm = containerPanel.getLayout(); if (lm instanceof FlowLayout) { FlowLayout fm = (FlowLayout) lm; fm.setVgap(0); fm.setHgap(0); } p = getGoodPoint(p, pane, currentTip, dims); pane.add(containerPanel); containerPanel.setBounds(p.x, p.y, dims.width, dims.height); currentTip.setBounds(0, 0, dims.width, dims.height); pane.revalidate(); pane.repaint(); } else { SwingUtilities.convertPointToScreen(p, currentComponent); tooltipWindow = new JWindow(); tooltipWindow.getContentPane().add(currentTip); tooltipWindow.setFocusable(false); tooltipWindow.pack(); tooltipWindow.setBounds(p.x, p.y, dims.width, dims.height); tooltipWindow.show(); } currentTip.setVisible(true); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/3826e72d9ebe31a854c4d01d6c8f1ec65a8d80fe/ToolTipManager.java/buggy/core/src/classpath/javax/javax/swing/ToolTipManager.java
else { SwingUtilities.convertPointToScreen(p, currentComponent); tooltipWindow = new JWindow(); tooltipWindow.getContentPane().add(currentTip); tooltipWindow.setFocusable(false); tooltipWindow.pack(); tooltipWindow.setBounds(p.x, p.y, dims.width, dims.height); tooltipWindow.show();
else if (currentComponent.isShowing()) { SwingUtilities.convertPointToScreen(p, currentComponent); p = adjustLocation(p, SwingUtilities.getWindowAncestor(currentComponent), dims); tooltipWindow = new JDialog(); tooltipWindow.setContentPane(currentTip); tooltipWindow.setUndecorated(true); tooltipWindow.getRootPane(). setWindowDecorationStyle(JRootPane.PLAIN_DIALOG); tooltipWindow.pack(); tooltipWindow.setBounds(p.x, p.y, dims.width, dims.height); tooltipWindow.show(); tooltipWindow.repaint();
void showTip() { if (! enabled || currentComponent == null) return; if (currentTip == null || currentTip.getComponent() != currentComponent && currentComponent instanceof JComponent) currentTip = ((JComponent) currentComponent).createToolTip(); Point p = currentPoint; Dimension dims = currentTip.getPreferredSize(); if (canToolTipFit(currentTip)) { JLayeredPane pane = ((JRootPane) SwingUtilities.getAncestorOfClass(JRootPane.class, currentComponent)) .getLayeredPane(); // This should never happen, but just in case. if (pane == null) return; if (containerPanel != null) hideTip(); if (isLightWeightPopupEnabled()) { containerPanel = new Panel(); JRootPane root = new JRootPane(); root.getContentPane().add(currentTip); containerPanel.add(root); } else { containerPanel = new JPanel(); containerPanel.add(currentTip); } LayoutManager lm = containerPanel.getLayout(); if (lm instanceof FlowLayout) { FlowLayout fm = (FlowLayout) lm; fm.setVgap(0); fm.setHgap(0); } p = getGoodPoint(p, pane, currentTip, dims); pane.add(containerPanel); containerPanel.setBounds(p.x, p.y, dims.width, dims.height); currentTip.setBounds(0, 0, dims.width, dims.height); pane.revalidate(); pane.repaint(); } else { SwingUtilities.convertPointToScreen(p, currentComponent); tooltipWindow = new JWindow(); tooltipWindow.getContentPane().add(currentTip); tooltipWindow.setFocusable(false); tooltipWindow.pack(); tooltipWindow.setBounds(p.x, p.y, dims.width, dims.height); tooltipWindow.show(); } currentTip.setVisible(true); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/3826e72d9ebe31a854c4d01d6c8f1ec65a8d80fe/ToolTipManager.java/buggy/core/src/classpath/javax/javax/swing/ToolTipManager.java
currentTip.repaint();
void showTip() { if (! enabled || currentComponent == null) return; if (currentTip == null || currentTip.getComponent() != currentComponent && currentComponent instanceof JComponent) currentTip = ((JComponent) currentComponent).createToolTip(); Point p = currentPoint; Dimension dims = currentTip.getPreferredSize(); if (canToolTipFit(currentTip)) { JLayeredPane pane = ((JRootPane) SwingUtilities.getAncestorOfClass(JRootPane.class, currentComponent)) .getLayeredPane(); // This should never happen, but just in case. if (pane == null) return; if (containerPanel != null) hideTip(); if (isLightWeightPopupEnabled()) { containerPanel = new Panel(); JRootPane root = new JRootPane(); root.getContentPane().add(currentTip); containerPanel.add(root); } else { containerPanel = new JPanel(); containerPanel.add(currentTip); } LayoutManager lm = containerPanel.getLayout(); if (lm instanceof FlowLayout) { FlowLayout fm = (FlowLayout) lm; fm.setVgap(0); fm.setHgap(0); } p = getGoodPoint(p, pane, currentTip, dims); pane.add(containerPanel); containerPanel.setBounds(p.x, p.y, dims.width, dims.height); currentTip.setBounds(0, 0, dims.width, dims.height); pane.revalidate(); pane.repaint(); } else { SwingUtilities.convertPointToScreen(p, currentComponent); tooltipWindow = new JWindow(); tooltipWindow.getContentPane().add(currentTip); tooltipWindow.setFocusable(false); tooltipWindow.pack(); tooltipWindow.setBounds(p.x, p.y, dims.width, dims.height); tooltipWindow.show(); } currentTip.setVisible(true); }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/3826e72d9ebe31a854c4d01d6c8f1ec65a8d80fe/ToolTipManager.java/buggy/core/src/classpath/javax/javax/swing/ToolTipManager.java
FileInputStream in = new FileInputStream(getConfigurationResource());
FileInputStream in = new FileInputStream(settingsDirectory() + getConfigurationResource());
private void loadConfigurationResource() { sesProps = new Properties(); try { FileInputStream in = new FileInputStream(getConfigurationResource()); sesProps.load(in); if (sesProps.size() == 0) loadDefaults(); } catch (IOException ioe) { System.out.println("Information Message: Properties file is being " + "created for first time use: File name " + getConfigurationResource()); loadDefaults(); } catch (SecurityException se) { System.out.println(se.getMessage()); } }
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/5dce2038407a15b746230ab6f0003e41130af9af/SessionConfig.java/buggy/tn5250j/src/org/tn5250j/SessionConfig.java
abstract public void saveSettings(String regKey, String fileName, String header);
abstract public void saveSettings();
abstract public void saveSettings(String regKey, String fileName, String header);
1179 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1179/d176b045eb10d934c5b8bbe4ce787a7bbc5a271e/ConfigureFactory.java/buggy/tn5250j/src/org/tn5250j/interfaces/ConfigureFactory.java
bad.minor = Minor.Any;
public static InvalidSlot extract(Any any) { try { EmptyExceptionHolder h = (EmptyExceptionHolder) any.extract_Streamable(); return (InvalidSlot) h.value; } catch (ClassCastException cex) { BAD_OPERATION bad = new BAD_OPERATION("InvalidSlot expected"); bad.initCause(cex); throw bad; } }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/44e3ea509d80974dab547c4d1cf8c070d32bac86/InvalidSlotHelper.java/buggy/core/src/classpath/org/org/omg/PortableInterceptor/InvalidSlotHelper.java
if(pcdata != null) writeOut(outputstream, pcdata);
if(pcdata != null) { writeOut(outputstream, pcdata); if (!dontCloseNode) if ( nodeNameString.equals(sXDFStructureNodeName) && !XMLDeclAttribs.isEmpty() ) { writeOut(outputstream, "</"+sXDFRootNodeName+">"); } else { writeOut(outputstream, "</"+nodeNameString+">"); } if (sPrettyXDFOutput) writeOut(outputstream, Constants.NEW_LINE); return ; };
public void toXDFOutputStream ( OutputStream outputstream, Hashtable XMLDeclAttribs, String indent, boolean dontCloseNode, String newNodeNameString, String noChildObjectNodeName ) { String nodeNameString = this.classXDFNodeName; // Setup. Sometimes the name of the node we are opening is different from // that specified in the classXDFNodeName (*sigh*) if (newNodeNameString != null) nodeNameString = newNodeNameString; // 0. To be valid XML, we always start an XML block with an // XML declaration (e.g. somehting like "<?xml standalone="no"?>"). // Here we deal with printing out XML Declaration && its attributes if (!XMLDeclAttribs.isEmpty()) { indent = ""; writeXMLDeclToOutputStream(outputstream, XMLDeclAttribs); } else { Log.warn("Warning: XMLDeclAttribs NOT currently supported."); } // 1. open this node, print its simple XML attributes if (nodeNameString != null) { if (sPrettyXDFOutput) writeOut(outputstream, indent); // indent node if desired // For printing the opening statement we need to invoke a little // Voodoo to keep the DTD happy: the first structure node is always // called by the root node name instead of the usual nodeNameString // We can tell this by checking if this object is derived from class // Structure and if XMLDeclAttrib defined/populated with information // NOTE: This isnt really the way to do this. We need to check if 'this' is // is or has as a superclass xdf.Structure instead of the 'string check' below. // check is class Strucuture & XMLDeclAttribs populated? if ( nodeNameString.equals(sXDFStructureNodeName) && !XMLDeclAttribs.isEmpty() ) { writeOut(outputstream,"<" + sXDFRootNodeName); // print opening root node statement } else { writeOut(outputstream,"<" + nodeNameString); // print opening statement } } // gather info about XMLAttributes in this object/node Hashtable xmlInfo = getXMLInfo(); // 2. Print out string object XML attributes EXCEPT for the one that // matches PCDATAAttribute. ArrayList attribs = (ArrayList) xmlInfo.get("attribList"); // is synchronized here correct? synchronized(attribs) { for (int i = 0; i < attribs.size(); i++) { Hashtable item = (Hashtable) attribs.get(i); writeOut(outputstream, " "+ item.get("name") + "=\"" + item.get("value") + "\""); } } // 3. Print out Node PCData or Child Nodes as specified by object ref // XML attributes. The way this stuff occurs will also affect how we // close the node. ArrayList childObjs = (ArrayList) xmlInfo.get("childObjList"); String pcdata = (String) xmlInfo.get("PCDATA"); if ( childObjs.size() > 0 || pcdata != null || noChildObjectNodeName != null) { // close the opening tag if (nodeNameString != null) { writeOut(outputstream, ">"); if (sPrettyXDFOutput && pcdata == null) writeOut(outputstream, Constants.NEW_LINE); } // deal with object/list XML attributes, if any in our list for (int i = 0; i < childObjs.size(); i++) { Hashtable item = (Hashtable) childObjs.get(i); if (item.get("type") == Constants.LIST_TYPE) { List objectList = (List) item.get("value"); // Im not sure this synchronized wrapper is needed, we are // only accessing stuff here.. Also, should synchronzied wrapper // occur back in the getXMLInfo method instead where the orig // access occured?!? synchronized(objectList) { Iterator iter = objectList.iterator(); // Must be in synchronized block while (iter.hasNext()) { BaseObject containedObj = (BaseObject) iter.next(); if (containedObj != null) { // can happen from pre-allocation of axis values, etc (?) String newindent = indent + sPrettyXDFOutputIndentation; dealWithOpeningGroupNodes(containedObj, outputstream, indent); dealWithClosingGroupNodes(containedObj, outputstream, indent); containedObj.toXDFOutputStream(outputstream, new Hashtable(), newindent); } } } } else if (item.get("type") == Constants.OBJECT_TYPE) { BaseObject containedObj = (BaseObject) item.get("value"); if (containedObj != null) { // can happen from pre-allocation of axis values, etc (?) // shouldnt this be synchronized too?? synchronized(containedObj) { String newindent = indent + sPrettyXDFOutputIndentation; dealWithOpeningGroupNodes(containedObj, outputstream, indent); dealWithClosingGroupNodes(containedObj, outputstream, indent); containedObj.toXDFOutputStream(outputstream, new Hashtable(), newindent); } } } else { // error: weird type, actually shouldnt occur. Is this needed?? Log.error("Weird error: unknown XML attribute type for item:"+item); } } // print out PCDATA, if any if(pcdata != null) writeOut(outputstream, pcdata); // if there are no PCDATA or child objects/nodes then // we print out noChildObjectNodeName if ( childObjs.size() == 0 && pcdata == null && noChildObjectNodeName != null) { if (sPrettyXDFOutput) writeOut(outputstream, indent); writeOut(outputstream, "<" + noChildObjectNodeName + "/>"); if (sPrettyXDFOutput) writeOut(outputstream, Constants.NEW_LINE); } // ok, now deal with closing the node if (nodeNameString != null) { // Needed?? //dealWithClosingGroupNodes(containedObj, outputstream, indent); //Brian: we have to fix this, no whitespace should be allowed between //PCDATA and closing node if (sPrettyXDFOutput) writeOut(outputstream, indent); if (!dontCloseNode) if ( nodeNameString.equals(sXDFStructureNodeName) && !XMLDeclAttribs.isEmpty() ) { writeOut(outputstream, "</"+sXDFRootNodeName+">"); } else { writeOut(outputstream, "</"+nodeNameString+">"); } } } else { if(dontCloseNode) { // it may not have sub-objects, but we dont want to close it // (happens for group objects) } else { // no sub-objects, just close this node writeOut(outputstream, "/>"); } } if (sPrettyXDFOutput) writeOut(outputstream, Constants.NEW_LINE); }
4483 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/4483/b5f74590aa4a229b60a4749160322fc01693cd63/BaseObject.java/buggy/src/gov/nasa/gsfc/adc/xdf/BaseObject.java
public void toXDFOutputStream ( OutputStream outputstream, Hashtable XMLDeclAttribs, String indent, boolean dontCloseNode, String newNodeNameString, String noChildObjectNodeName ) { String nodeNameString = this.classXDFNodeName; // Setup. Sometimes the name of the node we are opening is different from // that specified in the classXDFNodeName (*sigh*) if (newNodeNameString != null) nodeNameString = newNodeNameString; // 0. To be valid XML, we always start an XML block with an // XML declaration (e.g. somehting like "<?xml standalone="no"?>"). // Here we deal with printing out XML Declaration && its attributes if (!XMLDeclAttribs.isEmpty()) { indent = ""; writeXMLDeclToOutputStream(outputstream, XMLDeclAttribs); } else { Log.warn("Warning: XMLDeclAttribs NOT currently supported."); } // 1. open this node, print its simple XML attributes if (nodeNameString != null) { if (sPrettyXDFOutput) writeOut(outputstream, indent); // indent node if desired // For printing the opening statement we need to invoke a little // Voodoo to keep the DTD happy: the first structure node is always // called by the root node name instead of the usual nodeNameString // We can tell this by checking if this object is derived from class // Structure and if XMLDeclAttrib defined/populated with information // NOTE: This isnt really the way to do this. We need to check if 'this' is // is or has as a superclass xdf.Structure instead of the 'string check' below. // check is class Strucuture & XMLDeclAttribs populated? if ( nodeNameString.equals(sXDFStructureNodeName) && !XMLDeclAttribs.isEmpty() ) { writeOut(outputstream,"<" + sXDFRootNodeName); // print opening root node statement } else { writeOut(outputstream,"<" + nodeNameString); // print opening statement } } // gather info about XMLAttributes in this object/node Hashtable xmlInfo = getXMLInfo(); // 2. Print out string object XML attributes EXCEPT for the one that // matches PCDATAAttribute. ArrayList attribs = (ArrayList) xmlInfo.get("attribList"); // is synchronized here correct? synchronized(attribs) { for (int i = 0; i < attribs.size(); i++) { Hashtable item = (Hashtable) attribs.get(i); writeOut(outputstream, " "+ item.get("name") + "=\"" + item.get("value") + "\""); } } // 3. Print out Node PCData or Child Nodes as specified by object ref // XML attributes. The way this stuff occurs will also affect how we // close the node. ArrayList childObjs = (ArrayList) xmlInfo.get("childObjList"); String pcdata = (String) xmlInfo.get("PCDATA"); if ( childObjs.size() > 0 || pcdata != null || noChildObjectNodeName != null) { // close the opening tag if (nodeNameString != null) { writeOut(outputstream, ">"); if (sPrettyXDFOutput && pcdata == null) writeOut(outputstream, Constants.NEW_LINE); } // deal with object/list XML attributes, if any in our list for (int i = 0; i < childObjs.size(); i++) { Hashtable item = (Hashtable) childObjs.get(i); if (item.get("type") == Constants.LIST_TYPE) { List objectList = (List) item.get("value"); // Im not sure this synchronized wrapper is needed, we are // only accessing stuff here.. Also, should synchronzied wrapper // occur back in the getXMLInfo method instead where the orig // access occured?!? synchronized(objectList) { Iterator iter = objectList.iterator(); // Must be in synchronized block while (iter.hasNext()) { BaseObject containedObj = (BaseObject) iter.next(); if (containedObj != null) { // can happen from pre-allocation of axis values, etc (?) String newindent = indent + sPrettyXDFOutputIndentation; dealWithOpeningGroupNodes(containedObj, outputstream, indent); dealWithClosingGroupNodes(containedObj, outputstream, indent); containedObj.toXDFOutputStream(outputstream, new Hashtable(), newindent); } } } } else if (item.get("type") == Constants.OBJECT_TYPE) { BaseObject containedObj = (BaseObject) item.get("value"); if (containedObj != null) { // can happen from pre-allocation of axis values, etc (?) // shouldnt this be synchronized too?? synchronized(containedObj) { String newindent = indent + sPrettyXDFOutputIndentation; dealWithOpeningGroupNodes(containedObj, outputstream, indent); dealWithClosingGroupNodes(containedObj, outputstream, indent); containedObj.toXDFOutputStream(outputstream, new Hashtable(), newindent); } } } else { // error: weird type, actually shouldnt occur. Is this needed?? Log.error("Weird error: unknown XML attribute type for item:"+item); } } // print out PCDATA, if any if(pcdata != null) writeOut(outputstream, pcdata); // if there are no PCDATA or child objects/nodes then // we print out noChildObjectNodeName if ( childObjs.size() == 0 && pcdata == null && noChildObjectNodeName != null) { if (sPrettyXDFOutput) writeOut(outputstream, indent); writeOut(outputstream, "<" + noChildObjectNodeName + "/>"); if (sPrettyXDFOutput) writeOut(outputstream, Constants.NEW_LINE); } // ok, now deal with closing the node if (nodeNameString != null) { // Needed?? //dealWithClosingGroupNodes(containedObj, outputstream, indent); //Brian: we have to fix this, no whitespace should be allowed between //PCDATA and closing node if (sPrettyXDFOutput) writeOut(outputstream, indent); if (!dontCloseNode) if ( nodeNameString.equals(sXDFStructureNodeName) && !XMLDeclAttribs.isEmpty() ) { writeOut(outputstream, "</"+sXDFRootNodeName+">"); } else { writeOut(outputstream, "</"+nodeNameString+">"); } } } else { if(dontCloseNode) { // it may not have sub-objects, but we dont want to close it // (happens for group objects) } else { // no sub-objects, just close this node writeOut(outputstream, "/>"); } } if (sPrettyXDFOutput) writeOut(outputstream, Constants.NEW_LINE); }
4483 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/4483/b5f74590aa4a229b60a4749160322fc01693cd63/BaseObject.java/buggy/src/gov/nasa/gsfc/adc/xdf/BaseObject.java
public void toXDFOutputStream (OutputStream outputstream, String indent)
public void toXDFOutputStream ( OutputStream outputstream, Hashtable XMLDeclAttribs, String indent, boolean dontCloseNode, String newNodeNameString, String noChildObjectNodeName )
public void toXDFOutputStream (OutputStream outputstream, String indent) { // prepare XMLDeclaration Hashtable XMLDeclAttribs = new Hashtable(); XMLDeclAttribs.put("standalone", new String("no")); XMLDeclAttribs.put("version", (String) sXMLSpecVersion); toXDFOutputStream(outputstream, XMLDeclAttribs, indent); }
4483 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/4483/161a6723e174f89f58248382a4c2cc6e342e6bb2/BaseObject.java/buggy/src/gov/nasa/gsfc/adc/xdf/BaseObject.java
Hashtable XMLDeclAttribs = new Hashtable(); XMLDeclAttribs.put("standalone", new String("no")); XMLDeclAttribs.put("version", (String) sXMLSpecVersion); toXDFOutputStream(outputstream, XMLDeclAttribs, indent);
String nodeNameString = this.classXDFNodeName; if (newNodeNameString != null) nodeNameString = newNodeNameString; if ((XMLDeclAttribs !=null) &&(!XMLDeclAttribs.isEmpty())) { indent = ""; writeXMLDeclToOutputStream(outputstream, XMLDeclAttribs); } if (nodeNameString != null) { if (sPrettyXDFOutput) writeOut(outputstream, indent); if ( nodeNameString.equals(sXDFStructureNodeName) && !XMLDeclAttribs.isEmpty() ) nodeNameString = sXDFRootNodeName; writeOut(outputstream,"<" + nodeNameString); } Hashtable xmlInfo = getXMLInfo(); ArrayList attribs = (ArrayList) xmlInfo.get("attribList"); synchronized(attribs) { for (int i = 0; i < attribs.size(); i++) { Hashtable item = (Hashtable) attribs.get(i); writeOut(outputstream, " "+ item.get("name") + "=\"" + item.get("value") + "\""); } } ArrayList childObjs = (ArrayList) xmlInfo.get("childObjList"); String pcdata = (String) xmlInfo.get("PCDATA"); if ( childObjs.size() > 0 || pcdata != null || noChildObjectNodeName != null) { if (nodeNameString != null) { writeOut(outputstream, ">"); if ((sPrettyXDFOutput) && (pcdata == null)) writeOut(outputstream, Constants.NEW_LINE); } for (int i = 0; i < childObjs.size(); i++) { Hashtable item = (Hashtable) childObjs.get(i); if (item.get("type") == Constants.LIST_TYPE) { List objectList = (List) item.get("value"); synchronized(objectList) { Iterator iter = objectList.iterator(); while (iter.hasNext()) { BaseObject containedObj = (BaseObject) iter.next(); if (containedObj != null) { indent = dealWithOpeningGroupNodes(containedObj, outputstream, indent); indent = dealWithClosingGroupNodes(containedObj, outputstream, indent); String newindent = indent + sPrettyXDFOutputIndentation; containedObj.toXDFOutputStream(outputstream, new Hashtable(), newindent); } } } } else if (item.get("type") == Constants.OBJECT_TYPE) { BaseObject containedObj = (BaseObject) item.get("value"); if (containedObj != null) { synchronized(containedObj) { indent = dealWithOpeningGroupNodes(containedObj, outputstream, indent); indent = dealWithClosingGroupNodes(containedObj, outputstream, indent); String newindent = indent + sPrettyXDFOutputIndentation; containedObj.toXDFOutputStream(outputstream, new Hashtable(), newindent); } } } else { Log.errorln("Weird error: unknown XML attribute type for item:"+item); } } if(pcdata != null) { writeOut(outputstream, pcdata); }; if ( childObjs.size() == 0 && pcdata == null && noChildObjectNodeName != null) { if (sPrettyXDFOutput) writeOut(outputstream, indent + sPrettyXDFOutputIndentation); writeOut(outputstream, "<" + noChildObjectNodeName + "/>"); if (sPrettyXDFOutput) writeOut(outputstream, Constants.NEW_LINE); } if (nodeNameString != null) { indent = dealWithClosingGroupNodes((BaseObject) this, outputstream, indent); if (sPrettyXDFOutput && pcdata == null) writeOut(outputstream, indent); if (!dontCloseNode) writeOut(outputstream, "</"+nodeNameString+">"); } } else { if (dontCloseNode) { writeOut(outputstream, ">"); } else { writeOut(outputstream, "/>"); } } if (sPrettyXDFOutput) writeOut(outputstream, Constants.NEW_LINE);
public void toXDFOutputStream (OutputStream outputstream, String indent) { // prepare XMLDeclaration Hashtable XMLDeclAttribs = new Hashtable(); XMLDeclAttribs.put("standalone", new String("no")); XMLDeclAttribs.put("version", (String) sXMLSpecVersion); toXDFOutputStream(outputstream, XMLDeclAttribs, indent); }
4483 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/4483/161a6723e174f89f58248382a4c2cc6e342e6bb2/BaseObject.java/buggy/src/gov/nasa/gsfc/adc/xdf/BaseObject.java
super(p, q, g); this.x = x;
this(Registry.RAW_ENCODING_ID, p, q, g, x);
public DSSPrivateKey(BigInteger p, BigInteger q, BigInteger g, BigInteger x) { super(p, q, g); this.x = x; }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/792415b1783f5e8798e64529a3048ed049193e55/DSSPrivateKey.java/clean/core/src/classpath/gnu/gnu/java/security/key/dss/DSSPrivateKey.java
throw new IllegalArgumentException("format");
throw new IllegalArgumentException("Unsupported encoding format: " + format);
public byte[] getEncoded(int format) { byte[] result; switch (format) { case IKeyPairCodec.RAW_FORMAT: result = new DSSKeyPairRawCodec().encodePrivateKey(this); break; default: throw new IllegalArgumentException("format"); } return result; }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/792415b1783f5e8798e64529a3048ed049193e55/DSSPrivateKey.java/clean/core/src/classpath/gnu/gnu/java/security/key/dss/DSSPrivateKey.java
public static DSSPrivateKey valueOf(byte[] k) { // check magic... // we should parse here enough bytes to know which codec to use, and // direct the byte array to the appropriate codec. since we only have one // codec, we could have immediately tried it; nevertheless since testing // one byte is cheaper than instatiating a codec that will fail we test // the first byte before we carry on. if (k[0] == Registry.MAGIC_RAW_DSS_PRIVATE_KEY[0]) { // it's likely to be in raw format. get a raw codec and hand it over IKeyPairCodec codec = new DSSKeyPairRawCodec(); return (DSSPrivateKey) codec.decodePrivateKey(k); } else { throw new IllegalArgumentException("magic"); } }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/792415b1783f5e8798e64529a3048ed049193e55/DSSPrivateKey.java/clean/core/src/classpath/gnu/gnu/java/security/key/dss/DSSPrivateKey.java
IKeyPairCodec codec = new DSSKeyPairRawCodec(); return (DSSPrivateKey) codec.decodePrivateKey(k);
return (DSSPrivateKey) new DSSKeyPairRawCodec().decodePrivateKey(k);
public static DSSPrivateKey valueOf(byte[] k) { // check magic... // we should parse here enough bytes to know which codec to use, and // direct the byte array to the appropriate codec. since we only have one // codec, we could have immediately tried it; nevertheless since testing // one byte is cheaper than instatiating a codec that will fail we test // the first byte before we carry on. if (k[0] == Registry.MAGIC_RAW_DSS_PRIVATE_KEY[0]) { // it's likely to be in raw format. get a raw codec and hand it over IKeyPairCodec codec = new DSSKeyPairRawCodec(); return (DSSPrivateKey) codec.decodePrivateKey(k); } else { throw new IllegalArgumentException("magic"); } }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/792415b1783f5e8798e64529a3048ed049193e55/DSSPrivateKey.java/clean/core/src/classpath/gnu/gnu/java/security/key/dss/DSSPrivateKey.java
else
catch (IllegalArgumentException ignored)
public static DSSPrivateKey valueOf(byte[] k) { // check magic... // we should parse here enough bytes to know which codec to use, and // direct the byte array to the appropriate codec. since we only have one // codec, we could have immediately tried it; nevertheless since testing // one byte is cheaper than instatiating a codec that will fail we test // the first byte before we carry on. if (k[0] == Registry.MAGIC_RAW_DSS_PRIVATE_KEY[0]) { // it's likely to be in raw format. get a raw codec and hand it over IKeyPairCodec codec = new DSSKeyPairRawCodec(); return (DSSPrivateKey) codec.decodePrivateKey(k); } else { throw new IllegalArgumentException("magic"); } }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/792415b1783f5e8798e64529a3048ed049193e55/DSSPrivateKey.java/clean/core/src/classpath/gnu/gnu/java/security/key/dss/DSSPrivateKey.java
throw new IllegalArgumentException("magic");
public static DSSPrivateKey valueOf(byte[] k) { // check magic... // we should parse here enough bytes to know which codec to use, and // direct the byte array to the appropriate codec. since we only have one // codec, we could have immediately tried it; nevertheless since testing // one byte is cheaper than instatiating a codec that will fail we test // the first byte before we carry on. if (k[0] == Registry.MAGIC_RAW_DSS_PRIVATE_KEY[0]) { // it's likely to be in raw format. get a raw codec and hand it over IKeyPairCodec codec = new DSSKeyPairRawCodec(); return (DSSPrivateKey) codec.decodePrivateKey(k); } else { throw new IllegalArgumentException("magic"); } }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/792415b1783f5e8798e64529a3048ed049193e55/DSSPrivateKey.java/clean/core/src/classpath/gnu/gnu/java/security/key/dss/DSSPrivateKey.java
return (DSSPrivateKey) new DSSKeyPairPKCS8Codec().decodePrivateKey(k);
public static DSSPrivateKey valueOf(byte[] k) { // check magic... // we should parse here enough bytes to know which codec to use, and // direct the byte array to the appropriate codec. since we only have one // codec, we could have immediately tried it; nevertheless since testing // one byte is cheaper than instatiating a codec that will fail we test // the first byte before we carry on. if (k[0] == Registry.MAGIC_RAW_DSS_PRIVATE_KEY[0]) { // it's likely to be in raw format. get a raw codec and hand it over IKeyPairCodec codec = new DSSKeyPairRawCodec(); return (DSSPrivateKey) codec.decodePrivateKey(k); } else { throw new IllegalArgumentException("magic"); } }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/792415b1783f5e8798e64529a3048ed049193e55/DSSPrivateKey.java/clean/core/src/classpath/gnu/gnu/java/security/key/dss/DSSPrivateKey.java