CIC iSign Version 1.2

InkTools
Class CicInkControl

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--InkTools.CicInkControl
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class CicInkControl
extends java.awt.Canvas
implements java.io.Serializable

Provides the signature box, the UI element of InkTools. This class connects automatically to an input device (digitizer) and captures and displays the ink data if the user does sign his/her signature into this box.

The signature is captures as raw data into a CicDoodle object and then rendered in realtime into the InkControl. A CicDoodle with ink data can also get loaded into the InkControl for redisplay. All the visible elements of the InkControl are controlable via class methods or Java-Bean properties.

Version:
1.0
Author:
CIC
See Also:
Serialized Form

Field Summary
static int FIT_TO_CONTROL
          This diaplay option will force the InkControl to resize the ink so that it is displayed filling the InkControl.
static int NORMAL_INK
          With this display option the ink data will be displayed in its original dimension if it fits into the control.
 CicWinTab winThread
           
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
CicInkControl()
          Constructs an emty InkControl object with default values: size is 300 by 150 screen points, black ink on white background with blue double border, writing guide is shown.
CicInkControl(CicDoodle doodle)
          Constructs an InkControl and loads the ink from the CicDoodle object passed in.
CicInkControl(int width, int height)
          Constructs an empty InkControl with the specified height and width.
 
Method Summary
 void deleteInk()
          Deletes the actual ink data in the current doodle and clears the ink from the InkControl.
 void drawInk()
          Displays the current ink onto the screen.
 void drawInk(java.awt.Graphics g)
          Displays the current ink onto the screen.
 void endWintabDataCollection()
          Stops the CicWinTab thread class.
 java.awt.Color getBackgroundColor()
          Returns the current background color of the InkControl.
 java.awt.Color getBorderColor()
          Return the current border color
 int getBorderStyle()
          Returns the current border style.
 java.awt.Dimension getCtrlSize()
          Get the current dimension of the InkControl
 CicDoodle getDoodle()
          Returns a copy (clone) of the current active CicDoodle object.
 boolean getEnabled()
          Returns the enable status of the control
 CicDoodle[] getEnrollSignaturesFromPalm(java.lang.String userName, int numSigs)
          Deprecated. 

Call this function if you want the user to input enrollment signatures from a Palm device. The Palm has to be connected to the desktop and he/she has to start the 'SignIt' application on the palm device and input the signatures there. The signatures are then transmitted and displayed in the InkControl.

 java.awt.Color getInkColor()
          Returns the current ink color.
 int getInkWidth()
          Returns the current ink width
 CicDoodle getRefToDoodle()
          Returns a reference to the current active CicDoodle object.
 CicDoodle getSignature()
          This function supports multiple signature collection in the InkControl like it is used for the enrollment process.
 boolean getSignatureFromPalm(java.lang.String userName)
          Deprecated. 

Call this function if you want the user to input a signature from a Palm device. The Palm has to be connected to the desktop and he/she has to start the 'SignIt' application on the palm device and input the signature there. The signature gets then transmitted and displayed in the InkControl.

 int getWritingGuide()
          Returns the current writing guide style.
 boolean hasInk()
          This function checks if the current active CicDoodle object of the InkControl has any ink in it.
 void hasMoved()
          The parent applet/application has moved.
 void isInForeground(boolean bIsInForeground)
          If the application or applet where this InkControl is embedded switched the foreground status, this function should be called to update the status.
 void loadDoodle(CicDoodle newDoodle)
          This function loads a new doodle into the InkControl.
 java.awt.Dimension minimumSize()
          Requirred by the BEAN API.
 void paint(java.awt.Graphics g)
          Overwrites Component paint function.
 java.awt.Dimension preferredSize()
          Requirred by the BEAN API.
 void setBackgroundColor(java.awt.Color newBackgroundColor)
          Sets the background color of the ink control.
 void setBorderColor(java.awt.Color color)
          Sets the InkControl border color.
 void setBorderStyle(int bStyle)
          Sets the border style for the InkControl.
 void setControlSize(int width, int height)
          The size of the InkControl box will be changed with this function.
 void setCtrlSize(java.awt.Dimension dim)
          The size of the InkControl box will be changed with this function.
 void setDisplayMode(int mode)
          Sets the display mode for the InkControl.
 void setDisplaySmoothingLevel(int smoothingLevel)
          Sets the Paper property displaySmoothingLevel.
 void setEnabled(boolean enable)
          This functions enables or disables the InkControl.
 void setInkColor(java.awt.Color color)
          Changes the color of the ink in the InkControl
 void setInkWidth(int width)
          Changes the current ink width for display.
 void setWritingGuide(int newWritingGuide)
          Sets the writing guide style .
 void stopWinThread()
          Stops the CicWinTab thread class.
 void update(java.awt.Graphics g)
          Overwrites Component update function.
 
