rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
|
---|---|---|
char c = screen[getPos(m,i)].getChar(); if (c >= ' ' && !screen[getPos(m,i)].nonDisplay) | char c = screen[getPos(m - 1,i - 1)].getChar(); if (c >= ' ' && !screen[getPos(m - 1,i - 1)].nonDisplay) | protected final void copyMe() { Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard(); StringBuffer s = new StringBuffer(); if (!gui.rubberband.isAreaSelected()) workR.setBounds(0,0,numCols,numRows); else { // lets get the bounding area using a rectangle that we have already // allocated gui.rubberband.getBoundingArea(workR); // get starting row and column int sPos = getRowColFromPoint(workR.x , workR.y ); // get the width and height int ePos = getRowColFromPoint(workR.width , workR.height ); int r = getRow(sPos); int c = getCol(sPos); int r2 = getRow(ePos) + 1; int c2 = getCol(ePos) + 1;// if (c2 == 0)// c2 = getCols();// if (r2 == 0)// r2 = 1; workR.setBounds(r,c,c2,r2); gui.rubberband.reset(); gui.repaint(); } System.out.println("Copying"); System.out.println(workR); // loop through all the screen characters to send them to the clip board int m = workR.x; int i = 0; int t = 0; while (workR.height-- > 0) { t = workR.width; i = workR.y; while (t-- > 0) { // only copy printable characters (in this case >= ' ') char c = screen[getPos(m,i)].getChar(); if (c >= ' ' && !screen[getPos(m,i)].nonDisplay) s.append(c); else s.append(' '); i++; } s.append('\n'); m++; } StringSelection contents = new StringSelection(s.toString()); cb.setContents(contents, null); } |
bounds.setBounds(1,1,getRows(),getCols()); | bounds.setBounds(1,1,getCols(),getRows()); | public void getBoundingArea(Rectangle bounds) { // check to see if there is an area selected. If not then return all // screen area. if (!gui.rubberband.isAreaSelected()) { bounds.setBounds(1,1,getRows(),getCols()); } else { // lets get the bounding area using a rectangle that we have already // allocated gui.rubberband.getBoundingArea(bounds); // get starting row and column int sPos = getRowColFromPoint(bounds.x , bounds.y ); // get the width and height int ePos = getRowColFromPoint(bounds.width , bounds.height ); int row = getRow(sPos) + 1; int col = getCol(sPos) + 1; bounds.setBounds(row,col,getCol(ePos),getRow(ePos)); } } |
gui.rubberband.getBoundingArea(bounds); | gui.rubberband.getBoundingArea(workR); | public void getBoundingArea(Rectangle bounds) { // check to see if there is an area selected. If not then return all // screen area. if (!gui.rubberband.isAreaSelected()) { bounds.setBounds(1,1,getRows(),getCols()); } else { // lets get the bounding area using a rectangle that we have already // allocated gui.rubberband.getBoundingArea(bounds); // get starting row and column int sPos = getRowColFromPoint(bounds.x , bounds.y ); // get the width and height int ePos = getRowColFromPoint(bounds.width , bounds.height ); int row = getRow(sPos) + 1; int col = getCol(sPos) + 1; bounds.setBounds(row,col,getCol(ePos),getRow(ePos)); } } |
int sPos = getRowColFromPoint(bounds.x , bounds.y ); | int sPos = getRowColFromPoint(workR.x, workR.y); | public void getBoundingArea(Rectangle bounds) { // check to see if there is an area selected. If not then return all // screen area. if (!gui.rubberband.isAreaSelected()) { bounds.setBounds(1,1,getRows(),getCols()); } else { // lets get the bounding area using a rectangle that we have already // allocated gui.rubberband.getBoundingArea(bounds); // get starting row and column int sPos = getRowColFromPoint(bounds.x , bounds.y ); // get the width and height int ePos = getRowColFromPoint(bounds.width , bounds.height ); int row = getRow(sPos) + 1; int col = getCol(sPos) + 1; bounds.setBounds(row,col,getCol(ePos),getRow(ePos)); } } |
int ePos = getRowColFromPoint(bounds.width , bounds.height ); | int ePos = getRowColFromPoint(workR.width, workR.height); | public void getBoundingArea(Rectangle bounds) { // check to see if there is an area selected. If not then return all // screen area. if (!gui.rubberband.isAreaSelected()) { bounds.setBounds(1,1,getRows(),getCols()); } else { // lets get the bounding area using a rectangle that we have already // allocated gui.rubberband.getBoundingArea(bounds); // get starting row and column int sPos = getRowColFromPoint(bounds.x , bounds.y ); // get the width and height int ePos = getRowColFromPoint(bounds.width , bounds.height ); int row = getRow(sPos) + 1; int col = getCol(sPos) + 1; bounds.setBounds(row,col,getCol(ePos),getRow(ePos)); } } |
bounds.setBounds(row,col,getCol(ePos),getRow(ePos)); | bounds.setBounds(row,col,getCol(ePos) + 1,getRow(ePos) + 1); | public void getBoundingArea(Rectangle bounds) { // check to see if there is an area selected. If not then return all // screen area. if (!gui.rubberband.isAreaSelected()) { bounds.setBounds(1,1,getRows(),getCols()); } else { // lets get the bounding area using a rectangle that we have already // allocated gui.rubberband.getBoundingArea(bounds); // get starting row and column int sPos = getRowColFromPoint(bounds.x , bounds.y ); // get the width and height int ePos = getRowColFromPoint(bounds.width , bounds.height ); int row = getRow(sPos) + 1; int col = getCol(sPos) + 1; bounds.setBounds(row,col,getCol(ePos),getRow(ePos)); } } |
point.x = screen[getPos(r,c)].x; point.y = screen[getPos(r,c)].y; | point.x = screen[getPos(r,c)].x + bi.offLeft; point.y = screen[getPos(r,c)].y + bi.offTop; | public void getPointFromRowCol (int r, int c, Point point) { point.x = screen[getPos(r,c)].x; point.y = screen[getPos(r,c)].y; } |
if (x > tArea.getMaxX()) x = (int)tArea.getMaxX() - 1; if (y > tArea.getMaxY()) y = (int)tArea.getMaxY() - 1; if (x < tArea.getMinX()) x = 0; if (y < tArea.getMinY()) y = 0; | public int getRowColFromPoint (int x, int y) { // is x,y in the drawing area // x is left to right and y is top to bottom// if (tArea.contains(x,y)) {//// // int cols = (numCols - ((((fmWidth * numCols) - x) / fmWidth)));// // System.out.println(cols);// return getPos((numRows - ((((fmHeight * (numRows)) - y) / fmHeight))),// (numCols - ((((fmWidth * (numCols)) - x) / fmWidth)))// );//// }// else {// if (!tArea.contains(x,y)) {// System.out.println(" Not in area before " +// (int)tArea.getMinX() + " " +// (int)tArea.getMinY() + " " +// (int)tArea.getMaxX() + " " +// (int)tArea.getMaxY() + " " +// x + " " + y); if (x > tArea.getMaxX()) x = (int)tArea.getMaxX() - 1; if (y > tArea.getMaxY()) y = (int)tArea.getMaxY() - 1; if (x < tArea.getMinX()) x = 0; if (y < tArea.getMinY()) y = 0;// System.out.println(" Not in area after " +// (int)tArea.getMinX() + " " +// (int)tArea.getMinY() + " " +// (int)tArea.getMaxX() + " " +// (int)tArea.getMaxY() + " " +// x + " " + y);// } int s = fmWidth * numCols; int t = s - x; int u = t / fmWidth; int v = numCols - u; int s0 = y / fmHeight; int s1 = x / fmWidth;// return getPos((numRows - ((((fmHeight * (numRows)) - y) / fmHeight))),// (numCols - ((((fmWidth * (numCols)) - x) / fmWidth)))// ); return getPos(s0,s1);// return 0; } |
|
if (x > tArea.getMaxX()) x = (int)tArea.getMaxX() - 1; if (y > tArea.getMaxY()) y = (int)tArea.getMaxY() - 1; if (x < tArea.getMinX()) x = 0; if (y < tArea.getMinY()) y = 0; int s = fmWidth * numCols; int t = s - x; int u = t / fmWidth; int v = numCols - u; | public int getRowColFromPoint (int x, int y) { // is x,y in the drawing area // x is left to right and y is top to bottom// if (tArea.contains(x,y)) {//// // int cols = (numCols - ((((fmWidth * numCols) - x) / fmWidth)));// // System.out.println(cols);// return getPos((numRows - ((((fmHeight * (numRows)) - y) / fmHeight))),// (numCols - ((((fmWidth * (numCols)) - x) / fmWidth)))// );//// }// else {// if (!tArea.contains(x,y)) {// System.out.println(" Not in area before " +// (int)tArea.getMinX() + " " +// (int)tArea.getMinY() + " " +// (int)tArea.getMaxX() + " " +// (int)tArea.getMaxY() + " " +// x + " " + y); if (x > tArea.getMaxX()) x = (int)tArea.getMaxX() - 1; if (y > tArea.getMaxY()) y = (int)tArea.getMaxY() - 1; if (x < tArea.getMinX()) x = 0; if (y < tArea.getMinY()) y = 0;// System.out.println(" Not in area after " +// (int)tArea.getMinX() + " " +// (int)tArea.getMinY() + " " +// (int)tArea.getMaxX() + " " +// (int)tArea.getMaxY() + " " +// x + " " + y);// } int s = fmWidth * numCols; int t = s - x; int u = t / fmWidth; int v = numCols - u; int s0 = y / fmHeight; int s1 = x / fmWidth;// return getPos((numRows - ((((fmHeight * (numRows)) - y) / fmHeight))),// (numCols - ((((fmWidth * (numCols)) - x) / fmWidth)))// ); return getPos(s0,s1);// return 0; } |
|
font = new Font("dialoginput",Font.PLAIN,14); config.setProperty("font","dialoginput"); | font = new Font("Courier New",Font.PLAIN,14); config.setProperty("font","Courier New"); | void jbInit() throws Exception { if (!config.isPropertyExists("font")) { font = new Font("dialoginput",Font.PLAIN,14); config.setProperty("font","dialoginput"); } else { font = new Font(getStringProperty("font"),Font.PLAIN,14); } gui.setFont(font); lastAttr = 32; // default number of rows and columns numRows = 24; numCols = 80; goto_XY(1,1); // set initial cursor position restriction = new Rectangle(0,0); errorLineNum = numRows; updateCursorLoc = false; FontRenderContext frc = new FontRenderContext(font.getTransform(),true,true); lm = font.getLineMetrics("Wy",frc); fmWidth = (int)font.getStringBounds("W",frc).getWidth() + 1; fmHeight = (int)(font.getStringBounds("g",frc).getHeight() + lm.getDescent() + lm.getLeading()); keyboardLocked = true; checkOffScreenImage(); lenScreen = numRows * numCols; screen = new ScreenChar[lenScreen]; for (int y = 0;y < lenScreen; y++) { screen[y] = new ScreenChar(this); screen[y].setCharAndAttr(' ',initAttr,false); screen[y].setRowCol(getRow(y),getCol(y)); } screenFields = new ScreenFields(this); strokenizer = new KeyStrokenizer(); } |
int pos = getRowColFromPoint(e.getX(),e.getY()); | int pos = getPosFromView(e.getX(),e.getY()); | public void moveCursor (MouseEvent e) { if(!keyboardLocked) { int pos = getRowColFromPoint(e.getX(),e.getY());// System.out.println((getRow(pos)) + "," + (getCol(pos)));// System.out.println(e.getX() + "," + e.getY()+ "," + fmWidth+ "," + fmHeight); if (pos == 0) return ; // because getRowColFromPoint returns offset of 1,1 we need to // translate to offset 0,0// pos -= (numCols + 1); int g = screen[pos].getWhichGUI(); // lets check for hot spots if (g >= ScreenChar.BUTTON_LEFT && g <= ScreenChar.BUTTON_LAST) { StringBuffer aid = new StringBuffer(); boolean aidFlag = true; switch (g) { case ScreenChar.BUTTON_RIGHT: case ScreenChar.BUTTON_MIDDLE: while (screen[--pos].getWhichGUI() != ScreenChar.BUTTON_LEFT) { } case ScreenChar.BUTTON_LEFT: if (screen[pos].getChar() == 'F') { pos++; } else aidFlag=false; if (screen[pos+1].getChar() != '=' && screen[pos+1].getChar() != '.' && screen[pos+1].getChar() != '/' ) {// System.out.println(" Hotspot clicked!!! we will send characters " +// screen[pos].getChar() +// screen[pos+1].getChar()); aid.append(screen[pos].getChar()); aid.append(screen[pos + 1].getChar()); } else {// System.out.println(" Hotspot clicked!!! we will send character " +// screen[pos].getChar());// aid.append(screen[pos].getChar()); } break; } if (aidFlag) { switch (g) { case ScreenChar.BUTTON_LEFT_UP: case ScreenChar.BUTTON_MIDDLE_UP: case ScreenChar.BUTTON_RIGHT_UP: case ScreenChar.BUTTON_ONE_UP: case ScreenChar.BUTTON_SB_UP: case ScreenChar.BUTTON_SB_GUIDE: gui.sendAidKey(tnvt.AID_ROLL_UP); break; case ScreenChar.BUTTON_LEFT_DN: case ScreenChar.BUTTON_MIDDLE_DN: case ScreenChar.BUTTON_RIGHT_DN: case ScreenChar.BUTTON_ONE_DN: case ScreenChar.BUTTON_SB_DN: case ScreenChar.BUTTON_SB_THUMB: gui.sendAidKey(tnvt.AID_ROLL_DOWN); break; case ScreenChar.BUTTON_LEFT_EB: case ScreenChar.BUTTON_MIDDLE_EB: case ScreenChar.BUTTON_RIGHT_EB: System.out.println("Send to external Browser"); break; default: int aidKey = Integer.parseInt(aid.toString()); if (aidKey >= 1 && aidKey <= 12) gui.sendAidKey(0x30 + aidKey); if (aidKey >= 13 && aidKey <= 24) gui.sendAidKey(0xB0 + (aidKey - 12)); } } else { if (screenFields.getCurrentField() != null) { int xPos = screenFields.getCurrentField().startPos(); for (int x = 0; x < aid.length(); x++) {// System.out.println(sr + "," + (sc + x) + " " + aid.charAt(x)); screen[xPos + x].setChar(aid.charAt(x)); }// System.out.println(aid); screenFields.setCurrentFieldMDT(); gui.sendAidKey(tnvt.AID_ENTER); } } } else { if (gui.rubberband.isAreaSelected()) { gui.rubberband.reset(); gui.repaint(); } goto_XY(pos); isInField(lastPos); } } gui.requestFocus(); } |
if (pos == 0) | if (pos < 0) | public void moveCursor (MouseEvent e) { if(!keyboardLocked) { int pos = getRowColFromPoint(e.getX(),e.getY());// System.out.println((getRow(pos)) + "," + (getCol(pos)));// System.out.println(e.getX() + "," + e.getY()+ "," + fmWidth+ "," + fmHeight); if (pos == 0) return ; // because getRowColFromPoint returns offset of 1,1 we need to // translate to offset 0,0// pos -= (numCols + 1); int g = screen[pos].getWhichGUI(); // lets check for hot spots if (g >= ScreenChar.BUTTON_LEFT && g <= ScreenChar.BUTTON_LAST) { StringBuffer aid = new StringBuffer(); boolean aidFlag = true; switch (g) { case ScreenChar.BUTTON_RIGHT: case ScreenChar.BUTTON_MIDDLE: while (screen[--pos].getWhichGUI() != ScreenChar.BUTTON_LEFT) { } case ScreenChar.BUTTON_LEFT: if (screen[pos].getChar() == 'F') { pos++; } else aidFlag=false; if (screen[pos+1].getChar() != '=' && screen[pos+1].getChar() != '.' && screen[pos+1].getChar() != '/' ) {// System.out.println(" Hotspot clicked!!! we will send characters " +// screen[pos].getChar() +// screen[pos+1].getChar()); aid.append(screen[pos].getChar()); aid.append(screen[pos + 1].getChar()); } else {// System.out.println(" Hotspot clicked!!! we will send character " +// screen[pos].getChar());// aid.append(screen[pos].getChar()); } break; } if (aidFlag) { switch (g) { case ScreenChar.BUTTON_LEFT_UP: case ScreenChar.BUTTON_MIDDLE_UP: case ScreenChar.BUTTON_RIGHT_UP: case ScreenChar.BUTTON_ONE_UP: case ScreenChar.BUTTON_SB_UP: case ScreenChar.BUTTON_SB_GUIDE: gui.sendAidKey(tnvt.AID_ROLL_UP); break; case ScreenChar.BUTTON_LEFT_DN: case ScreenChar.BUTTON_MIDDLE_DN: case ScreenChar.BUTTON_RIGHT_DN: case ScreenChar.BUTTON_ONE_DN: case ScreenChar.BUTTON_SB_DN: case ScreenChar.BUTTON_SB_THUMB: gui.sendAidKey(tnvt.AID_ROLL_DOWN); break; case ScreenChar.BUTTON_LEFT_EB: case ScreenChar.BUTTON_MIDDLE_EB: case ScreenChar.BUTTON_RIGHT_EB: System.out.println("Send to external Browser"); break; default: int aidKey = Integer.parseInt(aid.toString()); if (aidKey >= 1 && aidKey <= 12) gui.sendAidKey(0x30 + aidKey); if (aidKey >= 13 && aidKey <= 24) gui.sendAidKey(0xB0 + (aidKey - 12)); } } else { if (screenFields.getCurrentField() != null) { int xPos = screenFields.getCurrentField().startPos(); for (int x = 0; x < aid.length(); x++) {// System.out.println(sr + "," + (sc + x) + " " + aid.charAt(x)); screen[xPos + x].setChar(aid.charAt(x)); }// System.out.println(aid); screenFields.setCurrentFieldMDT(); gui.sendAidKey(tnvt.AID_ENTER); } } } else { if (gui.rubberband.isAreaSelected()) { gui.rubberband.reset(); gui.repaint(); } goto_XY(pos); isInField(lastPos); } } gui.requestFocus(); } |
System.out.println("Summing"); System.out.println(workR); int m = workR.x; int i = 0; int t = 0; double sum = 0.0; | protected final Vector sumThem(boolean which) { StringBuffer s = new StringBuffer(); getBoundingArea(workR); gui.rubberband.reset(); gui.repaint(); System.out.println("Summing"); System.out.println(workR); // loop through all the screen characters to send them to the clip board int m = workR.x; int i = 0; int t = 0; double sum = 0.0; // obtain the decimal format for parsing DecimalFormat df = (DecimalFormat)NumberFormat.getInstance() ; DecimalFormatSymbols dfs = df.getDecimalFormatSymbols(); if (which) { dfs.setDecimalSeparator('.'); dfs.setGroupingSeparator(','); } else { dfs.setDecimalSeparator(','); dfs.setGroupingSeparator('.'); } df.setDecimalFormatSymbols(dfs); Vector sumVector = new Vector(); while (workR.height-- >= 0) { t = workR.width; i = workR.y; while (t-- >= 0) { // only copy printable numeric characters (in this case >= ' ') char c = screen[getPos(m-1,i-1)].getChar(); if (((c >= '0' && c <= '9') || c== '.' || c == ',' || c == '-') && !screen[getPos(m-1,i-1)].nonDisplay) { s.append(c); } i++; } if (s.length() > 0) { if (s.charAt(s.length()-1) == '-') { s.insert(0,'-'); s.deleteCharAt(s.length()-1); } try { Number n = df.parse(s.toString()); System.out.println(s + " " + n.doubleValue()); sumVector.add(new Double(n.doubleValue())); sum += n.doubleValue(); } catch (ParseException pe) { System.out.println(pe.getMessage() + " at " + pe.getErrorOffset()); } } s.setLength(0); m++; }// System.out.println(sum); return sumVector; } |
|
while (workR.height-- >= 0) { | int m = workR.x; int i = 0; int t = 0; double sum = 0.0; while (workR.height-- > 0) { | protected final Vector sumThem(boolean which) { StringBuffer s = new StringBuffer(); getBoundingArea(workR); gui.rubberband.reset(); gui.repaint(); System.out.println("Summing"); System.out.println(workR); // loop through all the screen characters to send them to the clip board int m = workR.x; int i = 0; int t = 0; double sum = 0.0; // obtain the decimal format for parsing DecimalFormat df = (DecimalFormat)NumberFormat.getInstance() ; DecimalFormatSymbols dfs = df.getDecimalFormatSymbols(); if (which) { dfs.setDecimalSeparator('.'); dfs.setGroupingSeparator(','); } else { dfs.setDecimalSeparator(','); dfs.setGroupingSeparator('.'); } df.setDecimalFormatSymbols(dfs); Vector sumVector = new Vector(); while (workR.height-- >= 0) { t = workR.width; i = workR.y; while (t-- >= 0) { // only copy printable numeric characters (in this case >= ' ') char c = screen[getPos(m-1,i-1)].getChar(); if (((c >= '0' && c <= '9') || c== '.' || c == ',' || c == '-') && !screen[getPos(m-1,i-1)].nonDisplay) { s.append(c); } i++; } if (s.length() > 0) { if (s.charAt(s.length()-1) == '-') { s.insert(0,'-'); s.deleteCharAt(s.length()-1); } try { Number n = df.parse(s.toString()); System.out.println(s + " " + n.doubleValue()); sumVector.add(new Double(n.doubleValue())); sum += n.doubleValue(); } catch (ParseException pe) { System.out.println(pe.getMessage() + " at " + pe.getErrorOffset()); } } s.setLength(0); m++; }// System.out.println(sum); return sumVector; } |
while (t-- >= 0) { | while (t-- > 0) { | protected final Vector sumThem(boolean which) { StringBuffer s = new StringBuffer(); getBoundingArea(workR); gui.rubberband.reset(); gui.repaint(); System.out.println("Summing"); System.out.println(workR); // loop through all the screen characters to send them to the clip board int m = workR.x; int i = 0; int t = 0; double sum = 0.0; // obtain the decimal format for parsing DecimalFormat df = (DecimalFormat)NumberFormat.getInstance() ; DecimalFormatSymbols dfs = df.getDecimalFormatSymbols(); if (which) { dfs.setDecimalSeparator('.'); dfs.setGroupingSeparator(','); } else { dfs.setDecimalSeparator(','); dfs.setGroupingSeparator('.'); } df.setDecimalFormatSymbols(dfs); Vector sumVector = new Vector(); while (workR.height-- >= 0) { t = workR.width; i = workR.y; while (t-- >= 0) { // only copy printable numeric characters (in this case >= ' ') char c = screen[getPos(m-1,i-1)].getChar(); if (((c >= '0' && c <= '9') || c== '.' || c == ',' || c == '-') && !screen[getPos(m-1,i-1)].nonDisplay) { s.append(c); } i++; } if (s.length() > 0) { if (s.charAt(s.length()-1) == '-') { s.insert(0,'-'); s.deleteCharAt(s.length()-1); } try { Number n = df.parse(s.toString()); System.out.println(s + " " + n.doubleValue()); sumVector.add(new Double(n.doubleValue())); sum += n.doubleValue(); } catch (ParseException pe) { System.out.println(pe.getMessage() + " at " + pe.getErrorOffset()); } } s.setLength(0); m++; }// System.out.println(sum); return sumVector; } |
System.out.println(s + " " + n.doubleValue()); | protected final Vector sumThem(boolean which) { StringBuffer s = new StringBuffer(); getBoundingArea(workR); gui.rubberband.reset(); gui.repaint(); System.out.println("Summing"); System.out.println(workR); // loop through all the screen characters to send them to the clip board int m = workR.x; int i = 0; int t = 0; double sum = 0.0; // obtain the decimal format for parsing DecimalFormat df = (DecimalFormat)NumberFormat.getInstance() ; DecimalFormatSymbols dfs = df.getDecimalFormatSymbols(); if (which) { dfs.setDecimalSeparator('.'); dfs.setGroupingSeparator(','); } else { dfs.setDecimalSeparator(','); dfs.setGroupingSeparator('.'); } df.setDecimalFormatSymbols(dfs); Vector sumVector = new Vector(); while (workR.height-- >= 0) { t = workR.width; i = workR.y; while (t-- >= 0) { // only copy printable numeric characters (in this case >= ' ') char c = screen[getPos(m-1,i-1)].getChar(); if (((c >= '0' && c <= '9') || c== '.' || c == ',' || c == '-') && !screen[getPos(m-1,i-1)].nonDisplay) { s.append(c); } i++; } if (s.length() > 0) { if (s.charAt(s.length()-1) == '-') { s.insert(0,'-'); s.deleteCharAt(s.length()-1); } try { Number n = df.parse(s.toString()); System.out.println(s + " " + n.doubleValue()); sumVector.add(new Double(n.doubleValue())); sum += n.doubleValue(); } catch (ParseException pe) { System.out.println(pe.getMessage() + " at " + pe.getErrorOffset()); } } s.setLength(0); m++; }// System.out.println(sum); return sumVector; } |
|
int pos = getRowColFromPoint(end.x,end.y); | int pos = getPosFromView(end.x,end.y); | public Point translateEnd(Point end) { // because getRowColFromPoint returns position offset as 1,1 we need // to translate as offset 0,0 int pos = getRowColFromPoint(end.x,end.y);// if (pos >= 0 && pos <= lenScreen) { int x = screen[pos].x + fmWidth - 1; int y = screen[pos].y + fmHeight - 1;// System.out.println(" ex = " + x + " sx = " + rubberband.getStartPoint().x); end.setLocation(x,y);// }// else {// System.out.println(" pos is not good " + pos);// } return end; } |
int pos = getRowColFromPoint(start.x,start.y); | int pos = getPosFromView(start.x,start.y); | public Point translateStart(Point start) { // because getRowColFromPoint returns position offset as 1,1 we need // to translate as offset 0,0 int pos = getRowColFromPoint(start.x,start.y); start.setLocation(screen[pos].x,screen[pos].y); return start; } |
{ return GetScreen(buffer,bufferLength,0,lenScreen,plane); | public synchronized int GetScreen(char buffer[], int bufferLength, int plane)// throws OhioException { { return GetScreen(buffer,bufferLength,0,lenScreen,plane); } |
|
} | { return GetScreen(buffer, bufferLength, 0, lenScreen, plane); } | public synchronized int GetScreen(char buffer[], int bufferLength, int plane)// throws OhioException { { return GetScreen(buffer,bufferLength,0,lenScreen,plane); } |
int startPos, int endPos, int plane) { return planes.GetScreenRect(buffer, bufferLength, startPos, endPos, plane); | public synchronized int GetScreenRect(char buffer[], int bufferLength, int startPos, int endPos, int plane)// throws OhioException { { return planes.GetScreenRect(buffer, bufferLength, startPos, endPos, plane); } |
|
} | int startPos, int endPos, int plane) { return planes.GetScreenRect(buffer, bufferLength, startPos, endPos, plane); } | public synchronized int GetScreenRect(char buffer[], int bufferLength, int startPos, int endPos, int plane)// throws OhioException { { return planes.GetScreenRect(buffer, bufferLength, startPos, endPos, plane); } |
if (listeners == null) { listeners = new java.util.Vector(3); } listeners.addElement(listener); | if (listeners == null) { | public void addScreenListener(ScreenListener listener) { if (listeners == null) { listeners = new java.util.Vector(3); } listeners.addElement(listener); } |
} | listeners = new java.util.Vector(3); } listeners.addElement(listener); } | public void addScreenListener(ScreenListener listener) { if (listeners == null) { listeners = new java.util.Vector(3); } listeners.addElement(listener); } |
planes.setScreenCharAndAttr(sp, ' ', 32, false); | protected void createScrollBar(int flag, int totalRowScrollable, int totalColScrollable, int sliderRowPos, int sliderColPos, int sbSize) { // System.out.println("Scrollbar flag: " + flag + // " scrollable Rows: " + totalRowScrollable + // " scrollable Cols: " + totalColScrollable + // " thumb Row: " + sliderRowPos + // " thumb Col: " + sliderColPos + // " size: " + sbSize + // " row: " + getRow(lastPos) + // " col: " + getCol(lastPos)); int sp = lastPos; int size = sbSize - 2; int thumbPos = (int) (size * (float) ((float) sliderColPos / (float) totalColScrollable)); // System.out.println(thumbPos); planes.setScreenCharAndAttr(sp,' ', 32, false); planes.setUseGUI(sp,BUTTON_SB_UP); int ctr = 0; while (ctr < size) { sp += numCols; planes.setScreenCharAndAttr(sp,' ', 32, false); if (ctr == thumbPos) planes.setUseGUI(sp,BUTTON_SB_THUMB); else planes.setUseGUI(sp, BUTTON_SB_GUIDE); ctr++; } sp += numCols; planes.setScreenCharAndAttr(sp, ' ', 32, false); planes.setUseGUI(sp, BUTTON_SB_DN); } |
|
sf.setRightAdjusted(); break; case 6: rightAdjustField(' '); | private boolean fieldExit() { int pos = lastPos; boolean mdt = false; int end = endOfField(false); // get the ending position of the first // non blank character in field ScreenField sf = screenFields.getCurrentField(); if (sf.isMandatoryEnter() && end == sf.startPos()) { displayError(ERR_MANDITORY_ENTER); return false; } // get the number of characters to the right int count = (end - sf.startPos()) - sf.getKeyPos(pos); if (count == 0 && sf.isFER()) { mdt = true; return mdt; } for (; count >= 0; count--) {// screen[pos].setChar(initChar); planes.setChar(pos,initChar); setDirty(pos); pos++; mdt = true; } int adj = sf.getAdjustment(); if (adj != 0) { switch (adj) { case 5: rightAdjustField('0'); sf.setRightAdjusted(); break; case 6: rightAdjustField(' '); sf.setRightAdjusted(); break; case 7: sf.setManditoryEntered(); break; } } else { // we need to right adjust signed numeric fields as well. if (sf.isSignedNumeric()) { rightAdjustField(' '); } } return mdt; } |
|
int startRow = getRow(lastPos); int startCol = getCol(lastPos); | private synchronized void fireCursorChanged(int update) { int startRow = getRow(lastPos); int startCol = getCol(lastPos); if (listeners != null) { int size = listeners.size(); for (int i = 0; i < size; i++) { ScreenListener target = (ScreenListener)listeners.elementAt(i); target.onScreenChanged(update,startRow,startCol,startRow,startCol); } } } |
|
if (listeners != null) { int size = listeners.size(); for (int i = 0; i < size; i++) { ScreenListener target = (ScreenListener)listeners.elementAt(i); target.onScreenChanged(update,startRow,startCol,startRow,startCol); } } } | int startRow = getRow(lastPos); int startCol = getCol(lastPos); if (listeners != null) { int size = listeners.size(); for (int i = 0; i < size; i++) { ScreenListener target = (ScreenListener) listeners.elementAt(i); target.onScreenChanged(update, startRow, startCol, startRow, startCol); } } } | private synchronized void fireCursorChanged(int update) { int startRow = getRow(lastPos); int startCol = getCol(lastPos); if (listeners != null) { int size = listeners.size(); for (int i = 0; i < size; i++) { ScreenListener target = (ScreenListener)listeners.elementAt(i); target.onScreenChanged(update,startRow,startCol,startRow,startCol); } } } |
int endRow, int endCol) { | private void fireScreenChanged(int which, int startRow, int startCol, int endRow, int endCol) { if (listeners != null) { int size = listeners.size(); for (int i = 0; i < size; i++) { ScreenListener target = (ScreenListener)listeners.elementAt(i); target.onScreenChanged(1,startRow,startCol,endRow,endCol); } } dirtyScreen.setBounds(lenScreen,0,0,0); } |
|
if (listeners != null) { int size = listeners.size(); for (int i = 0; i < size; i++) { ScreenListener target = (ScreenListener)listeners.elementAt(i); target.onScreenChanged(1,startRow,startCol,endRow,endCol); } } dirtyScreen.setBounds(lenScreen,0,0,0); } | int endRow, int endCol) { if (listeners != null) { int size = listeners.size(); for (int i = 0; i < size; i++) { ScreenListener target = (ScreenListener) listeners.elementAt(i); target.onScreenChanged(1, startRow, startCol, endRow, endCol); } } dirtyScreen.setBounds(lenScreen, 0, 0, 0); } | private void fireScreenChanged(int which, int startRow, int startCol, int endRow, int endCol) { if (listeners != null) { int size = listeners.size(); for (int i = 0; i < size; i++) { ScreenListener target = (ScreenListener)listeners.elementAt(i); target.onScreenChanged(1,startRow,startCol,endRow,endCol); } } dirtyScreen.setBounds(lenScreen,0,0,0); } |
public char[] getData(int startRow, int startCol, int endRow, int endCol, int plane) { try { int from = getPos(startRow,startCol); int to = getPos(endRow,endCol); if (from > to) { | public char[] getData(int startRow, int startCol, int endRow, int endCol, int plane) { | public char[] getData(int startRow, int startCol, int endRow, int endCol, int plane) { try { int from = getPos(startRow,startCol); int to = getPos(endRow,endCol); if (from > to) { int f = from; to = f; from = f; } return planes.getPlaneData(from,to,plane); } catch (Exception oe) { return null; } } |
int f = from; to = f; from = f; } return planes.getPlaneData(from,to,plane); } catch (Exception oe) { return null; } | try { | public char[] getData(int startRow, int startCol, int endRow, int endCol, int plane) { try { int from = getPos(startRow,startCol); int to = getPos(endRow,endCol); if (from > to) { int f = from; to = f; from = f; } return planes.getPlaneData(from,to,plane); } catch (Exception oe) { return null; } } |
} | int from = getPos(startRow, startCol); int to = getPos(endRow, endCol); if (from > to) { int f = from; to = f; from = f; } return planes.getPlaneData(from, to, plane); } catch (Exception oe) { return null; } } | public char[] getData(int startRow, int startCol, int endRow, int endCol, int plane) { try { int from = getPos(startRow,startCol); int to = getPos(endRow,endCol); if (from > to) { int f = from; to = f; from = f; } return planes.getPlaneData(from,to,plane); } catch (Exception oe) { return null; } } |
return cursorActive; | public boolean isCursorActive() { return cursorActive; } |
|
} | return cursorActive; } | public boolean isCursorActive() { return cursorActive; } |
int minr = Math.min(getRow(pos),getRow(dirtyScreen.x)); int minc = Math.min(getCol(pos),getCol(dirtyScreen.x)); | int minr = Math.min(getRow(pos), getRow(dirtyScreen.x)); | protected void setDirty(int pos) { int minr = Math.min(getRow(pos),getRow(dirtyScreen.x)); int minc = Math.min(getCol(pos),getCol(dirtyScreen.x)); int maxr = Math.max(getRow(pos),getRow(dirtyScreen.y)); int maxc = Math.max(getCol(pos),getCol(dirtyScreen.y)); int x1 = getPos(minr,minc); int x2 = getPos(maxr,maxc); dirtyScreen.setBounds(x1,x2,0,0); } |
int maxr = Math.max(getRow(pos),getRow(dirtyScreen.y)); int maxc = Math.max(getCol(pos),getCol(dirtyScreen.y)); | int minc = Math.min(getCol(pos), getCol(dirtyScreen.x)); | protected void setDirty(int pos) { int minr = Math.min(getRow(pos),getRow(dirtyScreen.x)); int minc = Math.min(getCol(pos),getCol(dirtyScreen.x)); int maxr = Math.max(getRow(pos),getRow(dirtyScreen.y)); int maxc = Math.max(getCol(pos),getCol(dirtyScreen.y)); int x1 = getPos(minr,minc); int x2 = getPos(maxr,maxc); dirtyScreen.setBounds(x1,x2,0,0); } |
int x1 = getPos(minr,minc); int x2 = getPos(maxr,maxc); | int maxr = Math.max(getRow(pos), getRow(dirtyScreen.y)); | protected void setDirty(int pos) { int minr = Math.min(getRow(pos),getRow(dirtyScreen.x)); int minc = Math.min(getCol(pos),getCol(dirtyScreen.x)); int maxr = Math.max(getRow(pos),getRow(dirtyScreen.y)); int maxc = Math.max(getCol(pos),getCol(dirtyScreen.y)); int x1 = getPos(minr,minc); int x2 = getPos(maxr,maxc); dirtyScreen.setBounds(x1,x2,0,0); } |
dirtyScreen.setBounds(x1,x2,0,0); | int maxc = Math.max(getCol(pos), getCol(dirtyScreen.y)); int x1 = getPos(minr, minc); int x2 = getPos(maxr, maxc); dirtyScreen.setBounds(x1, x2, 0, 0); | protected void setDirty(int pos) { int minr = Math.min(getRow(pos),getRow(dirtyScreen.x)); int minc = Math.min(getCol(pos),getCol(dirtyScreen.x)); int maxr = Math.max(getRow(pos),getRow(dirtyScreen.y)); int maxc = Math.max(getCol(pos),getCol(dirtyScreen.y)); int x1 = getPos(minr,minc); int x2 = getPos(maxr,maxc); dirtyScreen.setBounds(x1,x2,0,0); } |
oia.setKeysBuffered(false); | protected void setPrehelpState(boolean setErrorCode, boolean lockKeyboard, boolean unlockIfLocked) { statusErrorCode = setErrorCode; if (oia.isKeyBoardLocked() && unlockIfLocked) oia.setKeyBoardLocked(false); else oia.setKeyBoardLocked(lockKeyboard); bufferedKeys = null; oia.setKeysBuffered(false); } |
|
oia.setKeysBuffered(false); | protected void setPrehelpState(boolean setErrorCode, boolean lockKeyboard, boolean unlockIfLocked) { statusErrorCode = setErrorCode; if (oia.isKeyBoardLocked() && unlockIfLocked) oia.setKeyBoardLocked(false); else oia.setKeyBoardLocked(lockKeyboard); bufferedKeys = null; oia.setKeysBuffered(false); } |
|
if (location < 0 || location > lenScreen) { return; } | protected synchronized void setScreenData(String text, int location) {// throws OhioException { if (location < 0 || location > lenScreen) { return;// throw new OhioException(sessionVT.getSessionConfiguration(),// OhioScreen5250.class.getName(), "osohio.screen.ohio00300", 1); } int pos = location; int l = text.length(); boolean updated = false; boolean flag = false; int x =0; for (; x < l; x++) { if (isInField(pos + x,true)) { if (!screenFields.getCurrentField().isBypassField()) { if (!flag) { screenFields.getCurrentField().setMDT(); updated = true; resetDirty(pos + x); screenFields.setMasterMDT(); flag = true; } planes.screen[pos + x] = text.charAt(x); setDirty(pos + x); } } } lastPos = pos + x; if (updated) { fireScreenChanged(1); } } |
|
int pos = location; | if (location < 0 || location > lenScreen) { | protected synchronized void setScreenData(String text, int location) {// throws OhioException { if (location < 0 || location > lenScreen) { return;// throw new OhioException(sessionVT.getSessionConfiguration(),// OhioScreen5250.class.getName(), "osohio.screen.ohio00300", 1); } int pos = location; int l = text.length(); boolean updated = false; boolean flag = false; int x =0; for (; x < l; x++) { if (isInField(pos + x,true)) { if (!screenFields.getCurrentField().isBypassField()) { if (!flag) { screenFields.getCurrentField().setMDT(); updated = true; resetDirty(pos + x); screenFields.setMasterMDT(); flag = true; } planes.screen[pos + x] = text.charAt(x); setDirty(pos + x); } } } lastPos = pos + x; if (updated) { fireScreenChanged(1); } } |
int l = text.length(); boolean updated = false; boolean flag = false; int x =0; for (; x < l; x++) { if (isInField(pos + x,true)) { if (!screenFields.getCurrentField().isBypassField()) { if (!flag) { screenFields.getCurrentField().setMDT(); updated = true; resetDirty(pos + x); screenFields.setMasterMDT(); flag = true; } | return; | protected synchronized void setScreenData(String text, int location) {// throws OhioException { if (location < 0 || location > lenScreen) { return;// throw new OhioException(sessionVT.getSessionConfiguration(),// OhioScreen5250.class.getName(), "osohio.screen.ohio00300", 1); } int pos = location; int l = text.length(); boolean updated = false; boolean flag = false; int x =0; for (; x < l; x++) { if (isInField(pos + x,true)) { if (!screenFields.getCurrentField().isBypassField()) { if (!flag) { screenFields.getCurrentField().setMDT(); updated = true; resetDirty(pos + x); screenFields.setMasterMDT(); flag = true; } planes.screen[pos + x] = text.charAt(x); setDirty(pos + x); } } } lastPos = pos + x; if (updated) { fireScreenChanged(1); } } |
planes.screen[pos + x] = text.charAt(x); setDirty(pos + x); } } | protected synchronized void setScreenData(String text, int location) {// throws OhioException { if (location < 0 || location > lenScreen) { return;// throw new OhioException(sessionVT.getSessionConfiguration(),// OhioScreen5250.class.getName(), "osohio.screen.ohio00300", 1); } int pos = location; int l = text.length(); boolean updated = false; boolean flag = false; int x =0; for (; x < l; x++) { if (isInField(pos + x,true)) { if (!screenFields.getCurrentField().isBypassField()) { if (!flag) { screenFields.getCurrentField().setMDT(); updated = true; resetDirty(pos + x); screenFields.setMasterMDT(); flag = true; } planes.screen[pos + x] = text.charAt(x); setDirty(pos + x); } } } lastPos = pos + x; if (updated) { fireScreenChanged(1); } } |
|
} lastPos = pos + x; if (updated) { fireScreenChanged(1); } | protected synchronized void setScreenData(String text, int location) {// throws OhioException { if (location < 0 || location > lenScreen) { return;// throw new OhioException(sessionVT.getSessionConfiguration(),// OhioScreen5250.class.getName(), "osohio.screen.ohio00300", 1); } int pos = location; int l = text.length(); boolean updated = false; boolean flag = false; int x =0; for (; x < l; x++) { if (isInField(pos + x,true)) { if (!screenFields.getCurrentField().isBypassField()) { if (!flag) { screenFields.getCurrentField().setMDT(); updated = true; resetDirty(pos + x); screenFields.setMasterMDT(); flag = true; } planes.screen[pos + x] = text.charAt(x); setDirty(pos + x); } } } lastPos = pos + x; if (updated) { fireScreenChanged(1); } } |
|
} | } int pos = location; int l = text.length(); boolean updated = false; boolean flag = false; int x = 0; for (; x < l; x++) { if (isInField(pos + x, true)) { if (!screenFields.getCurrentField().isBypassField()) { if (!flag) { screenFields.getCurrentField().setMDT(); updated = true; resetDirty(pos + x); screenFields.setMasterMDT(); flag = true; } planes.screen[pos + x] = text.charAt(x); setDirty(pos + x); } } } lastPos = pos + x; if (updated) { fireScreenChanged(1); } } | protected synchronized void setScreenData(String text, int location) {// throws OhioException { if (location < 0 || location > lenScreen) { return;// throw new OhioException(sessionVT.getSessionConfiguration(),// OhioScreen5250.class.getName(), "osohio.screen.ohio00300", 1); } int pos = location; int l = text.length(); boolean updated = false; boolean flag = false; int x =0; for (; x < l; x++) { if (isInField(pos + x,true)) { if (!screenFields.getCurrentField().isBypassField()) { if (!flag) { screenFields.getCurrentField().setMDT(); updated = true; resetDirty(pos + x); screenFields.setMasterMDT(); flag = true; } planes.screen[pos + x] = text.charAt(x); setDirty(pos + x); } } } lastPos = pos + x; if (updated) { fireScreenChanged(1); } } |
if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) | if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.getCurrentField().startPos() == lastPos) displayError(ERR_CURSOR_PROTECTED); else { screenFields.getCurrentField().getKeyPos(lastPos); screenFields.getCurrentField().changePos(-1); resetDirty(screenFields.getCurrentField().getCurrentPos()); shiftLeft(screenFields.getCurrentField().getCurrentPos()); updateDirty(); 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()) { resetDirty(lastPos); screenFields.getCurrentField().getKeyPos(lastPos); shiftLeft(screenFields.getCurrentFieldPos()); screenFields.setCurrentFieldMDT(); updateDirty(); 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) { setCursor((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()) { 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); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case ERASE_FIELD: if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { 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); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case INSERT: insertMode = insertMode ? false : true; break; case HOME: if (lastPos + numCols + 1 != homePos) { goto_XY(homePos - numCols - 1); 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) { planes.setChar(lastPos, '-'); 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()) { resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); 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()) { resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); 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) { planes.setChar(lastPos, '-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields .isCurrentFieldContinuedMiddle() || screenFields .isCurrentFieldContinuedLast()); } } updateDirty(); 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(); } else { setPrehelpState(false, oia.isKeyBoardLocked(), false); } simulated = true; break; case ATTN: sessionVT.sendAttentionKey(); simulated = true; break; case DUP_FIELD: if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.isCurrentFieldDupEnabled()) { resetDirty(lastPos); screenFields.getCurrentField().setFieldChar(lastPos, (char) 0x1C); screenFields.setCurrentFieldMDT(); gotoFieldNext(); updateDirty(); 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; if (startRow == getRows()) startRow = 0; setCursor(++startRow, 1); if (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { while (!isInField() && screenFields.getCurrentField() != null | 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: if (!screenFields.isCanSendAid()) { displayError(ERR_ENTER_NO_ALLOWED); } else 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 { screenFields.getCurrentField().getKeyPos(lastPos); screenFields.getCurrentField().changePos(-1); resetDirty(screenFields.getCurrentField().getCurrentPos()); shiftLeft(screenFields.getCurrentField().getCurrentPos()); updateDirty(); 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()) { resetDirty(lastPos); screenFields.getCurrentField().getKeyPos(lastPos); shiftLeft(screenFields.getCurrentFieldPos()); screenFields.setCurrentFieldMDT(); updateDirty(); 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) { setCursor((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()) { 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); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case ERASE_FIELD: if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { 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); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case INSERT: // we toggle it insertMode = insertMode ? false : true; 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) { planes.setChar(lastPos,'-'); 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()) { resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); 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()) { resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); 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) { planes.setChar(lastPos,'-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields .isCurrentFieldContinuedMiddle() || screenFields .isCurrentFieldContinuedLast()); } } updateDirty(); 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(); } else { setPrehelpState(false, oia.isKeyBoardLocked(), false); } simulated = true; break; case ATTN: sessionVT.sendAttentionKey(); simulated = true; break; case DUP_FIELD: if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.isCurrentFieldDupEnabled()) { resetDirty(lastPos); screenFields.getCurrentField().setFieldChar(lastPos, (char) 0x1C); screenFields.setCurrentFieldMDT(); gotoFieldNext(); updateDirty(); 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; if (startRow == getRows()) startRow = 0; setCursor(++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; } } } } simulated = true; break; default: log.info(" Mnemonic not supported " + mnem); break; } return simulated; } |
if (screenFields.getCurrentField().startPos() == lastPos) displayError(ERR_CURSOR_PROTECTED); else { screenFields.getCurrentField().getKeyPos(lastPos); screenFields.getCurrentField().changePos(-1); resetDirty(screenFields.getCurrentField().getCurrentPos()); shiftLeft(screenFields.getCurrentField().getCurrentPos()); updateDirty(); 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()) { resetDirty(lastPos); screenFields.getCurrentField().getKeyPos(lastPos); shiftLeft(screenFields.getCurrentFieldPos()); screenFields.setCurrentFieldMDT(); updateDirty(); 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) { setCursor((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()) { 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()); | advancePos(); if (lastPos == startPos) { goto_XY(startPos); break; } | 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: if (!screenFields.isCanSendAid()) { displayError(ERR_ENTER_NO_ALLOWED); } else 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 { screenFields.getCurrentField().getKeyPos(lastPos); screenFields.getCurrentField().changePos(-1); resetDirty(screenFields.getCurrentField().getCurrentPos()); shiftLeft(screenFields.getCurrentField().getCurrentPos()); updateDirty(); 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()) { resetDirty(lastPos); screenFields.getCurrentField().getKeyPos(lastPos); shiftLeft(screenFields.getCurrentFieldPos()); screenFields.setCurrentFieldMDT(); updateDirty(); 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) { setCursor((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()) { 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); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case ERASE_FIELD: if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { 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); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case INSERT: // we toggle it insertMode = insertMode ? false : true; 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) { planes.setChar(lastPos,'-'); 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()) { resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); 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()) { resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); 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) { planes.setChar(lastPos,'-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields .isCurrentFieldContinuedMiddle() || screenFields .isCurrentFieldContinuedLast()); } } updateDirty(); 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(); } else { setPrehelpState(false, oia.isKeyBoardLocked(), false); } simulated = true; break; case ATTN: sessionVT.sendAttentionKey(); simulated = true; break; case DUP_FIELD: if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.isCurrentFieldDupEnabled()) { resetDirty(lastPos); screenFields.getCurrentField().setFieldChar(lastPos, (char) 0x1C); screenFields.setCurrentFieldMDT(); gotoFieldNext(); updateDirty(); 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; if (startRow == getRows()) startRow = 0; setCursor(++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; } } } } simulated = true; break; default: log.info(" Mnemonic not supported " + mnem); break; } return simulated; } |
} updateDirty(); goto_XY(where); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case ERASE_FIELD: if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { 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); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case INSERT: insertMode = insertMode ? false : true; break; case HOME: if (lastPos + numCols + 1 != homePos) { goto_XY(homePos - numCols - 1); 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) { planes.setChar(lastPos,'-'); 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()) { resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); 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()) { resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); 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) { planes.setChar(lastPos,'-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields .isCurrentFieldContinuedMiddle() || screenFields .isCurrentFieldContinuedLast()); } } updateDirty(); 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(); } else { setPrehelpState(false, oia.isKeyBoardLocked(), false); } simulated = true; break; case ATTN: sessionVT.sendAttentionKey(); simulated = true; break; case DUP_FIELD: if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.isCurrentFieldDupEnabled()) { resetDirty(lastPos); screenFields.getCurrentField().setFieldChar(lastPos, (char) 0x1C); screenFields.setCurrentFieldMDT(); gotoFieldNext(); updateDirty(); 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; if (startRow == getRows()) startRow = 0; setCursor(++startRow, 1); if (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { while (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { advancePos(); if (lastPos == startPos) { goto_XY(startPos); break; } } } } simulated = true; break; | } } simulated = true; break; | 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: if (!screenFields.isCanSendAid()) { displayError(ERR_ENTER_NO_ALLOWED); } else 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 { screenFields.getCurrentField().getKeyPos(lastPos); screenFields.getCurrentField().changePos(-1); resetDirty(screenFields.getCurrentField().getCurrentPos()); shiftLeft(screenFields.getCurrentField().getCurrentPos()); updateDirty(); 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()) { resetDirty(lastPos); screenFields.getCurrentField().getKeyPos(lastPos); shiftLeft(screenFields.getCurrentFieldPos()); screenFields.setCurrentFieldMDT(); updateDirty(); 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) { setCursor((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()) { 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); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case ERASE_FIELD: if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { 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); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case INSERT: // we toggle it insertMode = insertMode ? false : true; 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) { planes.setChar(lastPos,'-'); 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()) { resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); 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()) { resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); 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) { planes.setChar(lastPos,'-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields .isCurrentFieldContinuedMiddle() || screenFields .isCurrentFieldContinuedLast()); } } updateDirty(); 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(); } else { setPrehelpState(false, oia.isKeyBoardLocked(), false); } simulated = true; break; case ATTN: sessionVT.sendAttentionKey(); simulated = true; break; case DUP_FIELD: if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.isCurrentFieldDupEnabled()) { resetDirty(lastPos); screenFields.getCurrentField().setFieldChar(lastPos, (char) 0x1C); screenFields.setCurrentFieldMDT(); gotoFieldNext(); updateDirty(); 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; if (startRow == getRows()) startRow = 0; setCursor(++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; } } } } simulated = true; break; default: log.info(" Mnemonic not supported " + mnem); break; } return simulated; } |
public synchronized int GetScreen(char buffer[], int bufferLength, int from, int length, int plane) { if(buffer == null) return 0; | public synchronized int GetScreen(char buffer[], int bufferLength, int plane) { | public synchronized int GetScreen(char buffer[], int bufferLength, int from, int length, int plane) {// if(buffer == null)// throw new OhioException(sessionVT.getSessionConfiguration(),// OhioScreen.class.getName(), "osohio.screen.ohio00300", 1); if(buffer == null) return 0; int min = Math.min(Math.min(buffer.length, bufferLength), screenSize); if ((from + min) > screenSize) { min = screenSize - from; } char[] pd = getPlaneData(from,from + min,plane); if(pd != null) { System.arraycopy(pd, 0, buffer, 0, min); return pd.length; } return 0; } |
int min = Math.min(Math.min(buffer.length, bufferLength), screenSize); if ((from + min) > screenSize) { min = screenSize - from; } | return GetScreen(buffer,bufferLength,0,screenSize,plane); | public synchronized int GetScreen(char buffer[], int bufferLength, int from, int length, int plane) {// if(buffer == null)// throw new OhioException(sessionVT.getSessionConfiguration(),// OhioScreen.class.getName(), "osohio.screen.ohio00300", 1); if(buffer == null) return 0; int min = Math.min(Math.min(buffer.length, bufferLength), screenSize); if ((from + min) > screenSize) { min = screenSize - from; } char[] pd = getPlaneData(from,from + min,plane); if(pd != null) { System.arraycopy(pd, 0, buffer, 0, min); return pd.length; } return 0; } |
char[] pd = getPlaneData(from,from + min,plane); if(pd != null) { System.arraycopy(pd, 0, buffer, 0, min); return pd.length; } return 0; | public synchronized int GetScreen(char buffer[], int bufferLength, int from, int length, int plane) {// if(buffer == null)// throw new OhioException(sessionVT.getSessionConfiguration(),// OhioScreen.class.getName(), "osohio.screen.ohio00300", 1); if(buffer == null) return 0; int min = Math.min(Math.min(buffer.length, bufferLength), screenSize); if ((from + min) > screenSize) { min = screenSize - from; } char[] pd = getPlaneData(from,from + min,plane); if(pd != null) { System.arraycopy(pd, 0, buffer, 0, min); return pd.length; } return 0; } |
|
protected void setScreenAttr(int pos, int attr) { | protected void setScreenAttr(int pos, int attr, boolean isAttr) { | protected void setScreenAttr(int pos, int attr) { screenAttr[pos] = (char)attr; screenGUI[pos] = initChar; disperseAttribute(pos,attr); } |
disperseAttribute(pos,attr); | protected void setScreenAttr(int pos, int attr) { screenAttr[pos] = (char)attr; screenGUI[pos] = initChar; disperseAttribute(pos,attr); } |
|
System.arraycopy(screen,0,fieldExtended,0,screenSize); System.arraycopy(screen,0,screenField,0,screenSize); | if (initArray == null) { initArray = new char[screenSize]; System.arraycopy(screen,0,initArray,0,screenSize); } System.arraycopy(initArray,0,fieldExtended,0,screenSize); System.arraycopy(initArray,0,screenField,0,screenSize); | protected void initalizePlanes () { for (int y = 0;y < screenSize; y++) { setScreenCharAndAttr(y,initChar,initAttr,false); screenGUI[y] = NO_GUI; screenIsChanged[y] = false; } // here we will just copy a plane that has already been initialized // onto the other planes using arraycopy which will be faster. I hope. System.arraycopy(screen,0,fieldExtended,0,screenSize); System.arraycopy(screen,0,screenField,0,screenSize); } |
protected boolean isInField(int pos, boolean chgToField) { ScreenField sf; for (int x = 0;x < sizeFields; x++) { sf = screenFields[x]; if (sf.withinField(pos)) { if (chgToField) { if (!currentField.equals(sf)) currentModified = false; currentField = sf; } return true; } } return false; | protected boolean isInField(int pos) { return isInField(pos,true); | protected boolean isInField(int pos, boolean chgToField) { ScreenField sf; for (int x = 0;x < sizeFields; x++) { sf = screenFields[x]; if (sf.withinField(pos)) { if (chgToField) { if (!currentField.equals(sf)) currentModified = false; currentField = sf; } return true; } } return false; } |
initArray = null; | protected void setSize(int newSize) { int oldRows = numRows; screenSize = newSize; numCols = 80; switch (newSize) { case 24: numRows = 24; break; case 27: numRows = 27; numCols = 132; break; } // this is used here when size changes setErrorLine(numRows); screenSize = numRows * numCols; screen = new char[screenSize]; screenAttr = new char[screenSize]; screenIsAttr = new char[screenSize]; screenGUI = new char[screenSize]; screenColor = new char[screenSize]; screenExtended = new char[screenSize]; fieldExtended = new char[screenSize]; screenIsChanged = new boolean[screenSize]; screenField = new char[screenSize]; initalizePlanes(); } |
|
throw new BAD_OPERATION("Policy expected"); | BAD_OPERATION bad = new BAD_OPERATION("Policy expected"); bad.minor = Minor.Any; throw bad; | public static Policy extract(Any any) { try { PolicyHolder h = (PolicyHolder) any.extract_Streamable(); return h.value; } catch (ClassCastException ex) { throw new BAD_OPERATION("Policy expected"); } } |
switch (logLevel) { case TN5250jLogger.OFF: intOFF.setSelected(true); break; case TN5250jLogger.DEBUG: intDEBUG.setSelected(true); break; case TN5250jLogger.INFO: intINFO.setSelected(true); break; case TN5250jLogger.WARN: intWARN.setSelected(true); break; case TN5250jLogger.ERROR: intERROR.setSelected(true); break; case TN5250jLogger.FATAL: intFATAL.setSelected(true); break; default: intINFO.setSelected(true); } | private void createLoggingPanel(){ loggingPanel.setLayout(new GridBagLayout()); // levelPanel levelPanel = new JPanel(new GridBagLayout()); TitledBorder tb = BorderFactory.createTitledBorder( LangTool.getString("logscr.Level")); tb.setTitleJustification(TitledBorder.CENTER); levelPanel.setBorder(tb); // Create the Checkboxes // The translation section is called ... // #Logging Literals // Search and translate into the message property-files ButtonGroup levelGroup = new ButtonGroup(); intOFF = new JRadioButton(LangTool.getString("logscr.Off")); intOFF.setSelected(true); intOFF.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(ItemEvent e) { intOFF_itemStateChanged(e); } }); intDEBUG = new JRadioButton(LangTool.getString("logscr.Debug")); intINFO = new JRadioButton(LangTool.getString("logscr.Info")); intWARN = new JRadioButton(LangTool.getString("logscr.Warn")); intERROR = new JRadioButton(LangTool.getString("logscr.Error")); intFATAL = new JRadioButton(LangTool.getString("logscr.Fatal")); // add the interface options to the group control levelGroup.add(intOFF); levelGroup.add(intDEBUG); levelGroup.add(intINFO); levelGroup.add(intWARN); levelGroup.add(intERROR); levelGroup.add(intFATAL); // add the levelPanel components gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(20, 20, 5, 20); levelPanel.add(intOFF, gbc); gbc.gridx = 0; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 20, 5, 20); levelPanel.add(intDEBUG, gbc); gbc.gridx = 0; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 20, 5, 20); levelPanel.add(intINFO, gbc); gbc.gridx = 0; gbc.gridy = 3; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 20, 5, 20); levelPanel.add(intWARN, gbc); gbc.gridx = 0; gbc.gridy = 4; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 20, 5, 20); levelPanel.add(intERROR, gbc); gbc.gridx = 0; gbc.gridy = 5; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 20, 20, 20); levelPanel.add(intFATAL, gbc); appenderPanel = new JPanel(new GridBagLayout()); tb = BorderFactory.createTitledBorder( LangTool.getString("logscr.Appender")); tb.setTitleJustification(TitledBorder.CENTER); appenderPanel.setBorder(tb); ButtonGroup appenderGroup = new ButtonGroup(); intConsole = new JRadioButton(LangTool.getString("logscr.Console")); intConsole.setSelected(true); intConsole.setEnabled(false); intConsole.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(ItemEvent e) { intConsole_itemStateChanged(e); } }); intFile = new JRadioButton(LangTool.getString("logscr.File")); intFile.setEnabled(false); intBoth = new JRadioButton(LangTool.getString("logscr.Both")); intBoth.setEnabled(false); appenderGroup.add(intConsole); appenderGroup.add(intFile); appenderGroup.add(intBoth); gbc.gridx = 0; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(20, 20, 5, 20); appenderPanel.add(intConsole, gbc); gbc.gridx = 0; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 20, 5, 20); appenderPanel.add(intFile, gbc); gbc.gridx = 0; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 20, 20, 20); appenderPanel.add(intBoth, gbc); // add the pannels to the mainpanel gbc.gridx = 0; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(10, 10, 10, 20); loggingPanel.add(levelPanel, gbc); gbc.gridx = 1; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(10, 20, 10, 10); loggingPanel.add(appenderPanel, gbc); } |
|
intConsole_itemStateChanged(e); | intDEBUG_itemStateChanged(e); | public void itemStateChanged(ItemEvent e) { intConsole_itemStateChanged(e); } |
TN5250jLogFactory.setLogLevels(TN5250jLogger.OFF); | private void intOFF_itemStateChanged(ItemEvent e) { if (!intOFF.isSelected() && TN5250jLogFactory.isLog4j()) { intConsole.setEnabled(true); intFile.setEnabled(true); intBoth.setEnabled(true); } else { intConsole.setEnabled(false); intConsole.setSelected(true); intFile.setEnabled(false); intBoth.setEnabled(false); } } |
|
setLogLevel(); | private void saveProps() { setOptionAccess(); setExternalPrograms(); ConfigureFactory.getInstance().saveSettings( ConfigureFactory.SESSIONS, "------ Session Information --------"); OptionAccessFactory.getInstance().reload(); } |
|
listener = new DefaultExceptionListener(); | listener = DefaultExceptionListener.INSTANCE; | public void setExceptionListener(ExceptionListener listener) { // uses a default implementation when null if (listener == null) { listener = new DefaultExceptionListener(); } exceptionListener = listener; } |
ClassLoader cl = security.getCallingClassLoader(); | ClassLoader cl = VMStackWalker.getCallingClassLoader(); | public static ResourceBundle getBundle(String baseName) { ClassLoader cl = security.getCallingClassLoader(); if (cl == null) cl = ClassLoader.getSystemClassLoader(); return getBundle(baseName, Locale.getDefault(), cl); } |
static ClassLoader currentClassLoader (SecurityManager sm) { | static ClassLoader currentClassLoader() { | static ClassLoader currentClassLoader (SecurityManager sm) { // TODO implement me return null; } |
protected void installDefaults(JTree tree) | protected void installDefaults() | protected void installDefaults(JTree tree) { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); tree.setFont(defaults.getFont("Tree.font")); tree.setForeground(defaults.getColor("Tree.foreground")); tree.setBackground(defaults.getColor("Tree.background")); tree.setOpaque(true); rightChildIndent = defaults.getInt("Tree.rightChildIndent"); leftChildIndent = defaults.getInt("Tree.leftChildIndent"); setRowHeight(defaults.getInt("Tree.rowHeight")); tree.requestFocusInWindow(false); } |
protected void uninstallDefaults(JTree tree) | protected void uninstallDefaults() | protected void uninstallDefaults(JTree tree) { tree.setFont(null); tree.setForeground(null); tree.setBackground(null); } |
setPropertiesFromAttributes(); | StyleSheet ss = getStyleSheet(); attributes = ss.getViewAttributes(this); preferenceChanged(null, true, true); | public void changedUpdate(DocumentEvent e, Shape a, ViewFactory f) { super.changedUpdate(e, a, f); setPropertiesFromAttributes(); } |
return super.getAttributes(); | if (attributes == null) { StyleSheet ss = getStyleSheet(); attributes = ss.getViewAttributes(this); } return attributes; | public AttributeSet getAttributes() { // FIXME: Implement this. return super.getAttributes(); } |
AttributeSet atts = getAttributes(); Object o = atts.getAttribute(CSS.Attribute.TEXT_DECORATION); boolean b = false; if (o != null && o.toString().contains("underline")) b = true; setUnderline(b); b = false; if (o != null && o.toString().contains("line-through")) b = true; setStrikeThrough(b); o = atts.getAttribute(CSS.Attribute.VERTICAL_ALIGN); b = false; if (o != null && o.toString().contains("sub")) b = true; setSubscript(b); b = false; if (o != null && o.toString().contains("sup")) b = true; setSuperscript(b); | protected void setPropertiesFromAttributes() { // FIXME: Implement this. super.setPropertiesFromAttributes(); } |
|
final String diffFileName = pkg + ".diff"; | final String diffFileName = pkg + ".pkgdiff"; | public void execute() { if (destDir == null) { throw new BuildException("The destdir attribute must be set"); } final Map vmFiles = scanJavaFiles(vmDirs); final Map classpathFiles = scanJavaFiles(classpathDirs); final TreeSet allFiles = new TreeSet(); final Map packageDiffs = new TreeMap(); allFiles.addAll(vmFiles.keySet()); allFiles.addAll(classpathFiles.keySet()); try { destDir.mkdirs(); final File outFile = new File(destDir, "classpath-compare.html"); final PrintWriter out = new PrintWriter(new FileWriter(outFile)); reportHeader(out); int missingInCp = 0; int missingInVm = 0; int needsMerge = 0; int diffVmSpecific = 0; int diffClasspathBugfix = 0; int diffNative = 0; int diffJNode = 0; for (Iterator i = allFiles.iterator(); i.hasNext(); ) { final String name = (String)i.next(); final JavaFile cpFile = (JavaFile)classpathFiles.get(name); final JavaFile vmFile = (JavaFile)vmFiles.get(name); if (!vmFiles.containsKey(name)) { reportMissing(out, cpFile.getClassName(), "classpath", getFlags(cpFile)); missingInCp++; } else if (!classpathFiles.containsKey(name)) { reportMissing(out, vmFile.getClassName(), "vm", 0); missingInVm++; } else { final String diffFileName = vmFile.getClassName() + ".diff"; int rc = runDiff(vmFile, cpFile, diffFileName, packageDiffs); switch (rc & ~FLAGS_MASK) { case NO_CHANGE: break; case NEEDS_MERGE: reportNeedsMerge(out, vmFile.getClassName(), diffFileName, rc & FLAGS_MASK); needsMerge++; break; default: throw new RuntimeException("Invalid rc " + rc); } if ((rc & FLAG_VM_SPECIFIC) != 0) { diffVmSpecific++; } if ((rc & FLAG_CLASSPATH_BUGFIX) != 0) { diffClasspathBugfix++; } if ((rc & FLAG_NATIVE) != 0) { diffNative++; } if ((rc & FLAG_JNODE) != 0) { diffJNode++; } // Let's compare them } } // Package diffs for (Iterator i = packageDiffs.entrySet().iterator(); i.hasNext(); ) { final Map.Entry entry = (Map.Entry)i.next(); final String pkg = (String)entry.getKey(); final String diff = (String)entry.getValue(); final String diffFileName = pkg + ".diff"; processPackageDiff(diffFileName, pkg, diff); reportPackageDiff(out, pkg, diffFileName, getFlags(diff)); } out.println("</table><p/>"); // Summary out.println("<a name='summary'/><h2>Summary</h2>"); if (missingInCp > 0) { out.println("Found " + missingInCp + " files missing in classpath</br>"); log("Found " + missingInCp + " files missing in classpath"); } if (missingInVm > 0) { out.println("Found " + missingInVm + " files missing in vm<br/>"); log("Found " + missingInVm + " files missing in vm"); } if (needsMerge > 0) { out.println("Found " + needsMerge + " files that needs merging<br/>"); log("Found " + needsMerge + " files that needs merging"); } if (diffVmSpecific > 0) { out.println("Found " + diffVmSpecific + " VM specific differences<br/>"); log("Found " + diffVmSpecific + " VM specific differences"); } if (diffClasspathBugfix > 0) { out.println("Found " + diffClasspathBugfix + " local classpath bugfixes<br/>"); log("Found " + diffClasspathBugfix + " local classpath bugfixes"); } if (diffNative > 0) { out.println("Found " + diffNative + " changes with native in it<br/>"); log("Found " + diffNative + " changes with native in it"); } if (diffJNode > 0) { out.println("Found " + diffJNode + " changes with JNode in it<br/>"); log("Found " + diffJNode + " changes with JNode in it"); } reportFooter(out); out.flush(); out.close(); } catch (IOException ex) { throw new BuildException(ex); } catch (InterruptedException ex) { throw new BuildException(ex); } } |
g.drawLine(x + 1, y + 1, x + w - 1, y + 1); g.drawLine(x + 1, y + 1, x + 1, y + h - 1); | g.drawLine(x + 1, y + 1, x + w - 3, y + 1); g.drawLine(x + 1, y + 1, x + 1, y + h - 2); | public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { Color saved = g.getColor(); g.setColor(highlight); g.drawLine(x + 1, y + 1, x + w - 1, y + 1); g.drawLine(x + 1, y + 1, x + 1, y + h - 1); g.setColor(shadow); g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1); g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1); g.setColor(darkShadow); g.drawLine(x, y + h, x + w, y + h); g.drawLine(x + w, y, x + w, y + h); g.setColor(saved); } |
g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1); g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1); | g.drawLine(x + 1, y + h - 2, x + w - 1, y + h - 2); g.drawLine(x + w - 2, y + 1, x + w - 2, y + h - 2); | public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { Color saved = g.getColor(); g.setColor(highlight); g.drawLine(x + 1, y + 1, x + w - 1, y + 1); g.drawLine(x + 1, y + 1, x + 1, y + h - 1); g.setColor(shadow); g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1); g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1); g.setColor(darkShadow); g.drawLine(x, y + h, x + w, y + h); g.drawLine(x + w, y, x + w, y + h); g.setColor(saved); } |
g.drawLine(x, y + h, x + w, y + h); g.drawLine(x + w, y, x + w, y + h); | g.drawLine(x, y + h - 1, x + w - 1, y + h - 1); g.drawLine(x + w - 1, y, x + w - 1, y + h - 1); | public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { Color saved = g.getColor(); g.setColor(highlight); g.drawLine(x + 1, y + 1, x + w - 1, y + 1); g.drawLine(x + 1, y + 1, x + 1, y + h - 1); g.setColor(shadow); g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1); g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1); g.setColor(darkShadow); g.drawLine(x, y + h, x + w, y + h); g.drawLine(x + w, y, x + w, y + h); g.setColor(saved); } |
} | public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { Color saved = g.getColor(); g.setColor(highlight); g.drawLine(x + 1, y + 1, x + w - 1, y + 1); g.drawLine(x + 1, y + 1, x + 1, y + h - 1); g.setColor(shadow); g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1); g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1); g.setColor(darkShadow); g.drawLine(x, y + h, x + w, y + h); g.drawLine(x + w, y, x + w, y + h); g.setColor(saved); } |
|
int len = p1 - p0; char[] buffer = new char[len]; for (int index = 0; index < len; ++index) buffer[index] = ch; g.drawChars(buffer, 0, len, x, y); return x + len * metrics.charWidth(ch); | for (int index = p0; index < p1; ++index) x = drawEchoCharacter(g, x, y, ch); return x; | protected int drawSelectedText(Graphics g, int x, int y, int p0, int p1) throws BadLocationException { // FIXME: Throw BadLocationException somehow. // Update font metrics. updateMetrics(); // Get echo character. char ch = getEchoChar(); // Set color for selected text. g.setColor(selectedColor); g.setColor(Color.BLACK); // Initialize buffer for faster drawing of all characters. int len = p1 - p0; char[] buffer = new char[len]; for (int index = 0; index < len; ++index) buffer[index] = ch; // Draw echo charaters. g.drawChars(buffer, 0, len, x, y); // Return new x position right of all drawn characters. return x + len * metrics.charWidth(ch); } |
Segment segment = new Segment(); | protected int drawUnselectedText(Graphics g, int x, int y, int p0, int p1) throws BadLocationException { // FIXME: Throw BadLocationException somehow. // Update font metrics. updateMetrics(); // Get echo character. char ch = getEchoChar(); Segment segment = new Segment(); // Set color for unselected text. g.setColor(unselectedColor); g.setColor(Color.BLACK); // Initialize buffer for faster drawing of all characters. p1--; getDocument().getText(p0, p1 - p0, segment); int len = segment.toString().length(); char[] buffer = new char[len]; for (int index = 0; index < len; ++index) buffer[index] = ch; y += getPreferredSpan(Y_AXIS)/2; // Draw echo charaters. g.drawChars(buffer, 0, len, x, y); // Return new x position right of all drawn characters. return x + (len * metrics.charWidth(ch)); } |
|
p1--; getDocument().getText(p0, p1 - p0, segment); int len = segment.toString().length(); char[] buffer = new char[len]; for (int index = 0; index < len; ++index) buffer[index] = ch; y += getPreferredSpan(Y_AXIS)/2; g.drawChars(buffer, 0, len, x, y); return x + (len * metrics.charWidth(ch)); | for (int index = p0; index < p1; ++index) x = drawEchoCharacter(g, x, y, ch); return x; | protected int drawUnselectedText(Graphics g, int x, int y, int p0, int p1) throws BadLocationException { // FIXME: Throw BadLocationException somehow. // Update font metrics. updateMetrics(); // Get echo character. char ch = getEchoChar(); Segment segment = new Segment(); // Set color for unselected text. g.setColor(unselectedColor); g.setColor(Color.BLACK); // Initialize buffer for faster drawing of all characters. p1--; getDocument().getText(p0, p1 - p0, segment); int len = segment.toString().length(); char[] buffer = new char[len]; for (int index = 0; index < len; ++index) buffer[index] = ch; y += getPreferredSpan(Y_AXIS)/2; // Draw echo charaters. g.drawChars(buffer, 0, len, x, y); // Return new x position right of all drawn characters. return x + (len * metrics.charWidth(ch)); } |
int size = listeners.size(); | Vector lc = new Vector(listeners); int size = lc.size(); | private synchronized void fireCursorChanged(int update) { int startRow = getRow(lastPos); int startCol = getCol(lastPos); if (listeners != null) { int size = listeners.size(); for (int i = 0; i < size; i++) { ScreenListener target = (ScreenListener)listeners.elementAt(i); target.onScreenChanged(update,startRow,startCol,startRow,startCol); } } } |
(ScreenListener)listeners.elementAt(i); | (ScreenListener)lc.elementAt(i); | private synchronized void fireCursorChanged(int update) { int startRow = getRow(lastPos); int startCol = getCol(lastPos); if (listeners != null) { int size = listeners.size(); for (int i = 0; i < size; i++) { ScreenListener target = (ScreenListener)listeners.elementAt(i); target.onScreenChanged(update,startRow,startCol,startRow,startCol); } } } |
int size = listeners.size(); | Vector lc = new Vector(listeners); int size = lc.size(); | private void fireScreenChanged(int which, int startRow, int startCol, int endRow, int endCol) { if (listeners != null) { int size = listeners.size(); for (int i = 0; i < size; i++) { ScreenListener target = (ScreenListener)listeners.elementAt(i); target.onScreenChanged(1,startRow,startCol,endRow,endCol); } } dirtyScreen.setBounds(lenScreen,0,0,0); } |
ScreenListener target = (ScreenListener)listeners.elementAt(i); | ScreenListener target = (ScreenListener)lc.elementAt(i); | private void fireScreenChanged(int which, int startRow, int startCol, int endRow, int endCol) { if (listeners != null) { int size = listeners.size(); for (int i = 0; i < size; i++) { ScreenListener target = (ScreenListener)listeners.elementAt(i); target.onScreenChanged(1,startRow,startCol,endRow,endCol); } } dirtyScreen.setBounds(lenScreen,0,0,0); } |
int size = listeners.size(); | Vector lc = new Vector(listeners); int size = lc.size(); | private void fireScreenSizeChanged() { if (listeners != null) { int size = listeners.size(); for (int i = 0; i < size; i++) { ScreenListener target = (ScreenListener)listeners.elementAt(i); target.onScreenSizeChanged(numRows,numCols); } } } |
(ScreenListener)listeners.elementAt(i); | (ScreenListener)lc.elementAt(i); | private void fireScreenSizeChanged() { if (listeners != null) { int size = listeners.size(); for (int i = 0; i < size; i++) { ScreenListener target = (ScreenListener)listeners.elementAt(i); target.onScreenSizeChanged(numRows,numCols); } } } |
indent = dealWithClosingGroupNodes(containedObj, outputstream, indent); | public void toXMLOutputStream ( OutputStream outputstream, Hashtable XMLDeclAttribs, String indent, boolean dontCloseNode, String newNodeNameString, String noChildObjectNodeName ) { //while writing out, attribHash should not be changed synchronized (attribHash) { 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 !=null) &&(!XMLDeclAttribs.isEmpty())) { indent = ""; writeXMLDeclToOutputStream(outputstream, XMLDeclAttribs); }*/ // 1. open this node, print its simple XML attributes if (nodeNameString != null) { if (Specification.getInstance().isPrettyXDFOutput()) 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(Specification.getInstance().getXDFStructureNodeName()) && !XMLDeclAttribs.isEmpty() ) nodeNameString = Specification.getInstance().getXDFRootNodeName();*/ 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) { int size = attribs.size(); for (int i = 0; i < size; i++) { Hashtable item = (Hashtable) attribs.get(i); writeOut(outputstream, " " + item.get("name") + "=\""); // this slows things down, should we use? //writeOutAttribute(outputstream, (String) item.get("value")); writeOut(outputstream, (String) item.get("value")); writeOut(outputstream, "\"" ); } } // 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 ((Specification.getInstance().isPrettyXDFOutput()) && (pcdata == null)) writeOut(outputstream, Constants.NEW_LINE); } // deal with object/list XML attributes, if any in our list int size = childObjs.size(); for (int i = 0; i < 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 (?) indent = dealWithOpeningGroupNodes(containedObj, outputstream, indent); indent = dealWithClosingGroupNodes(containedObj, outputstream, indent); String newindent = indent + Specification.getInstance().getPrettyXDFOutputIndentation(); containedObj.toXMLOutputStream(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) { indent = dealWithOpeningGroupNodes(containedObj, outputstream, indent); indent = dealWithClosingGroupNodes(containedObj, outputstream, indent); String newindent = indent + Specification.getInstance().getPrettyXDFOutputIndentation(); containedObj.toXMLOutputStream(outputstream, new Hashtable(), newindent); } } } else { // error: weird type, actually shouldnt occur. Is this needed?? Log.errorln("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 and close the node if ( childObjs.size() == 0 && pcdata == null && noChildObjectNodeName != null) { if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, indent + Specification.getInstance().getPrettyXDFOutputIndentation()); writeOut(outputstream, "<" + noChildObjectNodeName + "/>"); if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, Constants.NEW_LINE); } // ok, now deal with closing the node if (nodeNameString != null) { indent = dealWithClosingGroupNodes((BaseObject) this, outputstream, indent); if (Specification.getInstance().isPrettyXDFOutput() && pcdata == null) writeOut(outputstream, indent); if (!dontCloseNode) writeOut(outputstream, "</"+nodeNameString+">"); } } else { if (nodeNameString != null) { if (dontCloseNode) { // it may not have sub-objects, but we dont want to close it // (happens for group objects) writeOut(outputstream, ">"); } else { // no sub-objects, just close this node writeOut(outputstream, "/>"); } } } if (Specification.getInstance().isPrettyXDFOutput() && nodeNameString != null) writeOut(outputstream, Constants.NEW_LINE); }//synchronize } |
|
"MenuItem.selectionBackground", getMenuSelectedBackground(), "MenuItem.selectionForeground", getMenuSelectedForeground(), "Panel.background", new ColorUIResource(getControl()), | protected void initComponentDefaults(UIDefaults defaults) { super.initComponentDefaults(defaults); Object[] myDefaults = new Object[] { "Button.background", new ColorUIResource(getControl()), "Button.border", MetalBorders.getButtonBorder(), "Button.darkShadow", new ColorUIResource(getControlDarkShadow()), "Button.disabledText", new ColorUIResource(getControlDisabled()), "Button.focus", new ColorUIResource(getFocusColor()), "Button.font", getControlTextFont(), "Button.foreground", new ColorUIResource(getSystemTextColor()), "Button.highlight", new ColorUIResource(getControlHighlight()), "Button.light", new ColorUIResource(getControlHighlight()), "Button.margin", new Insets(2, 14, 2, 14), "Button.select", new ColorUIResource(getPrimaryControlShadow()), "Button.shadow", new ColorUIResource(getPrimaryControlShadow()), "CheckBox.background", new ColorUIResource(getControl()), "CheckBox.icon", new UIDefaults.ProxyLazyValue ("javax.swing.plaf.metal.MetalCheckBoxIcon"), "CheckBoxMenuItem.background", new ColorUIResource(getControl()), "ToolBar.background", new ColorUIResource(getControl()), "Panel.background", new ColorUIResource(getControl()), "Slider.background", new ColorUIResource(getControl()), "OptionPane.background", new ColorUIResource(getControl()), "ProgressBar.background", new ColorUIResource(getControl()), "ScrollPane.border", new MetalBorders.ScrollPaneBorder(), "TabbedPane.background", new ColorUIResource(getControl()), "Label.background", new ColorUIResource(getControl()), "Label.font", getControlTextFont(), "Label.disabledForeground", new ColorUIResource(getControlDisabled()), "Label.foreground", new ColorUIResource(getSystemTextColor()), "Menu.background", new ColorUIResource(getControl()), "Menu.font", getControlTextFont(), "MenuBar.background", new ColorUIResource(getControl()), "MenuBar.font", getControlTextFont(), "MenuItem.background", new ColorUIResource(getControl()), "MenuItem.font", getControlTextFont(), "RadioButton.icon", new UIDefaults.LazyValue() { public Object createValue(UIDefaults def) { return MetalIconFactory.getRadioButtonIcon(); } }, "ScrollBar.background", new ColorUIResource(getControl()), "ScrollBar.shadow", new ColorUIResource(getControlShadow()), "ScrollBar.thumb", new ColorUIResource(getPrimaryControlShadow()), "ScrollBar.thumbDarkShadow", new ColorUIResource(getPrimaryControlDarkShadow()), "ScrollBar.thumbHighlight", new ColorUIResource(getPrimaryControl()), "SplitPane.darkShadow", new ColorUIResource(getControlDarkShadow()), "SplitPane.highlight", new ColorUIResource(getControlHighlight()), "Slider.focusInsets", new InsetsUIResource(0, 0, 0, 0), "Slider.horizontalThumbIcon", MetalIconFactory.getHorizontalSliderThumbIcon(), "Slider.verticalThumbIcon", MetalIconFactory.getVerticalSliderThumbIcon(), "Slider.trackWidth", new Integer(7), "Slider.majorTickLength", new Integer(6), "ToggleButton.background", new ColorUIResource(getControl()), "ToggleButton.border", MetalBorders.getButtonBorder(), "ToggleButton.darkShadow", new ColorUIResource(getControlDarkShadow()), "ToggleButton.disabledText", new ColorUIResource(getControlDisabled()), "ToggleButton.focus", new ColorUIResource(getFocusColor()), "ToggleButton.font", getControlTextFont(), "ToggleButton.foreground", new ColorUIResource(getSystemTextColor()), "ToggleButton.highlight", new ColorUIResource(getControlHighlight()), "ToggleButton.light", new ColorUIResource(getControlHighlight()), "ToggleButton.margin", new Insets(2, 14, 2, 14), "ToggleButton.select", new ColorUIResource(getPrimaryControlShadow()), "ToggleButton.shadow", new ColorUIResource(getPrimaryControlShadow()), "Tree.openIcon", MetalIconFactory.getTreeFolderIcon(), "Tree.closedIcon", MetalIconFactory.getTreeFolderIcon(), "Tree.leafIcon", MetalIconFactory.getTreeLeafIcon(), "Tree.collapsedIcon", MetalIconFactory.getTreeControlIcon(true), "Tree.expandedIcon", MetalIconFactory.getTreeControlIcon(false), "Tree.font", new FontUIResource(new Font("Helvetica", Font.PLAIN, 12)), "Tree.background", new ColorUIResource(Color.white), "Tree.foreground", new ColorUIResource(new Color(204, 204, 255)), "Tree.hash", new ColorUIResource(new Color(204, 204, 255)), "Tree.leftChildIndent", new Integer(7), "Tree.rightChildIndent", new Integer(13), "Tree.rowHeight", new Integer(20), "Tree.scrollsOnExpand", Boolean.TRUE, "Tree.selectionBackground", new ColorUIResource(new Color(204, 204, 255)), "Tree.nonSelectionBackground", new ColorUIResource(Color.white), "Tree.selectionBorderColor", new ColorUIResource(new Color(102, 102, 153)), "Tree.selectionForeground", new ColorUIResource(Color.black), "Tree.textBackground", new ColorUIResource(new Color(204, 204, 255)), "Tree.textForeground", new ColorUIResource(Color.black), "Tree.selectionForeground", new ColorUIResource(Color.black), "PopupMenu.border", new MetalBorders.PopupMenuBorder() }; defaults.putDefaults(myDefaults); } |
|
private static final void checkTag(int value_tag) { if ((value_tag < 0x7fffff00 || value_tag > 0x7fffffff) && value_tag != vt_NULL && value_tag != vt_INDIRECTION ) throw new MARSHAL("Invalid value record, unsupported header tag: " + value_tag ); } | static void checkTag(int value_tag) { if ((value_tag < 0x7fffff00 || value_tag > 0x7fffffff) && value_tag != vt_NULL && value_tag != vt_INDIRECTION) { MARSHAL m = new MARSHAL("Invalid value record, unsupported header tag: " + value_tag + " (0x" + Integer.toHexString(value_tag) + ")"); m.minor = Minor.ValueHeaderTag; throw m; } if ((value_tag & vf_MULTIPLE_IDS) != 0 && (value_tag & vf_ID) == 0) { MARSHAL m = new MARSHAL("Invalid value record header flag combination (0x" + Integer.toHexString(value_tag) + ")"); m.minor = Minor.ValueHeaderFlags; throw m; } } | private static final void checkTag(int value_tag) { if ((value_tag < 0x7fffff00 || value_tag > 0x7fffffff) && value_tag != vt_NULL && value_tag != vt_INDIRECTION ) throw new MARSHAL("Invalid value record, unsupported header tag: " + value_tag ); } |
private static Object read_instance(InputStream input, Object value, int value_tag, Object helper ) | static Object read_instance(InputStream input, final int position, Object value, int value_tag, BoxedValueHelper helper, String id, String[] ids, String codebase) | private static Object read_instance(InputStream input, Object value, int value_tag, Object helper ) { try { if ((value_tag & vf_CHUNKING) != 0) { ByteArrayOutputStream bout = null; int n = -1; // Read all chunks. int chunk_size = input.read_long(); if (chunk_size < 0) throw new MARSHAL("Invalid first chunk size " + chunk_size); byte[] r = new byte[ chunk_size ]; while (chunk_size > 0) { if (r.length < chunk_size) r = new byte[ chunk_size + 256 ]; n = 0; reading: while (n < chunk_size) n += input.read(r, n, r.length - n); // Read the size of the next chunk. chunk_size = input.read_long(); // If the value is non negative, there is more than one chunk. // Accumulate chunks in the buffer. // The last chunk (or the only chunk, if only one chunk is // present) is not written in the buffer. It is stored in the // array r, avoiding unnecessary buffer operations. if (chunk_size > 0) { bout = new ByteArrayOutputStream(2 * chunk_size); bout.write(r, 0, chunk_size); } } if (bout != null) { // More than one chunk was present. // Add the last chunk. bout.write(r, 0, n); input = new noHeaderInput(bout.toByteArray()); } else { // Only one chunk was present. input = new noHeaderInput(r); } } else { if (input instanceof cdrBufInput) { // Highly probable case. input = new noHeaderInput(((cdrBufInput) input).buffer.getBuffer()); } else { cdrBufOutput bout = new cdrBufOutput(); int c; while ((c = input.read()) >= 0) bout.write((byte) c); input = new noHeaderInput(bout.buffer.toByteArray()); } } } catch (IOException ex) { MARSHAL m = new MARSHAL("Unable to read chunks"); m.initCause(ex); throw m; } // The user-defines io operations are implemented. if (value instanceof CustomMarshal) { CustomMarshal marsh = (CustomMarshal) value; try { marsh.unmarshal((DataInputStream) input); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else // The IDL-generated io operations are implemented. if (value instanceof Streamable) { ((Streamable) value)._read(input); } else if (helper instanceof BoxedValueHelper) value = ((BoxedValueHelper) helper).read_value(input); else if (helper instanceof ValueFactory) value = ((ValueFactory) helper).read_value((org.omg.CORBA_2_3.portable.InputStream) input); else // Stating the interfaces that the USER should use. throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue or CustomValue." ); // The negative end of state marker is expected from OMG standard. // If the chunking is used, this marker is already extracted. if ((value_tag & vf_CHUNKING) == 0) { int eor = input.read_long(); if (eor >= 0) throw new MARSHAL("End of state marker has an invalid value " + eor); } return value; } |
ByteArrayOutputStream bout = null; int n = -1; | cdrBufOutput output = createBuffer(input, 1024); readNestedValue(value_tag, input, output, -1); cdrBufInput ci = new cdrBufInput(output.buffer.getBuffer()); ci.setRunTime(output.getRunTime()); | private static Object read_instance(InputStream input, Object value, int value_tag, Object helper ) { try { if ((value_tag & vf_CHUNKING) != 0) { ByteArrayOutputStream bout = null; int n = -1; // Read all chunks. int chunk_size = input.read_long(); if (chunk_size < 0) throw new MARSHAL("Invalid first chunk size " + chunk_size); byte[] r = new byte[ chunk_size ]; while (chunk_size > 0) { if (r.length < chunk_size) r = new byte[ chunk_size + 256 ]; n = 0; reading: while (n < chunk_size) n += input.read(r, n, r.length - n); // Read the size of the next chunk. chunk_size = input.read_long(); // If the value is non negative, there is more than one chunk. // Accumulate chunks in the buffer. // The last chunk (or the only chunk, if only one chunk is // present) is not written in the buffer. It is stored in the // array r, avoiding unnecessary buffer operations. if (chunk_size > 0) { bout = new ByteArrayOutputStream(2 * chunk_size); bout.write(r, 0, chunk_size); } } if (bout != null) { // More than one chunk was present. // Add the last chunk. bout.write(r, 0, n); input = new noHeaderInput(bout.toByteArray()); } else { // Only one chunk was present. input = new noHeaderInput(r); } } else { if (input instanceof cdrBufInput) { // Highly probable case. input = new noHeaderInput(((cdrBufInput) input).buffer.getBuffer()); } else { cdrBufOutput bout = new cdrBufOutput(); int c; while ((c = input.read()) >= 0) bout.write((byte) c); input = new noHeaderInput(bout.buffer.toByteArray()); } } } catch (IOException ex) { MARSHAL m = new MARSHAL("Unable to read chunks"); m.initCause(ex); throw m; } // The user-defines io operations are implemented. if (value instanceof CustomMarshal) { CustomMarshal marsh = (CustomMarshal) value; try { marsh.unmarshal((DataInputStream) input); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else // The IDL-generated io operations are implemented. if (value instanceof Streamable) { ((Streamable) value)._read(input); } else if (helper instanceof BoxedValueHelper) value = ((BoxedValueHelper) helper).read_value(input); else if (helper instanceof ValueFactory) value = ((ValueFactory) helper).read_value((org.omg.CORBA_2_3.portable.InputStream) input); else // Stating the interfaces that the USER should use. throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue or CustomValue." ); // The negative end of state marker is expected from OMG standard. // If the chunking is used, this marker is already extracted. if ((value_tag & vf_CHUNKING) == 0) { int eor = input.read_long(); if (eor >= 0) throw new MARSHAL("End of state marker has an invalid value " + eor); } return value; } |
int chunk_size = input.read_long(); if (chunk_size < 0) throw new MARSHAL("Invalid first chunk size " + chunk_size); byte[] r = new byte[ chunk_size ]; while (chunk_size > 0) { if (r.length < chunk_size) r = new byte[ chunk_size + 256 ]; n = 0; reading: while (n < chunk_size) n += input.read(r, n, r.length - n); chunk_size = input.read_long(); if (chunk_size > 0) { bout = new ByteArrayOutputStream(2 * chunk_size); bout.write(r, 0, chunk_size); } } if (bout != null) { bout.write(r, 0, n); input = new noHeaderInput(bout.toByteArray()); } else { input = new noHeaderInput(r); } | input = new noHeaderInput(ci, input); | private static Object read_instance(InputStream input, Object value, int value_tag, Object helper ) { try { if ((value_tag & vf_CHUNKING) != 0) { ByteArrayOutputStream bout = null; int n = -1; // Read all chunks. int chunk_size = input.read_long(); if (chunk_size < 0) throw new MARSHAL("Invalid first chunk size " + chunk_size); byte[] r = new byte[ chunk_size ]; while (chunk_size > 0) { if (r.length < chunk_size) r = new byte[ chunk_size + 256 ]; n = 0; reading: while (n < chunk_size) n += input.read(r, n, r.length - n); // Read the size of the next chunk. chunk_size = input.read_long(); // If the value is non negative, there is more than one chunk. // Accumulate chunks in the buffer. // The last chunk (or the only chunk, if only one chunk is // present) is not written in the buffer. It is stored in the // array r, avoiding unnecessary buffer operations. if (chunk_size > 0) { bout = new ByteArrayOutputStream(2 * chunk_size); bout.write(r, 0, chunk_size); } } if (bout != null) { // More than one chunk was present. // Add the last chunk. bout.write(r, 0, n); input = new noHeaderInput(bout.toByteArray()); } else { // Only one chunk was present. input = new noHeaderInput(r); } } else { if (input instanceof cdrBufInput) { // Highly probable case. input = new noHeaderInput(((cdrBufInput) input).buffer.getBuffer()); } else { cdrBufOutput bout = new cdrBufOutput(); int c; while ((c = input.read()) >= 0) bout.write((byte) c); input = new noHeaderInput(bout.buffer.toByteArray()); } } } catch (IOException ex) { MARSHAL m = new MARSHAL("Unable to read chunks"); m.initCause(ex); throw m; } // The user-defines io operations are implemented. if (value instanceof CustomMarshal) { CustomMarshal marsh = (CustomMarshal) value; try { marsh.unmarshal((DataInputStream) input); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else // The IDL-generated io operations are implemented. if (value instanceof Streamable) { ((Streamable) value)._read(input); } else if (helper instanceof BoxedValueHelper) value = ((BoxedValueHelper) helper).read_value(input); else if (helper instanceof ValueFactory) value = ((ValueFactory) helper).read_value((org.omg.CORBA_2_3.portable.InputStream) input); else // Stating the interfaces that the USER should use. throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue or CustomValue." ); // The negative end of state marker is expected from OMG standard. // If the chunking is used, this marker is already extracted. if ((value_tag & vf_CHUNKING) == 0) { int eor = input.read_long(); if (eor >= 0) throw new MARSHAL("End of state marker has an invalid value " + eor); } return value; } |
input = new noHeaderInput(((cdrBufInput) input).buffer.getBuffer()); | input = new noHeaderInput((cdrBufInput) input, null); } else if (input instanceof noHeaderInput) { ((noHeaderInput) input).subsequentCalls = false; | private static Object read_instance(InputStream input, Object value, int value_tag, Object helper ) { try { if ((value_tag & vf_CHUNKING) != 0) { ByteArrayOutputStream bout = null; int n = -1; // Read all chunks. int chunk_size = input.read_long(); if (chunk_size < 0) throw new MARSHAL("Invalid first chunk size " + chunk_size); byte[] r = new byte[ chunk_size ]; while (chunk_size > 0) { if (r.length < chunk_size) r = new byte[ chunk_size + 256 ]; n = 0; reading: while (n < chunk_size) n += input.read(r, n, r.length - n); // Read the size of the next chunk. chunk_size = input.read_long(); // If the value is non negative, there is more than one chunk. // Accumulate chunks in the buffer. // The last chunk (or the only chunk, if only one chunk is // present) is not written in the buffer. It is stored in the // array r, avoiding unnecessary buffer operations. if (chunk_size > 0) { bout = new ByteArrayOutputStream(2 * chunk_size); bout.write(r, 0, chunk_size); } } if (bout != null) { // More than one chunk was present. // Add the last chunk. bout.write(r, 0, n); input = new noHeaderInput(bout.toByteArray()); } else { // Only one chunk was present. input = new noHeaderInput(r); } } else { if (input instanceof cdrBufInput) { // Highly probable case. input = new noHeaderInput(((cdrBufInput) input).buffer.getBuffer()); } else { cdrBufOutput bout = new cdrBufOutput(); int c; while ((c = input.read()) >= 0) bout.write((byte) c); input = new noHeaderInput(bout.buffer.toByteArray()); } } } catch (IOException ex) { MARSHAL m = new MARSHAL("Unable to read chunks"); m.initCause(ex); throw m; } // The user-defines io operations are implemented. if (value instanceof CustomMarshal) { CustomMarshal marsh = (CustomMarshal) value; try { marsh.unmarshal((DataInputStream) input); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else // The IDL-generated io operations are implemented. if (value instanceof Streamable) { ((Streamable) value)._read(input); } else if (helper instanceof BoxedValueHelper) value = ((BoxedValueHelper) helper).read_value(input); else if (helper instanceof ValueFactory) value = ((ValueFactory) helper).read_value((org.omg.CORBA_2_3.portable.InputStream) input); else // Stating the interfaces that the USER should use. throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue or CustomValue." ); // The negative end of state marker is expected from OMG standard. // If the chunking is used, this marker is already extracted. if ((value_tag & vf_CHUNKING) == 0) { int eor = input.read_long(); if (eor >= 0) throw new MARSHAL("End of state marker has an invalid value " + eor); } return value; } |
input = new noHeaderInput(bout.buffer.toByteArray()); | input = new noHeaderInput( (cdrBufInput) bout.create_input_stream(), input); | private static Object read_instance(InputStream input, Object value, int value_tag, Object helper ) { try { if ((value_tag & vf_CHUNKING) != 0) { ByteArrayOutputStream bout = null; int n = -1; // Read all chunks. int chunk_size = input.read_long(); if (chunk_size < 0) throw new MARSHAL("Invalid first chunk size " + chunk_size); byte[] r = new byte[ chunk_size ]; while (chunk_size > 0) { if (r.length < chunk_size) r = new byte[ chunk_size + 256 ]; n = 0; reading: while (n < chunk_size) n += input.read(r, n, r.length - n); // Read the size of the next chunk. chunk_size = input.read_long(); // If the value is non negative, there is more than one chunk. // Accumulate chunks in the buffer. // The last chunk (or the only chunk, if only one chunk is // present) is not written in the buffer. It is stored in the // array r, avoiding unnecessary buffer operations. if (chunk_size > 0) { bout = new ByteArrayOutputStream(2 * chunk_size); bout.write(r, 0, chunk_size); } } if (bout != null) { // More than one chunk was present. // Add the last chunk. bout.write(r, 0, n); input = new noHeaderInput(bout.toByteArray()); } else { // Only one chunk was present. input = new noHeaderInput(r); } } else { if (input instanceof cdrBufInput) { // Highly probable case. input = new noHeaderInput(((cdrBufInput) input).buffer.getBuffer()); } else { cdrBufOutput bout = new cdrBufOutput(); int c; while ((c = input.read()) >= 0) bout.write((byte) c); input = new noHeaderInput(bout.buffer.toByteArray()); } } } catch (IOException ex) { MARSHAL m = new MARSHAL("Unable to read chunks"); m.initCause(ex); throw m; } // The user-defines io operations are implemented. if (value instanceof CustomMarshal) { CustomMarshal marsh = (CustomMarshal) value; try { marsh.unmarshal((DataInputStream) input); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else // The IDL-generated io operations are implemented. if (value instanceof Streamable) { ((Streamable) value)._read(input); } else if (helper instanceof BoxedValueHelper) value = ((BoxedValueHelper) helper).read_value(input); else if (helper instanceof ValueFactory) value = ((ValueFactory) helper).read_value((org.omg.CORBA_2_3.portable.InputStream) input); else // Stating the interfaces that the USER should use. throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue or CustomValue." ); // The negative end of state marker is expected from OMG standard. // If the chunking is used, this marker is already extracted. if ((value_tag & vf_CHUNKING) == 0) { int eor = input.read_long(); if (eor >= 0) throw new MARSHAL("End of state marker has an invalid value " + eor); } return value; } |
if (value instanceof CustomMarshal) { CustomMarshal marsh = (CustomMarshal) value; try { marsh.unmarshal((DataInputStream) input); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else if (value instanceof Streamable) { ((Streamable) value)._read(input); } else if (helper instanceof BoxedValueHelper) value = ((BoxedValueHelper) helper).read_value(input); else if (helper instanceof ValueFactory) value = ((ValueFactory) helper).read_value((org.omg.CORBA_2_3.portable.InputStream) input); else throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue or CustomValue." ); if ((value_tag & vf_CHUNKING) == 0) { int eor = input.read_long(); if (eor >= 0) throw new MARSHAL("End of state marker has an invalid value " + eor); } return value; | return readValue(input, position, value, helper, id, ids, codebase); | private static Object read_instance(InputStream input, Object value, int value_tag, Object helper ) { try { if ((value_tag & vf_CHUNKING) != 0) { ByteArrayOutputStream bout = null; int n = -1; // Read all chunks. int chunk_size = input.read_long(); if (chunk_size < 0) throw new MARSHAL("Invalid first chunk size " + chunk_size); byte[] r = new byte[ chunk_size ]; while (chunk_size > 0) { if (r.length < chunk_size) r = new byte[ chunk_size + 256 ]; n = 0; reading: while (n < chunk_size) n += input.read(r, n, r.length - n); // Read the size of the next chunk. chunk_size = input.read_long(); // If the value is non negative, there is more than one chunk. // Accumulate chunks in the buffer. // The last chunk (or the only chunk, if only one chunk is // present) is not written in the buffer. It is stored in the // array r, avoiding unnecessary buffer operations. if (chunk_size > 0) { bout = new ByteArrayOutputStream(2 * chunk_size); bout.write(r, 0, chunk_size); } } if (bout != null) { // More than one chunk was present. // Add the last chunk. bout.write(r, 0, n); input = new noHeaderInput(bout.toByteArray()); } else { // Only one chunk was present. input = new noHeaderInput(r); } } else { if (input instanceof cdrBufInput) { // Highly probable case. input = new noHeaderInput(((cdrBufInput) input).buffer.getBuffer()); } else { cdrBufOutput bout = new cdrBufOutput(); int c; while ((c = input.read()) >= 0) bout.write((byte) c); input = new noHeaderInput(bout.buffer.toByteArray()); } } } catch (IOException ex) { MARSHAL m = new MARSHAL("Unable to read chunks"); m.initCause(ex); throw m; } // The user-defines io operations are implemented. if (value instanceof CustomMarshal) { CustomMarshal marsh = (CustomMarshal) value; try { marsh.unmarshal((DataInputStream) input); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else // The IDL-generated io operations are implemented. if (value instanceof Streamable) { ((Streamable) value)._read(input); } else if (helper instanceof BoxedValueHelper) value = ((BoxedValueHelper) helper).read_value(input); else if (helper instanceof ValueFactory) value = ((ValueFactory) helper).read_value((org.omg.CORBA_2_3.portable.InputStream) input); else // Stating the interfaces that the USER should use. throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue or CustomValue." ); // The negative end of state marker is expected from OMG standard. // If the chunking is used, this marker is already extracted. if ((value_tag & vf_CHUNKING) == 0) { int eor = input.read_long(); if (eor >= 0) throw new MARSHAL("End of state marker has an invalid value " + eor); } return value; } |
write(output, value, ObjectCreator.toIDL(value.getClass().getName())); | write(output, value, value.getClass()); | public static void write(OutputStream output, Serializable value) { // Write null if this is a null value. if (value == null) output.write_long(vt_NULL); else write(output, value, ObjectCreator.toIDL(value.getClass().getName())); } |
private static void write_instance(OutputStream output, Serializable value, String id, Object helper ) | static void write_instance(OutputStream output, Serializable value, Object ids, BoxedValueHelper helper) | private static void write_instance(OutputStream output, Serializable value, String id, Object helper ) { // This implementation always writes a single repository id. // It never writes multiple repository ids and currently does not use // a codebase. int value_tag = vt_VALUE_TAG | vf_ID; OutputStream outObj; cdrBufOutput out = null; if (USE_CHUNKING) { out = new cdrBufOutput(); out.setOrb(output.orb()); outObj = out; value_tag |= vf_CHUNKING; } else outObj = output; output.write_long(value_tag); output.write_string(id); if (helper instanceof BoxedValueHelper) { ((BoxedValueHelper) helper).write_value(outObj, value); } else // User defince write method is present. if (value instanceof CustomMarshal) { try { ((CustomMarshal) value).marshal((DataOutputStream) outObj); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else if (value instanceof Streamable) { ((Streamable) value)._write(outObj); } else { // Try to find helper via class loader. boolean ok = false; try { Class helperClass = Class.forName(ObjectCreator.toHelperName(id)); // It will be the helper for the encapsulated boxed value, not the // for the global boxed value type itself. Method write = helperClass.getMethod("write", new Class[] { org.omg.CORBA.portable.OutputStream.class, value.getClass() } ); write.invoke(null, new Object[] { outObj, value }); ok = true; } catch (Exception ex) { ok = false; } // Stating the interfaces that the USER should use. if (!ok) throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue" + " or CustomValue." ); } if (USE_CHUNKING) { output.write_long(out.buffer.size()); try { out.buffer.writeTo(output); } catch (IOException ex) { MARSHAL m = new MARSHAL(); m.initCause(ex); throw m; } } // The end of record marker, required by OMG standard. output.write_long(-1); } |
int value_tag = vt_VALUE_TAG | vf_ID; | gnuValueStream rout = null; gnuRuntime runtime = null; try { if (output instanceof gnuValueStream) { int position; rout = (gnuValueStream) output; runtime = rout.getRunTime(); if (runtime == null) { runtime = new gnuRuntime(null, value); rout.setRunTime(runtime); rout.getRunTime().objectWritten(value, position = rout.getPosition()); } else if (runtime.target == value) { if (!writeSelf(output, value)) throw new InternalError("Recursive helper call for " + value.getClass().getName()); return; } else { position = runtime.isWrittenAt(value); if (position >= 0) { output.write_long(vt_INDIRECTION); output.write_long(position - rout.getPosition()); return; } else { runtime.objectWritten(value, position = rout.getPosition()); } } } int value_tag = vt_VALUE_TAG; if (ids instanceof String) value_tag |= vf_ID; else if (ids instanceof String[]) value_tag |= vf_MULTIPLE_IDS | vf_ID; int chunkSizeLocation; | private static void write_instance(OutputStream output, Serializable value, String id, Object helper ) { // This implementation always writes a single repository id. // It never writes multiple repository ids and currently does not use // a codebase. int value_tag = vt_VALUE_TAG | vf_ID; OutputStream outObj; cdrBufOutput out = null; if (USE_CHUNKING) { out = new cdrBufOutput(); out.setOrb(output.orb()); outObj = out; value_tag |= vf_CHUNKING; } else outObj = output; output.write_long(value_tag); output.write_string(id); if (helper instanceof BoxedValueHelper) { ((BoxedValueHelper) helper).write_value(outObj, value); } else // User defince write method is present. if (value instanceof CustomMarshal) { try { ((CustomMarshal) value).marshal((DataOutputStream) outObj); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else if (value instanceof Streamable) { ((Streamable) value)._write(outObj); } else { // Try to find helper via class loader. boolean ok = false; try { Class helperClass = Class.forName(ObjectCreator.toHelperName(id)); // It will be the helper for the encapsulated boxed value, not the // for the global boxed value type itself. Method write = helperClass.getMethod("write", new Class[] { org.omg.CORBA.portable.OutputStream.class, value.getClass() } ); write.invoke(null, new Object[] { outObj, value }); ok = true; } catch (Exception ex) { ok = false; } // Stating the interfaces that the USER should use. if (!ok) throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue" + " or CustomValue." ); } if (USE_CHUNKING) { output.write_long(out.buffer.size()); try { out.buffer.writeTo(output); } catch (IOException ex) { MARSHAL m = new MARSHAL(); m.initCause(ex); throw m; } } // The end of record marker, required by OMG standard. output.write_long(-1); } |
cdrBufOutput out = null; | private static void write_instance(OutputStream output, Serializable value, String id, Object helper ) { // This implementation always writes a single repository id. // It never writes multiple repository ids and currently does not use // a codebase. int value_tag = vt_VALUE_TAG | vf_ID; OutputStream outObj; cdrBufOutput out = null; if (USE_CHUNKING) { out = new cdrBufOutput(); out.setOrb(output.orb()); outObj = out; value_tag |= vf_CHUNKING; } else outObj = output; output.write_long(value_tag); output.write_string(id); if (helper instanceof BoxedValueHelper) { ((BoxedValueHelper) helper).write_value(outObj, value); } else // User defince write method is present. if (value instanceof CustomMarshal) { try { ((CustomMarshal) value).marshal((DataOutputStream) outObj); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else if (value instanceof Streamable) { ((Streamable) value)._write(outObj); } else { // Try to find helper via class loader. boolean ok = false; try { Class helperClass = Class.forName(ObjectCreator.toHelperName(id)); // It will be the helper for the encapsulated boxed value, not the // for the global boxed value type itself. Method write = helperClass.getMethod("write", new Class[] { org.omg.CORBA.portable.OutputStream.class, value.getClass() } ); write.invoke(null, new Object[] { outObj, value }); ok = true; } catch (Exception ex) { ok = false; } // Stating the interfaces that the USER should use. if (!ok) throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue" + " or CustomValue." ); } if (USE_CHUNKING) { output.write_long(out.buffer.size()); try { out.buffer.writeTo(output); } catch (IOException ex) { MARSHAL m = new MARSHAL(); m.initCause(ex); throw m; } } // The end of record marker, required by OMG standard. output.write_long(-1); } |
|
out = new cdrBufOutput(); out.setOrb(output.orb()); outObj = out; | outObj = output; | private static void write_instance(OutputStream output, Serializable value, String id, Object helper ) { // This implementation always writes a single repository id. // It never writes multiple repository ids and currently does not use // a codebase. int value_tag = vt_VALUE_TAG | vf_ID; OutputStream outObj; cdrBufOutput out = null; if (USE_CHUNKING) { out = new cdrBufOutput(); out.setOrb(output.orb()); outObj = out; value_tag |= vf_CHUNKING; } else outObj = output; output.write_long(value_tag); output.write_string(id); if (helper instanceof BoxedValueHelper) { ((BoxedValueHelper) helper).write_value(outObj, value); } else // User defince write method is present. if (value instanceof CustomMarshal) { try { ((CustomMarshal) value).marshal((DataOutputStream) outObj); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else if (value instanceof Streamable) { ((Streamable) value)._write(outObj); } else { // Try to find helper via class loader. boolean ok = false; try { Class helperClass = Class.forName(ObjectCreator.toHelperName(id)); // It will be the helper for the encapsulated boxed value, not the // for the global boxed value type itself. Method write = helperClass.getMethod("write", new Class[] { org.omg.CORBA.portable.OutputStream.class, value.getClass() } ); write.invoke(null, new Object[] { outObj, value }); ok = true; } catch (Exception ex) { ok = false; } // Stating the interfaces that the USER should use. if (!ok) throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue" + " or CustomValue." ); } if (USE_CHUNKING) { output.write_long(out.buffer.size()); try { out.buffer.writeTo(output); } catch (IOException ex) { MARSHAL m = new MARSHAL(); m.initCause(ex); throw m; } } // The end of record marker, required by OMG standard. output.write_long(-1); } |
output.write_string(id); | private static void write_instance(OutputStream output, Serializable value, String id, Object helper ) { // This implementation always writes a single repository id. // It never writes multiple repository ids and currently does not use // a codebase. int value_tag = vt_VALUE_TAG | vf_ID; OutputStream outObj; cdrBufOutput out = null; if (USE_CHUNKING) { out = new cdrBufOutput(); out.setOrb(output.orb()); outObj = out; value_tag |= vf_CHUNKING; } else outObj = output; output.write_long(value_tag); output.write_string(id); if (helper instanceof BoxedValueHelper) { ((BoxedValueHelper) helper).write_value(outObj, value); } else // User defince write method is present. if (value instanceof CustomMarshal) { try { ((CustomMarshal) value).marshal((DataOutputStream) outObj); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else if (value instanceof Streamable) { ((Streamable) value)._write(outObj); } else { // Try to find helper via class loader. boolean ok = false; try { Class helperClass = Class.forName(ObjectCreator.toHelperName(id)); // It will be the helper for the encapsulated boxed value, not the // for the global boxed value type itself. Method write = helperClass.getMethod("write", new Class[] { org.omg.CORBA.portable.OutputStream.class, value.getClass() } ); write.invoke(null, new Object[] { outObj, value }); ok = true; } catch (Exception ex) { ok = false; } // Stating the interfaces that the USER should use. if (!ok) throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue" + " or CustomValue." ); } if (USE_CHUNKING) { output.write_long(out.buffer.size()); try { out.buffer.writeTo(output); } catch (IOException ex) { MARSHAL m = new MARSHAL(); m.initCause(ex); throw m; } } // The end of record marker, required by OMG standard. output.write_long(-1); } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.