tn5250j/src/org/tn5250j Gui5250.java,1.56,1.57 My5250App.java,1.12,1.13 Screen5250.java,1.49,1.50 SessionAttributes.java,1.16,1.17 SessionPopup.java,1.7,1.8 Sessions.java,1.6,1.7 Stream5250.java,1.1.1.1,1.2 tnvt.java,1.38,1.39
Patrick Bielen <[email protected]> Wed, 31 Mar 2004 12:25:10 +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-serv23849/src/org/tn5250j
Modified Files:
Gui5250.java My5250App.java Screen5250.java
SessionAttributes.java SessionPopup.java Sessions.java
Stream5250.java tnvt.java
Log Message:
Submitted by: Kenneth
Various updates to update CVS with actual code
Index: tnvt.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/tnvt.java,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -d -r1.38 -r1.39
*** tnvt.java 15 Feb 2004 12:55:49 -0000 1.38
--- tnvt.java 31 Mar 2004 12:25:07 -0000 1.39
***************
*** 44,48 ****
Stream5250 bk;
DataStreamProducer producer;
! private Screen5250 screen52;
private boolean waitingForInput;
boolean invited;
--- 44,48 ----
Stream5250 bk;
DataStreamProducer producer;
! protected Screen5250 screen52;
private boolean waitingForInput;
[...1140 lines suppressed...]
}
--- 2724,2730 ----
if (enhanced == true) {
! // abyte0[53] = 0x5E; // 0x5E turns on ehnhanced mode
! // abyte0[53] = 0x27; // 0x5E turns on ehnhanced mode
! abyte0[53] = 0x7; // 0x5E turns on ehnhanced mode
System.out.println("enhanced options");
}
***************
*** 2705,2708 ****
--- 2736,2743 ----
// interface level 3. Bit 4 allows headers
// and footers for windows
+ abyte0[54] = 8; // 54 - 60 Reserved set to 0x00
+ // 54 - I found out is used for enhanced user
+ // interface level 3. Bit 4 allows headers
+ // and footers for windows
abyte0[55] = 0;
abyte0[56] = 0;
Index: My5250App.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/My5250App.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** My5250App.java 9 Jul 2003 18:55:39 -0000 1.12
--- My5250App.java 31 Mar 2004 12:25:07 -0000 1.13
***************
*** 36,39 ****
--- 36,40 ----
Properties sesProps = new Properties();
+ System.out.println(" We have loaded a new one");
// Start loading properties - Host must exist
***************
*** 108,112 ****
/**Get Applet information*/
public String getAppletInfo() {
! return "tn5250j - Jave tn5250 Client";
}
--- 109,113 ----
/**Get Applet information*/
public String getAppletInfo() {
! return "tn5250j - " + tn5250jRelease + tn5250jVersion + tn5250jSubVer + " - Jave tn5250 Client";
}
Index: Sessions.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/Sessions.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Sessions.java 15 Feb 2004 17:30:43 -0000 1.6
--- Sessions.java 31 Mar 2004 12:25:07 -0000 1.7
***************
*** 44,48 ****
public void actionPerformed(ActionEvent e) {
- //String t = new Date(e.getWhen()).toString();
Session ses;
for (int x = 0; x < sessions.size(); x++) {
--- 44,47 ----
***************
*** 51,55 ****
if (ses.isConnected() && ses.isSendKeepAlive()) {
ses.getVT().sendHeartBeat();
! //System.out.println(" sent heartbeat to " + ses.getSessionName());
}
}
--- 50,54 ----
if (ses.isConnected() && ses.isSendKeepAlive()) {
ses.getVT().sendHeartBeat();
! System.out.println(" sent heartbeat to " + ses.getSessionName());
}
}
***************
*** 59,64 ****
}
- //System.out.println(" sending heartbeats " + t);
-
}
--- 58,61 ----
Index: Screen5250.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/Screen5250.java,v
retrieving revision 1.49
retrieving revision 1.50
diff -C2 -d -r1.49 -r1.50
*** Screen5250.java 18 Feb 2004 05:05:10 -0000 1.49
--- Screen5250.java 31 Mar 2004 12:25:07 -0000 1.50
***************
*** 775,778 ****
--- 775,792 ----
}
+ public void setBlinkCursorStop() {
+ if (blinker != null) {
+ blinker.stop();
+ blinker.removeActionListener(this);
+ blinker = null;
+ }
+ }
+
+ public boolean isBlinkCursor() {
+
+ return blinker != null;
+
+ }
+
public boolean isHotSpots() {
return hotSpots;
***************
*** 1606,1611 ****
if (strokenizer.hasMoreKeyStrokes()) {
! s = strokenizer.nextKeyStroke();
! if (s.length() == 1) {
// setCursorOn();
// if (!keysBuffered) {
--- 1620,1628 ----
if (strokenizer.hasMoreKeyStrokes()) {
! // check to see if position is in a field and if it is then change
! // current field to that field
! isInField(lastPos,true);
! s = strokenizer.nextKeyStroke();
! if (s.length() == 1) {
// setCursorOn();
// if (!keysBuffered) {
***************
*** 1615,1619 ****
// try { new Thread().sleep(400);} catch (InterruptedException ie) {}
! simulateKeyStroke(s.charAt(0));
// System.out.println(" s two " + s + " " + cursorActive);
// if (cursorActive && !keysBuffered) {
--- 1632,1636 ----
// try { new Thread().sleep(400);} catch (InterruptedException ie) {}
! simulateKeyStroke(s.charAt(0));
// System.out.println(" s two " + s + " " + cursorActive);
// if (cursorActive && !keysBuffered) {
***************
*** 3457,3460 ****
--- 3474,3549 ----
}
+ /**
+ * Roll the screen up or down.
+ *
+ * Byte 1: Bit 0 0 = Roll up
+ * 1 = Roll down
+ * Bits 1-2 Reserved
+ * Bits 3-7 Number of lines that the
+ * designated area is to be
+ * rolled
+ * Byte 2: Bits 0-7 Line number defining the top
+ * line of the area that will
+ * participate in the roll.
+ * Byte 3: Bits 0-7 Line number defining the
+ * bottom line of the area that
+ * will participate in the roll.
+ *
+ * @param direction
+ * @param topLine
+ * @param bottomLine
+ */
+ public void rollScreen(int direction, int topLine, int bottomLine) {
+
+ // get the number of lines which are the last 5 bits
+ int lines = direction & 0x7F;
+ // get the direction of the roll which is the first bit
+ // 0 - up
+ // 1 - down
+ int updown = direction & 0x80;
+
+ // calculate the reference points for the move.
+ int start = this.getPos(topLine - 1,0);
+ int end = this.getPos(bottomLine - 1,numCols - 1);
+ int len = end - start;
+
+ // System.out.println(" starting roll");
+ // dumpScreen();
+ switch(updown) {
+ case 0:
+ // Now round em up and head em UP.
+ for (int x = start; x < len + numCols; x++) {
+ screen[x].setChar(screen[x + numCols].getChar());
+ }
+ break;
+ case 1:
+ // Now round em up and head em DOWN.
+ for (int x = end + numCols; x > 0; x--) {
+ screen[x+numCols].setChar(screen[x].getChar());
+ }
+ break;
+ default:
+ System.err.println(" Invalid roll parameter - please report this");
+ }
+ // System.out.println(" end roll");
+ // dumpScreen();
+
+ }
+ public void dumpScreen () {
+
+ StringBuffer sb = new StringBuffer();
+ char[] s = getScreenAsChars();
+ int c = getCols();
+ int l = getRows() * c;
+ int col = 0;
+ for (int x = 0; x < l; x++, col++) {
+ sb.append(s[x]);
+ if (col == c) {
+ sb.append('\n');
+ col = 0;
+ }
+ }
+ System.out.println(sb.toString());
+ }
/**
***************
*** 3534,3537 ****
--- 3623,3650 ----
}
+ class ChoiceField {
+
+ int x;
+ int y;
+ int width;
+ int height;
+ char mnemonic;
+ int fieldId;
+
+ }
+
+ Vector choices;
+
+ public void addChoiceField(String text) {
+
+ if (choices == null) {
+ choices = new Vector(3);
+ }
+
+ ChoiceField cf = new ChoiceField();
+ cf.fieldId = screenFields.getCurrentField().getFieldId();
+ choices.add(cf);
+
+ }
// public void addChoiceField(int attr, int len, int ffw1, int ffw2, int fcw1, int fcw2) {
//
Index: SessionPopup.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/SessionPopup.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** SessionPopup.java 15 Feb 2004 12:55:49 -0000 1.7
--- SessionPopup.java 31 Mar 2004 12:25:07 -0000 1.8
***************
*** 1,749 ****
! /**
! * Title: tn5250J
! * Copyright: Copyright (c) 2001
! * Company:
! * @author Kenneth J. Pouncey
! * @version 0.5
! *
! * Description:
! *
! * This program is free software; you can redistribute it and/or modify
[...1471 lines suppressed...]
! // lets set this puppy up to connect within its own thread
! Runnable connectIt = new Runnable() {
! public void run() {
! vt.connect();
! }
!
! };
!
! // now lets set it to connect within its own daemon thread
! // this seems to work better and is more responsive than using
! // swingutilities's invokelater
! Thread ct = new Thread(connectIt);
! ct.setDaemon(true);
! ct.start();
!
! }
!
! }
!
! }
Index: Stream5250.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/Stream5250.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** Stream5250.java 10 Apr 2002 19:46:21 -0000 1.1.1.1
--- Stream5250.java 31 Mar 2004 12:25:07 -0000 1.2
***************
*** 1,92 ****
! package org.tn5250j;
! /**
! * Title: tn5250J
! * Copyright: Copyright (c) 2001
! * Company:
! * @author Kenneth J. Pouncey
! * @version 0.4
! *
! * Description:
! *
! * This program is free software; you can redistribute it and/or modify
! * it under the terms of the GNU General Public License as published by
! * the Free Software Foundation; either version 2, or (at your option)
! * any later version.
! *
! * This program is distributed in the hope that it will be useful,
! * but WITHOUT ANY WARRANTY; without even the implied warranty of
! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! * GNU General Public License for more details.
! *
! * You should have received a copy of the GNU General Public License
! * along with this software; see the file COPYING. If not, write to
! * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
! * Boston, MA 02111-1307 USA
! *
! */
!
! public class Stream5250 {
!
! public int streamSize;
! public int opCode;
! public int dataStart;
! public int pos;
! public byte buffer[];
!
! public Stream5250(byte abyte0[]) {
! buffer = abyte0;
! // size without end of record 0xFF 0xEF
! streamSize = (abyte0[0] & 0xff) << 8 | abyte0[1] & 0xff;
! opCode = abyte0[9];
! dataStart = 6 + abyte0[6];
! pos = dataStart;
! }
!
! public final int getOpCode() {
! return opCode;
! }
!
! public final byte getNextByte()
! throws Exception {
! if(pos > buffer.length)
! throw new Exception("Buffer length exceeded: " + pos);
! else
! return buffer[pos++];
! }
!
! public final void setPrevByte()
! throws Exception {
! if(pos == 0) {
! throw new Exception("Index equals zero.");
! }
! else {
! pos--;
! return;
! }
! }
!
! public final int getCurrentPos() {
! return pos;
! }
!
! public final byte getByteOffset(int off)
! throws Exception {
!
! if((pos + off ) > buffer.length)
! throw new Exception("Buffer length exceeded: " + pos);
! else
! return buffer[pos + off];
!
! }
!
! public final boolean size() {
! return pos >= streamSize;
! }
!
!
! public final boolean hasNext() {
!
! // return pos >= buffer.length;
! return pos < streamSize;
! }
! }
--- 1,148 ----
! /**
! * Title: tn5250J
! * Copyright: Copyright (c) 2001
! * Company:
! * @author Kenneth J. Pouncey
! * @version 0.4
! *
! * Description:
! *
! * This program is free software; you can redistribute it and/or modify
! * it under the terms of the GNU General Public License as published by
! * the Free Software Foundation; either version 2, or (at your option)
! * any later version.
! *
! * This program is distributed in the hope that it will be useful,
! * but WITHOUT ANY WARRANTY; without even the implied warranty of
! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! * GNU General Public License for more details.
! *
! * You should have received a copy of the GNU General Public License
! * along with this software; see the file COPYING. If not, write to
! * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
! * Boston, MA 02111-1307 USA
! *
! */
! package org.tn5250j;
!
! public class Stream5250 {
!
! public int streamSize;
! public int opCode;
! public int dataStart;
! public int pos;
! public byte buffer[];
!
! public Stream5250(byte abyte0[]) {
! buffer = abyte0;
! // size without end of record 0xFF 0xEF
! streamSize = (abyte0[0] & 0xff) << 8 | abyte0[1] & 0xff;
! opCode = abyte0[9];
! dataStart = 6 + abyte0[6];
! pos = dataStart;
! }
!
! public final int getOpCode() {
! return opCode;
! }
!
! public final byte getNextByte()
! throws Exception {
! if(pos > buffer.length)
! throw new Exception("Buffer length exceeded: " + pos);
! else
! return buffer[pos++];
! }
!
! public final void setPrevByte()
! throws Exception {
! if(pos == 0) {
! throw new Exception("Index equals zero.");
! }
! else {
! pos--;
! return;
! }
! }
!
! /**
! * Returns where we are in the buffer
! * @return position in the buffer
! */
! public final int getCurrentPos() {
! return pos;
! }
!
! public final byte getByteOffset(int off)
! throws Exception {
!
! if((pos + off ) > buffer.length)
! throw new Exception("Buffer length exceeded: " + pos);
! else
! return buffer[pos + off];
!
! }
!
! public final boolean size() {
! return pos >= streamSize;
! }
!
!
! /**
! * Determines if any more bytes are available in the buffer to be processed.
! * @return yes or no
! */
! public final boolean hasNext() {
!
! // return pos >= buffer.length;
! return pos < streamSize;
! }
!
! /**
! * This routine will retrieve a segment based on the first two bytes being
! * the length of the segment.
! *
! * @return a new byte array containing the bytes of the segment.
! * @throws Exception
! */
! public final byte[] getSegment() throws Exception {
!
! // The first two bytes contain the length of the segment.
! int length = ((buffer[pos] & 0xff )<< 8 | (buffer[pos+1] & 0xff));
! // allocate space for it.
! byte[] segment = new byte[length];
!
! getSegment(segment,length,true);
!
! return segment;
! }
!
!
! /**
! * This routine will retrieve a byte array based on the first two bytes being
! * the length of the segment.
! *
! * @param segment - byte array
! * @param length - length of segment to return
! * @param adjustPos - adjust the position of the buffer to the end of the seg
! * ment
! * @throws Exception
! */
! public final void getSegment(byte[] segment, int length, boolean adjustPos)
! throws Exception {
!
! // If the length is larger than what is available throw an exception
! if((pos + length ) > buffer.length)
! throw new Exception("Buffer length exceeded: start " + pos
! + " length " + length);
! // use the system array copy to move the bytes from the buffer
! // to the allocated byte array
! System.arraycopy(buffer,pos,segment,0,length);
!
! // update the offset to be after the segment so the next byte can be read
! if (adjustPos)
! pos +=length;
!
! }
!
! }
Index: SessionAttributes.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/SessionAttributes.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** SessionAttributes.java 9 Jul 2003 18:55:39 -0000 1.16
--- SessionAttributes.java 31 Mar 2004 12:25:07 -0000 1.17
***************
*** 51,55 ****
JPanel jp;
! public SessionAttributes(JFrame parent, SessionConfig config ) {
super(parent);
--- 51,55 ----
JPanel jp;
! public SessionAttributes(Frame parent, SessionConfig config ) {
super(parent);
Index: Gui5250.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/Gui5250.java,v
retrieving revision 1.56
retrieving revision 1.57
diff -C2 -d -r1.56 -r1.57
*** Gui5250.java 15 Feb 2004 12:55:49 -0000 1.56
--- Gui5250.java 31 Mar 2004 12:25:07 -0000 1.57
***************
*** 29,34 ****
--- 29,38 ----
import java.awt.*;
import java.awt.event.*;
+ import java.awt.dnd.*;
+ import java.awt.datatransfer.*;
import javax.swing.*;
import java.util.*;
+
+
import org.tn5250j.tools.*;
import org.tn5250j.mailtools.*;
***************
*** 39,42 ****
--- 43,47 ----
import org.tn5250j.event.SessionConfigListener;
import org.tn5250j.event.SessionConfigEvent;
+ import org.tn5250j.interfaces.SessionScrollerInterface;
import org.tn5250j.keyboard.KeyboardHandler;
import org.tn5250j.event.EmulatorActionListener;
***************
*** 49,52 ****
--- 54,58 ----
SessionListener,
SessionConfigListener {
+ // DropTargetListener {
BorderLayout borderLayout1 = new BorderLayout();
***************
*** 68,71 ****
--- 74,78 ----
protected SessionConfig sesConfig;
protected KeyboardHandler keyHandler;
+ protected SessionScrollerInterface scroller;
public Gui5250 () {
***************
*** 145,148 ****
--- 152,159 ----
});
+ scroller = new SessionScroller().getScrollerInstance((Session)this);
+ if (!sesConfig.getStringProperty("mouseWheel").equals("Yes"))
+ scroller.removeMouseWheelListener((Session)this);
+
keyHandler = KeyboardHandler.getKeyboardHandlerInstance((Session)this);
***************
*** 175,178 ****
--- 186,243 ----
doubleClick = false;
+ DropTargetAdapter dta = new DropTargetAdapter() {
+ public void drop(DropTargetDropEvent dtde) {
+ Transferable tr = dtde.getTransferable();
+ dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
+ DataFlavor[] dfs = dtde.getCurrentDataFlavors();
+ if(tr.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
+ try {
+ System.out.println("dtde drop it2 ");
+
+ java.util.List fileList =
+ (java.util.List)tr.getTransferData(DataFlavor.javaFileListFlavor);
+ // implementation for when we are able to process a list
+ // of files.
+ // Iterator iterator = fileList.iterator();
+ // if (iterator.hasNext()) {
+ // File file = (File)iterator.next();
+ // }
+ java.io.File file = (java.io.File)fileList.get(0);
+ System.out.println(file.toString());
+ dtde.dropComplete(true);
+ doTransfer(file);
+ return;
+ }
+ catch (UnsupportedFlavorException ufe) {
+ System.out.println("importData: unsupported data flavor");
+ }
+ catch (java.io.IOException ieo) {
+ System.out.println("importData: I/O exception");
+ }
+ catch (Exception ex) {
+ System.out.println(ex.getMessage());
+ }
+ finally {
+ dtde.dropComplete(false);
+ }
+ }
+ }
+ };
+ DropTarget dt = new DropTarget((JPanel)this,dta);
+
+ setDropTarget(dt);
+
+ }
+
+ private void doTransfer(java.io.File file) {
+
+ try {
+ Properties props = new Properties();
+ props.load(new java.io.FileInputStream(file));
+ org.tn5250j.tools.XTFRFile tfr = new org.tn5250j.tools.XTFRFile(null,
+ vt, (Session)this,props);
+ }
+ catch (Exception exc) {}
+
}
***************
*** 408,411 ****
--- 473,485 ----
}
+ if (pn.equals("mouseWheel")) {
+ if (((String)pce.getNewValue()).equals("Yes")) {
+ scroller.addMouseWheelListener((Session)this);
+ }
+ else {
+ scroller.removeMouseWheelListener((Session)this);
+ }
+ }
+
screen.propertyChange(pce);
***************
*** 577,580 ****
--- 651,660 ----
sesConfig.saveSessionProps(getParent());
+
+ // Let's stop the cursor blinking as well as it seems to be causing problems
+ if (screen.isBlinkCursor()) {
+ screen.setBlinkCursorStop();
+ }
+
vt.disconnect();
***************
*** 588,593 ****
public void doAttributes() {
! SessionAttributes sa = new SessionAttributes(
! (JFrame)SwingUtilities.getRoot(this),
sesConfig);
sa.showIt();
--- 668,672 ----
public void doAttributes() {
! SessionAttributes sa = new SessionAttributes((Frame)SwingUtilities.getRoot(this),
sesConfig);
sa.showIt();
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click