Methods inherited from class java.awt.Canvas
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NORMAL_INK

public static final int NORMAL_INK
With this display option the ink data will be displayed in its original dimension if it fits into the control. If the signature is to big, it will be resized. This is the default.

See Also:
Constant Field Values

FIT_TO_CONTROL

public static final int FIT_TO_CONTROL
This diaplay option will force the InkControl to resize the ink so that it is displayed filling the InkControl. This option should be enabled if ink data is redisplayed.

See Also:
Constant Field Values

winThread

public CicWinTab winThread
Constructor Detail

CicInkControl

public CicInkControl()
Constructs an emty InkControl object with default values: size is 300 by 150 screen points, black ink on white background with blue double border, writing guide is shown. On a Windows system, the control will try to connect to the JavaInk DLL in order to utilize the direct interface to a digitizer otherwise mouse message are used to collect ink data.


CicInkControl

public CicInkControl(int width,
                     int height)
Constructs an empty InkControl with the specified height and width. Other value are: black ink on white background with blue double border, writing guide is shown. On a Windows system, the control will try to connect to the JavaInk DLL in order to utilize the direct interface to a digitizer otherwise mouse message are used to collect ink data.

Parameters:
width - the width of the InkControl box
height - the height of the InkControl box

CicInkControl

public CicInkControl(CicDoodle doodle)
Constructs an InkControl and loads the ink from the CicDoodle object passed in. Default values are: size is 300 by 150 screen points, black ink on white background with blue double border, writing guide is shown. On a Windows system, the control will try to connect to the JavaInk DLL in order to utilize the direct interface to a digitizer otherwise mouse message are used to collect ink data.

Parameters:
doodle - The CicDoodle object which gets laoded into the InkControl
Method Detail

hasMoved

public void hasMoved()
The parent applet/application has moved. If the Windows Tablet Engine running, we need to notify the dll that the InkControle moved, so the mapping can be adjusted.


stopWinThread

public void stopWinThread()
Stops the CicWinTab thread class. This method should be called if an applet receives the stop message.


endWintabDataCollection

public void endWintabDataCollection()
Stops the CicWinTab thread class. This method should be called if an applet receives the stop message. If CicInkControl will use the CicWinTab class for data collection, a call to this function ensures that the Windows Wintab32 DLL is released and a new Wintab data collection later on will be correct initilized. This is the same method as 'stopWinThread', just with a more appropriate name.


deleteInk

public void deleteInk()
Deletes the actual ink data in the current doodle and clears the ink from the InkControl. This function should be used if a user wants to reenter ink into the InkControl.


drawInk

public void drawInk()
Displays the current ink onto the screen. If a new CicDoodle object was loaded into the control, the data will first converted from tablet format into screen format and than scaled to fit into the control.


drawInk

public void drawInk(java.awt.Graphics g)
Displays the current ink onto the screen. If a new CicDoodle object was loaded into the control, the data will first converted from tablet format into screen format and than scaled to fit into the control.


