com.levigo.jadice.document.creator
Class AbstractContentsPageSegment

java.lang.Object
  extended by com.levigo.jadice.document.AbstractPageSegment
      extended by com.levigo.jadice.document.creator.AbstractContentsPageSegment
All Implemented Interfaces:
com.levigo.jadice.document.internal.model.RenderRoot, MetadataProvider, PageSegment, PermissionsProvider<PageSegment>, PropertiesProvider, Identifiable
Direct Known Subclasses:
DecorationPageSegment

public abstract class AbstractContentsPageSegment
extends AbstractPageSegment


Nested Class Summary
 
Nested classes/interfaces inherited from class com.levigo.jadice.document.AbstractPageSegment
AbstractPageSegment.CacheableRendering
 
Field Summary
 
Fields inherited from class com.levigo.jadice.document.AbstractPageSegment
CACHE_KEY_CONTENTS, format, id
 
Constructor Summary
AbstractContentsPageSegment()
           
AbstractContentsPageSegment(Dimension2D pageSize)
           
 
Method Summary
protected  AbstractPageSegment.CacheableRendering doCreateCacheableRendering()
           
protected abstract  void doCreateContents(GraphicalState initialState)
           
protected  String[] getAvailableFontFamilies()
           
 Rectangle2D getBounds()
          Returns the raw size and position of the PageSegment in base units.
 Resolution getResolution()
          Return the resolution of the page segment (in DPI).
 Dimension2D getSize()
          The returned size is either the previously set pageSize or a computed value.
protected  void setPageSize(Dimension2D pageSize)
          Assigns a Dimension2D to the pageSize member.
 
Methods inherited from class com.levigo.jadice.document.AbstractPageSegment
createRendering, getCachedRendering, getId, getMetadata, getPermissions, getProperties, getSource, isAuxiliary, isInitialized, setSource, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractContentsPageSegment

public AbstractContentsPageSegment()

AbstractContentsPageSegment

public AbstractContentsPageSegment(Dimension2D pageSize)
                            throws JadiceException
Parameters:
pageSize - The Dimension2D to be assigned to pageSize. May be null.
Throws:
JadiceException - See setPageSize(Dimension2D) for details.
See Also:
setPageSize(Dimension2D)
Method Detail

doCreateCacheableRendering

protected AbstractPageSegment.CacheableRendering doCreateCacheableRendering()
                                                                     throws JadiceException
Overrides:
doCreateCacheableRendering in class AbstractPageSegment
Throws:
JadiceException

doCreateContents

protected abstract void doCreateContents(GraphicalState initialState)

getAvailableFontFamilies

protected final String[] getAvailableFontFamilies()

getResolution

public Resolution getResolution()
Description copied from class: AbstractPageSegment
Return the resolution of the page segment (in DPI).

Page segments usually return just the base resolution as their native resolution. Page segments 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.

Overrides:
getResolution in class AbstractPageSegment
Returns:
Dimension where the width part contains the horizontal and the height part contains the vertical resolution

setPageSize

protected void setPageSize(Dimension2D pageSize)
                    throws JadiceException
Assigns a Dimension2D to the pageSize member. The parts of the given Dimension2D are checked and must not be negative or zero! If the given pageSize is null the checks are skipped and the pageSize member is reset to null.

Parameters:
pageSize - The Dimension2D to be assigned to pageSize. May be null.
Throws:
JadiceException - If at least one part of the dimension is smaller than or equal to zero. Qualified by the internal message identifier ILLEGAL_PAGE_SEGMENT_SIZE.

getSize

public Dimension2D getSize()
The returned size is either the previously set pageSize or a computed value.

If the user set a valid pageSize via setPageSize(Dimension2D), getSize() will return exactly this value. Please keep in mind that the dimensions may be changed by the user. This can't be controlled. It will not be changed by this implementation.

If no user-defined pageSize is available a computation of the dimensions is necessary. Each call triggers a new computation based on the content created via doCreateContents(GraphicalState). Each element in the content data structure is able to provide its bounds. All bounds will be collected and aggregated in getBounds() to form the base of the size computation. The size describes dimensions in relation to the page's origin coordinates which is located at (0,0).

Specified by:
getSize in interface PageSegment
Overrides:
getSize in class AbstractPageSegment
Returns:
The dimensions of this AbstractContentsPageSegment.

getBounds

public Rectangle2D getBounds()
Description copied from interface: PageSegment
Returns the raw size and position of the PageSegment in base units. Position is measured in relation to the Page's coordinate system's origin point (0,0).

Specified by:
getBounds in interface com.levigo.jadice.document.internal.model.RenderRoot
Specified by:
getBounds in interface PageSegment
Overrides:
getBounds in class AbstractPageSegment
Returns:
the raw size and position


Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.