tn5250j/src/org/tn5250j GuiGraphicBuffer.java,1.21,1.22 ScreenChar.java,1.10,1.11 Screen5250.java,1.67,1.68

"Kenneth J. Pouncey" <[email protected]> Wed, 07 Jul 2004 04:15:09 +0000
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-serv9140/src/org/tn5250j

Modified Files:
	GuiGraphicBuffer.java ScreenChar.java Screen5250.java 
Log Message:
Phase II of headless changes

Index: ScreenChar.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/ScreenChar.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** ScreenChar.java	11 Dec 2003 07:25:25 -0000	1.10
--- ScreenChar.java	7 Jul 2004 04:15:07 -0000	1.11
***************
*** 300,669 ****
     }
  
!    public final void drawChar(Graphics2D g) {
! 
!       if (attributePlace && s.isShowHex()) {
! //      if ((sChar[0] == 0x20 || sChar[0] == 0x0 || nonDisplay) && s.isShowHex()) {
!          Font f = g.getFont();
! 
!          Font k = f.deriveFont(f.getSize2D()/2);
!          g.setFont(k);
!          g.setColor(s.colorHexAttr);
!          char[] a = Integer.toHexString(attr).toCharArray();
!          g.drawChars(a, 0, 1, x, y + (int)(s.fmHeight /2));
!          g.drawChars(a, 1, 1, x+(int)(s.fmWidth/2),
!             (int)(y + s.fmHeight - (s.lm.getDescent() + s.lm.getLeading())-2));
!          g.setFont(f);
! //return;
!       }
! 
!       if(!nonDisplay && !attributePlace) {
! 
!          if (!useGui) {
!             g.setColor(bg);
!             g.fill(cArea);
!          }
!          else {
! 
!             if (bg == s.colorBg && whichGui >= FIELD_LEFT && whichGui <= FIELD_ONE)
!                g.setColor(s.colorGUIField);
!             else
!                g.setColor(bg);
! 
!             g.fill(cArea);
! 
!          }
! 
!          if (useGui && (whichGui < FIELD_LEFT)) {
!             int w = 0;
! 
!             g.setColor(fg);
! 
!             switch (whichGui) {
! 
!                case UPPER_LEFT:
!                   if (sChar[0] == '.') {
!                      if (s.isUsingGuiInterface()) {
!                         GUIGraphicsUtils.drawWinUpperLeft(g,
!                                              GUIGraphicsUtils.WINDOW_GRAPHIC,
!                                              s.colorBlue,
!                                              x,y,s.fmWidth,s.fmHeight);
! 
!                      }
!                      else {
! 
!                         GUIGraphicsUtils.drawWinUpperLeft(g,
!                                              GUIGraphicsUtils.WINDOW_NORMAL,
!                                              fg,
!                                              x,y,s.fmWidth,s.fmHeight);
! 
!                      }
!                   }
!                break;
!                case UPPER:
!                   if (sChar[0] == '.') {
! 
!                      if (s.isUsingGuiInterface()) {
!                         GUIGraphicsUtils.drawWinUpper(g,
!                                              GUIGraphicsUtils.WINDOW_GRAPHIC,
!                                              s.colorBlue,
!                                              x,y,s.fmWidth,s.fmHeight);
! 
! 
!                      }
!                      else {
! 
!                         GUIGraphicsUtils.drawWinUpper(g,
!                                              GUIGraphicsUtils.WINDOW_NORMAL,
!                                              fg,
!                                              x,y,s.fmWidth,s.fmHeight);
!                      }
!                   }
!                break;
!                case UPPER_RIGHT:
!                   if (sChar[0] == '.') {
!                      if (s.isUsingGuiInterface()) {
! 
!                         GUIGraphicsUtils.drawWinUpperRight(g,
!                                              GUIGraphicsUtils.WINDOW_GRAPHIC,
!                                              s.colorBlue,
!                                              x,y,s.fmWidth,s.fmHeight);
! 
! 
!                      }
!                      else {
! 
!                         GUIGraphicsUtils.drawWinUpperRight(g,
!                                              GUIGraphicsUtils.WINDOW_NORMAL,
!                                              fg,
!                                              x,y,s.fmWidth,s.fmHeight);
! 
!                      }
!                   }
!                break;
!                case LEFT:
!                   if (sChar[0] == ':') {
!                      if (s.isUsingGuiInterface()) {
!                         GUIGraphicsUtils.drawWinLeft(g,
!                                              GUIGraphicsUtils.WINDOW_GRAPHIC,
!                                              bg,
!                                              x,y,s.fmWidth,s.fmHeight);
! 
! 
!                      }
!                      else {
! 
!                         GUIGraphicsUtils.drawWinLeft(g,
!                                              GUIGraphicsUtils.WINDOW_NORMAL,
!                                              fg,
!                                              x,y,s.fmWidth,s.fmHeight);
! 
!                         g.drawLine(x + s.fmWidth / 2,
!                                     y,
!                                     x + s.fmWidth / 2,
!                                     y + s.fmHeight);
!                      }
!                   }
!                break;
!                case RIGHT:
!                   if (sChar[0] == ':') {
!                      if (s.isUsingGuiInterface()) {
!                         GUIGraphicsUtils.drawWinRight(g,
!                                              GUIGraphicsUtils.WINDOW_GRAPHIC,
!                                              bg,
!                                              x,y,s.fmWidth,s.fmHeight);
! 
! 
!                      }
!                      else {
!                         GUIGraphicsUtils.drawWinRight(g,
!                                              GUIGraphicsUtils.WINDOW_NORMAL,
!                                              fg,
!                                              x,y,s.fmWidth,s.fmHeight);
! 
!                      }
!                   }
!                break;
!                case LOWER_LEFT:
!                   if (sChar[0] == ':') {
! 
!                      if (s.isUsingGuiInterface()) {
! 
!                         GUIGraphicsUtils.drawWinLowerLeft(g,
!                                              GUIGraphicsUtils.WINDOW_GRAPHIC,
!                                              bg,
!                                              x,y,s.fmWidth,s.fmHeight);
! 
! 
!                      }
!                      else {
! 
!                         GUIGraphicsUtils.drawWinLowerLeft(g,
!                                              GUIGraphicsUtils.WINDOW_NORMAL,
!                                              fg,
!                                              x,y,s.fmWidth,s.fmHeight);
!                      }
!                   }
!                break;
!                case BOTTOM:
!                   if (sChar[0] == '.') {
! 
!                      if (s.isUsingGuiInterface()) {
! 
! 
!                         GUIGraphicsUtils.drawWinBottom(g,
!                                              GUIGraphicsUtils.WINDOW_GRAPHIC,
!                                              bg,
!                                              x,y,s.fmWidth,s.fmHeight);
! 
! 
!                      }
!                      else {
! 
!                         GUIGraphicsUtils.drawWinBottom(g,
!                                              GUIGraphicsUtils.WINDOW_NORMAL,
!                                              fg,
!                                              x,y,s.fmWidth,s.fmHeight);
!                      }
!                   }
!                break;
! 
!                case LOWER_RIGHT:
!                   if (sChar[0] == ':') {
!                      if (s.isUsingGuiInterface()) {
! 
!                         GUIGraphicsUtils.drawWinLowerRight(g,
!                                              GUIGraphicsUtils.WINDOW_GRAPHIC,
!                                              bg,
!                                              x,y,s.fmWidth,s.fmHeight);
! 
!                      }
!                      else {
! 
!                         GUIGraphicsUtils.drawWinLowerRight(g,
!                                              GUIGraphicsUtils.WINDOW_NORMAL,
!                                              fg,
!                                              x,y,s.fmWidth,s.fmHeight);
! 
!                      }
!                   }
!                break;
! 
!             }
!          }
! 
!          else {
!             if (sChar[0] != 0x0) {
!             // use this until we define colors for gui stuff
!                if ((useGui && whichGui < BUTTON_LEFT) && (fg == s.colorGUIField))
! 
!                   g.setColor(Color.black);
!                else
!                   g.setColor(fg);
! 
!                   try {
!                      if (useGui)
! 
!                         if (sChar[0] == 0x1C)
!                            g.drawChars(dupChar, 0, 1, x+1, cy -2);
!                         else
!                            g.drawChars(sChar, 0, 1, x+1, cy -2);
!                      else
!                         if (sChar[0] == 0x1C)
!                            g.drawChars(dupChar, 0, 1, x, cy -2);
!                         else
!                            g.drawChars(sChar, 0, 1, x, cy -2);
!                   }
!                   catch (IllegalArgumentException iae) {
!                      System.out.println(" ScreenChar iae " + iae.getMessage());
! 
!                   }
!             }
!             if(underLine ) {
! 
!                if (!useGui || s.guiShowUnderline) {
!                   g.setColor(fg);
! //                  g.drawLine(x, cy -2, (int)(x + s.fmWidth), cy -2);
! //                  g.drawLine(x, (int)(y + (s.fmHeight - s.lm.getLeading()-5)), (int)(x + s.fmWidth), (int)(y + (s.fmHeight - s.lm.getLeading())-5));
!                   g.drawLine(x, (int)(y + (s.fmHeight - (s.lm.getLeading() + s.lm.getDescent()))), (int)(x + s.fmWidth), (int)(y + (s.fmHeight -(s.lm.getLeading() + s.lm.getDescent()))));
! 
!                }
!             }
! 
!             if(colSep) {
!                g.setColor(s.colorSep);
!                switch (s.getColSepLine()) {
!                   case 0:  // line
!                      g.drawLine(x, y, x, y + s.fmHeight - 1);
!                      g.drawLine(x + s.fmWidth - 1, y, x + s.fmWidth - 1, y + s.fmHeight);
!                      break;
!                   case 1:  // short line
!                      g.drawLine(x,  y + s.fmHeight - (int)s.lm.getLeading()-4, x, y + s.fmHeight);
!                      g.drawLine(x + s.fmWidth - 1, y + s.fmHeight - (int)s.lm.getLeading()-4, x + s.fmWidth - 1, y + s.fmHeight);
!                      break;
!                   case 2:  // dot
!                      g.drawLine(x,  y + s.fmHeight - (int)s.lm.getLeading()-3, x, y + s.fmHeight - (int)s.lm.getLeading()-4);
!                      g.drawLine(x + s.fmWidth - 1, y + s.fmHeight - (int)s.lm.getLeading()-3, x + s.fmWidth - 1, y + s.fmHeight - (int)s.lm.getLeading()-4);
!                      break;
!                   case 3:  // hide
!                      break;
!                }
!             }
!          }
!       }
! 
!       if (useGui & (whichGui >= FIELD_LEFT)) {
!             int w = 0;
! 
!             switch (whichGui) {
! 
!                case FIELD_LEFT:
!                   GUIGraphicsUtils.draw3DLeft(g, GUIGraphicsUtils.INSET, x,y,
!                                              s.fmWidth,s.fmHeight);
! 
!                break;
!                case FIELD_MIDDLE:
!                   GUIGraphicsUtils.draw3DMiddle(g, GUIGraphicsUtils.INSET, x,y,
!                                              s.fmWidth,s.fmHeight);
!                break;
!                case FIELD_RIGHT:
!                   GUIGraphicsUtils.draw3DRight(g, GUIGraphicsUtils.INSET, x,y,
!                                              s.fmWidth,s.fmHeight);
!                break;
! 
!                case FIELD_ONE:
!                   GUIGraphicsUtils.draw3DOne(g, GUIGraphicsUtils.INSET, x,y,
!                                              s.fmWidth,s.fmHeight);
! 
!                break;
! 
!                case BUTTON_LEFT:
!                case BUTTON_LEFT_UP:
!                case BUTTON_LEFT_DN:
!                case BUTTON_LEFT_EB:
! 
!                   GUIGraphicsUtils.draw3DLeft(g, GUIGraphicsUtils.RAISED, x,y,
!                                              s.fmWidth,s.fmHeight);
! 
!                   break;
! 
!                case BUTTON_MIDDLE:
!                case BUTTON_MIDDLE_UP:
!                case BUTTON_MIDDLE_DN:
!                case BUTTON_MIDDLE_EB:
! 
!                   GUIGraphicsUtils.draw3DMiddle(g, GUIGraphicsUtils.RAISED, x,y,
!                                              s.fmWidth,s.fmHeight);
!                   break;
! 
!                case BUTTON_RIGHT:
!                case BUTTON_RIGHT_UP:
!                case BUTTON_RIGHT_DN:
!                case BUTTON_RIGHT_EB:
! 
!                   GUIGraphicsUtils.draw3DRight(g, GUIGraphicsUtils.RAISED, x,y,
!                                              s.fmWidth,s.fmHeight);
! 
!                break;
! 
!                // scroll bar
!                case BUTTON_SB_UP:
!                   GUIGraphicsUtils.drawScrollBar(g, GUIGraphicsUtils.RAISED, 1, x,y,
!                                              s.fmWidth,s.fmHeight,
!                                              s.colorWhite,s.colorBg);
!                   break;
! 
!                // scroll bar
!                case BUTTON_SB_DN:
! 
!                   GUIGraphicsUtils.drawScrollBar(g, GUIGraphicsUtils.RAISED, 2, x,y,
!                                              s.fmWidth,s.fmHeight,
!                                              s.colorWhite,s.colorBg);
! 
! 
!                   break;
!                // scroll bar
!                case BUTTON_SB_GUIDE:
! 
!                   GUIGraphicsUtils.drawScrollBar(g, GUIGraphicsUtils.INSET, 0,x,y,
!                                              s.fmWidth,s.fmHeight,
!                                              s.colorWhite,s.colorBg);
! 
! 
!                   break;
! 
!                // scroll bar
!                case BUTTON_SB_THUMB:
! 
!                   GUIGraphicsUtils.drawScrollBar(g, GUIGraphicsUtils.INSET, 3,x,y,
!                                              s.fmWidth,s.fmHeight,
!                                              s.colorWhite,s.colorBg);
! 
! 
!                   break;
! 
!             }
!          }
! 
!    }
  
     public final boolean isChanged() {
--- 300,669 ----
     }
  
! //      public final void drawChar(Graphics2D g) {
! //
! //         if (attributePlace && s.isShowHex()) {
! //   //      if ((sChar[0] == 0x20 || sChar[0] == 0x0 || nonDisplay) && s.isShowHex()) {
! //            Font f = g.getFont();
! //
! //            Font k = f.deriveFont(f.getSize2D()/2);
! //            g.setFont(k);
! //            g.setColor(s.colorHexAttr);
! //            char[] a = Integer.toHexString(attr).toCharArray();
! //            g.drawChars(a, 0, 1, x, y + (int)(s.fmHeight /2));
! //            g.drawChars(a, 1, 1, x+(int)(s.fmWidth/2),
! //               (int)(y + s.fmHeight - (s.lm.getDescent() + s.lm.getLeading())-2));
! //            g.setFont(f);
! //   //return;
! //         }
! //
! //         if(!nonDisplay && !attributePlace) {
! //
! //            if (!useGui) {
! //               g.setColor(bg);
! //               g.fill(cArea);
! //            }
! //            else {
! //
! //               if (bg == s.colorBg && whichGui >= FIELD_LEFT && whichGui <= FIELD_ONE)
! //                  g.setColor(s.colorGUIField);
! //               else
! //                  g.setColor(bg);
! //
! //               g.fill(cArea);
! //
! //            }
! //
! //            if (useGui && (whichGui < FIELD_LEFT)) {
! //               int w = 0;
! //
! //               g.setColor(fg);
! //
! //               switch (whichGui) {
! //
! //                  case UPPER_LEFT:
! //                     if (sChar[0] == '.') {
! //                        if (s.isUsingGuiInterface()) {
! //                           GUIGraphicsUtils.drawWinUpperLeft(g,
! //                                                GUIGraphicsUtils.WINDOW_GRAPHIC,
! //                                                s.colorBlue,
! //                                                x,y,s.fmWidth,s.fmHeight);
! //
! //                        }
! //                        else {
! //
! //                           GUIGraphicsUtils.drawWinUpperLeft(g,
! //                                                GUIGraphicsUtils.WINDOW_NORMAL,
! //                                                fg,
! //                                                x,y,s.fmWidth,s.fmHeight);
! //
! //                        }
! //                     }
! //                  break;
! //                  case UPPER:
! //                     if (sChar[0] == '.') {
! //
! //                        if (s.isUsingGuiInterface()) {
! //                           GUIGraphicsUtils.drawWinUpper(g,
! //                                                GUIGraphicsUtils.WINDOW_GRAPHIC,
! //                                                s.colorBlue,
! //                                                x,y,s.fmWidth,s.fmHeight);
! //
! //
! //                        }
! //                        else {
! //
! //                           GUIGraphicsUtils.drawWinUpper(g,
! //                                                GUIGraphicsUtils.WINDOW_NORMAL,
! //                                                fg,
! //                                                x,y,s.fmWidth,s.fmHeight);
! //                        }
! //                     }
! //                  break;
! //                  case UPPER_RIGHT:
! //                     if (sChar[0] == '.') {
! //                        if (s.isUsingGuiInterface()) {
! //
! //                           GUIGraphicsUtils.drawWinUpperRight(g,
! //                                                GUIGraphicsUtils.WINDOW_GRAPHIC,
! //                                                s.colorBlue,
! //                                                x,y,s.fmWidth,s.fmHeight);
! //
! //
! //                        }
! //                        else {
! //
! //                           GUIGraphicsUtils.drawWinUpperRight(g,
! //                                                GUIGraphicsUtils.WINDOW_NORMAL,
! //                                                fg,
! //                                                x,y,s.fmWidth,s.fmHeight);
! //
! //                        }
! //                     }
! //                  break;
! //                  case LEFT:
! //                     if (sChar[0] == ':') {
! //                        if (s.isUsingGuiInterface()) {
! //                           GUIGraphicsUtils.drawWinLeft(g,
! //                                                GUIGraphicsUtils.WINDOW_GRAPHIC,
! //                                                bg,
! //                                                x,y,s.fmWidth,s.fmHeight);
! //
! //
! //                        }
! //                        else {
! //
! //                           GUIGraphicsUtils.drawWinLeft(g,
! //                                                GUIGraphicsUtils.WINDOW_NORMAL,
! //                                                fg,
! //                                                x,y,s.fmWidth,s.fmHeight);
! //
! //                           g.drawLine(x + s.fmWidth / 2,
! //                                       y,
! //                                       x + s.fmWidth / 2,
! //                                       y + s.fmHeight);
! //                        }
! //                     }
! //                  break;
! //                  case RIGHT:
! //                     if (sChar[0] == ':') {
! //                        if (s.isUsingGuiInterface()) {
! //                           GUIGraphicsUtils.drawWinRight(g,
! //                                                GUIGraphicsUtils.WINDOW_GRAPHIC,
! //                                                bg,
! //                                                x,y,s.fmWidth,s.fmHeight);
! //
! //
! //                        }
! //                        else {
! //                           GUIGraphicsUtils.drawWinRight(g,
! //                                                GUIGraphicsUtils.WINDOW_NORMAL,
! //                                                fg,
! //                                                x,y,s.fmWidth,s.fmHeight);
! //
! //                        }
! //                     }
! //                  break;
! //                  case LOWER_LEFT:
! //                     if (sChar[0] == ':') {
! //
! //                        if (s.isUsingGuiInterface()) {
! //
! //                           GUIGraphicsUtils.drawWinLowerLeft(g,
! //                                                GUIGraphicsUtils.WINDOW_GRAPHIC,
! //                                                bg,
! //                                                x,y,s.fmWidth,s.fmHeight);
! //
! //
! //                        }
! //                        else {
! //
! //                           GUIGraphicsUtils.drawWinLowerLeft(g,
! //                                                GUIGraphicsUtils.WINDOW_NORMAL,
! //                                                fg,
! //                                                x,y,s.fmWidth,s.fmHeight);
! //                        }
! //                     }
! //                  break;
! //                  case BOTTOM:
! //                     if (sChar[0] == '.') {
! //
! //                        if (s.isUsingGuiInterface()) {
! //
! //
! //                           GUIGraphicsUtils.drawWinBottom(g,
! //                                                GUIGraphicsUtils.WINDOW_GRAPHIC,
! //                                                bg,
! //                                                x,y,s.fmWidth,s.fmHeight);
! //
! //
! //                        }
! //                        else {
! //
! //                           GUIGraphicsUtils.drawWinBottom(g,
! //                                                GUIGraphicsUtils.WINDOW_NORMAL,
! //                                                fg,
! //                                                x,y,s.fmWidth,s.fmHeight);
! //                        }
! //                     }
! //                  break;
! //
! //                  case LOWER_RIGHT:
! //                     if (sChar[0] == ':') {
! //                        if (s.isUsingGuiInterface()) {
! //
! //                           GUIGraphicsUtils.drawWinLowerRight(g,
! //                                                GUIGraphicsUtils.WINDOW_GRAPHIC,
! //                                                bg,
! //                                                x,y,s.fmWidth,s.fmHeight);
! //
! //                        }
! //                        else {
! //
! //                           GUIGraphicsUtils.drawWinLowerRight(g,
! //                                                GUIGraphicsUtils.WINDOW_NORMAL,
! //                                                fg,
! //                                                x,y,s.fmWidth,s.fmHeight);
! //
! //                        }
! //                     }
! //                  break;
! //
! //               }
! //            }
! //
! //            else {
! //               if (sChar[0] != 0x0) {
! //               // use this until we define colors for gui stuff
! //                  if ((useGui && whichGui < BUTTON_LEFT) && (fg == s.colorGUIField))
! //
! //                     g.setColor(Color.black);
! //                  else
! //                     g.setColor(fg);
! //
! //                     try {
! //                        if (useGui)
! //
! //                           if (sChar[0] == 0x1C)
! //                              g.drawChars(dupChar, 0, 1, x+1, cy -2);
! //                           else
! //                              g.drawChars(sChar, 0, 1, x+1, cy -2);
! //                        else
! //                           if (sChar[0] == 0x1C)
! //                              g.drawChars(dupChar, 0, 1, x, cy -2);
! //                           else
! //                              g.drawChars(sChar, 0, 1, x, cy -2);
! //                     }
! //                     catch (IllegalArgumentException iae) {
! //                        System.out.println(" ScreenChar iae " + iae.getMessage());
! //
! //                     }
! //               }
! //               if(underLine ) {
! //
! //                  if (!useGui || s.guiShowUnderline) {
! //                     g.setColor(fg);
! //   //                  g.drawLine(x, cy -2, (int)(x + s.fmWidth), cy -2);
! //   //                  g.drawLine(x, (int)(y + (s.fmHeight - s.lm.getLeading()-5)), (int)(x + s.fmWidth), (int)(y + (s.fmHeight - s.lm.getLeading())-5));
! //                     g.drawLine(x, (int)(y + (s.fmHeight - (s.lm.getLeading() + s.lm.getDescent()))), (int)(x + s.fmWidth), (int)(y + (s.fmHeight -(s.lm.getLeading() + s.lm.getDescent()))));
! //
! //                  }
! //               }
! //
! //               if(colSep) {
! //                  g.setColor(s.colorSep);
! //                  switch (s.getColSepLine()) {
! //                     case 0:  // line
! //                        g.drawLine(x, y, x, y + s.fmHeight - 1);
! //                        g.drawLine(x + s.fmWidth - 1, y, x + s.fmWidth - 1, y + s.fmHeight);
! //                        break;
! //                     case 1:  // short line
! //                        g.drawLine(x,  y + s.fmHeight - (int)s.lm.getLeading()-4, x, y + s.fmHeight);
! //                        g.drawLine(x + s.fmWidth - 1, y + s.fmHeight - (int)s.lm.getLeading()-4, x + s.fmWidth - 1, y + s.fmHeight);
! //                        break;
! //                     case 2:  // dot
! //                        g.drawLine(x,  y + s.fmHeight - (int)s.lm.getLeading()-3, x, y + s.fmHeight - (int)s.lm.getLeading()-4);
! //                        g.drawLine(x + s.fmWidth - 1, y + s.fmHeight - (int)s.lm.getLeading()-3, x + s.fmWidth - 1, y + s.fmHeight - (int)s.lm.getLeading()-4);
! //                        break;
! //                     case 3:  // hide
! //                        break;
! //                  }
! //               }
! //            }
! //         }
! //
! //         if (useGui & (whichGui >= FIELD_LEFT)) {
! //               int w = 0;
! //
! //               switch (whichGui) {
! //
! //                  case FIELD_LEFT:
! //                     GUIGraphicsUtils.draw3DLeft(g, GUIGraphicsUtils.INSET, x,y,
! //                                                s.fmWidth,s.fmHeight);
! //
! //                  break;
! //                  case FIELD_MIDDLE:
! //                     GUIGraphicsUtils.draw3DMiddle(g, GUIGraphicsUtils.INSET, x,y,
! //                                                s.fmWidth,s.fmHeight);
! //                  break;
! //                  case FIELD_RIGHT:
! //                     GUIGraphicsUtils.draw3DRight(g, GUIGraphicsUtils.INSET, x,y,
! //                                                s.fmWidth,s.fmHeight);
! //                  break;
! //
! //                  case FIELD_ONE:
! //                     GUIGraphicsUtils.draw3DOne(g, GUIGraphicsUtils.INSET, x,y,
! //                                                s.fmWidth,s.fmHeight);
! //
! //                  break;
! //
! //                  case BUTTON_LEFT:
! //                  case BUTTON_LEFT_UP:
! //                  case BUTTON_LEFT_DN:
! //                  case BUTTON_LEFT_EB:
! //
! //                     GUIGraphicsUtils.draw3DLeft(g, GUIGraphicsUtils.RAISED, x,y,
! //                                                s.fmWidth,s.fmHeight);
! //
! //                     break;
! //
! //                  case BUTTON_MIDDLE:
! //                  case BUTTON_MIDDLE_UP:
! //                  case BUTTON_MIDDLE_DN:
! //                  case BUTTON_MIDDLE_EB:
! //
! //                     GUIGraphicsUtils.draw3DMiddle(g, GUIGraphicsUtils.RAISED, x,y,
! //                                                s.fmWidth,s.fmHeight);
! //                     break;
! //
! //                  case BUTTON_RIGHT:
! //                  case BUTTON_RIGHT_UP:
! //                  case BUTTON_RIGHT_DN:
! //                  case BUTTON_RIGHT_EB:
! //
! //                     GUIGraphicsUtils.draw3DRight(g, GUIGraphicsUtils.RAISED, x,y,
! //                                                s.fmWidth,s.fmHeight);
! //
! //                  break;
! //
! //                  // scroll bar
! //                  case BUTTON_SB_UP:
! //                     GUIGraphicsUtils.drawScrollBar(g, GUIGraphicsUtils.RAISED, 1, x,y,
! //                                                s.fmWidth,s.fmHeight,
! //                                                s.colorWhite,s.colorBg);
! //                     break;
! //
! //                  // scroll bar
! //                  case BUTTON_SB_DN:
! //
! //                     GUIGraphicsUtils.drawScrollBar(g, GUIGraphicsUtils.RAISED, 2, x,y,
! //                                                s.fmWidth,s.fmHeight,
! //                                                s.colorWhite,s.colorBg);
! //
! //
! //                     break;
! //                  // scroll bar
! //                  case BUTTON_SB_GUIDE:
! //
! //                     GUIGraphicsUtils.drawScrollBar(g, GUIGraphicsUtils.INSET, 0,x,y,
! //                                                s.fmWidth,s.fmHeight,
! //                                                s.colorWhite,s.colorBg);
! //
! //
! //                     break;
! //
! //                  // scroll bar
! //                  case BUTTON_SB_THUMB:
! //
! //                     GUIGraphicsUtils.drawScrollBar(g, GUIGraphicsUtils.INSET, 3,x,y,
! //                                                s.fmWidth,s.fmHeight,
! //                                                s.colorWhite,s.colorBg);
! //
! //
! //                     break;
! //
! //               }
! //            }
! //
! //      }
  
     public final boolean isChanged() {
***************
*** 697,701 ****
     public final Screen5250 s;
     private boolean isChanged = true;
!    private Rectangle2D cArea; // character area
     public static final int NO_GUI = 0;
     public static final int UPPER_LEFT = 1;
--- 697,701 ----
     public final Screen5250 s;
     private boolean isChanged = true;
!    protected Rectangle2D cArea; // character area
     public static final int NO_GUI = 0;
     public static final int UPPER_LEFT = 1;

Index: GuiGraphicBuffer.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/GuiGraphicBuffer.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** GuiGraphicBuffer.java	6 Jul 2004 06:26:14 -0000	1.21
--- GuiGraphicBuffer.java	7 Jul 2004 04:15:07 -0000	1.22
***************
*** 36,42 ****
  
  import org.tn5250j.event.ScreenOIAListener;
  import org.tn5250j.tools.logging.*;
  
! public class GuiGraphicBuffer implements ScreenOIAListener {
  
     private BufferedImage bi;
--- 36,44 ----
  
  import org.tn5250j.event.ScreenOIAListener;
+ import org.tn5250j.event.ScreenListener;
  import org.tn5250j.tools.logging.*;
+ import org.tn5250j.tools.GUIGraphicsUtils;
  
! public class GuiGraphicBuffer implements ScreenOIAListener, ScreenListener {
  
     private BufferedImage bi;
***************
*** 68,72 ****
     private boolean resized = false;
     private boolean antialiased;
! 
     private Screen5250 screen;
  
--- 70,74 ----
     private boolean resized = false;
     private boolean antialiased;
!    private Graphics2D gg2d;
     private Screen5250 screen;
  
***************
*** 77,80 ****
--- 79,83 ----
        this.screen = screen;
        screen.getOIA().addOIAListener(this);
+       screen.addScreenListener(this);
        tArea = new Rectangle2D.Float();
        cArea = new Rectangle2D.Float();
***************
*** 129,133 ****
        	int numRows = screen.getRows();
        	int numCols = screen.getCols();
!       	
           Graphics2D g2d;
  
--- 132,136 ----
        	int numRows = screen.getRows();
        	int numCols = screen.getCols();
! 
           Graphics2D g2d;
  
***************
*** 180,184 ****
           g2d.setColor(screen.colorBlue);
           g2d.draw(separatorLine);
! 
        return g2d;
     }
--- 183,187 ----
           g2d.setColor(screen.colorBlue);
           g2d.draw(separatorLine);
!          gg2d = g2d;
        return g2d;
     }
***************
*** 196,200 ****
        	int row = screen.getRow(screen.getLastPos());
        	int col = screen.getCol(screen.getLastPos());
!       	
        	int fmHeight = screen.fmHeight;
        	int fmWidth = screen.fmWidth;
--- 199,203 ----
        	int row = screen.getRow(screen.getLastPos());
        	int col = screen.getCol(screen.getLastPos());
! 
        	int fmHeight = screen.fmHeight;
        	int fmWidth = screen.fmWidth;
***************
*** 204,208 ****
        	boolean rulerFixed = screen.rulerFixed;
        	int crossHair = screen.crossHair;
!       	
           Graphics2D g2 = getDrawingArea();
  
--- 207,211 ----
        	boolean rulerFixed = screen.rulerFixed;
        	int crossHair = screen.crossHair;
! 
           Graphics2D g2 = getDrawingArea();
  
***************
*** 471,475 ****
     }
  