setControlSize

public void setControlSize(int width,
                           int height)
The size of the InkControl box will be changed with this function. The current ink will be redisplayed after it got rescaled to the new InkControl dimensions.

Parameters:
width - the new width of the InkControl
height - the new height of the InkControl

setCtrlSize

public void setCtrlSize(java.awt.Dimension dim)
The size of the InkControl box will be changed with this function. The current ink will be redisplayed after it got rescaled to the new InkControl dimensions.

Parameters:
dim - the new dimension of the InkControl

getCtrlSize

public java.awt.Dimension getCtrlSize()
Get the current dimension of the InkControl

Returns:
the current dimension of the InkControl

setInkWidth

public void setInkWidth(int width)
Changes the current ink width for display.

Parameters:
width - The new ink width for display. Only single=1 and double=2 is supported for now

getInkWidth

public int getInkWidth()
Returns the current ink width

Returns:
the current ink width

setInkColor

public void setInkColor(java.awt.Color color)
Changes the color of the ink in the InkControl

Parameters:
color - the new ink color

getInkColor

public java.awt.Color getInkColor()
Returns the current ink color.

Returns:
the current ink color

setEnabled

public void setEnabled(boolean enable)
This functions enables or disables the InkControl. An enabled InkControl will be able to collect ink, while a disabled control can only redisplay ink. Note: there should be only one InkControl enabled at one time, so if an application has several controls, make sure only one InkControl is enabled.

Overrides:
setEnabled in class java.awt.Component
Parameters:
enable - true to enable the control or false to disable it

getEnabled

public boolean getEnabled()
Returns the enable status of the control

Returns:
true if the InkControl is currently enabled, otherwise false

setBorderStyle

public void setBorderStyle(int bStyle)
Sets the border style for the InkControl. Currently supported are:

Parameters:
bStyle - inkControl border style

getBorderStyle

public int getBorderStyle()
Returns the current border style.

Returns:
the current border style

setBorderColor

public void setBorderColor(java.awt.Color color)
Sets the InkControl border color.

Parameters:
color - the new border color

getBorderColor

public java.awt.Color getBorderColor()
Return the current border color

Returns:
current border color

setDisplaySmoothingLevel

public void setDisplaySmoothingLevel(int smoothingLevel)
Sets the Paper property displaySmoothingLevel. This property is used to set the degree of ink smoothing for display only, including the pen trace when a user inputs strokes. Valid levels are 0 to 6 with a value of 6 the highest amount of smoothing available

Parameters:
smoothingLevel - the smoothing level to use for displaying ink

getDoodle

public CicDoodle getDoodle()
Returns a copy (clone) of the current active CicDoodle object. The ink in the control gets not erased.

Returns:
a copy of the current active CicDoodle object

getRefToDoodle

public CicDoodle getRefToDoodle()
Returns a reference to the current active CicDoodle object. Note that this is no copy (clone), so if you change the returning doodle you will also change the undelying doodle for the InkControl. Create a new doole from this doodle if you need to.

Returns:
the current active CicDoodle object

getSignatureFromPalm

public boolean getSignatureFromPalm(java.lang.String userName)
Deprecated. 

Call this function if you want the user to input a signature from a Palm device. The Palm has to be connected to the desktop and he/she has to start the 'SignIt' application on the palm device and input the signature there. The signature gets then transmitted and displayed in the InkControl.

Parameters:
userName - the name which should be displayed on the palm device, only 9 characters are allowed
Returns:
true if successfull, else false

getEnrollSignaturesFromPalm

public CicDoodle[] getEnrollSignaturesFromPalm(java.lang.String userName,
                                               int numSigs)
Deprecated. 

Call this function if you want the user to input enrollment signatures from a Palm device. The Palm has to be connected to the desktop and he/she has to start the 'SignIt' application on the palm device and input the signatures there. The signatures are then transmitted and displayed in the InkControl.

