com.cc.framework.ui.painter.def
Class DefRatingPainter

java.lang.Object
  extended bycom.cc.framework.ui.painter.ControlPainter
      extended bycom.cc.framework.ui.painter.def.DefPainterBase
          extended bycom.cc.framework.ui.painter.def.DefRatingPainter

public class DefRatingPainter
extends DefPainterBase

Painter for the rating control

Version:
$Revision: 1.6 $
Author:
Harald Schulz

Field Summary
private static int[] COLS
           
private static java.lang.String[] PROPERTIES
           
 
Fields inherited from class com.cc.framework.ui.painter.ControlPainter
log
 
Constructor Summary
DefRatingPainter(PainterContext painterContext, RatingControl ctrl)
          Constructor
 
Method Summary
protected  double calcRatio(RatingItem item, long total)
          Calculates the ratio of the single item compared to the controls total value
protected  org.apache.ecs.ConcreteElement doCreateColGroup()
          Creates the HTML <COLGROUP> Element for the list
protected  org.apache.ecs.ConcreteElement doCreateElement()
          Creates the HTML-Element.
protected  org.apache.ecs.ConcreteElement doCreateEmptyRating()
          Creates the HTML code for the empty rating element
protected  org.apache.ecs.ConcreteElement doCreateHeader()
           
protected  org.apache.ecs.ConcreteElement doCreateItems()
           
protected  org.apache.ecs.ConcreteElement doCreateRating()
          Creates the rating element
protected  void doPaintBarCell(org.apache.ecs.html.TD cell, RatingItem item, long total)
          paint the ratio bar column of the control
protected  void doPaintCell(org.apache.ecs.html.TD cell, RatingItem item, int columnId, long total)
           
protected  void doPaintDetailCell(org.apache.ecs.html.TD cell, RatingItem item)
           
protected  void doPaintHeaderCell(org.apache.ecs.html.TD cell, int columnId)
          The painter will call this method to paint the column headers content
protected  void doPaintLabelCell(org.apache.ecs.html.TD cell, RatingItem item)
          paint the label column of the control
protected  void doPaintRatioCell(org.apache.ecs.html.TD cell, RatingItem item, long total)
          paint the ratio column of the control
protected  void doPaintValueCell(org.apache.ecs.html.TD cell, RatingItem item)
           
protected  int getBarWidth()
           
protected  java.lang.String getColumnHeader(int columnId)
           
protected  java.lang.String getColumnTooltip(int columnId)
           
protected  java.lang.String getColumnWidth(int columnId)
           
protected  RatingControl getCtrl()
          Retrieves the control for this painter
 int mapColumnPosition(int columnId)
          Maps the column identifier on to the actual column index
protected  boolean showColumn(int columnId)
           
 
Methods inherited from class com.cc.framework.ui.painter.def.DefPainterBase
createHelpElement, createHelpElement, doCreateHelpButton, doCreateHelpIcon, getElementClass
 
Methods inherited from class com.cc.framework.ui.painter.ControlPainter
ajaxPaint, attr, attr, attr, beginPaint, createActionPainter, createActionPainter, createElement, createImage, createImage, createImage, createInput, createInput, createSpacer, createSpacer, createSpacer, decorateURL, doAddDecorationsToRow, doAddDecorationsToRow, doAfterCreate, doAttachDecorations, doBeforeCreate, encodeURL, endPaint, forceControlName, getAsString, getAwtColor, getColor, getContextPath, getControlName, getDecorationsOnce, getElementName, getFramePainter, getFrameworkString, getFrameworkString, getImage, getImage, getImage, getImageSrc, getImageSrc, getImageSrc, getLocale, getPageContext, getPainterContext, getPrincipal, getRequest, getResponse, getSession, getSmartCaption, getSmartDetail, getSource, getSource, getStringResource, getStyleId, html, html, html, init, isRunAtClient, localize, localize, localize, paint, removeHtml, removeHtml, request, response, session, showComments
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COLS

private static final int[] COLS

PROPERTIES

private static final java.lang.String[] PROPERTIES
Constructor Detail

DefRatingPainter

public DefRatingPainter(PainterContext painterContext,
                        RatingControl ctrl)
Constructor

Parameters:
painterContext - The PainterContext
ctrl - The Control to render
Method Detail

getCtrl

protected RatingControl getCtrl()
Retrieves the control for this painter

Returns:
Control

calcRatio

protected double calcRatio(RatingItem item,
                           long total)
Calculates the ratio of the single item compared to the controls total value

Parameters:
item - the item to investigate
total - the total value of the control
Returns:
ratio

mapColumnPosition

public int mapColumnPosition(int columnId)
Maps the column identifier on to the actual column index

Parameters:
columnId - column identifier
Returns:
column index

getBarWidth

protected int getBarWidth()
Returns:
returns the width of the bar column in pixels

showColumn

protected boolean showColumn(int columnId)

getColumnWidth

protected java.lang.String getColumnWidth(int columnId)

getColumnHeader

protected java.lang.String getColumnHeader(int columnId)

getColumnTooltip

protected java.lang.String getColumnTooltip(int columnId)

doCreateEmptyRating

protected org.apache.ecs.ConcreteElement doCreateEmptyRating()
Creates the HTML code for the empty rating element

Returns:
HTML element

doPaintHeaderCell

protected void doPaintHeaderCell(org.apache.ecs.html.TD cell,
                                 int columnId)
The painter will call this method to paint the column headers content

Parameters:
cell - the header cell to render
columnId - The column identifier

doCreateHeader

protected org.apache.ecs.ConcreteElement doCreateHeader()

doCreateColGroup

protected org.apache.ecs.ConcreteElement doCreateColGroup()
Creates the HTML <COLGROUP> Element for the list

Returns:
ConcreteElement

doPaintLabelCell

protected void doPaintLabelCell(org.apache.ecs.html.TD cell,
                                RatingItem item)
paint the label column of the control

Parameters:
cell - the cell element
item - the item to render

doPaintDetailCell

protected void doPaintDetailCell(org.apache.ecs.html.TD cell,
                                 RatingItem item)

doPaintValueCell

protected void doPaintValueCell(org.apache.ecs.html.TD cell,
                                RatingItem item)

doPaintBarCell

protected void doPaintBarCell(org.apache.ecs.html.TD cell,
                              RatingItem item,
                              long total)
paint the ratio bar column of the control

Parameters:
cell - the cell element
item - the item to render
total - the total value of the control

doPaintRatioCell

protected void doPaintRatioCell(org.apache.ecs.html.TD cell,
                                RatingItem item,
                                long total)
paint the ratio column of the control

Parameters:
cell - the cell element
item - the item to render
total - the total value of the control

doPaintCell

protected void doPaintCell(org.apache.ecs.html.TD cell,
                           RatingItem item,
                           int columnId,
                           long total)

doCreateItems

protected org.apache.ecs.ConcreteElement doCreateItems()
Returns:
returns a list with the rating items

doCreateRating

protected org.apache.ecs.ConcreteElement doCreateRating()
Creates the rating element

Returns:
HTML

doCreateElement

protected org.apache.ecs.ConcreteElement doCreateElement()
Description copied from class: ControlPainter
Creates the HTML-Element. This Method must be implemented by the concrete Sub-Class

Specified by:
doCreateElement in class ControlPainter
Returns:
ConcreteElement
See Also:
ControlPainter.doCreateElement()


Copyright © 2000-2005 SCC Informationssysteme GmbH. All Rights Reserved.