Die Customizer-Klassen können dazu verwendet werden um Annotation nach dem Anlegen zu konfigurieren. Customizer-Klassen können in Annotation-Type und Annotation-Template Elementen definiert werden, es ist auch möglich mehrere anzugeben. Beim Anlegen einer Annotation wird diese anhand der Definition im Annotationsprofil erstellt, bevor die Annotation ins AnnotationPageSegment-Objekt hinzugefügt wird, werden zuvor alle AnnotationCustomizer-Implementationen in definierter Reihenfolge ausgeführt. Um ein Anwendungsbeispiel zu nennen, der AnnotationCustomizer kann verwendet werden um eine komplexe Polygonannotation anzulegen (hier Hakenannotation):
AnnotationCustomizer-Implementation
package customizers;
import java.awt.geom.GeneralPath;
import java.awt.geom.Point2D;
import com.levigo.jadice.annotation.Annotation;
import com.levigo.jadice.annotation.AnnotationCustomizer;
import com.levigo.jadice.annotation.PathAnnotation;
public class TickAnnotationCustomizer implements AnnotationCustomizer {
@Override
public void customize(Annotation a) {
final PathAnnotation annotation = (PathAnnotation) a;
// Position holen
final Point2D point = new Point2D.Double(annotation.getBounds().getX(), annotation.getBounds().getY());
final double xOff = point.getX();
final double yOff = point.getY();
final GeneralPath path = new GeneralPath();
path.moveTo(xOff, yOff + 2000);
path.lineTo(xOff + 1000, yOff + 3000);
path.lineTo(xOff + 3000, yOff);
annotation.setPath(path);
}
}
Definition im Profil
<annotation-type name="Tick" extends="BasePen"> <wrangler class="com.levigo.jadice.swing.internal.annotation.wranglers.FreehandAnnotationWrangler"> <property name="creationMode">SINGLE_CLICK</property> </wrangler> <customizer class="customizers.TickAnnotationCustomizer"/> </annotation-type>


