Enterprise Information Portal APIs

com.ibm.mm.viewer.annotation
Class CMBPageAnnotation

java.lang.Object
  |
  +--com.ibm.mm.viewer.annotation.CMBPageAnnotation
All Implemented Interfaces:
java.lang.Cloneable, CMBAnnotationConstants, CMBAnnotationPropertiesInterface, java.io.Serializable, java.awt.datatransfer.Transferable
Direct Known Subclasses:
CMBArrowAnnotation, CMBCircleAnnotation, CMBHighlightAnnotation, CMBLineAnnotation, CMBNoteAnnotation, CMBPenAnnotation, CMBRectAnnotation, CMBStampAnnotation, CMBTextAnnotation

public class CMBPageAnnotation
extends java.lang.Object
implements CMBAnnotationPropertiesInterface, CMBAnnotationConstants, java.io.Serializable, java.awt.datatransfer.Transferable, java.lang.Cloneable

The base class for all annotation objects.

Since:
8.1
See Also:
Serialized Form

Field Summary
protected  boolean allowedToDraw
          flag that tells whether the annotation should draw itself or not
protected  boolean applyPropertiesNow
          true when the annotation properties are applied immediately
protected  boolean canHide
           
protected  boolean canShow
           
protected  boolean canUpdate
           
protected  int creationIndex
          The creation index to keep track of the z-order of the annotation when it was created.
protected  int currentIndex
          The current index that indicates the z-order of the annotation.
protected static int DEFAULT_BORDER_WIDTH
           
protected static boolean DEFAULT_TRANSPARENCY
           
protected  boolean invertedHorz
          true if the bounding rectangle has been reversed (say by dragging a right handle accross a left handle)
protected  boolean invertedVert
          true if the bounding rectangle has been reversed (say by dragging a bottom handle accross a top handle)
protected  boolean isInMotion
          true when the annotation is resized or moved
protected  boolean isVisibleWhileDragging
          true if the entire annotation must be drawn while it is moved or resized otherwise only the outline is drawn
static java.awt.datatransfer.DataFlavor pageAnnotationFlavor
          DataFlavor used for clipboard operations as part of the Transferable interface
protected  int pageNumber
          page that the annotation is drawn on
protected  boolean showHandles
          flag that tells whether to show or hide the selection handles around the annotation
protected  int type
          The annotation type
 
Fields inherited from interface com.ibm.mm.viewer.annotation.CMBAnnotationConstants
ANN_ARROW, ANN_CIRCLE, ANN_HIGHLIGHT, ANN_LINE, ANN_NAMES, ANN_NOTE, ANN_PEN, ANN_RECT, ANN_STAMP, ANN_TEXT, ANN_UNKNOWN, BOTTOM_HANDLE, BOTTOM_LEFT_HANDLE, BOTTOM_RIGHT_HANDLE, CURSOR_COUNT, DEFAULT_CURSOR, DEFAULT_CURSOR_HOTSPOT, DELETING_ANNOTATION, DOUBLE_CLICK, DRAG_MOVE, DRAG_RESIZE, HANDLE_CURSOR, HANDLE_HEIGHT, HANDLE_HOTSPOT, HANDLE_WIDTH, IDLE, IIDSP_PAGE_SCALE_FACTOR, IIOV_ROTATE_0, IIOV_ROTATE_180, IIOV_ROTATE_270, IIOV_ROTATE_90, INSERTING_ANNOTATION, LEFT_HANDLE, MOVE_CURSOR, MOVE_CURSOR_HOTSPOT, OPAQUE_ALPHA, PRIV_CREATE_ANNOTATION, PRIV_DELETE_ANNOTATION, PRIV_VIEW_ANNOTATION, RIGHT_HANDLE, START_CUSTOM_TYPE, TEXT_OFFSET, TOP_HANDLE, TOP_LEFT_HANDLE, TOP_RIGHT_HANDLE, TRANSPARENT_ALPHA, UPDATE_ANN_WITH_DEFAULTS, UPDATE_ANN_WITH_GUI, UPDATE_DEFAULTS_WITH_ANN, UPDATE_DEFAULTS_WITH_GUI, UPDATE_GUI_WITH_ANN, UPDATE_GUI_WITH_DEFAULTS
 
Constructor Summary
CMBPageAnnotation()
          Standard constructor
CMBPageAnnotation(java.awt.Rectangle r)
           
CMBPageAnnotation(java.awt.Rectangle r, int pageNumber)
           
 
Method Summary
 void addAnnotationPropertiesListener(CMBAnnotationPropertiesListener apl)
           
 void addPropertyComponent(java.lang.String propertyName, javax.swing.JComponent component)
           
 boolean canHide()
           
 boolean canShow()
          Privilege testing for annotations.
 boolean canUpdate()
           
 java.lang.Object clone()
          Cloneable interface
 boolean contains(java.awt.Point p)
           
 void dispose()
           
 void dontDraw()
          Sets an internal flag that tells the annotation not to draw itself even though its draw() method is invoked.
 void draw(java.awt.Graphics2D g2)
          Draws the annotation on the supplied graphics.
protected  void drawHandles(java.awt.Graphics2D g)
          Draws the handles on the given graphics
 void drawOutline(java.awt.Graphics2D g2)
          Draws the dashed outline of the annotation.
protected  void drawSelectionBox(java.awt.Graphics2D g)
           
 void firePropertiesChangeEvent()
           
 void firePropertiesWillChangeEvent()
           
 int getAnnotationRotation()
           
 java.awt.Color getBorderColor()
          gets The color used for border.
 int getBorderWidth()
           
 int getCreationIndex()
           
 int getCurrentIndex()
           
protected  int getDefaultHandleHeight()
           
protected  int getDefaultHandleWidth()
           
 java.awt.Rectangle getDrawRect()
          Gets the rectangle in which the annotation will be drawn.
 java.awt.Color getFillColor()
          gets The color used for fill.
protected  java.awt.Rectangle getFillRect()
          Gets the inner 'hollow' rectangle that is to be filled.
 java.awt.Font getFont()
           
 boolean getInvertHorizontal()
           
 boolean getInvertVertical()
           
 java.lang.String getName()
           
protected  java.awt.Stroke getOutlineStroke()
          gets The stroke being used to paint the outline of the annotation (like when dragging).
 int getPageNumber()
           
 java.lang.String getPropertiesGroupTitle()
           
 javax.swing.JPanel getPropertiesPanel()
          Returns the custom properties panel that is used to build the custom properties dialog for the annotation.
 java.awt.Rectangle getRefreshRect()
          Gets the rectangle that encompasses the entire annotation, including borders and handles For example a 1 inch annotation can have a 1 inch border, and so it covers 2 inches not 1.
 boolean getRotateWithImage()
           
 int getRotation()
           
 java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor)
          Transferable interfaces
 java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
           
 boolean getTransparent()
          returns true if transparent.
 int getType()
          gets an enumerated type of the current annoation.
 boolean getVisibleWhileDragging()
           
 void growBy(int dx, int dy)
          grows the annotation (its bounding rectangle) by dx dy
 void handlePropertyChange(java.lang.String s, javax.swing.JComponent o, int action)
           
 boolean handlesShowing()
          Returns the visibility status of the handles
 boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
           
protected  void modifyDeltas(java.awt.Point deltasContainer)
           
 void pleaseDraw()
          Sets an internal flag that tells the annotation to draw itself when its draw() method is invoked.
 boolean pointInHandle(java.awt.Point p)
          returns true if the supplied point is in a handle
protected  void resizeDrawRect(int newWidth, int newHeight)
          changes the width and the height of the draw rectangle.
protected  java.awt.Rectangle rotateDocRect(java.awt.Rectangle toRotate)
           
protected  java.awt.Rectangle scaleRectangle(java.awt.Rectangle toScale)
          Scales the input rectangle according to the current scale (zoom) factors.
 void setAnnotationRotation(int rot)
          Must be called only when annotation is first created rot passed must be 0 when annotation is created
 void setApplyNow(boolean now)
           
 void setBorderColor(java.awt.Color c)
          sets The color used for border.
 void setBorderWidth(int width)
          sets the width of the stroke used to paint the line (borders).
 void setCanHide(boolean hide)
           
 void setCanShow(boolean show)
           
 void setCanUpdate(boolean update)
           
 void setCurrentIndex(int index)
           
