Package com.levigo.jadice.annotation
Class AnnotationPageSegment
- java.lang.Object
-
- com.levigo.jadice.document.AbstractPageSegment
-
- com.levigo.jadice.document.AbstractMutablePageSegment
-
- com.levigo.jadice.annotation.AnnotationPageSegment
-
- All Implemented Interfaces:
ConditionFactoryProvider,com.levigo.jadice.document.internal.ModCountingPageSegment,com.levigo.jadice.document.internal.PageAwarePageSegment,com.levigo.jadice.document.internal.presentation.group.DynamicPresentationInitializer,com.levigo.jadice.document.internal.presentation.group.PresentationInitializer,com.levigo.jadice.document.internal.presentation.group.VisualizationInitializer,com.levigo.jadice.document.internal.text.TextContentFactory,MetadataProvider,MutablePageSegment,PageSegment,PermissionsProvider<PageSegment>,PropertiesProvider,Identifiable
public class AnnotationPageSegment extends AbstractMutablePageSegment implements com.levigo.jadice.document.internal.PageAwarePageSegment, com.levigo.jadice.document.internal.text.TextContentFactory, com.levigo.jadice.document.internal.presentation.group.DynamicPresentationInitializer, com.levigo.jadice.document.internal.ModCountingPageSegment
A page segment which holds annotations
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.levigo.jadice.document.AbstractPageSegment
AbstractPageSegment.CacheableVisualElement
-
-
Field Summary
-
Fields inherited from class com.levigo.jadice.document.AbstractPageSegment
CACHE_KEY_CONTENTS, format, id
-
-
Constructor Summary
Constructors Constructor Description AnnotationPageSegment()AnnotationPageSegment(PageSegmentSource source)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddAnnotation(Annotation newAnno)Adds an existing annotation if not already present in thisAnnotationPageSegmentinstance.protected AbstractPageSegment.CacheableVisualElementcreateCacheableVisualElement()This method is not part of the public APIvoiddeleteAnnotation(Annotation annotation)Remove the given annotation.voiddeleteAnnotations(Collection<Annotation> annotation)Remove the given annotations.protected AbstractPageSegment.CacheableVisualElementdoCreateCacheableRendering(RenderControls controls)AnnotationProfilegetAnnotationProfile()List<Annotation>getAnnotations()Returns a collection of all annotations.protected AbstractPageSegment.CacheableVisualElementgetCachedVisualElement(RenderControls controls)Collection<Annotation>getDeletedAnnotations()Returns a collection of all deleted annotations.com.levigo.jadice.document.internal.presentation.group.TransparencyGroupContainergetInitialized()Caveat: this method is not part of the public API.intgetModCount()Deprecated.Do not use this method.DimensiongetPageResolution()Returns the horizontal and vertical resolution.com.levigo.jadice.document.internal.QualificationgetQualification(PageSegment pageSegment)ResolutiongetResolution()Return the resolution of the page segment (in DPI).Dimension2DgetSize()Returns the raw size/dimensions of thePageSegmentin base units.com.levigo.jadice.document.internal.text.TextContentRequestResultgetTextContent(PageSegment ps, Rectangle2D roi, List<com.levigo.jadice.document.internal.condition.PresentationElementCondition> conditions)If the factory provides the text content based on the presentation tree the given conditions shall be applied while traversing it.com.levigo.jadice.document.internal.presentation.group.TransparencyGroupContainerinitialize(RenderControls controls)booleanisAuxiliary()Return whether this PageSegment is in some way "auxiliary".booleanisEligible(PageSegment s, Rectangle2D roi, com.levigo.jadice.document.internal.text.TextContentServiceInternal.Priority priority)Return whether this factory is eligible for the given page segment and the given priority.voidsetCurrentPage(Page page)Integrator warning: this method is an implementation of an internal interface.voidtoBack(Collection<Annotation> a)Move the selected annotations to the back of the rendering list.voidtoFront(Collection<Annotation> a)Move the selected annotations to the front of the rendering list.StringtoString()Description of this page segment instances-
Methods inherited from class com.levigo.jadice.document.AbstractMutablePageSegment
addPageSegmentListener, createPageSegmentEvent, fireModified, fireModified, fireModified, removePageSegmentListener
-
Methods inherited from class com.levigo.jadice.document.AbstractPageSegment
getBounds, getCachedVisualElement, getId, getMetadata, getPermissions, getProperties, getSource, isInitialized, setSource
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.levigo.jadice.document.condition.ConditionFactoryProvider
getConditionFactories
-
Methods inherited from interface org.jadice.util.base.Identifiable
getId
-
Methods inherited from interface com.levigo.jadice.document.metadata.MetadataProvider
getMetadata
-
Methods inherited from interface com.levigo.jadice.document.PageSegment
getBounds, getSource
-
Methods inherited from interface com.levigo.jadice.document.PermissionsProvider
getPermissions
-
Methods inherited from interface com.levigo.jadice.document.internal.presentation.group.PresentationInitializer
isInitialized
-
Methods inherited from interface com.levigo.jadice.document.util.PropertiesProvider
getProperties
-
-
-
-
Constructor Detail
-
AnnotationPageSegment
public AnnotationPageSegment()
-
AnnotationPageSegment
public AnnotationPageSegment(PageSegmentSource source)
-
-
Method Detail
-
addAnnotation
public void addAnnotation(Annotation newAnno)
Adds an existing annotation if not already present in thisAnnotationPageSegmentinstance.- Throws:
IllegalArgumentException- if the given annotation already belongs to an otherAnnotationPageSegment. In such a case remove the annotation from itsAnnotationPageSegmentbefore adding it to thisAnnotationPageSegmentinstance.
-
getSize
public Dimension2D getSize()
Description copied from interface:PageSegmentReturns the raw size/dimensions of thePageSegmentin base units.- Specified by:
getSizein interfacePageSegment- Returns:
- the
PageSegment's raw size
-
deleteAnnotation
public void deleteAnnotation(Annotation annotation)
Remove the given annotation.
-
deleteAnnotations
public void deleteAnnotations(Collection<Annotation> annotation)
Remove the given annotations.
-
toFront
public void toFront(Collection<Annotation> a)
Move the selected annotations to the front of the rendering list.
-
toBack
public void toBack(Collection<Annotation> a)
Move the selected annotations to the back of the rendering list.
-
getAnnotations
public List<Annotation> getAnnotations()
Returns a collection of all annotations.
Caveat: for performance reasons, the returned collection is mutable and does not represent a copy of the internal collection of annotations. Modifications to this collection are possible and allowed, but must be done carefully.- Returns:
- Collection a collection of contained annotations
-
getDeletedAnnotations
public Collection<Annotation> getDeletedAnnotations()
Returns a collection of all deleted annotations.
Caveat: for performance reasons, the returned collection is mutable and does not represent a copy of the internal collection of annotations. Modifications to this collection are possible and allowed, but must be done carefully.- Returns:
- Collection a collection of deleted annotations
-
getPageResolution
public Dimension getPageResolution()
Returns the horizontal and vertical resolution.- Returns:
- Dimension containing the horizontal and vertical resolution
-
toString
public String toString()
Description copied from class:AbstractPageSegmentDescription of this page segment instances- Overrides:
toStringin classAbstractPageSegment- See Also:
Object.toString()
-
getModCount
public int getModCount()
Deprecated.Do not use this method. It is not part of the jadice document platform public API.Description copied from interface:com.levigo.jadice.document.internal.ModCountingPageSegmentGet the number of page segment modifications since its creation. A modification occurs when the contents of aPageSegmentare modified.- Specified by:
getModCountin interfacecom.levigo.jadice.document.internal.ModCountingPageSegment- Returns:
- number of page segment modifications
-
getInitialized
public com.levigo.jadice.document.internal.presentation.group.TransparencyGroupContainer getInitialized()
Description copied from class:AbstractPageSegmentCaveat: this method is not part of the public API.- Specified by:
getInitializedin interfacecom.levigo.jadice.document.internal.presentation.group.PresentationInitializer- Overrides:
getInitializedin classAbstractPageSegment
-
getCachedVisualElement
protected AbstractPageSegment.CacheableVisualElement getCachedVisualElement(RenderControls controls)
-
initialize
public com.levigo.jadice.document.internal.presentation.group.TransparencyGroupContainer initialize(RenderControls controls)
- Specified by:
initializein interfacecom.levigo.jadice.document.internal.presentation.group.DynamicPresentationInitializer
-
createCacheableVisualElement
protected AbstractPageSegment.CacheableVisualElement createCacheableVisualElement() throws JadiceException
Description copied from class:AbstractPageSegmentThis method is not part of the public API- Overrides:
createCacheableVisualElementin classAbstractPageSegment- Throws:
JadiceException
-
doCreateCacheableRendering
protected AbstractPageSegment.CacheableVisualElement doCreateCacheableRendering(RenderControls controls) throws JadiceException
- Throws:
JadiceException
-
getAnnotationProfile
public AnnotationProfile getAnnotationProfile()
- Returns:
- the annotationProfile
-
isAuxiliary
public boolean isAuxiliary()
Description copied from interface:PageSegmentReturn whether this PageSegment is in some way "auxiliary". Auxiliary page segments contain additions to the main page segment, but rarely represent the main page content in their own right. Currently most page segments are non-auxiliary except for the AnnotationPageSegment.- Specified by:
isAuxiliaryin interfacePageSegment- Overrides:
isAuxiliaryin classAbstractPageSegment- Returns:
trueif this page segment is auxiliary,falseif it represents "main" page content.
-
getTextContent
public com.levigo.jadice.document.internal.text.TextContentRequestResult getTextContent(PageSegment ps, Rectangle2D roi, List<com.levigo.jadice.document.internal.condition.PresentationElementCondition> conditions)
Description copied from interface:com.levigo.jadice.document.internal.text.TextContentFactoryIf the factory provides the text content based on the presentation tree the given conditions shall be applied while traversing it.- Specified by:
getTextContentin interfacecom.levigo.jadice.document.internal.text.TextContentFactory
-
getQualification
public com.levigo.jadice.document.internal.Qualification getQualification(PageSegment pageSegment)
- Specified by:
getQualificationin interfacecom.levigo.jadice.document.internal.text.TextContentFactory
-
isEligible
public boolean isEligible(PageSegment s, Rectangle2D roi, com.levigo.jadice.document.internal.text.TextContentServiceInternal.Priority priority)
Description copied from interface:com.levigo.jadice.document.internal.text.TextContentFactoryReturn whether this factory is eligible for the given page segment and the given priority. Whether a factory is eligible in a given situation may be a rather complex decision. For instance an OCR-based factory may refuse to become active at low priorities given the high cost of performing an OCR. However it may find that it already has a cached result for the page segment causing it to spring into action at a lower priority already.- Specified by:
isEligiblein interfacecom.levigo.jadice.document.internal.text.TextContentFactory
-
setCurrentPage
public void setCurrentPage(Page page)
Integrator warning: this method is an implementation of an internal interface. Do not use.- Specified by:
setCurrentPagein interfacecom.levigo.jadice.document.internal.PageAwarePageSegment- See Also:
PageAwarePageSegment.setCurrentPage(com.levigo.jadice.document.Page)
-
getResolution
public Resolution getResolution()
Description copied from class:AbstractPageSegmentReturn the resolution of the page segment (in DPI).Some PageSegments return just the base resolution as their native resolution. PageSegments with pixel data return the actual pixel resolution they can provide. This information is used to hint e.g. the printer about the maximum resolution a page segment can produce.
- Specified by:
getResolutionin classAbstractPageSegment- Returns:
- This PageSegment's resolution
-
-