Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

jpl2.link.channels
Class WPRTChannel  view WPRTChannel download WPRTChannel.java

java.lang.Object
  extended byjpl2.link.channels.ServerChannel
      extended byjpl2.link.channels.WPRTChannel
All Implemented Interfaces:
Channel, jpl2.common.Preference.Listener

public class WPRTChannel
extends ServerChannel
implements jpl2.common.Preference.Listener

Print server. Implements "Print Via PC" in the psion link protocol.


Nested Class Summary
 class WPRTChannel.Line
           
 class WPRTChannel.State
           
 class WPRTChannel.TestPrint
           
 class WPRTChannel.Text
           
 
Field Summary
static int CANCEL
           
private  WPRTChannel.TestPrint canvas
           
private  int channel
           
private static int DASH_DOT_DOT_PEN
           
private static int DASH_DOT_PEN
           
private static int DASHED_PEN
           
static int DATA
           
private static int DOTTED_PEN
           
static int DRAW_BITMAP
           
static int DRAW_BITMAP_SRC
           
private  java.lang.String[] fontNames
           
private  boolean fontsFound
           
private  jpl2.common.Data frameData
           
private  boolean frameReceived
           
private  java.awt.Graphics g
           
private  java.awt.PrintJob job
           
static int LEVEL
           
private  WPRTChannel.Line line
           
private static int NULL_PEN
           
private  int pageResolution
           
private  java.awt.Dimension pageSize
           
static int PRIMITIVE_06
           
static int PRIMITIVE_08
           
static int PRIMITIVE_11
           
static int PRIMITIVE_17
           
static int PRIMITIVE_BACKGROUND
           
static int PRIMITIVE_CARRIAGERETURN
           
static int PRIMITIVE_END
           
static int PRIMITIVE_FONT
           
static int PRIMITIVE_FOREGROUND
           
static int PRIMITIVE_LABEL
           
static int PRIMITIVE_LINE
           
static int PRIMITIVE_NEWLINE
           
static int PRIMITIVE_OF
           
static int PRIMITIVE_POLYGON
           
static int PRIMITIVE_RECTANGLE
           
static int PRIMITIVE_START
           
static int PRIMITIVE_STRIKETHROUGH
           
static int PRIMITIVE_TEXT
           
static int PRIMITIVE_UNDERLINE
           
static int RESET_CLIPPING_RECT
           
private  WPRTChannel self
           
static int SET_CLIPPING_RECT
           
static int SET_DRAW_MODE
           
static int SET_PEN_STYLE
           
private static int SOLID_PEN
           
private  int[] startJobBytes
           
private  int[] startPageBytes
           
private  WPRTChannel.State state
           
private  boolean testPrint
           
 int twipsPerInch
           
 
Fields inherited from class jpl2.link.channels.ServerChannel
COMPLETE, layer, PARTIAL
 
Fields inherited from interface jpl2.link.channels.Channel
FRAME_SIZE
 
Constructor Summary
WPRTChannel()
           
 
Method Summary
private  void cancelJob()
           
 void completeFrameReceived(jpl2.common.Data data)
           
 void connected()
           
 void data()
           
 void drawImage(java.awt.Image image, int left, int top, int right, int bottom)
           
 void drawLabel(java.lang.String text, int left, int baseline)
           
 void drawLine(int x1, int y1, int x2, int y2)
           
 void drawPolygon(int[] xpoints, int[] ypoints, int npoints)
           
 void drawRect(int left, int top, int right, int bottom)
           
 void drawString(java.lang.String str, int x, int y)
           
 void drawText(java.lang.String text, int left, int top, int right, int bottom, int baseline, int align, int margin)
          Attempt to justify the text in between the left and right values.
private  void endJob()
           
 int getChannel()
           
private  boolean isStartOfjob(jpl2.common.Data data)
           
private  void makeCanvas()
           
private  void pageDone()
           
 void partialFrameReceived(jpl2.common.Data data)
           
 void preferenceChanged(java.lang.String pref, java.lang.String value)
          This method will be called on each registered Preference.Listener objects when a preference has been changed.
