Class LegendProcessor
java.lang.Object
org.mapfish.print.processor.AbstractProcessor<LegendProcessor.Input,LegendProcessor.Output>
org.mapfish.print.processor.jasper.LegendProcessor
- All Implemented Interfaces:
ConfigurationObject,Processor<LegendProcessor.Input,LegendProcessor.Output>
public final class LegendProcessor
extends AbstractProcessor<LegendProcessor.Input,LegendProcessor.Output>
Create a legend.
See also: !legend attribute [[examples=verboseExample,legend_cropped,legend_scaled]]
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classThe Input Parameter object forLegendProcessor.static final recordThe Output object of the legend processor method.Nested classes/interfaces inherited from class org.mapfish.print.processor.AbstractProcessor
AbstractProcessor.ContextNested classes/interfaces inherited from interface org.mapfish.print.processor.Processor
Processor.ExecutionContext -
Field Summary
Fields inherited from interface org.mapfish.print.processor.Processor
MDC_APPLICATION_ID_KEY, MDC_JOB_ID_KEY -
Method Summary
Modifier and TypeMethodDescriptionReturns a new/clean instance of a parameter object.execute(LegendProcessor.Input values, Processor.ExecutionContext context) Perform the process on the input attributes.protected voidextraValidation(List<Throwable> validationErrors, Configuration configuration) Perform any extra validation a subclass may need to perform.voidThe DPI value that is used for the legend graphics.voidsetMaxWidth(Integer maxWidth) The maximum width in pixels for the legend graphics.voidsetScaled(boolean scaled) When the image is too big do a scaled (default) otherwise do a scale.voidsetTemplate(String template) The path to the Jasper Report template for rendering the legend data.Methods inherited from class org.mapfish.print.processor.AbstractProcessor
getInputMapperBiMap, getInputPrefix, getOutputMapperBiMap, getOutputPrefix, getOutputType, setInputMapper, setInputPrefix, setOutputMapper, setOutputPrefix, setPrefix, toString, toString, validate
-
Method Details
-
setTemplate
The path to the Jasper Report template for rendering the legend data.- Parameters:
template- path to the template file
-
setMaxWidth
The maximum width in pixels for the legend graphics. If this parameter is set, the legend graphics are cropped or scaled to the given maximum width. In this case a sub-report is created containing the graphic. For reference see the example [[examples=legend_cropped,legend_scaled]].- Parameters:
maxWidth- The maximum width.
-
setDpi
The DPI value that is used for the legend graphics.- Parameters:
dpi- The DPI value.
-
setScaled
public void setScaled(boolean scaled) When the image is too big do a scaled (default) otherwise do a scale. See the example [[examples=legend_scaled]] Note: This parameter is only considered when `maxWidth` is set.- Parameters:
scaled- do a scaled.
-
createInputParameter
Description copied from interface:ProcessorReturns a new/clean instance of a parameter object. This instance's will be inspected using reflection to find its public fields and the properties will be set from theValuesobject.The way the properties will be looked up is to
- take the bean property name
- map it using the input mapper, (if the input mapper does not have a mapping for the property then the unmapped property name is used)
- Look up the property value in the
Valuesobject using the mapped property name - set the value on the instance created by this method. If the value is null an exception
will be thrown UNLESS the
HasDefaultValueannotation is on the field for the property.
It is important to realize that super classes will also be analyzed, so care must be had with inheritance.
-
execute
public LegendProcessor.Output execute(LegendProcessor.Input values, Processor.ExecutionContext context) throws Exception Description copied from interface:ProcessorPerform the process on the input attributes.- Parameters:
values- A Java object whose public fields are populated from theValuesobject (which is used for transferring properties between processors).context- The execution context for a print task.- Returns:
- A Java object whose public fields will be put into the
Valuesobject. The key in theValuesobject is the name of the field or if there is a mapping in theProcessor.getOutputMapperBiMap()map, the mapped name. The key is determined in a similar way as for the input object. - Throws:
Exception
-
extraValidation
Description copied from class:AbstractProcessorPerform any extra validation a subclass may need to perform.- Specified by:
extraValidationin classAbstractProcessor<LegendProcessor.Input,LegendProcessor.Output> - Parameters:
validationErrors- a list to add errors to so that all validation errors are reported as one.configuration- the containing configuration
-