terp - the Codemesh Modular
Template Interpreter v1.3.309

com.codemesh.terp.util
Class TextLayoutEngine

java.lang.Object
  extended by com.codemesh.terp.util.TextLayoutEngine
All Implemented Interfaces:
java.util.Iterator<java.lang.String>

public class TextLayoutEngine
extends java.lang.Object
implements java.util.Iterator<java.lang.String>

The engine that performs the text layout on behalf of the terp expander.


Nested Class Summary
static class TextLayoutEngine.Break
           
static class TextLayoutEngine.LayoutRelevantData
           
 
Field Summary
static java.util.regex.Pattern NEWLINE
           
static java.util.regex.Pattern PREFERRED_ADD
           
 
Constructor Summary
TextLayoutEngine()
           
 
Method Summary
 java.lang.String append(java.lang.String text, TextLayoutEngine.LayoutRelevantData data)
           
 java.util.List<java.lang.String> breakLine(TextLayoutEngine.LayoutRelevantData firstData)
           
 boolean containsEOL(java.lang.String text)
           
 boolean endsWithEOL(java.lang.String text)
           
 void formatLine()
           
 int getAnchor()
           
 java.lang.StringBuilder getBuffer(TextLayoutEngine.LayoutRelevantData data)
           
 boolean hasNext()
           
protected  TextLayoutEngine.Break identifyBreak(java.lang.CharSequence seq, int index)
           
 java.lang.String next()
           
 void remove()
           
 void resetAnchor()
           
 void setAnchor()
           
 java.util.List<com.codemesh.terp.util.TextLayoutEngine.Segment> toSegments(java.lang.String text, TextLayoutEngine.LayoutRelevantData data)
           
 void treatLine(TextLayoutEngine.LayoutRelevantData firstData, boolean bBlockJustify)
          Takes the accumulated linebuffers (left,right,center) and assembles them into a line, taking the layout data into account.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PREFERRED_ADD

public static final java.util.regex.Pattern PREFERRED_ADD

NEWLINE

public static final java.util.regex.Pattern NEWLINE
Constructor Detail

TextLayoutEngine

public TextLayoutEngine()
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface java.util.Iterator<java.lang.String>

next

public java.lang.String next()
Specified by:
next in interface java.util.Iterator<java.lang.String>

remove

public void remove()
Specified by:
remove in interface java.util.Iterator<java.lang.String>

append

public java.lang.String append(java.lang.String text,
                               TextLayoutEngine.LayoutRelevantData data)

toSegments

public java.util.List<com.codemesh.terp.util.TextLayoutEngine.Segment> toSegments(java.lang.String text,
                                                                                  TextLayoutEngine.LayoutRelevantData data)

setAnchor

public void setAnchor()

getAnchor

public int getAnchor()

resetAnchor

public void resetAnchor()

formatLine

public void formatLine()

breakLine

public java.util.List<java.lang.String> breakLine(TextLayoutEngine.LayoutRelevantData firstData)

identifyBreak

protected TextLayoutEngine.Break identifyBreak(java.lang.CharSequence seq,
                                               int index)

treatLine

public void treatLine(TextLayoutEngine.LayoutRelevantData firstData,
                      boolean bBlockJustify)
Takes the accumulated linebuffers (left,right,center) and assembles them into a line, taking the layout data into account. The firstData parameter is used to pass the information that was in force at the beginning of the line.

Parameters:
firstData - the layout data of the first segment in that line.
bBlockJustify - add spaces if necessary.

getBuffer

public java.lang.StringBuilder getBuffer(TextLayoutEngine.LayoutRelevantData data)

containsEOL

public boolean containsEOL(java.lang.String text)

endsWithEOL

public boolean endsWithEOL(java.lang.String text)

terp - the Codemesh Modular
Template Interpreter v1.3.309

Copyright © 2008-2012 by Codemesh, Inc. All Rights Reserved.