protected  void setDrawRect(int x, int y, int width, int height)
          changes the draw rectangle to the coordinates supplied.
 void setFillColor(java.awt.Color c)
          sets The color used for fill.
 void setFont(java.awt.Font font)
           
 void setImageHeight(int h)
           
 void setImageWidth(int w)
           
 void setInMotion(boolean inMotion)
          Called to notify the annotation that it has started moving or stopped moving.
 void setInvertHorizontal(boolean invertH)
           
 void setInvertVertical(boolean invertV)
           
 void setPageNumber(int page)
           
 void setRotateWithImage(boolean b)
           
 void setRotation(int rot)
           
 void setScaleNum(int sn)
           
 void setTransparent(boolean bTrans)
          true makes it transparent, false makes it non-transparent
 void setVisibleWhileDragging(boolean visible)
           
 void showHandles(boolean showHandles)
          Shows/hides the handles on the annotation.
 java.lang.String toString()
           
 void translateBy(int dx, int dy)
          Translates the anotation by x, y
protected  java.awt.Rectangle translateDocRect(java.awt.Rectangle toRotate)
           
protected  java.awt.Rectangle translateRotateDocRect(java.awt.Rectangle toRotate)
           
 void updateValues(int action)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

allowedToDraw

protected transient boolean allowedToDraw
flag that tells whether the annotation should draw itself or not

showHandles

protected transient boolean showHandles
flag that tells whether to show or hide the selection handles around the annotation

type

protected int type
The annotation type

pageNumber

protected int pageNumber
page that the annotation is drawn on

creationIndex

protected int creationIndex
The creation index to keep track of the z-order of the annotation when it was created.

currentIndex

protected int currentIndex
The current index that indicates the z-order of the annotation.

invertedHorz

protected boolean invertedHorz
true if the bounding rectangle has been reversed (say by dragging a right handle accross a left handle)

invertedVert

protected boolean invertedVert
true if the bounding rectangle has been reversed (say by dragging a bottom handle accross a top handle)

pageAnnotationFlavor

public static java.awt.datatransfer.DataFlavor pageAnnotationFlavor
DataFlavor used for clipboard operations as part of the Transferable interface

isInMotion

protected transient boolean isInMotion
true when the annotation is resized or moved

isVisibleWhileDragging

protected boolean isVisibleWhileDragging
true if the entire annotation must be drawn while it is moved or resized otherwise only the outline is drawn

applyPropertiesNow

protected transient boolean applyPropertiesNow
true when the annotation properties are applied immediately

canShow

protected boolean canShow

canHide

protected boolean canHide

canUpdate

protected boolean canUpdate

DEFAULT_BORDER_WIDTH

protected static final int DEFAULT_BORDER_WIDTH

DEFAULT_TRANSPARENCY

protected static final boolean DEFAULT_TRANSPARENCY
Constructor Detail

CMBPageAnnotation

public CMBPageAnnotation()
Standard constructor

CMBPageAnnotation

public CMBPageAnnotation(java.awt.Rectangle r)
Parameters:
r - An initial bounding rectangle

CMBPageAnnotation

public CMBPageAnnotation(java.awt.Rectangle r,
                         int pageNumber)
Method Detail

getRotation

public int getRotation()

setRotation

public void setRotation(int rot)

setAnnotationRotation

public void setAnnotationRotation(int rot)
Must be called only when annotation is first created rot passed must be 0 when annotation is created

getAnnotationRotation

public int getAnnotationRotation()

setScaleNum

public void setScaleNum(int sn)

getRotateWithImage

public boolean getRotateWithImage()

setRotateWithImage

public void setRotateWithImage(boolean b)

setBorderWidth

public void setBorderWidth(int width)
sets the width of the stroke used to paint the line (borders).

setImageHeight

public void setImageHeight(int h)

