Class BaseRenderSettings
- All Implemented Interfaces:
RenderSettings
Provides PageRenderSettings to override rendering configuration for specific pages.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
An enumeration of type safe rotation values. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Identifier key for all-layer enabled state change, used within aRenderSettingsEvent
to recognize the kind of change which happen.static final String
Identifier key for a deviceResolution change, used within aRenderSettingsEvent
to recognize the kind of change which happens.static final String
Identifier key for a layer enabled state change, used within aRenderSettingsEvent
to recognize the kind of change which happen.static final String
Identifier key for a rotation change, used within aRenderSettingsEvent
to recognize the kind of change which happen.static final String
Identifier key for a zoom change, used within aRenderSettingsEvent
to recognize the kind of change which happen. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble
baseToDevice
(double value) Utility method: convert base units to device units and apply zoom factorint
baseToDevice
(int value) Utility method: convert base units to device units and apply zoom factorcalcBounds
(int pageWidth, int pageHeight) Calculates the Dimensions of the Page included the zoom level and RotationcalcBounds
(Page page) Calculates the Dimensions of the Page included the zoom level and RotationcalcDeviceBounds
(Page page) Calculates the Dimensions of the Page included the zoom level and Rotation and the device ratioConverts the fields of this class to aString
key that can be used to cache tiles in the client side TileCache.double
deviceToBase
(double value) Utility method: convert device units to base units and unapply zoom factorint
deviceToBase
(int value) Utility method: convert device units to base units and unapply zoom factorvoid
Disables the rendering of all standard layers provided by theDocumentLayer
class and explicit enabled layers (defined by a call ofsetDocumentLayerEnabled(DocumentLayer, boolean)
with a true boolean parameter).void
Enables the rendering of all standard layers provided by theDocumentLayer
class and explicit disabled layers (defined by a call ofsetDocumentLayerEnabled(DocumentLayer, boolean)
with a false boolean parameter).final boolean
Gets the affine transform for this render context, useful for converting from document to device space.getAffineTransform
(Dimension2D srcSize) Gets the affine transform for this render setting, useful for converting from document to device space.only for serializationint
Returns the currently configured device resolution.getInverseTransform
(Dimension2D pageSize) Gets the inverse affine transform for this render context, useful for converting from device to document space.only for serializationgetOrderedAndActiveLayers
(Collection<DocumentLayer> candidateLayers) Returns a collection of candidate layers in an ordering suitable for rendering.float
final int
hashCode()
boolean
Returns whether the given layer will be rendered (true if to be rendered, false if not enabled).void
setDefaultLayerStateEnabled
(Boolean defaultLayerStateEnabled) only for serializationprotected void
Initializes additional settings.void
setDeviceResolution
(Integer resolution) Sets the device deviceResolution.void
setDocumentLayerEnabled
(DocumentLayer layer, boolean value) Sets a flag whether document layer of given class should be rendered or not.void
void
setZoom
(float zoom) toString()
void
update
(String propertyName, RenderSettings other, Object... details) Overwrites the current render settings with the given one.Methods inherited from class com.levigo.jadice.web.shared.model.settings.AbstractListenableRenderSettings
addListener, fireChanged, getParent, init, removeListener
-
Field Details
-
LAYER_ENABLED
Identifier key for a layer enabled state change, used within aRenderSettingsEvent
to recognize the kind of change which happen.- See Also:
-
ALL_LAYERS_ENABLED
Identifier key for all-layer enabled state change, used within aRenderSettingsEvent
to recognize the kind of change which happen.- See Also:
-
ZOOM
Identifier key for a zoom change, used within aRenderSettingsEvent
to recognize the kind of change which happen.- See Also:
-
DEVICE_RESOLUTION
Identifier key for a deviceResolution change, used within aRenderSettingsEvent
to recognize the kind of change which happens.- See Also:
-
ROTATION
Identifier key for a rotation change, used within aRenderSettingsEvent
to recognize the kind of change which happen.- See Also:
-
-
Constructor Details
-
BaseRenderSettings
public BaseRenderSettings()
-
-
Method Details
-
setDefaults
protected void setDefaults()Description copied from class:AbstractListenableRenderSettings
Initializes additional settings.- Specified by:
setDefaults
in classAbstractListenableRenderSettings
-
setDocumentLayerEnabled
Sets a flag whether document layer of given class should be rendered or not.- Parameters:
layer
- Document layer.value
- Flag
-
enableAllLayers
public void enableAllLayers()Enables the rendering of all standard layers provided by the
Standard layers provided by theDocumentLayer
class and explicit disabled layers (defined by a call ofsetDocumentLayerEnabled(DocumentLayer, boolean)
with a false boolean parameter).DocumentLayer
class are:
Other customized layers, will not be enabled by a call of this method. To enable customized layers the usage of
setDocumentLayerEnabled(DocumentLayer, boolean)
is advised. -
disableAllLayers
public void disableAllLayers()Disables the rendering of all standard layers provided by the
Standard layers provided by theDocumentLayer
class and explicit enabled layers (defined by a call ofsetDocumentLayerEnabled(DocumentLayer, boolean)
with a true boolean parameter).DocumentLayer
class are:
Other customized layers, will not be disabled by a call of this method. To disable customized layers the usage of
setDocumentLayerEnabled(DocumentLayer, boolean)
is advised. -
isDocumentLayerEnabled
Returns whether the given layer will be rendered (true if to be rendered, false if not enabled).- Parameters:
layer
- The document layer to check the enabling state for.- Returns:
- Indicator whether the layer class should be rendered or not.
-
getOrderedAndActiveLayers
Returns a collection of candidate layers in an ordering suitable for rendering. This entails- filtering the layers to remove disabled ones.
- sorting the layers by their default priority.
- re-ordering as defined by the
DocumentLayer.compareTo(DocumentLayer)
method.
- Parameters:
candidateLayers
- The layers to check whether they are active and to return in their predefined order.- Returns:
- Collection of filtered and ordered layers. It is not guaranteed, that the given candidateLayers collection is changed by this method, but it is also not assured that the returned collection is the same instance as the candidateLayers collection.
-
getZoomFactor
public float getZoomFactor() -
getRotation
-
setDeviceResolution
Sets the device deviceResolution.- Parameters:
resolution
- the deviceResolution to be configured.
-
getDeviceResolution
public int getDeviceResolution()Returns the currently configured device resolution.- Returns:
- the device resolution that is currently used.
-
setZoom
public void setZoom(float zoom) -
calcBounds
Calculates the Dimensions of the Page included the zoom level and Rotation- Parameters:
page
- Page to calc the Bounds- Returns:
- the Dimensions to draw
-
calcDeviceBounds
Calculates the Dimensions of the Page included the zoom level and Rotation and the device ratio- Parameters:
page
- Page to calc the Bounds- Returns:
- the Dimensions to draw
-
calcBounds
Calculates the Dimensions of the Page included the zoom level and Rotation- Parameters:
pageWidth
- real PageWidthpageHeight
- real PageHeight- Returns:
- the Dimensions to draw
-
baseToDevice
public int baseToDevice(int value) Utility method: convert base units to device units and apply zoom factor- Parameters:
value
- value in base units- Returns:
- value in device units, zoomed
-
baseToDevice
public double baseToDevice(double value) Utility method: convert base units to device units and apply zoom factor- Parameters:
value
- value in base units- Returns:
- value in device units, zoomed
-
deviceToBase
public int deviceToBase(int value) Utility method: convert device units to base units and unapply zoom factor- Parameters:
value
- value in device units- Returns:
- value in base units, de-zoomed
-
deviceToBase
public double deviceToBase(double value) Utility method: convert device units to base units and unapply zoom factor- Parameters:
value
- value in device units- Returns:
- value in base units, de-zoomed
-
createSnapshot
-
getAffineTransform
Gets the affine transform for this render context, useful for converting from document to device space. Considers zoom factor and rotation. If the transform encompasses a rotational component, the rotation will use the origin as its center. Therefore, the target bounding box may occupy any quadrant of the target coordinate system, unless further transformation is applied to the transform returned by this method.WARN: Does not work with rotation!
- Returns:
- AffineTransform
-
getAffineTransform
Gets the affine transform for this render setting, useful for converting from document to device space. Considers zoom factor and rotation. If the transform encompasses a rotational component, the rotation will use an origin calculated from the given source size, so that the result of the rendering lies within the first quadrant (in screen coordinates, i.e. 0/0 at the top/left).- Parameters:
srcSize
- the size of the object to be rendered in source (document) coordinates.- Returns:
- AffineTransform
-
getInverseTransform
Gets the inverse affine transform for this render context, useful for converting from device to document space. Considers zoom factor and rotation.- Parameters:
pageSize
- the pages size in base units- Returns:
- AffineTransform
-
hashCode
public final int hashCode() -
equals
-
toString
-
convertToKey
Converts the fields of this class to aString
key that can be used to cache tiles in the client side TileCache.- Returns:
- the key
-
getLayers
only for serialization- Returns:
- the layers
-
getDefaultLayerStateEnabled
only for serialization- Returns:
- whether the default layer state is enabled or not
-
setDefaultLayerStateEnabled
only for serialization- Parameters:
defaultLayerStateEnabled
- whether the default layer state is enabled or not
-