diff 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
line wrap: on
line diff
--- a/src/org/tn5250j/framework/tn5250/ScreenField.java	Thu Jul 31 18:57:57 2014 -0700
+++ b/src/org/tn5250j/framework/tn5250/ScreenField.java	Fri Aug 01 10:25:44 2014 -0700
@@ -87,7 +87,7 @@
                     break;
 
                 case 7:
-                    manditoried = false;
+                    mandatory = false;
                     break;
             }
         }
@@ -268,8 +268,8 @@
         rightAdjd = true;
     }
 
-    protected void setManditoryEntered() {
-        manditoried = true;
+    protected void setMandatoryEntered() {
+        mandatory = true;
     }
 
     protected void resetMDT() {
@@ -306,7 +306,7 @@
         return (ffw2 & 0x40) == 0x40;
     }
 
-    // is field manditory enter
+    // is field mandatory enter
     public boolean isMandatoryEnter() {
         return (ffw2 & 0x8) == 0x8;
     }
@@ -383,7 +383,7 @@
                     return rightAdjd;
 
                 case 7:
-                    return manditoried;
+                    return mandatory;
 
                 default:
                     return true;
@@ -465,27 +465,23 @@
      * @param text - The text to be placed in the field's text plane.
      */
     public void setString(String text) {
-        int y = length;
-        cursorPos = startPos;
-        int len = text.length();
-        char[] c = text.toCharArray();
-        char tc = ' ';
+		cursorPos = startPos;
 
-        for (int x = 0; x < y; x++) {
-            tc = ' ';
+		if (isRightToLeft()) {
+			text = new StringBuilder(text).reverse().toString();
+		}
 
-            if (x < len) {
-                tc = c[x];
-            }
-
-            s.getPlanes().setChar(cursorPos, tc);
-            changePos(1);
-        }
-
-        setMDT();
-        s.getScreenFields().setMasterMDT();
+		final ScreenPlanes planes = s.getPlanes();
+		for (int x = 0,len = text.length(); x < length; x++) {
+			char tc = (x < len) ? text.charAt(x) : ' ';
+			planes.setChar(cursorPos, tc);
+			changePos(1);
+		}
+		setMDT();
+		s.getScreenFields().setMasterMDT();
     }
 
+	@Override
     public String toString() {
         int fcw = (fcw1 & 0xff) << 8 | fcw2 & 0xff;
         return "startRow = " + startRow() + " startCol = " + startCol() +
@@ -497,7 +493,7 @@
                ") fcw hex = (0x" + Integer.toHexString(fcw) +
                ") is bypass field = " + isBypassField() +
                ") is autoenter = " + isAutoEnter() +
-               ") is manditoryenter = " + isMandatoryEnter() +
+               ") is mandatoryenter = " + isMandatoryEnter() +
                ") is field exit required = " + isFER() +
                ") is Numeric = " + isNumeric() +
                ") is Signed Numeric = " + isSignedNumeric() +
@@ -520,7 +516,7 @@
     boolean mdt = false;
     protected boolean checkCanSend;
     protected boolean rightAdjd;
-    protected boolean manditoried;
+    protected boolean mandatory;
     boolean canSend = true;
     int attr = 0;
     int length = 0;