Class ScalebarAttribute
- All Implemented Interfaces:
Attribute
,ConfigurationObject
CreateScalebarProcessor
(see
!createScalebar processor).
[[examples=verboseExample,print_osm_new_york_EPSG_3857,print_osm_new_york_nosubreports]]-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class org.mapfish.print.attribute.ReflectiveAttribute
JSON_ATTRIBUTE_DEFAULT, JSON_ATTRIBUTE_EMBEDDED_TYPE, JSON_ATTRIBUTE_IS_ARRAY, JSON_ATTRIBUTE_TYPE, JSON_CLIENT_INFO, JSON_CLIENT_PARAMS, JSON_NAME
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateValue
(Template template) Create an instance of a attribute value object.final Boolean
final Integer
final Class<? extends ScalebarAttribute.ScalebarAttributeValues>
Return the type created byReflectiveAttribute.createValue(Template)
.final Integer
getWidth()
final void
setCreateSubReport
(Boolean createSubReport) Specifies whether a subreport should be created, or only a graphic.final void
The height of the scalebar in pixels.final void
The width of the scalebar in pixels.final void
validate
(List<Throwable> validationErrors, Configuration configuration) validate that the configuration was correct.Methods inherited from class org.mapfish.print.attribute.ReflectiveAttribute
getAttributeName, getClientInfo, getDefaultValue, getValue, printClientConfig, setConfigName, setDefault
-
Constructor Details
-
ScalebarAttribute
public ScalebarAttribute()
-
-
Method Details
-
validate
Description copied from interface:ConfigurationObject
validate that the configuration was correct.- Parameters:
validationErrors
- a list to add any detected errors to.configuration
- the containing configuration
-
createValue
Description copied from class:ReflectiveAttribute
Create an instance of a attribute value object. Each instance must be new and unique. Instances must NOT be shared.The object will be populated from the json. Each public field will be populated by looking up the value in the json.
If a field in the object has the
HasDefaultValue
annotation then no exception will be thrown if the json does not contain a value.Fields in the object with the
OneOf
annotation must have one of the fields in the request data.String
Integer
Float
Double
Short
Boolean
Character
Byte
Enum
- PJsonObject
- URL
- Any enum
- PJsonArray
- any type with a 0 argument constructor
- array of any of the above (String[], boolean[], PJsonObject[], ...)
"postConstruct"()
method then it will be called after the fields are all set.In the case where the a parameter type is a normal POJO (not a special case like PJsonObject, URL, enum, double, etc...) then it will be assumed that the json data is a json object and the parameters will be recursively parsed into the new object as if it is also MapLayer parameter object.
It is important to put values in the value object as public fields because reflection is used when printing client config as well as generating documentation. If a field is intended for the client software as information but is not intended to be set (or sent as part of the request data), the field can be a final field.
- Specified by:
createValue
in classReflectiveAttribute<ScalebarAttribute.ScalebarAttributeValues>
- Parameters:
template
- the template that this attribute is part of.
-
getValueType
Description copied from class:ReflectiveAttribute
Return the type created byReflectiveAttribute.createValue(Template)
.- Specified by:
getValueType
in interfaceAttribute
- Specified by:
getValueType
in classReflectiveAttribute<ScalebarAttribute.ScalebarAttributeValues>
- Returns:
- the value class
-
getWidth
-
setWidth
The width of the scalebar in pixels. This value should match the width of the sub-report in the JasperReport template.- Parameters:
width
- Width
-
getHeight
-
setHeight
The height of the scalebar in pixels. This value should match the height of the sub-report in the JasperReport template.- Parameters:
height
- Height
-
getCreateSubReport
-
setCreateSubReport
Specifies whether a subreport should be created, or only a graphic.- Parameters:
createSubReport
- Create a sub-report?
-