private  boolean printPage(jpl2.common.Data pageData)
          Print a page from the data given.
private  int readLength(jpl2.common.Data data)
           
 jpl2.common.Data receiveFrame()
           
private  java.awt.PrintJob requestPrintJob()
           
 void resetClip()
           
 void runPrintServer()
           
 void sendLevel()
           
 void setChannel(int channel)
           
 void setClip(int x1, int y1, int x2, int y2)
           
 void setPrintToWindow(boolean printToWindow)
           
private  boolean startJob()
           
private  int twipsToPixels(int twips)
           
private  int twipsToPoint(int twips)
           
 
Methods inherited from class jpl2.link.channels.ServerChannel
getDstChannel, received, sendFrame, setDstChannel, setSessionLayer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEVEL

public static final int LEVEL
See Also:
Constant Field Values

DATA

public static final int DATA
See Also:
Constant Field Values

CANCEL

public static final int CANCEL
See Also:
Constant Field Values

PRIMITIVE_START

public static final int PRIMITIVE_START
See Also:
Constant Field Values

PRIMITIVE_END

public static final int PRIMITIVE_END
See Also:
Constant Field Values

SET_DRAW_MODE

public static final int SET_DRAW_MODE
See Also:
Constant Field Values

SET_CLIPPING_RECT

public static final int SET_CLIPPING_RECT
See Also:
Constant Field Values

RESET_CLIPPING_RECT

public static final int RESET_CLIPPING_RECT
See Also:
Constant Field Values

PRIMITIVE_06

public static final int PRIMITIVE_06
See Also:
Constant Field Values

PRIMITIVE_FONT

public static final int PRIMITIVE_FONT
See Also:
Constant Field Values

PRIMITIVE_08

public static final int PRIMITIVE_08
See Also:
Constant Field Values

PRIMITIVE_UNDERLINE

public static final int PRIMITIVE_UNDERLINE
See Also:
Constant Field Values

PRIMITIVE_STRIKETHROUGH

public static final int PRIMITIVE_STRIKETHROUGH
See Also:
Constant Field Values

PRIMITIVE_NEWLINE

public static final int PRIMITIVE_NEWLINE
See Also:
Constant Field Values

PRIMITIVE_CARRIAGERETURN

public static final int PRIMITIVE_CARRIAGERETURN
See Also:
Constant Field Values

PRIMITIVE_FOREGROUND

public static final int PRIMITIVE_FOREGROUND
See Also:
Constant Field Values

SET_PEN_STYLE

public static final int SET_PEN_STYLE
See Also:
Constant Field Values

PRIMITIVE_OF

public static final int PRIMITIVE_OF
See Also:
Constant Field Values

PRIMITIVE_BACKGROUND

public static final int PRIMITIVE_BACKGROUND
See Also:
Constant Field Values

PRIMITIVE_11

public static final int PRIMITIVE_11
See Also:
Constant Field Values

PRIMITIVE_17

public static final int PRIMITIVE_17
See Also:
Constant Field Values

PRIMITIVE_LINE

public static final int PRIMITIVE_LINE
See Also:
Constant Field Values

PRIMITIVE_RECTANGLE

public static final int PRIMITIVE_RECTANGLE
See Also:
Constant Field Values

PRIMITIVE_POLYGON

public static final int PRIMITIVE_POLYGON
See Also:
Constant Field Values

DRAW_BITMAP

public static final int DRAW_BITMAP
See Also:
Constant Field Values

DRAW_BITMAP_SRC

public static final int DRAW_BITMAP_SRC
See Also:
Constant Field Values

PRIMITIVE_LABEL

public static final int PRIMITIVE_LABEL
See Also:
Constant Field Values

PRIMITIVE_TEXT

public static final int PRIMITIVE_TEXT
See Also:
Constant Field Values

NULL_PEN

private static final int NULL_PEN
See Also:
Constant Field Values

SOLID_PEN

private static final int SOLID_PEN
See Also:
Constant Field Values

