y.io
Class ImageMapOutputHandler

java.lang.Object
  |
  +--y.io.IOHandler
        |
        +--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 and 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.
 String createHTMLString(Graph2D graph)
          Creates a string representation of a HTML ImageMap corresponding to the specified graph.
 String getFileFormatString()
          Returns "HTML ImageMap"
 String getFileNameExtension()
          Returns "html"
 int getIndentDepth()
          Selector
 LinkMap getReferences()
          Selector
 boolean isUseNewlines()
          Selector
 boolean isWellFormed()
          Returns wether this class generates wellformed (xml-like) tags.
 void read(Graph2D graph, InputStream in)
          Unsupported method.
 void setIndentDepth(int indentDepth)
          Sets the indent depth.
 void setReferences(LinkMap references)
          Selector
 void setUseNewlines(boolean useNewlines)
          Sets the useNewlines flag.
 void setWellFormed(boolean wellFormed)
          Sets the policy for the generated html/xhtml.
 void write(Graph2D graph, 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,
                 InputStream in)
Unsupported method.

Specified by:
read in class IOHandler

write

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

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

createHTMLString

public 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

isUseNewlines

public boolean isUseNewlines()
Selector

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

setUseNewlines

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

Parameters:
useNewlines -

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 String getFileFormatString()
Returns "HTML ImageMap"

Specified by:
getFileFormatString in class IOHandler

getFileNameExtension

public String getFileNameExtension()
Returns "html"

Specified by:
getFileNameExtension in class IOHandler

isWellFormed

public boolean isWellFormed()
Returns wether this class generates wellformed (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-2003,
yWorks GmbH.
All rights reserved.

2003