ptolemy.vergil.pdfrenderer
Class PDFIcon

java.lang.Object
  extended by ptolemy.kernel.util.NamedObj
      extended by ptolemy.kernel.util.Attribute
          extended by ptolemy.vergil.icon.EditorIcon
              extended by ptolemy.vergil.icon.DynamicEditorIcon
                  extended by ptolemy.vergil.pdfrenderer.PDFIcon
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

public class PDFIcon
extends DynamicEditorIcon

An icon that displays a specified PDF page.

This class uses pdf-renderer, obtainable from https://pdf-renderer.dev.java.net/. This is an "an open source, all Java library which renders PDF documents to the screen using Java2D." By using this icon, an actor or attribute in Vergil can be defined by a PDF file. Using this icon requires that PDFRenderer.jar in the classpath, it is usually found in $PTII/lib/PDFRenderer.jar.

Since:
Ptolemy II 8.0
Version:
$Id: PDFIcon.java 59167 2010-09-21 17:08:02Z cxh $
Author:
Edward A. Lee
See Also:
Serialized Form
Accepted Rating:
Red (johnr)
Proposed Rating:
Yellow (eal)

Nested Class Summary
private  class PDFIcon.PDFPaintedObject
           
 
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
 
Field Summary
private  com.sun.pdfview.PDFPage _page
          The PDF page to render.
private  double _scale
           
 
Fields inherited from class ptolemy.vergil.icon.EditorIcon
_containerToBe, _iconCache
 
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
 
Constructor Summary
PDFIcon(NamedObj container, java.lang.String name)
          Create a new icon with the given name in the given container.
 
Method Summary
 java.lang.Object clone(Workspace workspace)
          Clone the object into the specified workspace.
 Figure createBackgroundFigure()
          Create a new default background figure, which is an instance of PDFFigure.
 void setPage(com.sun.pdfview.PDFPage page)
          Specify an PDF page to display.
 void setScale(double scalePercentage)
          Specify a scaling percentage of the PDF page.
 
Methods inherited from class ptolemy.vergil.icon.DynamicEditorIcon
_addLiveFigure, _liveFigureIterator, _trimLiveFigures
 
Methods inherited from class ptolemy.vergil.icon.EditorIcon
_createDefaultBackgroundFigure, _isPropertySet, _recreateFigure, createFigure, createIcon, getContainerOrContainerToBe, setContainerToBe
 
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setContainer, setName, updateContent
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _description, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _recordDecoratedAttributes, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, attributeChanged, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, propagateExistence, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_page

private com.sun.pdfview.PDFPage _page
The PDF page to render.


_scale

private double _scale
Constructor Detail

PDFIcon

public PDFIcon(NamedObj container,
               java.lang.String name)
        throws IllegalActionException,
               NameDuplicationException
Create a new icon with the given name in the given container.

Parameters:
container - The container.
name - The name of the attribute.
Throws:
IllegalActionException - If the attribute is not of an acceptable class for the container.
NameDuplicationException - If the name coincides with an attribute already in the container.
Method Detail

clone

public java.lang.Object clone(Workspace workspace)
                       throws java.lang.CloneNotSupportedException
Clone the object into the specified workspace. The new object is not added to the directory of that workspace (you must do this yourself if you want it there). The result is an object with no container.

Overrides:
clone in class DynamicEditorIcon
Parameters:
workspace - The workspace for the cloned object.
Returns:
The new Attribute.
Throws:
java.lang.CloneNotSupportedException - Not thrown in this base class
See Also:
NamedObj.exportMoML(Writer, int, String), NamedObj.setDeferringChangeRequests(boolean)

createBackgroundFigure

public Figure createBackgroundFigure()
Create a new default background figure, which is an instance of PDFFigure.

Overrides:
createBackgroundFigure in class EditorIcon
Returns:
A figure representing the specified PDF page.

setPage

public void setPage(com.sun.pdfview.PDFPage page)
Specify an PDF page to display.

Parameters:
page - The PDF page to display.

setScale

public void setScale(double scalePercentage)
Specify a scaling percentage of the PDF page.

Parameters:
scalePercentage - The scale percentage.