tn5250j/src/org/tn5250j Screen5250.java,1.48,1.49

[email protected]
Newsgroups gmane.comp.java.tn5250j.cvs
Message-ID <[email protected]>
Update of /cvsroot/tn5250j/tn5250j/src/org/tn5250j
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16165

Modified Files:
	Screen5250.java 
Log Message:

Fix for Field exit and Numeric Signed fields


Index: Screen5250.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/Screen5250.java,v
retrieving revision 1.48
retrieving revision 1.49
diff -C2 -d -r1.48 -r1.49
*** Screen5250.java	15 Feb 2004 12:55:49 -0000	1.48
--- Screen5250.java	18 Feb 2004 05:05:10 -0000	1.49
***************
*** 143,146 ****
--- 143,147 ----
     private final static int ERR_NUMERIC_09            = 0x10;
     private final static int ERR_FIELD_MINUS           = 0x16;
+    private final static int ERR_FIELD_EXIT_INVALID    = 0x18;
     private final static int ERR_ENTER_NO_ALLOWED      = 0x20;
     private final static int ERR_MANDITORY_ENTER       = 0x21;
***************
*** 156,159 ****
--- 157,161 ----
     private boolean rulerFixed;
     private boolean antialiased = true;
+    private boolean feError;
  
     private boolean fullRepaint;
***************
*** 1825,1828 ****
--- 1827,1831 ----
           case LEFT :
           case MARK_LEFT :
+ 
              process_XY(lastPos - 1);
              simulated = true;
***************
*** 2057,2060 ****
--- 2060,2064 ----
  
                 resetDirty(lastPos);
+ 
                 if (fieldExit()) {
                    screenFields.setCurrentFieldMDT();
***************
*** 2072,2075 ****
--- 2076,2080 ----
                    }
                 }
+ 
                 updateDirty();
                 simulated  = true;
***************
*** 2287,2290 ****
--- 2292,2307 ----
              && !screenFields.isCurrentFieldBypassField()) {
  
+             if(screenFields.isCurrentFieldFER() &&
+                !screenFields.withinCurrentField(screenFields.getCurrentFieldPos())
+                && lastPos == screenFields.getCurrentField().endPos()
+                && screenFields.getCurrentFieldPos() >
+                   screenFields.getCurrentField().endPos()) {
+ 
+                displayError(ERR_FIELD_EXIT_INVALID);
+                feError = true;
+                return false;
+             }
+ 
+ 
              switch (screenFields.getCurrentFieldShift()) {
                 case 0:  // Alpha shift
***************
*** 2354,2360 ****
--- 2371,2390 ----
                       else if (!screenFields.isCurrentFieldFER())
                          gotoFieldNext();
+                      else {
+ //                        screenFields.getCurrentField().changePos(1);
+ //
+ //                        if (screenFields.
+ //                        cursorPos == endPos)
+ //                           System.out.println("end of field");
+ //
+ //                        feError != feError;
+ //                        if (feError)
+ //                           displayError(ERR_FIELD_EXIT_INVALID);
+                      }
+ 
                    }
                    else
                       goto_XY(screenFields.getCurrentField().getCursorRow() + 1,screenFields.getCurrentField().getCursorCol() + 1);
+ 
                 }
  
***************
*** 2472,2475 ****
--- 2502,2510 ----
                    sf.getKeyPos(pos);
  
+       if (count == 0 && sf.isFER()) {
+          mdt = true;
+          return mdt;
+       }
+ 
        for (;count >= 0; count--) {
           screen[pos].setChar(initChar);
***************
*** 2504,2508 ****
--- 2539,2549 ----
           }
        }
+       else {
  
+          // we need to right adjust signed numeric fields as well.
+          if (sf.isSignedNumeric()) {
+             rightAdjustField(' ');
+          }
+       }
  
        return mdt;
***************
*** 2723,2727 ****
        if (pos > lenScreen - 1)
           pos = pos - lenScreen;
!       goto_XY(pos);
     }
  
--- 2764,2799 ----
        if (pos > lenScreen - 1)
           pos = pos - lenScreen;
! 
!       // if there was a field exit error then we need to treat the movement
!       //  of the cursor in a special way that equals that of Client Access.
!       //    If the cursor is moved from the field then we need to reset the
!       //       position within the field so that the last character can be typed
!       //       over again instead of sending the field exit error again.
!       //       We also need to reset the field exit error flag.
!       //
!       //    How we know we have a field exit error is when the field position is
!       //    set beyond the end of the field and a character is then typed we can
!       //    not position that character.  To reset this we need to set the next
!       //    position of the field to not be beyond the end of field but to the
!       //    last character.
!       //
!       //    Now to make it work like Client Access if the cursor is a back space
!       //    then do not move the cursor but place it on the last field.  All
!       //    other keys will reset the field position so that entering over the
!       //    last character will not cause an error but replace that character or
!       //    just plain move the cursor if the key was to do that.
! 
!       if (feError) {
!          feError = false;
!          screenFields.getCurrentField().changePos(-1);
! 
!          if (screenFields.getCurrentField() != null &&
!                screenFields.getCurrentField().isFER() &&
!                screenFields.getCurrentFieldPos() - 1 == pos) {
!          }
!       }
!       else {
!          goto_XY(pos);
!       }
     }
  



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.