PDF Clown
0.0.8

it.stefanochizzolini.clown.documents.contents
Class ContentScanner

java.lang.Object
  extended by it.stefanochizzolini.clown.documents.contents.ContentScanner

public final class ContentScanner
extends Object

Content objects scanner.

Remarks

It wraps the content objects collection (Contents) to scan its graphics state through a forward cursor.

Scanning is performed at an arbitrary depth, according to the content objects nesting: each depth level corresponds to a scan level so that at any time it's possible to seamlessly navigate across the levels (see getParentLevel(), getChildLevel())

Since:
0.0.4
Version:
0.0.8
Author:
Stefano Chizzolini (http://www.stefanochizzolini.it)

Nested Class Summary
static class ContentScanner.GraphicsObjectWrapper<TDataObject extends ContentObject>
          Object information.
static class ContentScanner.GraphicsState
          Graphics state [PDF:1.6:4.3].
static class ContentScanner.InlineImageWrapper
          Inline image information.
static class ContentScanner.TextStringWrapper
          Text string information.
static class ContentScanner.TextWrapper
          Text information.
static class ContentScanner.XObjectWrapper
          External object information.
 
Constructor Summary
ContentScanner(Contents contents)
           
ContentScanner(IContentContext contentContext)
           
 
Method Summary
 ContentScanner getChildLevel()
          Gets the current child scan level.
 IContentContext getContentContext()
          Gets the content context associated to the content objects collection.
 Contents getContents()
          Gets the content objects collection this scanner is inspecting.
 ContentObject getCurrent()
          Gets the current content object.
 ContentScanner.GraphicsObjectWrapper getCurrentWrapper()
          Gets the current content object's information.
 int getIndex()
          Gets the current position.
 CompositeObject getParent()
          Gets the current parent object.
 ContentScanner getParentLevel()
          Gets the parent scan level.
 ContentScanner.GraphicsState getState()
          Gets the current graphics state applied to the current content object.
 void insert(Collection<? extends ContentObject> objects)
          Inserts content objects at the current position.
 void insert(ContentObject object)
          Inserts a content object at the current position.
 boolean move(int index)
          Moves to the object at the given position.
 void moveEnd()
          Moves after the last object.
 boolean moveFirst()
          Moves to the first object.
 boolean moveLast()
          Moves to the last object.
 boolean moveNext()
          Moves to the next object.
 void moveStart()
          Moves before the first object.
 ContentObject remove()
          Removes the content object at the current position.
 ContentObject setCurrent(ContentObject value)
          Replaces the content object at the current position.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContentScanner

public ContentScanner(Contents contents)
Parameters:
contents - Content objects collection to scan.

ContentScanner

public ContentScanner(IContentContext contentContext)
Parameters:
contentContext - Content context containing the content objects collection to scan.
Method Detail

getChildLevel

public ContentScanner getChildLevel()
Gets the current child scan level.

See Also:
getParentLevel()

getContentContext

public IContentContext getContentContext()
Gets the content context associated to the content objects collection.


getContents

public Contents getContents()
Gets the content objects collection this scanner is inspecting.


getCurrent

public ContentObject getCurrent()
Gets the current content object.

See Also:
getIndex(), getParent()

getCurrentWrapper

public ContentScanner.GraphicsObjectWrapper getCurrentWrapper()
Gets the current content object's information.

See Also:
getCurrent()

getIndex

public int getIndex()
Gets the current position.

See Also:
getCurrent()

getParent

public CompositeObject getParent()
Gets the current parent object.

See Also:
getCurrent()

getParentLevel

public ContentScanner getParentLevel()
Gets the parent scan level.

See Also:
getChildLevel()

getState

public ContentScanner.GraphicsState getState()
Gets the current graphics state applied to the current content object.

Remarks

The returned object of this method is fundamental for any content manipulation as it represents the actual constraints that affect the current content object rendering.


insert

public void insert(ContentObject object)
Inserts a content object at the current position.


insert

public void insert(Collection<? extends ContentObject> objects)
Inserts content objects at the current position.

Remarks

After insertion complete, lastly-inserted content object is at the current position.


move

public boolean move(int index)
Moves to the object at the given position.

Parameters:
index - New position.
Returns:
Whether the object was successfully reached.
Since:
0.0.8

moveEnd

public void moveEnd()
Moves after the last object.

Since:
0.0.8

moveFirst

public boolean moveFirst()
Moves to the first object.

Returns:
Whether the first object was successfully reached.
Since:
0.0.5

moveLast

public boolean moveLast()
Moves to the last object.

Returns:
Whether the last object was successfully reached.
Since:
0.0.5

moveNext

public boolean moveNext()
Moves to the next object.

Returns:
Whether the next object was successfully reached.

moveStart

public void moveStart()
Moves before the first object.

Since:
0.0.8

remove

public ContentObject remove()
Removes the content object at the current position.

Returns:
Removed object.

setCurrent

public ContentObject setCurrent(ContentObject value)
Replaces the content object at the current position.

Returns:
Replaced object.

PDF Clown
0.0.8

Project home page

Copyright © 2006-2010 Stefano Chizzolini. Some Rights Reserved.
This documentation is available under the terms of the GNU Free Documentation License.