Mercurial > 510Connectbot
comparison app/src/main/java/org/tn5250j/framework/tn5250/ScreenField.java @ 445:8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Mon, 04 Jan 2016 15:52:25 -0800 |
parents | d29cce60f393 |
children |
comparison
equal
deleted
inserted
replaced
444:5a74f1b7c1db | 445:8fa8e73e2f5c |
---|---|
455 } | 455 } |
456 | 456 |
457 /** | 457 /** |
458 * Sets the field's text plane to the specified string. If the string is | 458 * Sets the field's text plane to the specified string. If the string is |
459 * shorter than the length of the field, the rest of the field is cleared. | 459 * shorter than the length of the field, the rest of the field is cleared. |
460 * If the string is longer than the field, the text is truncated. A subsequent | 460 * If the string is longer than the field, the text is truncated. A |
461 * call to getText on this field will not show the changed text. To see the | 461 * subsequent call to getText on this field will not show the changed text. |
462 * changed text, do a refresh on the iOhioFields collection and retrieve the | 462 * To see the changed text, do a refresh on the iOhioFields collection and |
463 * refreshed field object. | 463 * retrieve the refreshed field object. |
464 * | 464 * |
465 * @param text - The text to be placed in the field's text plane. | 465 * @param text |
466 * - The text to be placed in the field's text plane. | |
466 */ | 467 */ |
467 public void setString(String text) { | 468 public void setString(String text) { |
468 cursorPos = startPos; | 469 cursorPos = isRightToLeft() ? endPos - text.length() + 1 : startPos; |
469 | 470 |
470 if (isRightToLeft()) { | 471 if (isRightToLeft()) { |
471 text = new StringBuilder(text).reverse().toString(); | 472 text = new StringBuilder(text).reverse().toString(); |
472 } | 473 } |
473 | 474 |
474 final ScreenPlanes planes = s.getPlanes(); | 475 for (int x = 0, textLen = text.length(); x < length; x++) { |
475 for (int x = 0,len = text.length(); x < length; x++) { | 476 char tc = x < textLen ? text.charAt(x) : ' '; |
476 char tc = (x < len) ? text.charAt(x) : ' '; | 477 s.getPlanes().setChar(cursorPos, tc); |
477 planes.setChar(cursorPos, tc); | |
478 changePos(1); | 478 changePos(1); |
479 } | 479 } |
480 setMDT(); | 480 setMDT(); |
481 s.getScreenFields().setMasterMDT(); | 481 s.getScreenFields().setMasterMDT(); |
482 } | 482 } |