ConForM.CoopnTools.CoKer.CodeVisual
Class CodeExporter

java.lang.Object
  |
  +--ConForM.CoopnTools.CoKer.CodeVisual.CodeExporter

public abstract class CodeExporter
extends java.lang.Object

Code Exportation class. This class defines abstract code exporters, intended to be used with code visualisations. All interactions with an exporter object are made in the logical coordinate space, where 1 inch corresponds to 81,92 logical units.


Field Summary
protected  java.awt.Rectangle bounds
           
protected  java.awt.Color color
           
protected  CoopnEnv env
           
static int EPS
          Encaspulated postscript.
protected  java.awt.Insets insets
           
static int MIF
          MIF tag.
static int POSTSCRIPT
          Postscript.
static int RTF
          RTF.
protected  java.io.PrintWriter stream
           
protected  java.lang.String title
           
protected  int translationX
           
protected  int translationY
           
protected  float zoom
           
 
Constructor Summary
protected CodeExporter(java.io.PrintWriter stream, java.lang.String title, java.awt.Rectangle bounds, java.awt.Insets insets, int zoom, CoopnEnv env)
           
 
Method Summary
 void dispose()
          Terminates an exportation, and dispose the exporter object.
abstract  void drawText(double x, double y, java.lang.String text, java.awt.Font font)
          Draw a text.
 void drawText(java.awt.geom.Point2D point, java.lang.String text, java.awt.Font font)
          Draw a text.
abstract  void endElement()
          End an element.
static CodeExporter getExporter(java.io.PrintWriter stream, int format, java.lang.String title, java.awt.Rectangle bounds, java.awt.Insets insets, int zoom, CoopnEnv env)
          Get an exporter for a particular format.
protected abstract  void header()
           
 void setColor(java.awt.Color color)
          Set the current color.
abstract  void startElement(java.lang.String element)
          Start an element.
static java.lang.String[] supportedFormats(CoopnEnv env)
          Get the supported formats.
protected abstract  void trailer()
           
 void translate(int x, int y)
          Translate the current user space.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EPS

public static final int EPS
Encaspulated postscript.

MIF

public static final int MIF
MIF tag.

POSTSCRIPT

public static final int POSTSCRIPT
Postscript.

RTF

public static final int RTF
RTF.

stream

protected java.io.PrintWriter stream

title

protected java.lang.String title

bounds

protected java.awt.Rectangle bounds

insets

protected java.awt.Insets insets

zoom

protected float zoom

env

protected CoopnEnv env

translationX

protected int translationX

translationY

protected int translationY

color

protected java.awt.Color color
Constructor Detail

CodeExporter

protected CodeExporter(java.io.PrintWriter stream,
                       java.lang.String title,
                       java.awt.Rectangle bounds,
                       java.awt.Insets insets,
                       int zoom,
                       CoopnEnv env)
Method Detail

dispose

public void dispose()
Terminates an exportation, and dispose the exporter object. This routine does not dispose the stream, nor the bounds.

header

protected abstract void header()

trailer

protected abstract void trailer()

startElement

public abstract void startElement(java.lang.String element)
Start an element.
Parameters:
element - the element to start

endElement

public abstract void endElement()
End an element.

translate

public void translate(int x,
                      int y)
Translate the current user space.
Parameters:
x - x-displacement
y - y-displacement

setColor

public void setColor(java.awt.Color color)
Set the current color.
Parameters:
color - the new color

drawText

public abstract void drawText(double x,
                              double y,
                              java.lang.String text,
                              java.awt.Font font)
Draw a text.
Parameters:
x - x-coordinate of starting point
y - y-coordinate of starting point
text - text
font - font

drawText

public void drawText(java.awt.geom.Point2D point,
                     java.lang.String text,
                     java.awt.Font font)
Draw a text.
Parameters:
point - starting point
text - text
font - font

supportedFormats

public static java.lang.String[] supportedFormats(CoopnEnv env)
Get the supported formats.
Returns:
an array of strings, the indexes of which give the supported format code, and the elements of which give the names of the supported formats.

getExporter

public static CodeExporter getExporter(java.io.PrintWriter stream,
                                       int format,
                                       java.lang.String title,
                                       java.awt.Rectangle bounds,
                                       java.awt.Insets insets,
                                       int zoom,
                                       CoopnEnv env)
Get an exporter for a particular format.
Parameters:
stream - the stream used to write the external formatting instructions
format - the format to use, one of the valid indexes of the array returned by
title - the title
bounds - the logical bounds of the picture
insets - the logical inset of the picture
zoom - the zoom factor to use, in percent
env - the environment
Returns:
The adequate graphical exporter, or null if the format not supported.
Throws:
java.lang.IllegalArgumentException - an argument is erroneous.