!    public void setStatus(ScreenOIA oia) {
  
        int attr = oia.getLevel();
--- 474,478 ----
     }
  
!    private void setStatus(ScreenOIA oia) {
  
        int attr = oia.getLevel();
***************
*** 477,481 ****
        String s = oia.getInhibitedText();
        Graphics2D g2d = getWritingArea(screen.font);
!       log.info(attr + ", " + value + ", " + s);
        if (g2d == null)
           return;
--- 480,484 ----
        String s = oia.getInhibitedText();
        Graphics2D g2d = getWritingArea(screen.font);
! //      log.info(attr + ", " + value + ", " + s);
        if (g2d == null)
           return;
***************
*** 522,525 ****
--- 525,555 ----
     }
  
+    public void onScreenChanged(int which, int sr, int sc, int er, int ec) {
+ 
+ //      log.info("screen updated -> " +  sr + ", " + sc + ", " + er + ", " + ec);
+ 
+ //		workR.setBounds(sr, sc, ec, er);
+ 
+ 		int rows = er - sr;
+ 		int cols = 0;
+ 		int lc = 0;
+       int lenScreen = screen.getScreenLength();
+ 		int lr = screen.getPos(sr,sc);
+       int numCols = screen.getCols();
+ 
+ 		while (rows-- >= 0) {
+ 			cols = ec - sc;
+ 			lc = lr;
+ 			while (cols-- >= 0) {
+ 				if (lc >= 0 && lc < lenScreen) {
+ 					drawChar(gg2d,screen.screen[lc],screen.getRow(lc),screen.getCol(lc));
+                lc++;
+ 				}
+ 			}
+ 			lr += numCols;
+ 		}
+ 
+    }
+ 
     public void onOIAChanged(ScreenOIA changedOIA) {
  
***************
*** 649,652 ****
--- 679,683 ----
        }
     }
