org.faceless.pdf2.viewer2.feature
Class MarkupSelectionAction

java.lang.Object
  extended by org.faceless.pdf2.viewer2.ViewerFeature
      extended by org.faceless.pdf2.viewer2.feature.MarkupSelectionAction
All Implemented Interfaces:
DocumentPanelListener, AreaSelectionAction, TextSelectionAction
Direct Known Subclasses:
HighlightSelectionAction, StrikeOutSelectionAction, UnderlineSelectionAction

public class MarkupSelectionAction
extends ViewerFeature
implements TextSelectionAction, AreaSelectionAction, DocumentPanelListener

A TextSelectionAction that will create an AnnotationMarkup of the specified type on the selected text.

The following initialization parameters can be specified to configure this feature.
colorA 32-bit color value, eg 0x80FF0000 (for translucent red)
typeThe type of Markup - Highlight, Underline, StrikeOut or Squiggly
descriptionThe description of this markup

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.

Since:
2.11.7

Constructor Summary
MarkupSelectionAction(String name)
           
 
Method Summary
 void documentUpdated(DocumentPanelEvent event)
          Called when an DocumentPanelEvent is raised
 String getDescription()
          Get the name of this Action, to appear in the popup menu.
 void initialize(PDFViewer viewer)
          Called when the feature is first added to a viewer
 boolean isEnabled()
          Indicates whether this action is enabled.
 void selectAction(DocumentPanel docpanel, TextSelection.RangeList list)
          Run the action.
 void selectArea(PagePanel pagepanel, Rectangle2D area)
          Invoked when the area is selected.
 void setColor(Color color)
           
 void setDescription(String desc)
          Set the description that's returned by getDescription()
 void setType(String type)
          Set the type of AnnotationMarkup.
 
Methods inherited from class org.faceless.pdf2.viewer2.ViewerFeature
getAllEnabledFeatures, getAllFeatures, getCustomJavaScript, getFeatureProperty, getFeatureURLProperty, getName, isEnabledByDefault, setFeatureName, teardown, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MarkupSelectionAction

public MarkupSelectionAction(String name)
Method Detail

setDescription

public void setDescription(String desc)
Set the description that's returned by getDescription()


getDescription

public String getDescription()
Description copied from interface: TextSelectionAction
Get the name of this Action, to appear in the popup menu.

Specified by:
getDescription in interface AreaSelectionAction
Specified by:
getDescription in interface TextSelectionAction

setType

public void setType(String type)
Set the type of AnnotationMarkup.

Parameters:
type - one of "Highlight", "Underline", "StrikeOut" or "Squiggly"

setColor

public void setColor(Color color)

isEnabled

public boolean isEnabled()
Description copied from interface: TextSelectionAction
Indicates whether this action is enabled.

Specified by:
isEnabled in interface AreaSelectionAction
Specified by:
isEnabled in interface TextSelectionAction

initialize

public void initialize(PDFViewer viewer)
Description copied from class: ViewerFeature
Called when the feature is first added to a viewer

Overrides:
initialize in class ViewerFeature

documentUpdated

public void documentUpdated(DocumentPanelEvent event)
Description copied from interface: DocumentPanelListener
Called when an DocumentPanelEvent is raised

Specified by:
documentUpdated in interface DocumentPanelListener

selectAction

public void selectAction(DocumentPanel docpanel,
                         TextSelection.RangeList list)
Description copied from interface: TextSelectionAction
Run the action.

Specified by:
selectAction in interface TextSelectionAction
Parameters:
docpanel - the DocumentPanel this action is being run on.
list - the TextSelection.RangeList containing the list of selected text items, which may be from multiple pages

selectArea

public void selectArea(PagePanel pagepanel,
                       Rectangle2D area)
Description copied from interface: AreaSelectionAction
Invoked when the area is selected.

Specified by:
selectArea in interface AreaSelectionAction
Parameters:
pagepanel - the PagePanel the area was selected on
area - the selected area


Copyright © 2001-2013 Big Faceless Organization