ConForM.CoopnTools.CoKer.CodeVisual
Class Format

java.lang.Object
  |
  +--ConForM.CoopnTools.CoKer.CodeVisual.Format
Direct Known Subclasses:
AnsiFormat, HtmlFormat, LatexFormat, MIFFormat, PlainFormat

public abstract class Format
extends java.lang.Object

This class implements the basic functionality for formatting. Subclasses implement the actual formatting by overriding the formatting methods.


Field Summary
static int ANSI
          ANSI format.
protected  int colnum
           
protected  boolean contextMode
           
protected  java.lang.String[] conversions
           
protected  int[] conversionsLength
           
static int defaultFontSize
          Default font size.
static int defaultTabSize
          Default tab size.
protected  CoopnEnv env
           
protected  int fontsize
           
static java.lang.String[] formatNames
          Format names.
static int FORMATNUMBER
          Number of kinds of formats.
static int HTML
          HTMLtext format.
static int LATEX
          LATEX format.
static int MIF
          MIF format.
protected  java.io.PrintWriter out
           
static int PLAIN
          Plain text format.
protected  boolean tabMode
           
protected  int tabsize
           
 
Method Summary
 int getFontSize()
          Get the fontsize used when adding the context.
static Format getFormatter(java.io.PrintWriter stream, int format, boolean contextMode, boolean tabMode, CoopnEnv env)
          Get an exporter for a particular format.
 int getTabSize()
          Get the tabsize used when expanding tabs.
protected  void resetColor()
          Reset the current color to normal.
protected  void setColor(java.awt.Color color)
          Set the current color to the parameter color.
 void setFontSize(int size)
          Set the fontsize used when adding the context.
 void setTabSize(int size)
          Set the tabsize used when expanding tabs.
static java.lang.String[] supportedFormats(CoopnEnv env)
          Get the supported formats.
protected  java.lang.String write(java.lang.String text, int tabsize)
          Write the given string using the supplied tabsize
protected  void writeContext(java.lang.String title)
          The context, optionnaly present, insure that the produced document is a stand-alone document.
protected  void writeDocumentFooter()
           
protected  void writeDocumentHeader()
          Headers and footers are most outer texts, and are allway present
protected  void writeEndContext()
           
protected  void writeEndText()
           
protected  void writeStartText()
          Start and end texts encompass the data of the document
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FORMATNUMBER

public static final int FORMATNUMBER
Number of kinds of formats.

PLAIN

public static final int PLAIN
Plain text format.

ANSI

public static final int ANSI
ANSI format.

HTML

public static final int HTML
HTMLtext format.

LATEX

public static final int LATEX
LATEX format.

MIF

public static final int MIF
MIF format.

formatNames

public static final java.lang.String[] formatNames
Format names. This array associates a format and its name.
See Also:
FORMATNUMBER

out

protected java.io.PrintWriter out

conversions

protected java.lang.String[] conversions

conversionsLength

protected int[] conversionsLength

defaultTabSize

public static int defaultTabSize
Default tab size.

defaultFontSize

public static int defaultFontSize
Default font size.

colnum

protected int colnum

tabsize

protected int tabsize

fontsize

protected int fontsize

contextMode

protected boolean contextMode

tabMode

protected boolean tabMode

env

protected CoopnEnv env
Method Detail

getTabSize

public int getTabSize()
Get the tabsize used when expanding tabs.

getFontSize

public int getFontSize()
Get the fontsize used when adding the context.

setTabSize

public void setTabSize(int size)
Set the tabsize used when expanding tabs.

setFontSize

public void setFontSize(int size)
Set the fontsize used when adding the context.

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.

getFormatter

public static Format getFormatter(java.io.PrintWriter stream,
                                  int format,
                                  boolean contextMode,
                                  boolean tabMode,
                                  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 suppo rted.
Throws:
java.lang.IllegalArgumentException - an argument is erroneous.

writeDocumentHeader

protected void writeDocumentHeader()
Headers and footers are most outer texts, and are allway present

writeDocumentFooter

protected void writeDocumentFooter()

writeContext

protected void writeContext(java.lang.String title)
The context, optionnaly present, insure that the produced document is a stand-alone document. If the context is not present, it should be assumed that the document will be included into a more broader one.

writeEndContext

protected void writeEndContext()

writeStartText

protected void writeStartText()
Start and end texts encompass the data of the document

writeEndText

protected void writeEndText()

setColor

protected void setColor(java.awt.Color color)
Set the current color to the parameter color.

resetColor

protected void resetColor()
Reset the current color to normal.

write

protected java.lang.String write(java.lang.String text,
                                 int tabsize)
Write the given string using the supplied tabsize
Parameters:
text - The string to write
tabsize - The tabsize to use