DOTTED_PEN

private static final int DOTTED_PEN
See Also:
Constant Field Values

DASHED_PEN

private static final int DASHED_PEN
See Also:
Constant Field Values

DASH_DOT_PEN

private static final int DASH_DOT_PEN
See Also:
Constant Field Values

DASH_DOT_DOT_PEN

private static final int DASH_DOT_DOT_PEN
See Also:
Constant Field Values

fontNames

private final java.lang.String[] fontNames

fontsFound

private boolean fontsFound

testPrint

private boolean testPrint

canvas

private WPRTChannel.TestPrint canvas

twipsPerInch

public final int twipsPerInch
See Also:
Constant Field Values

job

private java.awt.PrintJob job

pageSize

private java.awt.Dimension pageSize

pageResolution

private int pageResolution

g

private java.awt.Graphics g

state

private WPRTChannel.State state

line

private WPRTChannel.Line line

self

private WPRTChannel self

channel

private int channel

frameData

private jpl2.common.Data frameData

frameReceived

private boolean frameReceived

startPageBytes

private final int[] startPageBytes

startJobBytes

private final int[] startJobBytes
Constructor Detail

WPRTChannel

public WPRTChannel()
Method Detail

preferenceChanged

public void preferenceChanged(java.lang.String pref,
                              java.lang.String value)
This method will be called on each registered Preference.Listener objects when a preference has been changed.

Specified by:
preferenceChanged in interface jpl2.common.Preference.Listener

twipsToPixels

private int twipsToPixels(int twips)

twipsToPoint

private int twipsToPoint(int twips)

getChannel

public int getChannel()
Specified by:
getChannel in interface Channel

setChannel

public void setChannel(int channel)
Specified by:
setChannel in interface Channel

setPrintToWindow

public void setPrintToWindow(boolean printToWindow)

connected

public void connected()
Specified by:
connected in interface Channel

sendLevel

public void sendLevel()
               throws java.io.IOException

data

public void data()
          throws java.io.IOException

completeFrameReceived

public void completeFrameReceived(jpl2.common.Data data)
                           throws java.io.IOException
Specified by:
completeFrameReceived in class ServerChannel

partialFrameReceived

public void partialFrameReceived(jpl2.common.Data data)
                          throws java.io.IOException
Specified by:
partialFrameReceived in class ServerChannel

receiveFrame

public jpl2.common.Data receiveFrame()
                              throws java.io.IOException

readLength

private int readLength(jpl2.common.Data data)
                throws java.io.IOException

makeCanvas

private void makeCanvas()

startJob

private boolean startJob()

requestPrintJob

private java.awt.PrintJob requestPrintJob()

cancelJob

private void cancelJob()
                throws java.io.IOException

printPage

private boolean printPage(jpl2.common.Data pageData)
                   throws java.io.IOException
Print a page from the data given.


pageDone

private void pageDone()

endJob

private void endJob()

isStartOfjob

private boolean isStartOfjob(jpl2.common.Data data)
                      throws java.io.IOException

runPrintServer

public void runPrintServer()
                    throws java.io.IOException

setClip

public void setClip(int x1,
                    int y1,
                    int x2,
                    int y2)

resetClip

public void resetClip()

drawLine

public void drawLine(int x1,
                     int y1,
                     int x2,
                     int y2)

drawRect

public void drawRect(int left,
                     int top,
                     int right,
                     int bottom)

drawPolygon

public void drawPolygon(int[] xpoints,
                        int[] ypoints,
                        int npoints)

drawLabel

public void drawLabel(java.lang.String text,
                      int left,
                      int baseline)

drawText

public void drawText(java.lang.String text,
                     int left,
                     int top,
                     int right,
                     int bottom,
                     int baseline,
                     int align,
                     int margin)
Attempt to justify the text in between the left and right values.


drawString

public void drawString(java.lang.String str,
                       int x,
                       int y)

drawImage

public void drawImage(java.awt.Image image,
                      int left,
                      int top,
                      int right,
                      int bottom)