Search this API

y.io
Class ImageMapOutputHandler

java.lang.Object
  extended by y.io.IOHandler
      extended by y.io.ImageMapOutputHandler

public class ImageMapOutputHandler
extends IOHandler

A simple write-only IOHandler that produces a HTML image map. The handler allows association of rectangular nodes, edge paths node labels and edge labels to hyperlinks. The hyperlink data has to be provided by a LinkMap object.

 

Constructor Summary
ImageMapOutputHandler()
          Constructs an ImageMapOutputHandler, which uses newlines and indents area elements by 2 spaces.
 
Method Summary
 boolean canRead()
          Returns false, since this class can't read a graph.
 Graph2DView createDefaultGraph2DView(Graph2D graph)
          Creates the default view used as image producer in case there is no current view associated with the graph2D.
 java.lang.String createHTMLString(Graph2D graph)
          Creates a string representation of a HTML ImageMap corresponding to the specified graph.
 double getEdgeHitSensitivity()
          Returns the width of an additional hit-test-sensitive border applied to each hyperlinked edge path.
 java.lang.String getFileFormatString()
          Returns "HTML ImageMap"
 java.lang.String getFileNameExtension()
          Returns "html"
 int getIndentDepth()
          Selector
 LinkMap getReferences()
          Selector
 boolean isSuppressEmptyMaps()
          Whether empty <map> elements should be suppressed or not.
 boolean isUseNewlines()
          Selector
 boolean isWellFormed()
          Returns whether this class generates well-formed (xml-like) tags.
 void read(Graph2D graph, java.io.InputStream in)
          Unsupported method.
 void setEdgeHitSensitivity(double sensitivity)
          Sets the width of an additional hit-test-sensitive border applied to each hyperlinked edge path.
 void setIndentDepth(int indentDepth)
          Sets the indent depth.
 void setReferences(LinkMap references)
          Selector
 void setSuppressEmptyMaps(boolean suppress)
          Sets whether empty <map> elements should be suppressed.
 void setUseNewlines(boolean useNewlines)
          Sets the useNewlines flag.
 void setWellFormed(boolean wellFormed)
          Sets the policy for the generated html/xhtml.
 void write(Graph2D graph, java.io.OutputStream out)
          Writes a HTML ImageMap corresponding to the specified graph to the specified stream.
 
Methods inherited from class y.io.IOHandler
canWrite, 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
 

Constructor Detail

ImageMapOutputHandler

public ImageMapOutputHandler()
Constructs an ImageMapOutputHandler, which uses newlines and indents area elements by 2 spaces.

Method Detail

read

public void read(Graph2D graph,
                 java.io.InputStream in)
Unsupported method.

Specified by:
read in class IOHandler

write

public void write(Graph2D graph,
                  java.io.OutputStream out)
           throws java.io.IOException
Writes a HTML ImageMap corresponding to the specified graph to the specified stream.

Specified by:
write in class IOHandler
Parameters:
graph -
out -
Throws:
java.io.IOException

createHTMLString

public java.lang.String createHTMLString(Graph2D graph)
Creates a string representation of a HTML ImageMap corresponding to the specified graph.

Parameters:
graph -
Returns:
the String representation of the HTML ImageMap

isSuppressEmptyMaps

public boolean isSuppressEmptyMaps()
Whether empty <map> elements should be suppressed or not.

See Also:
setSuppressEmptyMaps(boolean)

setSuppressEmptyMaps

public void setSuppressEmptyMaps(boolean suppress)
Sets whether empty <map> elements should be suppressed. By default, they are suppressed.


isUseNewlines

public boolean isUseNewlines()
Selector

Returns:
whether the <area> elements are separated by newlines

setUseNewlines

public void setUseNewlines(boolean useNewlines)
Sets the useNewlines flag. The default is true.

Parameters:
useNewlines -

setEdgeHitSensitivity

public void setEdgeHitSensitivity(double sensitivity)
Sets the width of an additional hit-test-sensitive border applied to each hyperlinked edge path. The given width is interpreted in world-coordinate space. By default this value is set to 10.0.


getEdgeHitSensitivity

public double getEdgeHitSensitivity()
Returns the width of an additional hit-test-sensitive border applied to each hyperlinked edge path.


getIndentDepth

public int getIndentDepth()
Selector

Returns:
the indent depth, i.e. the amount of blanks separating two <area> elements

setIndentDepth

public void setIndentDepth(int indentDepth)
Sets the indent depth. The default value is 2.

Parameters:
indentDepth -

createDefaultGraph2DView

public Graph2DView createDefaultGraph2DView(Graph2D graph)
Creates the default view used as image producer in case there is no current view associated with the graph2D. The default view renders the graph in its original size.

The returned view will be automatically registered as one of the graph's views. After the returned view is not needed anymore it is advisable to remove it from the list of registered view of the given graph.

See Also:
Graph2D.removeView(View)

getReferences

public LinkMap getReferences()
Selector

Returns:
the current LinkMap instance

setReferences

public void setReferences(LinkMap references)
Selector

Parameters:
references - the new LinkMap instance

canRead

public boolean canRead()
Returns false, since this class can't read a graph.

Overrides:
canRead in class IOHandler

getFileFormatString

public java.lang.String getFileFormatString()
Returns "HTML ImageMap"

Specified by:
getFileFormatString in class IOHandler

getFileNameExtension

public java.lang.String getFileNameExtension()
Returns "html"

Specified by:
getFileNameExtension in class IOHandler

isWellFormed

public boolean isWellFormed()
Returns whether this class generates well-formed (xml-like) tags.


setWellFormed

public void setWellFormed(boolean wellFormed)
Sets the policy for the generated html/xhtml. If set to true, elements will be well-formed. The default is false


© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.