tn5250j/src/org/tn5250j/swing/ui BasicTerminalUI.java,1.3,1.4 BasicOIA.java,1.3,1.4 BasicScreenUI.java,1.3,1.4
"Kenneth J. Pouncey" <[email protected]> Mon, 26 Jul 2004 19:26:29 +0000
| Newsgroups | gmane.comp.java.tn5250j.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/tn5250j/tn5250j/src/org/tn5250j/swing/ui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12515/src/org/tn5250j/swing/ui
Modified Files:
BasicTerminalUI.java BasicOIA.java BasicScreenUI.java
Log Message:
Added tn5250 package to framework to start work on the interfaces
Index: BasicScreenUI.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/swing/ui/BasicScreenUI.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** BasicScreenUI.java 22 Jul 2004 05:56:40 -0000 1.3
--- BasicScreenUI.java 26 Jul 2004 19:26:26 -0000 1.4
***************
*** 1,1064 ****
! package org.tn5250j.swing.ui;
!
! import java.awt.*;
! import java.awt.event.*;
! import java.awt.font.*;
! import java.awt.geom.*;
!
! import javax.swing.*;
! import javax.swing.border.*;
!
[...2100 lines suppressed...]
!
! return adjs;
! }
!
! private int columnOffset(int x)
! {
! return (x - this.x) % columnWidth;
! }
!
! private int rowOffset(int y)
! {
! return (y - this.y) % rowHeight;
! }
!
! transient Screen5250 screen;
! transient int columns;
! transient int rows;
! transient boolean cursorEnabled;
! transient Rectangle cursorRectangle = new Rectangle();
! }
Index: BasicTerminalUI.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/swing/ui/BasicTerminalUI.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** BasicTerminalUI.java 22 Jul 2004 05:56:40 -0000 1.3
--- BasicTerminalUI.java 26 Jul 2004 19:26:26 -0000 1.4
***************
*** 1,617 ****
! package org.tn5250j.swing.ui;
!
! import java.awt.*;
! import java.awt.event.*;
! import java.awt.font.*;
! import java.beans.*;
! import javax.swing.*;
! import javax.swing.event.*;
! import javax.swing.plaf.*;
!
[...1206 lines suppressed...]
! //============================================================================
! transient PropertyChangeListener propListener = new PropertyChangeHandler();
! transient FocusListener focusListener= new FocusHandler();
! transient SessionListener sessListener = new SessionHandler();
! transient RepaintHandler repainter = new RepaintHandler();
! // transient MouseHandler mouselistener= new MouseHandler();
!
! //============================================================================
! // C o n s a n t s
! //============================================================================
! private static final String SIZE_POL_FIXED = "fixed";
! private static final String SIZE_POL_DYNAMIC = "dynamic";
!
! private static final String KEY_POL_STRING = "string";
! private static final String KEY_POL_AID = "aid";
!
! public static final ColorUIResource DFT_BACKGROUND = new ColorUIResource(Color.black);
! public static final ColorUIResource DFT_FOREGROUND = new ColorUIResource(Color.green);
! public static final Font DFT_FONT = new FontUIResource("Monospaced", Font.BOLD, 12);
! }
Index: BasicOIA.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/swing/ui/BasicOIA.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** BasicOIA.java 22 Jul 2004 05:56:40 -0000 1.3
--- BasicOIA.java 26 Jul 2004 19:26:26 -0000 1.4
***************
*** 1,199 ****
! package org.tn5250j.swing.ui;
!
! import java.awt.*;
! import java.awt.font.*;
! import javax.swing.*;
!
! //import org.ohio.*;
! import org.tn5250j.*;
! import org.tn5250j.event.*;
!
! public class BasicOIA extends BasicSubUI implements ScreenListener, ScreenOIAListener
! {
! public BasicOIA(ScreenOIA oia)
! {
! this.oia = oia;
! }
!
! public void setBounds(int x, int y, int width, int height)
! {
! super.setBounds(x,y,width, height);
! this.clearLayout();
! }
!
! public void setFont(Font font, int charWidth, int charHeight)
! {
! super.setFont(font, charWidth, charHeight);
! this.clearLayout();
! }
!
! public void onScreenSizeChanged(int rows, int cols) {
!
! }
!
! public void onScreenChanged(int inUpdate, int startRow, int startCol, int endRow, int endCol)
! {
! if ((inUpdate == 3) && (locationRectangle != null))
! addDirtyRectangle(locationRectangle);
! }
!
! public void onOIAChanged(ScreenOIA oia, int change)
! {
! switch (change)
! {
! case OIA_CHANGED_BELL:
! ringAudibleBell();
! break;
! case OIA_CHANGED_CLEAR_SCREEN:
! break;
! case OIA_CHANGED_INPUTINHIBITED:
! addDirtyRectangle(inhibitedRectangle);
! break;
! case OIA_CHANGED_INSERT_MODE:
! break;
! case OIA_CHANGED_KEYBOARD_LOCKED:
! setKeyboardLocked(oia.isKeyBoardLocked());
! break;
! case OIA_CHANGED_KEYS_BUFFERED:
! break;
! case OIA_CHANGED_MESSAGELIGHT:
! break;
! case OIA_CHANGED_SCRIPT:
! break;
! default:
! // Do nothing
! }
! }
!
! public void install()
! {
! this.oia.addOIAListener(this);
! this.oia.getSource().addScreenListener(this);
! }
!
! public void uninstall()
! {
! this.oia.removeOIAListener(this);
! this.oia.getSource().removeScreenListener(this);
!
! this.oia = null;
! }
!
! public Dimension getPreferredSize()
! {
! return new Dimension(this.columnWidth, this.rowHeight);
! }
!
! public void paintComponent(Graphics g)
! {
! doLayout();
!
! Rectangle clip = g.getClipBounds();
!
! paintRuler(g, clip);
! paintLocation(g, clip);
! paintInhibited(g, clip);
! }
!
! private void paintRuler(Graphics g, Rectangle clip)
! {
! g.setColor(Color.white);
! g.drawLine(0, 0, this.width, 0);
! }
!
! private void paintLocation(Graphics g, Rectangle clip)
! {
! if (locationRectangle.intersects(clip))
! {
! g.setColor(BasicTerminalUI.DFT_FOREGROUND);
!
! Screen5250 s = oia.getSource();
! int col = s.getCurrentCol();
! int row = s.getCurrentRow();
! int cy = (int)(locationRectangle.y + rowHeight - (metrics.getDescent() + metrics.getLeading()));
!
! g.drawString(col + "/" + row, locationRectangle.x, cy);
! }
! }
!
! private void paintInhibited(Graphics g, Rectangle clip)
! {
!
! if (inhibitedRectangle.intersects(clip))
! {
! if (oia.getInhibitedText() != null)
! System.out.println(oia.getInhibitedText());
!
! System.out.println("xsystem " + oia.getLevel() + "," + oia.getInputInhibited());
!
! g.setColor(BasicTerminalUI.DFT_FOREGROUND);
!
! Screen5250 s = oia.getSource();
! int cy = (int)(inhibitedRectangle.y + rowHeight - (metrics.getDescent() + metrics.getLeading()));
! int attr = oia.getLevel();
! int value = oia.getInputInhibited();
! String stext = oia.getInhibitedText();
!
! g.setColor(Color.black);
! g.fillRect(inhibitedRectangle.x,inhibitedRectangle.x,inhibitedRectangle.width,
! inhibitedRectangle.height);
!
! switch (oia.getLevel()) {
! case 1:
! if (value == 1) {
!
! g.setColor(Color.white);
! if (stext != null) {
! g.drawChars(stext.toCharArray(),0,
! oia.getInhibitedText().length(),inhibitedRectangle.x,cy);
! }
! else {
! g.drawChars("X - System".toCharArray(),0,
! "X - System".length(),inhibitedRectangle.x,cy);
!
! }
! }
! break;
! }
!
! }
! }
!
! public final void setPosition(int row, int column)
! {
! }
!
! transient ScreenOIA oia;
! private transient Rectangle locationRectangle;
! private transient Rectangle inhibitedRectangle;
!
! private void clearLayout()
! {
! locationRectangle = null;
! inhibitedRectangle = null;
! }
!
! private void doLayout()
! {
! if (locationRectangle == null)
! {
! Rectangle bounds = this.getBounds();
! int x,y,w,h;
!
! // Location rectangle
! w = 6 * this.columnWidth;
! locationRectangle = new Rectangle(bounds.width - w, 0, w, this.rowHeight);
! inhibitedRectangle = new Rectangle(10, 0, 25* this.columnWidth, this.rowHeight);
! }
! }
!
! private void ringAudibleBell()
! {
! Toolkit.getDefaultToolkit().beep();
! }
!
! private void setKeyboardLocked(boolean locked)
! {
!
! }
! }
--- 1,200 ----
! package org.tn5250j.swing.ui;
!
! import java.awt.*;
! import java.awt.font.*;
! import javax.swing.*;
!
! //import org.ohio.*;
! import org.tn5250j.*;
! import org.tn5250j.event.*;
! import org.tn5250j.framework.tn5250.*;
!
! public class BasicOIA extends BasicSubUI implements ScreenListener, ScreenOIAListener
! {
! public BasicOIA(ScreenOIA oia)
! {
! this.oia = oia;
! }
!
! public void setBounds(int x, int y, int width, int height)
! {
! super.setBounds(x,y,width, height);
! this.clearLayout();
! }
!
! public void setFont(Font font, int charWidth, int charHeight)
! {
! super.setFont(font, charWidth, charHeight);
! this.clearLayout();
! }
!
! public void onScreenSizeChanged(int rows, int cols) {
!
! }
!
! public void onScreenChanged(int inUpdate, int startRow, int startCol, int endRow, int endCol)
! {
! if ((inUpdate == 3) && (locationRectangle != null))
! addDirtyRectangle(locationRectangle);
! }
!
! public void onOIAChanged(ScreenOIA oia, int change)
! {
! switch (change)
! {
! case OIA_CHANGED_BELL:
! ringAudibleBell();
! break;
! case OIA_CHANGED_CLEAR_SCREEN:
! break;
! case OIA_CHANGED_INPUTINHIBITED:
! addDirtyRectangle(inhibitedRectangle);
! break;
! case OIA_CHANGED_INSERT_MODE:
! break;
! case OIA_CHANGED_KEYBOARD_LOCKED:
! setKeyboardLocked(oia.isKeyBoardLocked());
! break;
! case OIA_CHANGED_KEYS_BUFFERED:
! break;
! case OIA_CHANGED_MESSAGELIGHT:
! break;
! case OIA_CHANGED_SCRIPT:
! break;
! default:
! // Do nothing
! }
! }
!
! public void install()
! {
! this.oia.addOIAListener(this);
! this.oia.getSource().addScreenListener(this);
! }
!
! public void uninstall()
! {
! this.oia.removeOIAListener(this);
! this.oia.getSource().removeScreenListener(this);
!
! this.oia = null;
! }
!
! public Dimension getPreferredSize()
! {
! return new Dimension(this.columnWidth, this.rowHeight);
! }
!
! public void paintComponent(Graphics g)
! {
! doLayout();
!
! Rectangle clip = g.getClipBounds();
!
! paintRuler(g, clip);
! paintLocation(g, clip);
! paintInhibited(g, clip);
! }
!
! private void paintRuler(Graphics g, Rectangle clip)
! {
! g.setColor(Color.white);
! g.drawLine(0, 0, this.width, 0);
! }
!
! private void paintLocation(Graphics g, Rectangle clip)
! {
! if (locationRectangle.intersects(clip))
! {
! g.setColor(BasicTerminalUI.DFT_FOREGROUND);
!
! Screen5250 s = oia.getSource();
! int col = s.getCurrentCol();
! int row = s.getCurrentRow();
! int cy = (int)(locationRectangle.y + rowHeight - (metrics.getDescent() + metrics.getLeading()));
!
! g.drawString(col + "/" + row, locationRectangle.x, cy);
! }
! }
!
! private void paintInhibited(Graphics g, Rectangle clip)
! {
!
! if (inhibitedRectangle.intersects(clip))
! {
! if (oia.getInhibitedText() != null)
! System.out.println(oia.getInhibitedText());
!
! System.out.println("xsystem " + oia.getLevel() + "," + oia.getInputInhibited());
!
! g.setColor(BasicTerminalUI.DFT_FOREGROUND);
!
! Screen5250 s = oia.getSource();
! int cy = (int)(inhibitedRectangle.y + rowHeight - (metrics.getDescent() + metrics.getLeading()));
! int attr = oia.getLevel();
! int value = oia.getInputInhibited();
! String stext = oia.getInhibitedText();
!
! g.setColor(Color.black);
! g.fillRect(inhibitedRectangle.x,inhibitedRectangle.x,inhibitedRectangle.width,
! inhibitedRectangle.height);
!
! switch (oia.getLevel()) {
! case 1:
! if (value == 1) {
!
! g.setColor(Color.white);
! if (stext != null) {
! g.drawChars(stext.toCharArray(),0,
! oia.getInhibitedText().length(),inhibitedRectangle.x,cy);
! }
! else {
! g.drawChars("X - System".toCharArray(),0,
! "X - System".length(),inhibitedRectangle.x,cy);
!
! }
! }
! break;
! }
!
! }
! }
!
! public final void setPosition(int row, int column)
! {
! }
!
! transient ScreenOIA oia;
! private transient Rectangle locationRectangle;
! private transient Rectangle inhibitedRectangle;
!
! private void clearLayout()
! {
! locationRectangle = null;
! inhibitedRectangle = null;
! }
!
! private void doLayout()
! {
! if (locationRectangle == null)
! {
! Rectangle bounds = this.getBounds();
! int x,y,w,h;
!
! // Location rectangle
! w = 6 * this.columnWidth;
! locationRectangle = new Rectangle(bounds.width - w, 0, w, this.rowHeight);
! inhibitedRectangle = new Rectangle(10, 0, 25* this.columnWidth, this.rowHeight);
! }
! }
!
! private void ringAudibleBell()
! {
! Toolkit.getDefaultToolkit().beep();
! }
!
! private void setKeyboardLocked(boolean locked)
! {
!
! }
! }
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click