|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.faceless.pdf2.viewer2.ViewerFeature
public abstract class ViewerFeature
The ViewerFeature class can be used to control the various features of the
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 org.faceless.pdf2.viewer2.ViewerFeature
service provider file. The bfopdf.jar
file contains this file in the META-INF/services
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.
Constructor Summary | |
---|---|
protected |
ViewerFeature(String name)
Create a new ViewerFeature |
Method Summary | |
---|---|
static List |
getAllEnabledFeatures()
Return a list of all features that return true from isEnabledByDefault() . |
static List |
getAllFeatures()
Return a Collection of all the features available, which can be passed to the PDFViewer constructor or used as a base for your
own set of features. |
String |
getCustomJavaScript(String type,
String name)
Return any custom JavaScript that needs to be run by this feature on the specified JavaScript event. |
String |
getFeatureProperty(PDFViewer viewer,
String key)
Get a custom property for this feature, as specified by the viewer. |
URL |
getFeatureURLProperty(PDFViewer viewer,
String key)
Exactly as for getFeatureProperty() but
returns a URL value |
String |
getName()
Return the name of this Feature |
void |
initialize(PDFViewer viewer)
Called when the feature is first added to a viewer |
boolean |
isEnabledByDefault()
Return true if this feature is enabled by default (the default). |
protected void |
setFeatureName(String name)
Set the feature name. |
void |
teardown()
Called when the PDFViewer containing this feature is closed |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected ViewerFeature(String name)
name
- the name of the featureMethod Detail |
---|
public static final List getAllFeatures()
PDFViewer
constructor or used as a base for your
own set of features.
getAllEnabledFeatures()
public static final List getAllEnabledFeatures()
isEnabledByDefault()
.
protected final void setFeatureName(String name)
public void initialize(PDFViewer viewer)
public void teardown()
public boolean isEnabledByDefault()
getAllEnabledFeatures()
and by the PDFViewerApplet
and PDFTool
public final String getName()
public String toString()
toString
in class Object
public String getCustomJavaScript(String type, String name)
null
.
type
- the Event type : "App", "Doc" etc.name
- the Event name : "Init", "Open", "WillClose" etc.public final String getFeatureProperty(PDFViewer viewer, String key)
PropertyManager
returned
by 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 KeyStoreSignatureProvider
class as getFeatureProperty(viewer, "name")
will first check
the property feature.KeyStoreSignatureProvider.name
. If no
matching value is found, SignatureServiceProvider.name
and then ViewerFeature.name
are checked. Custom subclasses outside
the org.faceless.pdf2.viewer2
package will have their full classnames used -
as an example, a subclass of KeyStoreSignatureProvider
called
com.mycompany.MyProvider
would check com.mycompany.MyProvider.name
first.
viewer
- the PDFViewer
to get the PropertyManager fromkey
- the property keypublic final URL getFeatureURLProperty(PDFViewer viewer, String key) throws MalformedURLException
getFeatureProperty()
but
returns a URL value
MalformedURLException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |