net.sf.mmm.util.text.api
Interface LineWrapper

All Known Implementing Classes:
AbstractLineWrapper, DefaultLineWrapper

@ComponentSpecification
public interface LineWrapper

This is the interface used to wrap texts if they exceed a specific length. It even allows to do complex multi-column layouts easily.

Since:
2.0.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Method Summary
 int wrap(Appendable appendable, TextTableInfo tableInfo, String columnText, TextColumnInfo columnInfo)
          This method appends the given text to the appendable.
 int wrap(Appendable appendable, TextTableInfo tableInfo, String column1Text, TextColumnInfo column1Info, String column2Text, TextColumnInfo column2Info)
          This method is like wrap(Appendable, TextTableInfo, String, TextColumnInfo) but for a two-column layout.
 int wrap(Appendable appendable, TextTableInfo tableInfo, String column1Text, TextColumnInfo column1Info, String column2Text, TextColumnInfo column2Info, String column3Text, TextColumnInfo column3Info)
          This method is like wrap(Appendable, TextTableInfo, String, TextColumnInfo) but for a three-column layout.
 int wrap(Appendable appendable, TextTableInfo tableInfo, TextColumn... columns)
          This method is like wrap(Appendable, TextTableInfo, String, TextColumnInfo, String, TextColumnInfo, String, TextColumnInfo) for any number of columns.
 

Method Detail

wrap

int wrap(Appendable appendable,
         TextTableInfo tableInfo,
         String columnText,
         TextColumnInfo columnInfo)
This method appends the given text to the appendable. If the text is longer than the number of characters left in the current line, the text is wrapped. This means the current line is filled with parts of the text, a newline is added and the next line is filled with the same procedure until the entire text is processed. The last line is NOT terminated with a newline but ends with the last character of the text.

Parameters:
appendable - is the target where to append to.
tableInfo - is the TextTableInfo for the general layout.
columnText - is the text to append. The text may contain newline characters to indicate a line-break is forced at those positions.
columnInfo - holds the configuration like width, alignment, indent, etc.
Returns:
the number of lines that have been appended excluding the first line. In other words the number of line separators that have been appended.

wrap

int wrap(Appendable appendable,
         TextTableInfo tableInfo,
         String column1Text,
         TextColumnInfo column1Info,
         String column2Text,
         TextColumnInfo column2Info)
This method is like wrap(Appendable, TextTableInfo, String, TextColumnInfo) but for a two-column layout.

Parameters:
appendable - is the target where to append to.
tableInfo - is the TextTableInfo for the general layout.
column1Text - is the text for the first column.
column1Info - is the TextColumnInfo of the first column.
column2Text - is the text for the second column.
column2Info - is the TextColumnInfo of the second column.
Returns:
the number of lines that have been appended excluding the first line. In other words the number of line separators that have been appended.
See Also:
wrap(Appendable, TextTableInfo, TextColumn[])

wrap

int wrap(Appendable appendable,
         TextTableInfo tableInfo,
         String column1Text,
         TextColumnInfo column1Info,
         String column2Text,
         TextColumnInfo column2Info,
         String column3Text,
         TextColumnInfo column3Info)
This method is like wrap(Appendable, TextTableInfo, String, TextColumnInfo) but for a three-column layout.

Parameters:
appendable - is the target where to append to.
tableInfo - is the TextTableInfo for the general layout.
column1Text - is the text for the first column.
column1Info - is the TextColumnInfo of the first column.
column2Text - is the text for the second column.
column2Info - is the TextColumnInfo of the second column.
column3Text - is the text for the third column.
column3Info - is the TextColumnInfo of the third column.
Returns:
the number of lines that have been appended excluding the first line. In other words the number of line separators that have been appended.
See Also:
wrap(Appendable, TextTableInfo, TextColumn[])

wrap

int wrap(Appendable appendable,
         TextTableInfo tableInfo,
         TextColumn... columns)
This method is like wrap(Appendable, TextTableInfo, String, TextColumnInfo, String, TextColumnInfo, String, TextColumnInfo) for any number of columns.

Parameters:
appendable - is the target where to append to.
tableInfo - is the TextTableInfo for the general layout.
columns - are the columns to append.
Returns:
the number of lines that have been appended excluding the first line. In other words the number of line separators that have been appended.


Copyright © 2001-2010 mmm-Team. All Rights Reserved.