Parameters:
userName - the name which should be displayed on the palm device, only 9 characters are allowed
numSigs - the number of signature to be collected, for enrollment usually three
Returns:
the CicDoolde array with numSigs doodles or null if an error occurred or the user canceled the enrollment

loadDoodle

public void loadDoodle(CicDoodle newDoodle)
This function loads a new doodle into the InkControl. The current ink data gets overriden (use getDoodle first to save the current ink). The InkControl will be disabled for realtime inking until the ink gets deleted with deleteInk() method or is enabled again. This is done in order to prevent that ink with different properties are mixed in the control, for example if the loaded signature was created on a different digitiser the one on the users system. Call the drawInk() method to show the ink in the control.

Parameters:
newDoodle - the new ink data loaded into this InkControl

setDisplayMode

public void setDisplayMode(int mode)
Sets the display mode for the InkControl. If set to NORMAL_INK = 1, the ink data is displayed like it was collected, only if its to big to fit into the control or way too small, the ink data is rescaled to fit into the control. If set to FIT_TO_CONTROL = 2, the ink data will be scaled that it fits exactly into the control placed onto the writing guide. The underlying ink data gets not changed.

Parameters:
mode - the display mode with 1 = NORMAL_INK and 2 = FIT_TO_CONTROL

hasInk

public boolean hasInk()
This function checks if the current active CicDoodle object of the InkControl has any ink in it.

Returns:
true if the InkControl has ink, otherwise false

getSignature

public CicDoodle getSignature()
This function supports multiple signature collection in the InkControl like it is used for the enrollment process. The current ink data in the active CicDoodle object gets returned and a new empty CicDoodle object gets created and set active in the control.

Returns:
the current ink data in a CicDoodle object

preferredSize

public java.awt.Dimension preferredSize()
Requirred by the BEAN API. Returns default size of the control

Overrides:
preferredSize in class java.awt.Component
Returns:
default dimension of the control

minimumSize

public java.awt.Dimension minimumSize()
Requirred by the BEAN API. Returns the minimum size for the control

Overrides:
minimumSize in class java.awt.Component
Returns:
minimum size is currently (100, 50)

update

public void update(java.awt.Graphics g)
Overwrites Component update function. Performs realtime inking of single points or repaints the whole stroke if stroke is ready. No Inking if inking is disabled.

Overrides:
update in class java.awt.Canvas
Parameters:
g - graphics context

paint

public void paint(java.awt.Graphics g)
Overwrites Component paint function. Does some initialization of the InkControl if this function gets called the first time. Repaints otherwise the InkControl and the ink.

Overrides:
paint in class java.awt.Canvas
Parameters:
g - Graphics context

setWritingGuide

public void setWritingGuide(int newWritingGuide)
Sets the writing guide style . Supported for now are:

Parameters:
newWritingGuide - the writing guide style

getWritingGuide

public int getWritingGuide()
Returns the current writing guide style.

Returns:
The current writing guide style

setBackgroundColor

public void setBackgroundColor(java.awt.Color newBackgroundColor)
Sets the background color of the ink control. Default is white.

Parameters:
newBackgroundColor - the new background color

getBackgroundColor

public java.awt.Color getBackgroundColor()
Returns the current background color of the InkControl.

Returns:
The current background color of the InkControl

isInForeground

public void isInForeground(boolean bIsInForeground)
If the application or applet where this InkControl is embedded switched the foreground status, this function should be called to update the status. The reason for this is, that if the underlying JavaInk DLL (Windows OS) is used for the data input, the control must disable the ink input into the control in case an other application in order to prevent unintended inking. The underlying JavaInk dll does not know if the InkControl is the top windows or not.

Parameters:
bIsInForeground - set to true if the application/applet switched back to the foreground (is the active window) or false if it switched to the background (is inactive window)

CIC iSign Version 1.2