|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.icepdf.ri.common.tools.CommonToolHandler
org.icepdf.ri.common.tools.SelectionBoxHandler
org.icepdf.ri.common.tools.TextSelection
public class TextSelection
TextSelection is a utility class that captures most of the work needed to do basic text, word and line selection.
| Field Summary | |
|---|---|
protected int |
bottomMargin
|
protected java.awt.geom.Rectangle2D |
bottomMarginExclusion
|
protected static boolean |
enableMarginExclusion
|
protected static boolean |
enableMarginExclusionBorder
|
protected java.awt.Point |
lastMouseLocation
|
protected java.awt.Point |
lastMousePressedLocation
|
protected static java.util.logging.Logger |
logger
|
protected org.icepdf.core.pobjects.Page |
pageLock
|
int |
selectedCount
|
protected int |
topMargin
|
protected java.awt.geom.Rectangle2D |
topMarginExclusion
|
| Fields inherited from class org.icepdf.ri.common.tools.SelectionBoxHandler |
|---|
currentRect, dash1, previousRectDrawn, rectToDraw, selectionBoxColour, stroke |
| Fields inherited from class org.icepdf.ri.common.tools.CommonToolHandler |
|---|
documentViewController, documentViewModel, pageViewComponent |
| Constructor Summary | |
|---|---|
TextSelection(DocumentViewController documentViewController,
AbstractPageViewComponent pageViewComponent,
DocumentViewModel documentViewModel)
|
|
| Method Summary | |
|---|---|
protected void |
calculateTextSelectionExclusion(java.awt.geom.AffineTransform pageTransform)
|
void |
clearSelection()
|
void |
clearSelectionState()
|
protected void |
lineSelectHandler(org.icepdf.core.pobjects.Page currentPage,
java.awt.Point mouseLocation)
Utility for selecting a LineText which is usually a sentence in the document. |
protected void |
multiLineSelectHandler(AbstractPageViewComponent pageViewComponent,
java.awt.Point mouseLocation,
boolean isDown,
boolean isLocalDown,
boolean isMovingRight)
Entry point for multiline text selection. |
static void |
paintSelectedText(java.awt.Graphics g,
AbstractPageViewComponent pageViewComponent,
DocumentViewModel documentViewModel)
Paints any text that is selected in the page wrapped by a pageViewComponent. |
protected void |
paintTextBounds(java.awt.Graphics g)
Utility for painting text bounds. |
void |
selection(java.awt.Point dragPoint,
AbstractPageViewComponent pageViewComponent,
boolean isDown,
boolean isMovingRight)
|
void |
selectionEnd(java.awt.Point endPoint,
AbstractPageViewComponent pageViewComponent)
Selection ended so we want to stop record the position and update the selection. |
void |
selectionIcon(java.awt.Point mouseLocation,
AbstractPageViewComponent pageViewComponent)
|
void |
selectionStart(java.awt.Point startPoint,
AbstractPageViewComponent pageViewComponent,
boolean isFirst)
Selection started so we want to record the position and update the selection rectangle. |
void |
setBottomMargin(int bottomMargin)
Sets the bottom margin used to define an exclusion zone for text selection. |
void |
setSelectionRectangle(java.awt.Point cursorLocation,
java.awt.Rectangle selection)
|
void |
setTopMargin(int topMargin)
Sets the top margin used to define an exclusion zone for text selection. |
void |
wordLineSelection(int clickCount,
java.awt.Point clickPoint,
AbstractPageViewComponent pageViewComponent)
Handles double and triple left mouse clicks to select a word or line of text respectively. |
protected void |
wordSelectHandler(org.icepdf.core.pobjects.Page currentPage,
java.awt.Point mouseLocation)
Utility for selecting multiple lines via rectangle like tool. |
| Methods inherited from class org.icepdf.ri.common.tools.SelectionBoxHandler |
|---|
clearRectangle, getCurrentRect, getRectToDraw, isOverPageComponent, paintSelectionBox, resetRectangle, setCurrentRect, setRectToDraw, setSelectionSize, updateDrawableRect, updateSelectionSize |
| Methods inherited from class org.icepdf.ri.common.tools.CommonToolHandler |
|---|
convertMouseToPageSpace, convertRectangleToPageSpace, convertToPageSpace, convertToPageSpace, getPageTransform, getPageTransform |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final java.util.logging.Logger logger
public int selectedCount
protected java.awt.Point lastMousePressedLocation
protected java.awt.Point lastMouseLocation
protected int topMargin
protected int bottomMargin
protected static boolean enableMarginExclusion
protected static boolean enableMarginExclusionBorder
protected java.awt.geom.Rectangle2D topMarginExclusion
protected java.awt.geom.Rectangle2D bottomMarginExclusion
protected org.icepdf.core.pobjects.Page pageLock
| Constructor Detail |
|---|
public TextSelection(DocumentViewController documentViewController,
AbstractPageViewComponent pageViewComponent,
DocumentViewModel documentViewModel)
| Method Detail |
|---|
public void wordLineSelection(int clickCount,
java.awt.Point clickPoint,
AbstractPageViewComponent pageViewComponent)
clickCount - number of mouse clicks to interpret for line or word selection.clickPoint - point that mouse was clicked.
public void selectionStart(java.awt.Point startPoint,
AbstractPageViewComponent pageViewComponent,
boolean isFirst)
startPoint - starting selection position.
public void selectionEnd(java.awt.Point endPoint,
AbstractPageViewComponent pageViewComponent)
public void clearSelection()
public void clearSelectionState()
public void selection(java.awt.Point dragPoint,
AbstractPageViewComponent pageViewComponent,
boolean isDown,
boolean isMovingRight)
public void selectionIcon(java.awt.Point mouseLocation,
AbstractPageViewComponent pageViewComponent)
protected void calculateTextSelectionExclusion(java.awt.geom.AffineTransform pageTransform)
public static void paintSelectedText(java.awt.Graphics g,
AbstractPageViewComponent pageViewComponent,
DocumentViewModel documentViewModel)
throws java.lang.InterruptedException
g - graphics context to paint to.pageViewComponent - page view component to paint selected to on.documentViewModel - document model contains view properties such as zoom and rotation.
java.lang.InterruptedException
protected void paintTextBounds(java.awt.Graphics g)
throws java.lang.InterruptedException
g - graphics context to paint to.
java.lang.InterruptedException
protected void multiLineSelectHandler(AbstractPageViewComponent pageViewComponent,
java.awt.Point mouseLocation,
boolean isDown,
boolean isLocalDown,
boolean isMovingRight)
throws java.lang.InterruptedException
pageViewComponent - page view that is being acted.mouseLocation - current mouse location already normalized to page space. .isDown - general selection trent is down, if false it's up.isMovingRight - general selection trent is right, if alse it's left.
java.lang.InterruptedException
protected void wordSelectHandler(org.icepdf.core.pobjects.Page currentPage,
java.awt.Point mouseLocation)
throws java.lang.InterruptedException
This method should only be called from within a locked page content
currentPage - page to looking for text intersection on.mouseLocation - location of mouse.
java.lang.InterruptedException
protected void lineSelectHandler(org.icepdf.core.pobjects.Page currentPage,
java.awt.Point mouseLocation)
throws java.lang.InterruptedException
currentPage - page to selectmouseLocation - location of mouse
java.lang.InterruptedException
public void setSelectionRectangle(java.awt.Point cursorLocation,
java.awt.Rectangle selection)
setSelectionRectangle in class SelectionBoxHandlerpublic void setTopMargin(int topMargin)
topMargin - top margin height in pixels.public void setBottomMargin(int bottomMargin)
bottomMargin - bottom margin height in pixels.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||