comparison src/org/tn5250j/framework/tn5250/ScreenField.java @ 348:29076621bab0

merge tn5250j r1227; fix spelling
author Carl Byington <carl@five-ten-sg.com>
date Fri, 01 Aug 2014 10:25:44 -0700
parents 77ac18bc1b2f
children
comparison
equal deleted inserted replaced
347:bb7d8a7babbe 348:29076621bab0
85 case 6: 85 case 6:
86 rightAdjd = false; 86 rightAdjd = false;
87 break; 87 break;
88 88
89 case 7: 89 case 7:
90 manditoried = false; 90 mandatory = false;
91 break; 91 break;
92 } 92 }
93 } 93 }
94 94
95 mdt = (ffw1 & 0x8) == 0x8; 95 mdt = (ffw1 & 0x8) == 0x8;
266 266
267 protected void setRightAdjusted() { 267 protected void setRightAdjusted() {
268 rightAdjd = true; 268 rightAdjd = true;
269 } 269 }
270 270
271 protected void setManditoryEntered() { 271 protected void setMandatoryEntered() {
272 manditoried = true; 272 mandatory = true;
273 } 273 }
274 274
275 protected void resetMDT() { 275 protected void resetMDT() {
276 mdt = false; 276 mdt = false;
277 } 277 }
304 // is field exit required 304 // is field exit required
305 public boolean isFER() { 305 public boolean isFER() {
306 return (ffw2 & 0x40) == 0x40; 306 return (ffw2 & 0x40) == 0x40;
307 } 307 }
308 308
309 // is field manditory enter 309 // is field mandatory enter
310 public boolean isMandatoryEnter() { 310 public boolean isMandatoryEnter() {
311 return (ffw2 & 0x8) == 0x8; 311 return (ffw2 & 0x8) == 0x8;
312 } 312 }
313 313
314 public boolean isToUpper() { 314 public boolean isToUpper() {
381 case 5: 381 case 5:
382 case 6: 382 case 6:
383 return rightAdjd; 383 return rightAdjd;
384 384
385 case 7: 385 case 7:
386 return manditoried; 386 return mandatory;
387 387
388 default: 388 default:
389 return true; 389 return true;
390 } 390 }
391 } 391 }
463 * refreshed field object. 463 * refreshed field object.
464 * 464 *
465 * @param text - The text to be placed in the field's text plane. 465 * @param text - The text to be placed in the field's text plane.
466 */ 466 */
467 public void setString(String text) { 467 public void setString(String text) {
468 int y = length; 468 cursorPos = startPos;
469 cursorPos = startPos; 469
470 int len = text.length(); 470 if (isRightToLeft()) {
471 char[] c = text.toCharArray(); 471 text = new StringBuilder(text).reverse().toString();
472 char tc = ' '; 472 }
473 473
474 for (int x = 0; x < y; x++) { 474 final ScreenPlanes planes = s.getPlanes();
475 tc = ' '; 475 for (int x = 0,len = text.length(); x < length; x++) {
476 476 char tc = (x < len) ? text.charAt(x) : ' ';
477 if (x < len) { 477 planes.setChar(cursorPos, tc);
478 tc = c[x]; 478 changePos(1);
479 } 479 }
480 480 setMDT();
481 s.getPlanes().setChar(cursorPos, tc); 481 s.getScreenFields().setMasterMDT();
482 changePos(1); 482 }
483 } 483
484 484 @Override
485 setMDT();
486 s.getScreenFields().setMasterMDT();
487 }
488
489 public String toString() { 485 public String toString() {
490 int fcw = (fcw1 & 0xff) << 8 | fcw2 & 0xff; 486 int fcw = (fcw1 & 0xff) << 8 | fcw2 & 0xff;
491 return "startRow = " + startRow() + " startCol = " + startCol() + 487 return "startRow = " + startRow() + " startCol = " + startCol() +
492 " length = " + length + " ffw1 = (0x" + Integer.toHexString(ffw1) + 488 " length = " + length + " ffw1 = (0x" + Integer.toHexString(ffw1) +
493 ") ffw2 = (0x" + Integer.toHexString(ffw2) + 489 ") ffw2 = (0x" + Integer.toHexString(ffw2) +
495 ") fcw2 = (0x" + Integer.toHexString(fcw2) + 491 ") fcw2 = (0x" + Integer.toHexString(fcw2) +
496 ") fcw = (" + Integer.toBinaryString(fcw) + 492 ") fcw = (" + Integer.toBinaryString(fcw) +
497 ") fcw hex = (0x" + Integer.toHexString(fcw) + 493 ") fcw hex = (0x" + Integer.toHexString(fcw) +
498 ") is bypass field = " + isBypassField() + 494 ") is bypass field = " + isBypassField() +
499 ") is autoenter = " + isAutoEnter() + 495 ") is autoenter = " + isAutoEnter() +
500 ") is manditoryenter = " + isMandatoryEnter() + 496 ") is mandatoryenter = " + isMandatoryEnter() +
501 ") is field exit required = " + isFER() + 497 ") is field exit required = " + isFER() +
502 ") is Numeric = " + isNumeric() + 498 ") is Numeric = " + isNumeric() +
503 ") is Signed Numeric = " + isSignedNumeric() + 499 ") is Signed Numeric = " + isSignedNumeric() +
504 ") is cursor progression = " + (fcw1 == 0x88) + 500 ") is cursor progression = " + (fcw1 == 0x88) +
505 ") next progression field = " + fcw2 + 501 ") next progression field = " + fcw2 +
518 int startPos = 0; 514 int startPos = 0;
519 int endPos = 0; 515 int endPos = 0;
520 boolean mdt = false; 516 boolean mdt = false;
521 protected boolean checkCanSend; 517 protected boolean checkCanSend;
522 protected boolean rightAdjd; 518 protected boolean rightAdjd;
523 protected boolean manditoried; 519 protected boolean mandatory;
524 boolean canSend = true; 520 boolean canSend = true;
525 int attr = 0; 521 int attr = 0;
526 int length = 0; 522 int length = 0;
527 int ffw1 = 0; 523 int ffw1 = 0;
528 int ffw2 = 0; 524 int ffw2 = 0;