com.overzealous.remark.util
Class MarkdownTableCell

java.lang.Object
  extended by 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
MarkdownTableCell()
          Creates a new, empty MarkdownTableCell
MarkdownTableCell(String contents)
          Creates a new MarkdownTableCell with only contents
MarkdownTableCell(String contents, int colspan)
          Creates a new MarkdownTableCell with contents and a colspan
MarkdownTableCell(String contents, MarkdownTable.Alignment alignment)
          Creates a new MarkdownTableCell with contents and alignment
MarkdownTableCell(String contents, MarkdownTable.Alignment alignment, int colspan)
          Creates a new MarkdownTableCell with contents and a colspan
 
Method Summary
 boolean equals(Object o)
           
 MarkdownTable.Alignment getAlignment()
          Gets the text-alignment of this cell
 int getColspan()
           
 String getContents()
           
 int getWidth()
          Returns the number of characters needed to show this column.
 int hashCode()
           
 void setAlignment(MarkdownTable.Alignment alignment)
          Sets the text-alignment.
 void setColspan(int colspan)
          Sets the number of columns this cell spans.
 void setContents(String contents)
          Sets the contents of this cell.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

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 cell
alignment - 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 cell
colspan - 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 cell
alignment - 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.

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


© 2011 OverZealous Creations, LLC - BitBucket Repository