public abstract class ViewerFeature extends java.lang.Object
PDFViewer, such as widgets, side panels, annotations and action handlers. Most of the interesting methods are in the subclasses, particularly
ViewerWidget, but the
getAllFeatures()method is commonly called to return a list of all the features available to the viewer.
The list of default features is specified by the
service provider file. The
bfopdf.jar file contains this file in the
folder, which lists the classnames of each feature to load by default. Each feature specified this
way must be a subclass of
ViewerFeature, and contain a zero-parameter constructor or a
getInstance() method that returns a singleton. Additional features may be specified
this way in any other Jars available to the application. See the Java
Service Provider Interface
documentation for more information.
This code is copyright the Big Faceless Organization. You're welcome to use, modify and distribute it in any form in your own projects, provided those projects continue to make use of the Big Faceless PDF library.
|Modifier||Constructor and Description|
Create a new ViewerFeature
|Modifier and Type||Method and Description|
Return a list of all features that return true from
Return a Collection of all the features available, which can be passed to the
Get a custom property for this feature, as specified by the viewer.
Exactly as for
Return the name of this Feature
Called when the feature is first added to a viewer
Return true if this feature is enabled by default (the default).
Set the feature name.
Called when the PDFViewer containing this feature is closed
protected ViewerFeature(java.lang.String name)
name- the name of the feature
public static final java.util.List<ViewerFeature> getAllFeatures()
PDFViewerconstructor or used as a base for your own set of features.
public static final java.util.List<ViewerFeature> getAllEnabledFeatures()
protected final void setFeatureName(java.lang.String name)
public void initialize(PDFViewer viewer)
public void teardown()
public boolean isEnabledByDefault()
getAllEnabledFeatures()and by the
public final java.lang.String getName()
public java.lang.String toString()
type- the Event type : "App", "Doc" etc.
name- the Event name : "Init", "Open", "WillClose" etc.
public final java.lang.String getFeatureProperty(PDFViewer viewer, java.lang.String key)
Get a custom property for this feature, as specified by the viewer. This
method provides a convenient, standardised way to access properties for
a feature at runtime, by querying the
PDFViewer.getPropertyManager(). The key is prefixed by the name
of this class, and if no value is found the superclass is specified.
For example, calling this method from a
getFeatureProperty(viewer, "name") will first check
feature.KeyStoreSignatureProvider.name. If no
matching value is found,
ViewerFeature.name are checked. Custom subclasses outside
org.faceless.pdf2.viewer2 package will have their full classnames used -
as an example, a subclass of
com.mycompany.MyProvider would check
PDFViewerto get the PropertyManager from
key- the property key
Copyright © 2001-2017 Big Faceless Organization