setImageWidth

public void setImageWidth(int w)

getBorderWidth

public int getBorderWidth()

getInvertHorizontal

public boolean getInvertHorizontal()

getInvertVertical

public boolean getInvertVertical()

setInvertHorizontal

public void setInvertHorizontal(boolean invertH)

setInvertVertical

public void setInvertVertical(boolean invertV)

getOutlineStroke

protected java.awt.Stroke getOutlineStroke()
gets The stroke being used to paint the outline of the annotation (like when dragging).

getTransparent

public boolean getTransparent()
returns true if transparent.

setTransparent

public void setTransparent(boolean bTrans)
true makes it transparent, false makes it non-transparent

getBorderColor

public java.awt.Color getBorderColor()
gets The color used for border.

setPageNumber

public void setPageNumber(int page)

getPageNumber

public int getPageNumber()

rotateDocRect

protected java.awt.Rectangle rotateDocRect(java.awt.Rectangle toRotate)

translateDocRect

protected java.awt.Rectangle translateDocRect(java.awt.Rectangle toRotate)

translateRotateDocRect

protected java.awt.Rectangle translateRotateDocRect(java.awt.Rectangle toRotate)

setBorderColor

public void setBorderColor(java.awt.Color c)
sets The color used for border.

getFillColor

public java.awt.Color getFillColor()
gets The color used for fill.

setFillColor

public void setFillColor(java.awt.Color c)
sets The color used for fill.

getFont

public java.awt.Font getFont()

setFont

public void setFont(java.awt.Font font)

getType

public int getType()
gets an enumerated type of the current annoation.

getName

public java.lang.String getName()

setInMotion

public void setInMotion(boolean inMotion)
Called to notify the annotation that it has started moving or stopped moving.

setApplyNow

public void setApplyNow(boolean now)

setVisibleWhileDragging

public void setVisibleWhileDragging(boolean visible)

getVisibleWhileDragging

public boolean getVisibleWhileDragging()

dontDraw

public void dontDraw()
Sets an internal flag that tells the annotation not to draw itself even though its draw() method is invoked.

pleaseDraw

public void pleaseDraw()
Sets an internal flag that tells the annotation to draw itself when its draw() method is invoked.

contains

public boolean contains(java.awt.Point p)
Parameters:
p - A point
Returns:
true if p is inside the bounding rectangle of this annotation.

resizeDrawRect

protected void resizeDrawRect(int newWidth,
                              int newHeight)
changes the width and the height of the draw rectangle. This will cause a recalculation of the bounding rectangle.
Parameters:
newWidth - - new width of the draw rectangle.
newHeight - - new height of the draw rectangle.

setDrawRect

protected void setDrawRect(int x,
                           int y,
                           int width,
                           int height)
changes the draw rectangle to the coordinates supplied. This will cause a recalculation of the bounding rectangle.

translateBy

public void translateBy(int dx,
                        int dy)
Translates the anotation by x, y
Parameters:
x - How far to translate on the x axis
y - How much to translate on y axis

getRefreshRect

public java.awt.Rectangle getRefreshRect()
Gets the rectangle that encompasses the entire annotation, including borders and handles For example a 1 inch annotation can have a 1 inch border, and so it covers 2 inches not 1. This rectangle is used to refresh the screen when the annotation needs to be deleted or redrawn.

getDrawRect

public java.awt.Rectangle getDrawRect()
Gets the rectangle in which the annotation will be drawn.

getFillRect

protected java.awt.Rectangle getFillRect()
Gets the inner 'hollow' rectangle that is to be filled.

getDefaultHandleWidth

protected int getDefaultHandleWidth()

getDefaultHandleHeight

protected int getDefaultHandleHeight()

addAnnotationPropertiesListener

public void addAnnotationPropertiesListener(CMBAnnotationPropertiesListener apl)

firePropertiesChangeEvent

public void firePropertiesChangeEvent()

firePropertiesWillChangeEvent

public void firePropertiesWillChangeEvent()

draw

public void draw(java.awt.Graphics2D g2)
Draws the annotation on the supplied graphics. This is always overriden by the subclasses
Parameters:
g2 - - Graphics to draw on

