org.salespointframework.web.html
Class View<T extends SpItem>

java.lang.Object
  extended by org.salespointframework.web.html.View<T>

public class View<T extends SpItem>
extends java.lang.Object

Renders a View by a dataset.

Author:
Uwe Schmidt, Lars Kreisz

Field Summary
protected  AbstractTableModel atm
           
protected  java.lang.String caption
           
protected  java.util.List<AbstractExtraColumn<T>> extraCols
           
protected  java.lang.String id
           
private  boolean insideDoubleView
           
protected  PositionOfExtraColumnsType positionOfExtraColumns
           
private  boolean searchField
           
protected  java.lang.String searchString
           
protected  java.lang.StringBuffer style
           
protected  java.lang.String styleName
           
protected  java.lang.String summary
           
protected  HtmlViewRepresentation viewRepresentation
           
 
Constructor Summary
View(AbstractTableModel atm, HtmlViewRepresentation viewRepresentation)
          Renders a View by a dataset.
 
Method Summary
protected  java.lang.StringBuffer getElement(int row)
          Renders the HTML-code of the element in the ATM.
protected  java.util.List<java.lang.String> getElements()
          Renders elements and ECs and take the HTML-code to a List.
 java.lang.StringBuffer render()
          Renders the HTML-code of the View.
protected  java.lang.StringBuffer renderBody()
          Renders the HTML-code of the body in the ATM.
protected  java.lang.StringBuffer renderCaptionAhead()
          Renders the caption of the View.
protected  java.lang.StringBuffer renderExtraColumn(int row)
          Renders the HTML-code of the EC-element in the ATM.
protected  java.lang.StringBuffer renderFooter()
          Renders the HTML-code of the footer in the ATM.
protected  java.lang.StringBuffer renderHeader()
          Renders the HTML-code of the header in the ATM.
private  java.lang.StringBuffer renderSearchField()
           
 void setCaption(java.lang.String caption)
          A caption of a View.
 void setExtraCols(java.util.List<AbstractExtraColumn<T>> extraCols)
          Set a List of extra-columns into the View.
 void setId(java.lang.String id)
          The value of the id-attribute of the View.
 void setInsideDoubleView(boolean insideDoubleView)
          Default is 'false'.
 void setPositionOfExtraColumns(PositionOfExtraColumnsType positionOfExtraColumns)
          Set the position of insert ECs.
 void setSearchField(boolean searchField)
          Renders a search-field on top of the View.
 void setSearchString(java.lang.String searchString)
          Preset of searchField.
 void setStyle(java.lang.String style)
          The value of the style of the View.
 void setStyleName(java.lang.String styleName)
          The value of the class-attribute of the View.
 void setSummary(java.lang.String summary)
          A summary is only using by a table.
 java.lang.String toString()
          Return a String like "View[id: x |styleName: y |viewRep: z ](Object.toString)"
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

caption

protected java.lang.String caption

summary

protected java.lang.String summary

extraCols

protected java.util.List<AbstractExtraColumn<T extends SpItem>> extraCols

style

protected java.lang.StringBuffer style

positionOfExtraColumns

protected PositionOfExtraColumnsType positionOfExtraColumns

viewRepresentation

protected HtmlViewRepresentation viewRepresentation

atm

protected AbstractTableModel atm

id

protected java.lang.String id

styleName

protected java.lang.String styleName

searchField

private boolean searchField

searchString

protected java.lang.String searchString

insideDoubleView

private boolean insideDoubleView
Constructor Detail

View

public View(AbstractTableModel atm,
            HtmlViewRepresentation viewRepresentation)
Renders a View by a dataset.

Parameters:
{@link - AbstractTableModel} atm
{@link - HtmlViewRepresentation} viewRepresentation
Method Detail

setCaption

public void setCaption(java.lang.String caption)
A caption of a View. It will be rendered on top.

Parameters:
caption -

setSummary

public void setSummary(java.lang.String summary)
A summary is only using by a table.

Parameters:
summary -

setSearchField

public void setSearchField(boolean searchField)
Renders a search-field on top of the View. Default is 'false'.

Parameters:
searchField -

setExtraCols

public void setExtraCols(java.util.List<AbstractExtraColumn<T>> extraCols)
Set a List of extra-columns into the View.

Parameters:
extraCols -

setId

public void setId(java.lang.String id)
The value of the id-attribute of the View. Be sure it's unique for the whole HTML document.

Parameters:
id -

setStyleName

public void setStyleName(java.lang.String styleName)
The value of the class-attribute of the View.

Parameters:
styleName -

setStyle

public void setStyle(java.lang.String style)
The value of the style of the View.

Parameters:
style -

setSearchString

public void setSearchString(java.lang.String searchString)
Preset of searchField.

Parameters:
searchString -

setPositionOfExtraColumns

public void setPositionOfExtraColumns(PositionOfExtraColumnsType positionOfExtraColumns)
Set the position of insert ECs. Default is 'BACK'.

Parameters:
positionOfExtraColumns -
See Also:
PositionOfExtraColumnsType

setInsideDoubleView

public void setInsideDoubleView(boolean insideDoubleView)
Default is 'false'. Set on 'true' if the View is setting into a DoubleView.

Parameters:
insideDoubleView -

renderSearchField

private java.lang.StringBuffer renderSearchField()

renderCaptionAhead

protected java.lang.StringBuffer renderCaptionAhead()
Renders the caption of the View.

The ViewRepresentation must have: (a caption must be set)

Returns:
StringBuffer HTML-code of a Caption

getElement

protected java.lang.StringBuffer getElement(int row)
Renders the HTML-code of the element in the ATM.

The ViewRepresentation must have: (if the element don't match with the search-string, it returns 'null')

Parameters:
row - the row of the ATM
Returns:
StringBuffer HTML-code of an element

getElements

protected java.util.List<java.lang.String> getElements()
Renders elements and ECs and take the HTML-code to a List.
(the positionOfExtraColumns, renderExtraColumn() and getElement() are used)

Returns:
List<String> of all objects (in a List) or lines (in a Table)

renderExtraColumn

protected java.lang.StringBuffer renderExtraColumn(int row)
Renders the HTML-code of the EC-element in the ATM.

The ViewRepresentation must have: (getCellContent() in the EC is used)

Parameters:
row - the row of the ATM
Returns:
StringBuffer HTML-code of an EC-element

renderHeader

protected java.lang.StringBuffer renderHeader()
Renders the HTML-code of the header in the ATM. (Headers are not in ListViews.)

The ViewRepresentation must have: (getHeaderCell() in the EC and positionOfExtraColumns are used)

Returns:
StringBuffer HTML-code of the header

renderBody

protected java.lang.StringBuffer renderBody()
Renders the HTML-code of the body in the ATM.

The ViewRepresentation must have: (getElements() is used)

Returns:
StringBuffer HTML-code of the body

renderFooter

protected java.lang.StringBuffer renderFooter()
Renders the HTML-code of the footer in the ATM. (Footers are not in ListViews.)

The ViewRepresentation must have: (This method is empty and must be override.)

Returns:
StringBuffer HTML-code of the footer

render

public java.lang.StringBuffer render()
Renders the HTML-code of the View.

The ViewRepresentation must have: (style, id and styleName are used)

Returns:
StringBuffer HTML-code of the View

toString

public java.lang.String toString()
Return a String like "View[id: x |styleName: y |viewRep: z ](Object.toString)"

Overrides:
toString in class java.lang.Object