public class ProcessImageMapCreator extends Object
SarasvatiProcessScene
internally, which can be used directly if more control is required.
SarasvatiProcessScene, be sure to call
GraphSceneImpl.setupForExportOnHeadless() before calling
GraphSceneImpl.export(StringBuilder, Function, Function).
<%
ProcessToImageMapAdapter helper = new ProcessToImageMapAdapter ()
{
public String hrefForNode (VisualProcessNode node)
{
return "javascript:alert( 'You have selected " + node.getNode().getName() + "' );";
}
public String hoverForNode (VisualProcessNode node)
{
NodeToken token = node.getToken();
if ( token == null )
{
return null;
}
return "Started: " + sdf.format( token.getCreateDate() ) +
" Finished: " + (token.getCompleteDate() == null ? "Not yet finished" : sdf.format( token.getCompleteDate() ) ) ;
}
};
String basePath = config.getServletContext().getRealPath( "/" );
ProcessImageMapCreator imageMapCreator = new ProcessImageMapCreator( process, helper );
imageMapCreator.writeImageToFile( "gif", basepath + "/test-process.gif" );
%>
<map name="processMap">
<%=imageMapCreator.getMapContents()%>
</map>
<div style="margin-left:10px; padding-top:10px">
<image style="border:2px black solid" src="<%=request.getContextPath() + "/test-process.gif"%>" usemap="#processMap"/>
</div>
| Modifier and Type | Field and Description |
|---|---|
protected BufferedImage |
image |
protected String |
mapContents |
| Constructor and Description |
|---|
ProcessImageMapCreator(GraphProcess process,
ProcessToImageMap processToImageMap)
Creates a new ProcessImageMapCreate using the given process and process to image map
helper.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
generateMapAndImage(GraphProcess process,
ProcessToImageMap processToImageMap) |
BufferedImage |
getImage()
Returns the generated process image.
|
String |
getMapContents()
Returns what should placed in a map tag.
|
void |
writeImageToFile(String imageFormat,
String imageFileName)
Writes the generated process image to a file in the given format
|
protected String mapContents
protected BufferedImage image
public ProcessImageMapCreator(GraphProcess process, ProcessToImageMap processToImageMap)
process - The process to create an image map and image from.processToImageMap - Controls how the image and image map are constructed.protected void generateMapAndImage(GraphProcess process, ProcessToImageMap processToImageMap)
public String getMapContents()
public BufferedImage getImage()
writeImageToFile(String, String).public void writeImageToFile(String imageFormat, String imageFileName) throws IOException
imageFormat - The informal name of the format to write the file in,
as understood by ImageIO.imageFileName - The name of the file to write the image toIOException - If an error occurs writing the image to discCopyright © 2012. All Rights Reserved.