drawOutline

public void drawOutline(java.awt.Graphics2D g2)
Draws the dashed outline of the annotation. Useful when dragging it or resizing it. This is always overriden by the subclasses
Parameters:
g2 - - Graphics to draw on

handlesShowing

public boolean handlesShowing()
Returns the visibility status of the handles

showHandles

public void showHandles(boolean showHandles)
Shows/hides the handles on the annotation. a refresh of the screen is necessary.
Parameters:
showHandles - true-show handles false-hide them

pointInHandle

public boolean pointInHandle(java.awt.Point p)
returns true if the supplied point is in a handle
Parameters:
p - A point to check

getPropertiesGroupTitle

public java.lang.String getPropertiesGroupTitle()

drawSelectionBox

protected void drawSelectionBox(java.awt.Graphics2D g)

drawHandles

protected void drawHandles(java.awt.Graphics2D g)
Draws the handles on the given graphics
Parameters:
g -  

modifyDeltas

protected void modifyDeltas(java.awt.Point deltasContainer)

growBy

public void growBy(int dx,
                   int dy)
grows the annotation (its bounding rectangle) by dx dy
Parameters:
dx - how much to grow on the x axis
dy - how much to grow on the y axis

scaleRectangle

protected java.awt.Rectangle scaleRectangle(java.awt.Rectangle toScale)
Scales the input rectangle according to the current scale (zoom) factors. will modify the input rectangle and return a reference to it.

getCreationIndex

public int getCreationIndex()

setCurrentIndex

public void setCurrentIndex(int index)

getCurrentIndex

public int getCurrentIndex()

getPropertiesPanel

public javax.swing.JPanel getPropertiesPanel()
Description copied from interface: CMBAnnotationPropertiesInterface
Returns the custom properties panel that is used to build the custom properties dialog for the annotation.
Specified by:
getPropertiesPanel in interface CMBAnnotationPropertiesInterface
Returns:
JPanel The panel used for this annotation type in the properties dialog to edit the properties of this annotation.

updateValues

public void updateValues(int action)
Specified by:
updateValues in interface CMBAnnotationPropertiesInterface
Following copied from interface: com.ibm.mm.viewer.annotation.CMBAnnotationPropertiesInterface
Parameters:
int -  

handlePropertyChange

public void handlePropertyChange(java.lang.String s,
                                 javax.swing.JComponent o,
                                 int action)
Specified by:
handlePropertyChange in interface CMBAnnotationPropertiesInterface
Following copied from interface: com.ibm.mm.viewer.annotation.CMBAnnotationPropertiesInterface
Parameters:
String -  
JComponent -  
int -  

addPropertyComponent

public void addPropertyComponent(java.lang.String propertyName,
                                 javax.swing.JComponent component)
Specified by:
addPropertyComponent in interface CMBAnnotationPropertiesInterface
Following copied from interface: com.ibm.mm.viewer.annotation.CMBAnnotationPropertiesInterface
Parameters:
String -  
JComponent -  

getTransferData

public java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor)
                                 throws java.awt.datatransfer.UnsupportedFlavorException,
                                        java.io.IOException
Transferable interfaces
Specified by:
getTransferData in interface java.awt.datatransfer.Transferable

getTransferDataFlavors

public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
Specified by:
getTransferDataFlavors in interface java.awt.datatransfer.Transferable

isDataFlavorSupported

public boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
Specified by:
isDataFlavorSupported in interface java.awt.datatransfer.Transferable

clone

public java.lang.Object clone()
Cloneable interface
Overrides:
clone in class java.lang.Object

canShow

public boolean canShow()
Privilege testing for annotations.

canHide

public boolean canHide()

canUpdate

public boolean canUpdate()

setCanShow

public void setCanShow(boolean show)

setCanHide

public void setCanHide(boolean hide)

setCanUpdate

public void setCanUpdate(boolean update)

dispose

public void dispose()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

EIP JavaBeans

(c) Copyright International Business Machines Corporation 1996, 2002. IBM Corp. All rights reserved.