net.sf.mmm.util.text.api
Class TextTableInfo

java.lang.Object
  extended by net.sf.mmm.util.text.api.TextTableInfo

public class TextTableInfo
extends Object

This is a Java-bean for the layout-configuration of a text table.
It contains the width, line-separator, and various other meta-information for the layout of a textual table.

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

Field Summary
static int DEFAULT_WIDTH
          The default width.
private  String lineSeparator
           
private  int width
           
 
Constructor Summary
TextTableInfo()
          The constructor.
 
Method Summary
 String getLineSeparator()
          This method gets the StringUtil.LINE_SEPARATOR used to terminate a line of text.
 int getWidth()
          This method gets the width of the text-table in characters.
 void setLineSeparator(String newline)
          This method sets the line-separator.
 void setWidth(int width)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_WIDTH

public static final int DEFAULT_WIDTH
The default width. This default is suitable for a single-column layout.

See Also:
Constant Field Values

lineSeparator

private String lineSeparator
See Also:
getLineSeparator()

width

private int width
See Also:
getWidth()
Constructor Detail

TextTableInfo

public TextTableInfo()
The constructor.

Method Detail

getLineSeparator

public String getLineSeparator()
This method gets the StringUtil.LINE_SEPARATOR used to terminate a line of text. Only the line-separator of the last column is used and all others are ignored.

Returns:
the line separator string.

setLineSeparator

public void setLineSeparator(String newline)
This method sets the line-separator.

Parameters:
newline - is the new line-separator.
See Also:
StringUtil.LINE_SEPARATOR, StringUtil.LINE_SEPARATOR_CR, StringUtil.LINE_SEPARATOR_CRLF, StringUtil.LINE_SEPARATOR_LF, StringUtil.LINE_SEPARATOR_LFCR

getWidth

public int getWidth()
This method gets the width of the text-table in characters.
This should be the number of characters per line in your console. It may be TextColumnInfo.WIDTH_AUTO_ADJUST if all column-widths are set to actual positive values. Otherwise the value returned by this method has to be positive and greater or equal to the sum of the following term for each column:
 TextColumnInfo.getBorderLeft().length() + TextColumnInfo.getBorderRight().length() + <column-with> 
 
Where <column-with> is TextColumnInfo.getWidth() or (in case of TextColumnInfo.WIDTH_AUTO_ADJUST) an auto-calculated value that has to be greater or equal to 1. The default value is 80.

Returns:
the width of the text-table.

setWidth

public void setWidth(int width)
Parameters:
width - is the width to set


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