|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.googlecode.sarasvati.visual.ProcessImageMapCreator
public class ProcessImageMapCreator
Class which generates HTML image maps for processes. This uses SarasvatiProcessScene
internally, which can be used directly if more control is required.
Note: If using SarasvatiProcessScene, be sure to call
GraphSceneImpl.setupForExportOnHeadless() before calling
GraphSceneImpl.export(StringBuilder, Function, Function).
Example usage in a JSP:
<%
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>
| Field Summary | |
|---|---|
protected BufferedImage |
image
|
protected String |
mapContents
|
| Constructor Summary | |
|---|---|
ProcessImageMapCreator(GraphProcess process,
ProcessToImageMap processToImageMap)
Creates a new ProcessImageMapCreate using the given process and process to image map helper. |
|
| Method Summary | |
|---|---|
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 |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected String mapContents
protected BufferedImage image
| Constructor Detail |
|---|
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.| Method Detail |
|---|
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 to
IOException - If an error occurs writing the image to disc
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||