+ 
     public int getHeight(ImageObserver io) {
  
***************
*** 657,659 ****
--- 688,1107 ----
        }
     }
+ 
+    public static final int NO_GUI = 0;
+    public static final int UPPER_LEFT = 1;
+    public static final int UPPER = 2;
+    public static final int UPPER_RIGHT = 3;
+    public static final int LEFT = 4;
+    public static final int RIGHT = 5;
+    public static final int LOWER_LEFT = 6;
+    public static final int BOTTOM = 7;
+    public static final int LOWER_RIGHT = 8;
+    public static final int FIELD_LEFT = 9;
+    public static final int FIELD_RIGHT = 10;
+    public static final int FIELD_MIDDLE = 11;
+    public static final int FIELD_ONE = 12;
+    public static final int BUTTON_LEFT = 13;
+    public static final int BUTTON_RIGHT = 14;
+    public static final int BUTTON_MIDDLE = 15;
+    public static final int BUTTON_ONE = 16;
+    public static final int BUTTON_LEFT_UP = 17;
+    public static final int BUTTON_RIGHT_UP = 18;
+    public static final int BUTTON_MIDDLE_UP = 19;
+    public static final int BUTTON_ONE_UP = 20;
+    public static final int BUTTON_LEFT_DN = 21;
+    public static final int BUTTON_RIGHT_DN = 22;
+    public static final int BUTTON_MIDDLE_DN = 23;
+    public static final int BUTTON_ONE_DN = 24;
+    public static final int BUTTON_LEFT_EB = 25;
+    public static final int BUTTON_RIGHT_EB = 26;
+    public static final int BUTTON_MIDDLE_EB = 27;
+    public static final int BUTTON_SB_UP = 28;
+    public static final int BUTTON_SB_DN = 29;
+    public static final int BUTTON_SB_GUIDE = 30;
+    public static final int BUTTON_SB_THUMB = 31;
+    public static final int BUTTON_LAST = 31;
+ 
+    public final void drawChar(Graphics2D g, ScreenChar sc, int row, int col) {
+ 
+       Screen5250 s = screen;
+ 
+       Color fg = sc.fg;
+       Color bg = sc.bg;
+ 
+       cArea.setRect((s.fmWidth*col),s.fmHeight * row,s.fmWidth,s.fmHeight);
+       int x = s.fmWidth * col;
+       int y = s.fmHeight * row;
+       int cy = (int)(y + s.fmHeight - (s.lm.getDescent() + s.lm.getLeading()));
+ 
+ //      int x = sc.x;
+ //      int y = sc.y;
+       int attr = sc.attr;
+ //      int cy = sc.cy;
+ 
+       if (sc.attributePlace && s.isShowHex()) {
+ //      if ((sc.sChar[0] == 0x20 || sc.sChar[0] == 0x0 || nonDisplay) && s.isShowHex()) {
+          Font f = g.getFont();
+ 
+          Font k = f.deriveFont(f.getSize2D()/2);
+          g.setFont(k);
+          g.setColor(s.colorHexAttr);
+          char[] a = Integer.toHexString(attr).toCharArray();
+          g.drawChars(a, 0, 1, x, y + (int)(s.fmHeight /2));
+          g.drawChars(a, 1, 1, x+(int)(s.fmWidth/2),
+             (int)(y + s.fmHeight - (s.lm.getDescent() + s.lm.getLeading())-2));
+          g.setFont(f);
+ //return;
+       }
+ 
+       if(!sc.nonDisplay && !sc.attributePlace) {
+ 
+          if (!sc.useGui) {
+             g.setColor(bg);
+             g.fill(sc.cArea);
+          }
+          else {
+ 
+             if (bg == s.colorBg && sc.whichGui >= FIELD_LEFT && sc.whichGui <= FIELD_ONE)
+                g.setColor(s.colorGUIField);
+             else
+                g.setColor(bg);
+ 
+             g.fill(sc.cArea);
+ 
+          }
+ 
+          if (sc.useGui && (sc.whichGui < FIELD_LEFT)) {
+             int w = 0;
+ 
+             g.setColor(fg);
+ 
+             switch (sc.whichGui) {
+ 
+                case UPPER_LEFT:
+                   if (sc.sChar[0] == '.') {
+                      if (s.isUsingGuiInterface()) {
+                         GUIGraphicsUtils.drawWinUpperLeft(g,
+                                              GUIGraphicsUtils.WINDOW_GRAPHIC,
+                                              s.colorBlue,
+                                              x,y,s.fmWidth,s.fmHeight);
+ 
+                      }
+                      else {
+ 
+                         GUIGraphicsUtils.drawWinUpperLeft(g,
+                                              GUIGraphicsUtils.WINDOW_NORMAL,
+                                              fg,
+                                              x,y,s.fmWidth,s.fmHeight);
+ 
+                      }
+                   }
+                break;
+                case UPPER:
+                   if (sc.sChar[0] == '.') {
+ 
+                      if (s.isUsingGuiInterface()) {
+                         GUIGraphicsUtils.drawWinUpper(g,
+                                              GUIGraphicsUtils.WINDOW_GRAPHIC,
+                                              s.colorBlue,
+                                              x,y,s.fmWidth,s.fmHeight);
+ 
+ 
+                      }
+                      else {
+ 
+                         GUIGraphicsUtils.drawWinUpper(g,
+                                              GUIGraphicsUtils.WINDOW_NORMAL,
+                                              fg,
+                                              x,y,s.fmWidth,s.fmHeight);
+                      }
+                   }
+                break;
+                case UPPER_RIGHT:
+                   if (sc.sChar[0] == '.') {
+                      if (s.isUsingGuiInterface()) {
+ 
+                         GUIGraphicsUtils.drawWinUpperRight(g,
+                                              GUIGraphicsUtils.WINDOW_GRAPHIC,
+                                              s.colorBlue,
+                                              x,y,s.fmWidth,s.fmHeight);
+ 
+ 
+                      }
+                      else {
+ 
+                         GUIGraphicsUtils.drawWinUpperRight(g,
+                                              GUIGraphicsUtils.WINDOW_NORMAL,
+                                              fg,
+                                              x,y,s.fmWidth,s.fmHeight);
+ 
+                      }
+                   }
+                break;
+                case LEFT:
+                   if (sc.sChar[0] == ':') {
+                      if (s.isUsingGuiInterface()) {
+                         GUIGraphicsUtils.drawWinLeft(g,
+                                              GUIGraphicsUtils.WINDOW_GRAPHIC,
+                                              bg,
+                                              x,y,s.fmWidth,s.fmHeight);
+ 
+ 
+                      }
+                      else {
+ 
+                         GUIGraphicsUtils.drawWinLeft(g,
+                                              GUIGraphicsUtils.WINDOW_NORMAL,
+                                              fg,
+                                              x,y,s.fmWidth,s.fmHeight);
+ 
+                         g.drawLine(x + s.fmWidth / 2,
+                                     y,
+                                     x + s.fmWidth / 2,
+                                     y + s.fmHeight);
+                      }
+                   }
+                break;
+                case RIGHT:
+                   if (sc.sChar[0] == ':') {
+                      if (s.isUsingGuiInterface()) {
+                         GUIGraphicsUtils.drawWinRight(g,
+                                              GUIGraphicsUtils.WINDOW_GRAPHIC,
+                                              bg,
+                                              x,y,s.fmWidth,s.fmHeight);
+ 
+ 
+                      }
+                      else {
+                         GUIGraphicsUtils.drawWinRight(g,
+                                              GUIGraphicsUtils.WINDOW_NORMAL,
+                                              fg,
+                                              x,y,s.fmWidth,s.fmHeight);
+ 
+                      }
+                   }
+                break;
+                case LOWER_LEFT:
+                   if (sc.sChar[0] == ':') {
+ 
+                      if (s.isUsingGuiInterface()) {
+ 
+                         GUIGraphicsUtils.drawWinLowerLeft(g,
+                                              GUIGraphicsUtils.WINDOW_GRAPHIC,
+                                              bg,
+                                              x,y,s.fmWidth,s.fmHeight);
+ 
+ 
+                      }
+                      else {
+ 
+                         GUIGraphicsUtils.drawWinLowerLeft(g,
+                                              GUIGraphicsUtils.WINDOW_NORMAL,
+                                              fg,
+                                              x,y,s.fmWidth,s.fmHeight);
+                      }
+                   }
+                break;
+                case BOTTOM:
+                   if (sc.sChar[0] == '.') {
+ 
+                      if (s.isUsingGuiInterface()) {
+ 
+ 
+                         GUIGraphicsUtils.drawWinBottom(g,
+                                              GUIGraphicsUtils.WINDOW_GRAPHIC,
+                                              bg,
+                                              x,y,s.fmWidth,s.fmHeight);
+ 
+ 
+                      }
+                      else {
+ 
+                         GUIGraphicsUtils.drawWinBottom(g,
+                                              GUIGraphicsUtils.WINDOW_NORMAL,
+                                              fg,
+                                              x,y,s.fmWidth,s.fmHeight);
+                      }
+                   }
+                break;
+ 
+                case LOWER_RIGHT:
+                   if (sc.sChar[0] == ':') {
+                      if (s.isUsingGuiInterface()) {
+ 
+                         GUIGraphicsUtils.drawWinLowerRight(g,
+                                              GUIGraphicsUtils.WINDOW_GRAPHIC,
+                                              bg,
+                                              x,y,s.fmWidth,s.fmHeight);
+ 
+                      }
+                      else {
+ 
+                         GUIGraphicsUtils.drawWinLowerRight(g,
+                                              GUIGraphicsUtils.WINDOW_NORMAL,
+                                              fg,
+                                              x,y,s.fmWidth,s.fmHeight);
+ 
+                      }
+                   }
+                break;
+ 
+             }
+          }
+ 
+          else {
+             if (sc.sChar[0] != 0x0) {
+             // use this until we define colors for gui stuff
+                if ((sc.useGui && sc.whichGui < BUTTON_LEFT) && (fg == s.colorGUIField))
+ 
+                   g.setColor(Color.black);
+                else
+                   g.setColor(fg);
+ 
+                   try {
+                      if (sc.useGui)
+ 
+                         if (sc.sChar[0] == 0x1C)
+                            g.drawChars(sc.dupChar, 0, 1, x+1, cy -2);
+                         else
+                            g.drawChars(sc.sChar, 0, 1, x+1, cy -2);
+                      else
+                         if (sc.sChar[0] == 0x1C)
+                            g.drawChars(sc.dupChar, 0, 1, x, cy -2);
+                         else
+                            g.drawChars(sc.sChar, 0, 1, x, cy -2);
+                   }
+                   catch (IllegalArgumentException iae) {
+                      System.out.println(" ScreenChar iae " + iae.getMessage());
+ 
+                   }
+             }
+             if(sc.underLine ) {
+ 
+                if (!sc.useGui || s.guiShowUnderline) {
+                   g.setColor(fg);
+ //                  g.drawLine(x, cy -2, (int)(x + s.fmWidth), cy -2);
+ //                  g.drawLine(x, (int)(y + (s.fmHeight - s.lm.getLeading()-5)), (int)(x + s.fmWidth), (int)(y + (s.fmHeight - s.lm.getLeading())-5));
+                   g.drawLine(x, (int)(y + (s.fmHeight - (s.lm.getLeading() + s.lm.getDescent()))), (int)(x + s.fmWidth), (int)(y + (s.fmHeight -(s.lm.getLeading() + s.lm.getDescent()))));
+ 
+                }
+             }
+ 
+             if(sc.colSep) {
+                g.setColor(s.colorSep);
+                switch (s.getColSepLine()) {
+                   case 0:  // line
+                      g.drawLine(x, y, x, y + s.fmHeight - 1);
+                      g.drawLine(x + s.fmWidth - 1, y, x + s.fmWidth - 1, y + s.fmHeight);
+                      break;
+                   case 1:  // short line
+                      g.drawLine(x,  y + s.fmHeight - (int)s.lm.getLeading()-4, x, y + s.fmHeight);
+                      g.drawLine(x + s.fmWidth - 1, y + s.fmHeight - (int)s.lm.getLeading()-4, x + s.fmWidth - 1, y + s.fmHeight);
+                      break;
+                   case 2:  // dot
+                      g.drawLine(x,  y + s.fmHeight - (int)s.lm.getLeading()-3, x, y + s.fmHeight - (int)s.lm.getLeading()-4);
+                      g.drawLine(x + s.fmWidth - 1, y + s.fmHeight - (int)s.lm.getLeading()-3, x + s.fmWidth - 1, y + s.fmHeight - (int)s.lm.getLeading()-4);
+                      break;
+                   case 3:  // hide
+                      break;
+                }
+             }
+          }
+       }
+ 
+       if (sc.useGui & (sc.whichGui >= FIELD_LEFT)) {
+             int w = 0;
+ 
+             switch (sc.whichGui) {
+ 
+                case FIELD_LEFT:
+                   GUIGraphicsUtils.draw3DLeft(g, GUIGraphicsUtils.INSET, x,y,
+                                              s.fmWidth,s.fmHeight);
+ 
+                break;
+                case FIELD_MIDDLE:
+                   GUIGraphicsUtils.draw3DMiddle(g, GUIGraphicsUtils.INSET, x,y,
+                                              s.fmWidth,s.fmHeight);
+                break;
+                case FIELD_RIGHT:
+                   GUIGraphicsUtils.draw3DRight(g, GUIGraphicsUtils.INSET, x,y,
+                                              s.fmWidth,s.fmHeight);
+                break;
+ 
+                case FIELD_ONE:
+                   GUIGraphicsUtils.draw3DOne(g, GUIGraphicsUtils.INSET, x,y,
+                                              s.fmWidth,s.fmHeight);
+ 
+                break;
+ 
+                case BUTTON_LEFT:
+                case BUTTON_LEFT_UP:
+                case BUTTON_LEFT_DN:
+                case BUTTON_LEFT_EB:
+ 
+                   GUIGraphicsUtils.draw3DLeft(g, GUIGraphicsUtils.RAISED, x,y,
+                                              s.fmWidth,s.fmHeight);
+ 
+                   break;
+ 
+                case BUTTON_MIDDLE:
+                case BUTTON_MIDDLE_UP:
+                case BUTTON_MIDDLE_DN:
+                case BUTTON_MIDDLE_EB:
+ 
+                   GUIGraphicsUtils.draw3DMiddle(g, GUIGraphicsUtils.RAISED, x,y,
+                                              s.fmWidth,s.fmHeight);
+                   break;
+ 
+                case BUTTON_RIGHT:
+                case BUTTON_RIGHT_UP:
+                case BUTTON_RIGHT_DN:
+                case BUTTON_RIGHT_EB:
+ 
+                   GUIGraphicsUtils.draw3DRight(g, GUIGraphicsUtils.RAISED, x,y,
+                                              s.fmWidth,s.fmHeight);
+ 
+                break;
+ 
+                // scroll bar
+                case BUTTON_SB_UP:
+                   GUIGraphicsUtils.drawScrollBar(g, GUIGraphicsUtils.RAISED, 1, x,y,
+                                              s.fmWidth,s.fmHeight,
+                                              s.colorWhite,s.colorBg);
+                   break;
+ 
+                // scroll bar
+                case BUTTON_SB_DN:
+ 
+                   GUIGraphicsUtils.drawScrollBar(g, GUIGraphicsUtils.RAISED, 2, x,y,
+                                              s.fmWidth,s.fmHeight,
+                                              s.colorWhite,s.colorBg);
+ 
+ 
+                   break;
+                // scroll bar
+                case BUTTON_SB_GUIDE:
+ 
+                   GUIGraphicsUtils.drawScrollBar(g, GUIGraphicsUtils.INSET, 0,x,y,
+                                              s.fmWidth,s.fmHeight,
+                                              s.colorWhite,s.colorBg);
+ 
+ 
+                   break;
+ 
+                // scroll bar
+                case BUTTON_SB_THUMB:
+ 
+                   GUIGraphicsUtils.drawScrollBar(g, GUIGraphicsUtils.INSET, 3,x,y,
+                                              s.fmWidth,s.fmHeight,
+                                              s.colorWhite,s.colorBg);
+ 
+ 
+                   break;
+ 
+             }
+          }
+ 
+    }
+ 
  }
\ No newline at end of file

Index: Screen5250.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/Screen5250.java,v
retrieving revision 1.67
retrieving revision 1.68
diff -C2 -d -r1.67 -r1.68
*** Screen5250.java	6 Jul 2004 06:26:14 -0000	1.67
--- Screen5250.java	7 Jul 2004 04:15:07 -0000	1.68
***************
*** 2,6 ****
   *
   * <p>
!  * Title: Screen5250.jar
   * </p>
   * <p>
--- 2,6 ----
   *
   * <p>
!  * Title: Screen5250.java
   * </p>
   * <p>
***************
*** 42,45 ****
--- 42,46 ----
  import org.tn5250j.tools.*;
  import org.tn5250j.tools.system.OperatingSystem;
+ import org.tn5250j.event.ScreenListener;
  
  public class Screen5250 implements PropertyChangeListener, TN5250jConstants,
***************
*** 147,150 ****
--- 148,155 ----
  	private boolean feError;
  
+    // vector of listeners for changes to the screen.
+    Vector listeners = null;
+ 
+    // Operator Information Area
     private ScreenOIA oia;
  
***************
*** 1794,1798 ****
  		//      }
  		this.keybuf.append(text);
! 		
  		if (isStatusErrorCode() && !resetRequired) {
  			setCursorActive(false);
--- 1799,1803 ----
  		//      }
  		this.keybuf.append(text);
! 
  		if (isStatusErrorCode() && !resetRequired) {
  			setCursorActive(false);
***************
*** 4514,4517 ****
--- 4519,4523 ----
  
  	protected synchronized void updateImage(int x, int y, int width, int height) {
+ 
  		if (gg2d == null) {
  			//System.out.println("was null");
***************
*** 4593,4596 ****
--- 4599,4603 ----
  		else
  			y += bi.offTop;
+ 
  		gui.repaint(x, y, width, height);
  
***************
*** 4613,4616 ****
--- 4620,4639 ----
  	}
  
+    /**
+     * Notify all registered listeners of the onScreenChanged event.
+     *
+     */
+    private void fireScreenChanged(int which, int x, int y, int width, int height) {
+ 
+       if (listeners != null) {
+          int size = listeners.size();
+          for (int i = 0; i < size; i++) {
+             ScreenListener target =
+                     (ScreenListener)listeners.elementAt(i);
+             target.onScreenChanged(1,x,y,width,height);
+          }
+       }
+    }
+ 
  	protected void paintComponent2(Graphics2D g2) {
  
***************
*** 4645,4668 ****
  		ec--;
  
! 		//      System.out.println(sr + "," + c + "," + er + "," + ec);
! 		workR.setBounds(sr, c, ec, er);
! 
! 		int rows = er - sr;
! 		int cols = 0;
! 		int lr = workR.x;
! 		int lc = 0;
! 
! 		lr = sPos;
  
! 		while (rows-- >= 0) {
! 			cols = ec - c;
! 			lc = lr;
! 			while (cols-- >= 0) {
! 				if (lc >= 0 && lc < lenScreen)
! 					screen[lc++].drawChar(g2);
  
! 			}
! 			lr += numCols;
! 		}
  
  	}
--- 4668,4695 ----
  		ec--;
  
!       fireScreenChanged(1,sr,c,er,ec);
  
! //         //      System.out.println(sr + "," + c + "," + er + "," + ec);
!       workR.setBounds(sr, c, ec, er);
  
! //         int rows = er - sr;
! //         int cols = 0;
! //         int lr = workR.x;
! //         int lc = 0;
! //
! //         lr = sPos;
! //
! //         while (rows-- >= 0) {
! //            cols = ec - c;
! //            lc = lr;
! //            while (cols-- >= 0) {
! //               if (lc >= 0 && lc < lenScreen) {
! //   //					screen[lc++].drawChar(g2);
! //                  bi.drawChar(g2,screen[lc],getRow(lc),getCol(lc));
! //                  lc++;
! //               }
! //            }
! //            lr += numCols;
! //         }
  
  	}
***************
*** 4805,4808 ****
--- 4832,4862 ----
  	}
  
+    /**
+     * Add a ScreenListener to the listener list.
+     *
+     * @param listener  The ScreenListener to be added
+     */
+    public void addScreenListener(ScreenListener listener) {
+ 
+       if (listeners == null) {
+           listeners = new java.util.Vector(3);
+       }
+       listeners.addElement(listener);
+ 
+    }
+ 
+    /**
+     * Remove a ScreenListener from the listener list.
+     *
+     * @param listener  The ScreenListener to be removed
+     */
+    public void removeScreenListener(ScreenListener listener) {
+ 
+       if (listeners == null) {
+           return;
+       }
+       listeners.removeElement(listener);
+    }
+ 
  	/**
  	 * Utility method to share the repaint behaviour between setBounds() and
***************
*** 4824,4828 ****
  		         			ScreenOIA.OIA_LEVEL_INPUT_ERROR);
  		}
! 		
  		if (oia.getLevel() == ScreenOIA.OIA_LEVEL_INPUT_INHIBITED) {
  		   oia.setInputInhibited(ScreenOIA.INPUTINHIBITED_SYSTEM_WAIT,
--- 4878,4882 ----
  		         			ScreenOIA.OIA_LEVEL_INPUT_ERROR);
  		}
! 
  		if (oia.getLevel() == ScreenOIA.OIA_LEVEL_INPUT_INHIBITED) {
  		   oia.setInputInhibited(ScreenOIA.INPUTINHIBITED_SYSTEM_WAIT,



-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com