eTextReader.tabletpc
Class InkAnnotationWindow

java.lang.Object
  extended by java.lang.Thread
      extended by eTextReader.tabletpc.InkAnnotationWindow
All Implemented Interfaces:
java.lang.Runnable

public class InkAnnotationWindow
extends java.lang.Thread


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
(package private)  InkCallback callback
          Callback object to call when messages are received
static int CHANGE_DISPLAY_TYPE
           
(package private)  DBClient client
          A DBClient object that we can use to communicate with the database; this is only used to retrieve the notation data
static int CLOSE_ANNOTATION
           
static int DELETE_ANNOTATION
           
(package private)  java.io.DataInputStream fromWindows
          A stream to receive data from the windows process
private static java.lang.String INK_THREADGROUP_NAME
          The name of the thread group used to store InkAnnotationWindow threads
private static java.lang.ThreadGroup inkAnnotationThreads
          Contains references to each of the InkAnnotationWindow threads
static int ISF
          Constant used to indicate retrieval of ISF data
(package private)  byte[] isfData
          Holds the annotation data in Ink Serialized Format
static int LOAD_ANNOTATION
           
private static int newInkAnnotations
          Keeps a count of the number of new ink annotation windows; used to generate a unique name for the threads
(package private)  Notation notation
          Holds information about the Notation object this window is editing
(package private)  java.awt.Dimension parentSize
          The size of the opening window before this window was opened
static int PNG
          Constant used to indicate retrieval of PNG data
(package private)  byte[] pngData
          Holds the annotation data in Portable Network Graphic format
static int RESIZE_WINDOW
          constants used to identify messages between this object and the windows process
static int SAVE_ANNOTATION
           
(package private)  java.net.ServerSocket server
          A socket used by this object to receive commands from the windows process
static int SHARE_ANNOTATION
           
static int SHOW_DETAILS
           
(package private)  java.lang.String subject
          Holds the subject of the annotation entered by the user
static int TABLET_ANNOTATION_PORT
          the port number used on tablet PC to communicate with the windows annotation server
(package private)  java.io.DataOutputStream toWindows
          A stream to write data to the windows process
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
InkAnnotationWindow(InkCallback callback, Notation notation, DBClient client, int x, int y, int width, int height, java.awt.Dimension parentSize)
          creates a new InkAnnotationWindow object, working on the given notation
 
Method Summary
 void close()
          Closes this window
static void closeAllInkThreads()
           
 byte[] getAnnotationData(int type)
          retrieves the annotation data in the specified format
 java.lang.String getSubject()
          returns the annotation subject entered by the user
static java.lang.String getThreadName(Notation n)
          Create a unique thread name for a new ink annotation
 void run()
           
private  void saveAnnotation()
          called when the user requests the ink annotation be saved.
private  void sendNotationData()
          loads the notation data from the database, and then sends it to the windows process
protected  void setupInkAnnotation(int width, int height, int x, int y)
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ISF

public static final int ISF
Constant used to indicate retrieval of ISF data

See Also:
Constant Field Values

PNG

public static final int PNG
Constant used to indicate retrieval of PNG data

See Also:
Constant Field Values

TABLET_ANNOTATION_PORT

public static final int TABLET_ANNOTATION_PORT
the port number used on tablet PC to communicate with the windows annotation server

See Also:
Constant Field Values

RESIZE_WINDOW

public static final int RESIZE_WINDOW
constants used to identify messages between this object and the windows process

See Also:
Constant Field Values

SAVE_ANNOTATION

public static final int SAVE_ANNOTATION
See Also:
Constant Field Values

LOAD_ANNOTATION

public static final int LOAD_ANNOTATION
See Also:
Constant Field Values

CLOSE_ANNOTATION

public static final int CLOSE_ANNOTATION
See Also:
Constant Field Values

DELETE_ANNOTATION

public static final int DELETE_ANNOTATION
See Also:
Constant Field Values

SHARE_ANNOTATION

public static final int SHARE_ANNOTATION
See Also:
Constant Field Values

SHOW_DETAILS

public static final int SHOW_DETAILS
See Also:
Constant Field Values

CHANGE_DISPLAY_TYPE

public static final int CHANGE_DISPLAY_TYPE
See Also:
Constant Field Values

callback

InkCallback callback
Callback object to call when messages are received


isfData

byte[] isfData
Holds the annotation data in Ink Serialized Format


pngData

byte[] pngData
Holds the annotation data in Portable Network Graphic format


subject

java.lang.String subject
Holds the subject of the annotation entered by the user


notation

Notation notation
Holds information about the Notation object this window is editing


client

DBClient client
A DBClient object that we can use to communicate with the database; this is only used to retrieve the notation data


parentSize

java.awt.Dimension parentSize
The size of the opening window before this window was opened


server

java.net.ServerSocket server
A socket used by this object to receive commands from the windows process


fromWindows

java.io.DataInputStream fromWindows
A stream to receive data from the windows process


toWindows

java.io.DataOutputStream toWindows
A stream to write data to the windows process


inkAnnotationThreads

private static java.lang.ThreadGroup inkAnnotationThreads
Contains references to each of the InkAnnotationWindow threads


newInkAnnotations

private static int newInkAnnotations
Keeps a count of the number of new ink annotation windows; used to generate a unique name for the threads


INK_THREADGROUP_NAME

private static java.lang.String INK_THREADGROUP_NAME
The name of the thread group used to store InkAnnotationWindow threads

Constructor Detail

InkAnnotationWindow

public InkAnnotationWindow(InkCallback callback,
                           Notation notation,
                           DBClient client,
                           int x,
                           int y,
                           int width,
                           int height,
                           java.awt.Dimension parentSize)
creates a new InkAnnotationWindow object, working on the given notation

Parameters:
callback: - an InkCallback object that this window will notify when various events occur
notation: - the notation object to load when the window is opened. Note this should always be the notation describing the PNG version of the data, not the ISF version.
client: - a DBClient object that can be used to retrieve the notation data from the database. If the value of client is null, a new DBClient object will be constructed
x - the x coordinate where the window should be opened
y - the y coordinate where the window should be opened
width - the width of the window when opened
height - the height of the window when opened
parentSize - the size of the parent window before this window is opened. This value is passed back to the callback object as part of the callback methods
Method Detail

getThreadName

public static java.lang.String getThreadName(Notation n)
Create a unique thread name for a new ink annotation


closeAllInkThreads

public static void closeAllInkThreads()

setupInkAnnotation

protected void setupInkAnnotation(int width,
                                  int height,
                                  int x,
                                  int y)

getSubject

public java.lang.String getSubject()
returns the annotation subject entered by the user


getAnnotationData

public byte[] getAnnotationData(int type)
retrieves the annotation data in the specified format

Returns:
a byte array containing the ink data in the requested format

close

public void close()
Closes this window


saveAnnotation

private void saveAnnotation()
                     throws java.io.IOException
called when the user requests the ink annotation be saved. retrieves the data about the annotation from the database, and then notifies the callback object by invoking its saveAnnotation method.

Throws:
java.io.IOException

sendNotationData

private void sendNotationData()
loads the notation data from the database, and then sends it to the windows process


run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread