Package com.overzealous.remark.util
Class MarkdownTableCell
- java.lang.Object
-
- com.overzealous.remark.util.MarkdownTableCell
-
public class MarkdownTableCell extends Object
This class contains the contents of a table cell. It's used to help keep track of information about the table so the final table can be built with clean formatting.- Author:
- Phil DeJarnett
-
-
Constructor Summary
Constructors Constructor Description MarkdownTableCell()Creates a new, empty MarkdownTableCellMarkdownTableCell(String contents)Creates a new MarkdownTableCell with only contentsMarkdownTableCell(String contents, int colspan)Creates a new MarkdownTableCell with contents and a colspanMarkdownTableCell(String contents, MarkdownTable.Alignment alignment)Creates a new MarkdownTableCell with contents and alignmentMarkdownTableCell(String contents, MarkdownTable.Alignment alignment, int colspan)Creates a new MarkdownTableCell with contents and a colspan
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)MarkdownTable.AlignmentgetAlignment()Gets the text-alignment of this cellintgetColspan()StringgetContents()intgetWidth()Returns the number of characters needed to show this column.inthashCode()voidsetAlignment(MarkdownTable.Alignment alignment)Sets the text-alignment.voidsetColspan(int colspan)Sets the number of columns this cell spans.voidsetContents(String contents)Sets the contents of this cell.StringtoString()
-
-
-
Constructor Detail
-
MarkdownTableCell
public MarkdownTableCell()
Creates a new, empty MarkdownTableCell
-
MarkdownTableCell
public MarkdownTableCell(String contents)
Creates a new MarkdownTableCell with only contents- Parameters:
contents- The contents of this cell
-
MarkdownTableCell
public MarkdownTableCell(String contents, MarkdownTable.Alignment alignment)
Creates a new MarkdownTableCell with contents and alignment- Parameters:
contents- The contents of this cellalignment- The alignment of this cell (if specified)
-
MarkdownTableCell
public MarkdownTableCell(String contents, int colspan)
Creates a new MarkdownTableCell with contents and a colspan- Parameters:
contents- The contents of this cellcolspan- The number of columns this cell spans
-
MarkdownTableCell
public MarkdownTableCell(String contents, MarkdownTable.Alignment alignment, int colspan)
Creates a new MarkdownTableCell with contents and a colspan- Parameters:
contents- The contents of this cellalignment- The alignment of this cell (if specified)colspan- The number of columns this cell spans
-
-
Method Detail
-
getAlignment
public MarkdownTable.Alignment getAlignment()
Gets the text-alignment of this cell- Returns:
- The alignment of this cell
-
setAlignment
public void setAlignment(MarkdownTable.Alignment alignment)
Sets the text-alignment. Note: the alignment cannot be null.- Parameters:
alignment- The new alignment
-
getContents
public String getContents()
-
setContents
public void setContents(String contents)
Sets the contents of this cell. If the contents contain any linebreaks, they will be replaced with spaces.- Parameters:
contents- The new cell contents
-
getColspan
public int getColspan()
-
setColspan
public void setColspan(int colspan)
Sets the number of columns this cell spans. If the colspan is less than 1, it is set to 1.- Parameters:
colspan- The new colspan
-
getWidth
public int getWidth()
Returns the number of characters needed to show this column. It adds two to the content width, so there is padding around the content.- Returns:
- The width of this column in characters, plus 2 chars for spacing.
-
-