org.icepdf.core.pobjects.graphics.text
Class AbstractText

java.lang.Object
  extended by org.icepdf.core.pobjects.graphics.text.AbstractText
All Implemented Interfaces:
Text
Direct Known Subclasses:
GlyphText, LineText, WordText

public abstract class AbstractText
extends java.lang.Object
implements Text

Abstarct text is the base class for all Text extraction data. Its main purpose to is hold common data for GeneralPath and Bounds and commong contains and intersect calculations.

Some paintable properties are also defined here, such as selected, has selected highlight and hasHighlight which are used as queues to painting selected or highlighted text.

Since:
4.0

Field Summary
protected  java.awt.geom.Rectangle2D.Float bounds
           
protected  boolean hasHighlight
           
protected  boolean hasSelected
           
protected  boolean highlight
           
protected  boolean selected
           
 
Constructor Summary
AbstractText()
           
 
Method Summary
 void clearBounds()
           
abstract  java.awt.geom.Rectangle2D.Float getBounds()
          Gets the bounds of the respective text object.
 boolean hasHighligh()
          Indicates that at least this or one of the child instances of AbstractText is highlighted.
 boolean hasSelected()
          Indicates that at least this or one of the child instances of AbstractText is selected.
 boolean intersects(java.awt.geom.Rectangle2D rect)
          Creates a new instance of GeneralPath for this AbstractText object and applies the current pageTransformation to it.
 boolean isHighlighted()
          Is the AbstarctText highlighted, all of its children must also be highlighted.
 boolean isSelected()
          Is the AbstarctText selected, all of its children must also be selected.
 void setHasHighlight(boolean hasHighlight)
          Set the highlited state, meaning that this instance or one of the child AbstractText objects has a highlighted state.
 void setHasSelected(boolean hasSelected)
          Set the selected state, meaning that this instance or one of the child AbstractText objects has a selected state.
 void setHighlighted(boolean highlight)
          Sets the AbstractText as highlighted, if it child AbstractText object they must also be highlighted.
 void setSelected(boolean selected)
          Sets the AbstractText as selected, if it child AbstractText object they must also be selected.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bounds

protected java.awt.geom.Rectangle2D.Float bounds

selected

protected boolean selected

highlight

protected boolean highlight

hasSelected

protected boolean hasSelected

hasHighlight

protected boolean hasHighlight
Constructor Detail

AbstractText

public AbstractText()
Method Detail

getBounds

public abstract java.awt.geom.Rectangle2D.Float getBounds()
Gets the bounds of the respective text object.

Specified by:
getBounds in interface Text
Returns:
bounds of text object.

clearBounds

public void clearBounds()

intersects

public boolean intersects(java.awt.geom.Rectangle2D rect)
Creates a new instance of GeneralPath for this AbstractText object and applies the current pageTransformation to it. The containment calculation is then applied the newly tranformed path for the given rectangle.

This method is usually used for text selection via a selection box.

Parameters:
rect - rectangle to check intersection of in page.
Returns:
true if the point is contained with in this Text instance.

isSelected

public boolean isSelected()
Is the AbstarctText selected, all of its children must also be selected.

Specified by:
isSelected in interface Text
Returns:
true if selected false otherwise.

setSelected

public void setSelected(boolean selected)
Sets the AbstractText as selected, if it child AbstractText object they must also be selected.

Specified by:
setSelected in interface Text
Parameters:
selected - selected state.

isHighlighted

public boolean isHighlighted()
Is the AbstarctText highlighted, all of its children must also be highlighted.

Specified by:
isHighlighted in interface Text
Returns:
true if highlighted false otherwise.

setHighlighted

public void setHighlighted(boolean highlight)
Sets the AbstractText as highlighted, if it child AbstractText object they must also be highlighted.

Specified by:
setHighlighted in interface Text
Parameters:
highlight - selected state.

hasHighligh

public boolean hasHighligh()
Indicates that at least this or one of the child instances of AbstractText is highlighted.

Specified by:
hasHighligh in interface Text
Returns:
true if one or more root or parent elements are in a highlighted state.

hasSelected

public boolean hasSelected()
Indicates that at least this or one of the child instances of AbstractText is selected.

Specified by:
hasSelected in interface Text
Returns:
true if one or more root or parent elements are in a highlighted state.

setHasHighlight

public void setHasHighlight(boolean hasHighlight)
Set the highlited state, meaning that this instance or one of the child AbstractText objects has a highlighted state.

Specified by:
setHasHighlight in interface Text
Parameters:
hasHighlight - true to indicates a highlighted states.

setHasSelected

public void setHasSelected(boolean hasSelected)
Set the selected state, meaning that this instance or one of the child AbstractText objects has a selected state.

Specified by:
setHasSelected in interface Text
Parameters:
hasSelected - true to indicates a selected states.