|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.io.IOHandler yext.export.io.OutputHandler yext.export.io.SWFOutputHandler
public class SWFOutputHandler
Writes a Graph2D in SWF vector graphics format.
The size, viewport and zoom level of the output will be determined by the Graph2DView associated with the input graph. ASWFOutputHandler
is used the same way as any other
IOHandler
. E.g. the simplest way to export a given
Graph2D
instance to SWF is:
try { new SWFOutputHandler().write(graph2D, "myGraphAsSWF.swf"); } catch(IOException ex) { // error handling code }
If a non-null link map is passed to the constructor or set using
setReferences(y.io.LinkMap)
, the output handler will create
transparent buttons on top of all graph items (nodes, edges, labels) that
contain a non-null mapping to a LinkInfo
object in the link map.
Graph2DView
Field Summary | |
---|---|
static int |
SWF_VERSION_7
Version constant representing SWF file version 7. |
static int |
SWF_VERSION_8
Version constant representing SWF file version 8. |
Constructor Summary | |
---|---|
SWFOutputHandler()
Creates a new output handler using the default SWF version number. |
|
SWFOutputHandler(int swfVersion)
Creates a new output handler using the given swf version. |
|
SWFOutputHandler(int swfVersion,
LinkMap references)
Creates a new output handler using the given swf version number and link map. |
|
SWFOutputHandler(LinkMap references)
Creates a new output handler using the given link map and the default SWF version number. |
Method Summary | |
---|---|
double |
getEdgeHitSensitivity()
Returns the width of an additional hit-test-sensitive border applied to each hyperlinked edge path. |
String |
getFileNameExtension()
Returns "swf", the standard file name extension for Macromedia Flash. |
LinkMap |
getReferences()
Gets the link map that maps graph items to references that will be included in the swf file. |
int |
getSwfVersion()
Returns the SWF version of the SWF files this output handler produces. |
void |
setEdgeHitSensitivity(double sensitivity)
Sets the width of an additional hit-test-sensitive border applied to each hyperlinked edge path. |
void |
setReferences(LinkMap references)
Sets the link map that maps graph items to references that will be included in the swf file. |
void |
setSWFVersion(int swfVersion)
Sets the SWF version to write to the SWF header. |
protected void |
writeLinkInfo(org.freehep.graphicsio.swf.YSWFGraphics2D gfx,
LinkInfo linkInfo,
EdgeRealizer realizer)
Write a LinkInfo instance for the given edge realizer to the given swf graphics. |
protected void |
writeLinkInfo(org.freehep.graphicsio.swf.YSWFGraphics2D gfx,
LinkInfo linkInfo,
NodeRealizer realizer)
Write a LinkInfo instance for the given node realizer to the given swf graphics. |
protected void |
writeLinkInfo(org.freehep.graphicsio.swf.YSWFGraphics2D gfx,
LinkInfo linkInfo,
YLabel label)
Write a LinkInfo instance for the given label to the given swf graphics. |
protected void |
writeReferences(org.freehep.graphicsio.swf.YSWFGraphics2D gfx,
Graph2DView view,
LinkMap linkMap)
Writes the link references that were stored in the given linkMap . |
Methods inherited from class yext.export.io.OutputHandler |
---|
addRenderingHint, canRead, canWrite, createDefaultGraph2DView, createGraphicsContext, getCreator, getFileFormatString, read, removeRenderingHint, setCreator, write |
Methods inherited from class y.io.IOHandler |
---|
canWriteSubset, createObjectInputStream, createObjectOutputStream, hide, read, read, shouldSerialize, shouldSerialize, write, writeSubset, writeSubset |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int SWF_VERSION_7
public static final int SWF_VERSION_8
Constructor Detail |
---|
public SWFOutputHandler()
No hyperlinks will be created unless setReferences(y.io.LinkMap)
is called with a non-null link map before
OutputHandler.write(y.view.Graph2D, java.io.OutputStream)
is called.
public SWFOutputHandler(LinkMap references)
Note: For SWF_VERSION_8
currently only local links are
supported, i.e. external (or network) links are blocked by Flash player
implementations.
references
- the link map that maps graph items to references that
will be included in the SWF file.setReferences(y.io.LinkMap)
public SWFOutputHandler(int swfVersion)
No hyperlinks will be created unless setReferences(y.io.LinkMap)
is called with a non-null link map before
OutputHandler.write(y.view.Graph2D, java.io.OutputStream)
is called.
swfVersion
- the SWF version to write to the SWF header.setSWFVersion(int)
public SWFOutputHandler(int swfVersion, LinkMap references)
swfVersion
- the SWF version to write to the SWF header.references
- the link map that maps graph items to references that
will be included in the SWF file.setReferences(y.io.LinkMap)
,
setSWFVersion(int)
Method Detail |
---|
public int getSwfVersion()
public void setSWFVersion(int swfVersion)
OutputHandler.write(y.view.Graph2D, java.io.OutputStream)
is
called.
The main impact of the SWF version is the security policy used by Flash player implementations for links embedded into the generated SWF files.
Note: For SWF_VERSION_8
currently only local links are
supported, i.e. external (or network) links are blocked by Flash player
implementations.
Defaults to SWF_VERSION_7
.
swfVersion
- The version number to write to the SWF file header.
Currently only SWF_VERSION_7
and
SWF_VERSION_8
are supported.
IllegalArgumentException
- if the specified version is neither
SWF_VERSION_7
nor SWF_VERSION_8
.public String getFileNameExtension()
getFileNameExtension
in class IOHandler
protected void writeReferences(org.freehep.graphicsio.swf.YSWFGraphics2D gfx, Graph2DView view, LinkMap linkMap)
linkMap
. This method is called by
OutputHandler.write(y.view.Graph2D, java.io.OutputStream)
after the graph's
content has been painted, if a non-null reference map has been added using
setReferences(y.io.LinkMap)
.
gfx
- the swf graphics to write to.view
- the view to be exported.linkMap
- the link map that contains LinkInfo
objects
for graph items.protected void writeLinkInfo(org.freehep.graphicsio.swf.YSWFGraphics2D gfx, LinkInfo linkInfo, NodeRealizer realizer)
This implementation uses
YSWFGraphics2D.writeLink(String,String, java.awt.Shape)
to write the link to the swf. The sensible area of the link is determined
by the bounding box of the given realizer
.
The link url is queried using the swf_url
attribute
of the linkInfo
instance. The link target is queried using the
swf_target
attribute of the linkInfo
instance.
gfx
- the swf graphics to write to.linkInfo
- the link info that was stored for the node realized by
realizer
.realizer
- the realizer of the node for which the link should be
written.protected void writeLinkInfo(org.freehep.graphicsio.swf.YSWFGraphics2D gfx, LinkInfo linkInfo, EdgeRealizer realizer)
This implementation uses
YSWFGraphics2D.writeLink(String,String, java.awt.Shape)
to write the link to the swf. The sensible area of the link is determined
by the edge's path and by the getEdgeHitSensitivity()
property.
The link url is queried using the swf_url
attribute of the linkInfo
instance. The link target is
queried using the swf_target
attribute of the
linkInfo
instance.
gfx
- the swf graphics to write to.linkInfo
- the link info that was stored for the edge realized by
realizer
.realizer
- the realizer of the edge for which the link should be
written.protected void writeLinkInfo(org.freehep.graphicsio.swf.YSWFGraphics2D gfx, LinkInfo linkInfo, YLabel label)
This implementation uses
YSWFGraphics2D.writeLink(String,String, java.awt.Shape)
to write the link to the swf. The sensible area of the link is determined
by the location
and size of the given
label
.
The link url is queried using the swf_url
attribute
of the linkInfo
instance. The link target is queried using
the swf_target
attribute of the linkInfo
instance.
gfx
- the swf graphics to write to.linkInfo
- the link info that was stored for label
.label
- the label for which the link should be written.public void setEdgeHitSensitivity(double sensitivity)
By default this value is set to 10.0
.
public double getEdgeHitSensitivity()
public LinkMap getReferences()
LinkMap
instancepublic void setReferences(LinkMap references)
The default writeLinkInfo
implementations will query the
LinkInfo
instances stored in the link map for the
swf_url
and swf_target
attributes.
Note: For SWF_VERSION_8
currently only local links are
supported, i.e. external (or network) links are blocked by Flash player
implementations.
references
- the new LinkMap instance
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |