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

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.DefFormPainter
Direct Known Subclasses:
DefFormDisplayPainter, DefFormEditPainter, DefFormInfoPainter, DefFormSearchPainter

public abstract class DefFormPainter
extends DefPainterBase

Base class for form painters

Since:
1.0
Version:
$Revision: 1.96 $
Author:
Gernot Schulz

Field Summary
protected static FormLabelDesignModel LABEL_EMPTY
          Empty Label
protected static FormLabelDesignModel LABEL_MESSAGE
          Message Label
protected static java.lang.String ROWTYPE
          Custom HTML attribute to identify row types
protected static java.lang.String ROWTYPE_BUTTONS
          Row Type: Button Container
protected static java.lang.String ROWTYPE_CONTAINER
          Row Type: Container
protected static java.lang.String ROWTYPE_CONTROL
          Row Type: Control
protected static java.lang.String ROWTYPE_DESCRIPTION
          Row Type: Description
protected static java.lang.String ROWTYPE_INNERFRAME
          Row Type: Inner Frame
protected static java.lang.String ROWTYPE_SEPARATOR
          Row Type: Separator
 
Fields inherited from class com.cc.framework.ui.painter.ControlPainter
log
 
Constructor Summary
DefFormPainter(PainterContext painterContext, FormControl ctrl)
          Constructor for DefFormPainter
 
Method Summary
protected  void addColGroup(org.apache.ecs.html.Table table, FormElementContainer container)
           
protected  boolean attachRight(FormElement formElement)
          This method will check if the required image should be attached left or right to the description This is required for some Controls like the RadioControl or CheckboxControl.
protected  org.apache.ecs.ConcreteElement createButtons(FormButtonContainer container)
          Creates the buttons of a button container
private  org.apache.ecs.html.Col createCol(java.lang.String width)
           
protected  org.apache.ecs.ConcreteElement createElementBody(FormElement formElement, java.util.Collection decorations)
          This method creates the Body content of a form element
protected  java.lang.String decorateLabel(java.lang.String text, FormLabelDesignModel label)
          Adds the prefix and the suffix to the label
protected  void doAfterCreate()
          This template method gets called after element creation
protected  void doBeforeCreate()
          This template method gets called before element creation
protected  org.apache.ecs.ConcreteElement doCreateBody()
          Creates the from body.
protected  org.apache.ecs.ConcreteElement doCreateButton(FormButtonElement formButton)
          This method creates the button for a form element of type FormButtonElement
protected  org.apache.ecs.ConcreteElement doCreateColGroup(FormElementContainer container)
          Creates the HTML <COLGROUP> Element for the list
protected  org.apache.ecs.ConcreteElement doCreateContainer(FormElementContainer container, int cols, int nestingLevel)
          This method creates a generic container
protected  org.apache.ecs.ConcreteElement doCreateControl(FormControlElement formElement, java.util.Collection decorations)
          This method creates the control for a form element of type FormControlElement
protected  org.apache.ecs.ConcreteElement doCreateDefaultButton()
          This method creates a hidden default button for the form
protected  org.apache.ecs.ConcreteElement doCreateDefaultButton(FormButtonElement button)
          This method creates a hidden default button for the form
protected  org.apache.ecs.ConcreteElement doCreateElement()
          Creates the HTML Code for the following Elements: Title Body Footer (optional)
protected  org.apache.ecs.ConcreteElement doCreateFooter()
          Creates an additional footer.
protected  org.apache.ecs.ConcreteElement doCreateFrames(AlignmentType alignmentFilter)
          Creates a frame container with all frames that match the given filter
protected  org.apache.ecs.ConcreteElement doCreateGroupHeader(FormGroupElement group, int cols, int nestingLevel)
          Creates the header row for a form element group
protected  org.apache.ecs.ConcreteElement doCreateHeader()
          Creates an additional header.
protected  org.apache.ecs.ConcreteElement doCreateHorizontalContainer(FormElementContainer container, int cols, int nestingLevel)
          This method creates a container with horizontal orientation
protected  org.apache.ecs.ConcreteElement doCreateHtml(FormHtmlElement formElement)
          This method creates a form element of type FormHtmlElement
protected  org.apache.ecs.ElementContainer doCreateInnerFrames(InnerFrame[] innerFrames, int cols, int nestingLevel)
          This method creates inner frames
protected  org.apache.ecs.ConcreteElement doCreateLabeledElement(FormElement formElement, int cols)
          This method creates the TD's for a labeled form element
protected  org.apache.ecs.ConcreteElement doCreateRow(org.apache.ecs.ConcreteElement rowContent, int nestingLevel, java.lang.String rowType)
          This method creates a row container
protected  org.apache.ecs.ConcreteElement doCreateRow(FormElementContainer container, org.apache.ecs.ConcreteElement rowContent, int nestingLevel, java.lang.String rowType)
          This method creates a row container
protected  org.apache.ecs.ConcreteElement doCreateRowSeparator(int cols, int nestingLevel)
          This method creates a row separator
protected  java.util.Collection doCreateTitleButtons()
          Creates the buttons in the header of the list
protected  org.apache.ecs.ConcreteElement doCreateVerticalContainer(FormElementContainer container, int cols, int nestingLevel)
          This method creates a container with vertical orientation
protected  int getCellsPerElement()
          Returns the required number of TD-Elements for one form element
protected  java.lang.String getCellWidth(FormElementContainer container, int columnIndex)
          Returns the width of the control cell for the given element container
protected  FormButtonElement getDefaultButton(FormElementContainer container)
          Searches the FormElement tree for a default button
protected  java.lang.String getDescription(FormElement formElement)
          Retrieves the description of a form element
 java.lang.String getElementClass(int type)
          The method returns the HTML style class required for a list or treelist control.
 FormControl getForm()
          Returns the from control
protected  java.lang.String getFormElementId(FormElement formElement)
          Returns a id for the element that can be used in java script
protected  ImageModel getFormImage(java.lang.String imageref)
          Returns the referenced Image
 FormType getFormType()
          Returns the type of the form
protected  FrameTitle getFrameTitle()
          Creates the Title for the Frame
protected  java.lang.String getFrameWidth(FormElementContainer container)
          Returns the with of the frame surrounding the form
protected  FormLabelDesignModel getLabel(FormElement formElement)
          Retrieves the label of a form element
protected  java.lang.String getLabelWidth(FormElementContainer container, int columnIndex)
          Returns the width of the label column for the given element container
protected  java.lang.String getLinkId(FormElement formElement)
          Retrieves the Control Style id of the control element
protected  java.util.Locale getLocale(FormLabelDesignModel label)
          Retrieves the locale to use for a given label
protected  java.lang.String getMessageWidth(FormElementContainer container)
          Returns the width of the message indicator (for editable forms only)
protected  boolean hasErrorPending(FormElement formElement)
          Checks if a error hint must be painted
protected  boolean hasMessagePending(FormElement formElement)
          Checks if a message hint must be painted
protected  boolean isRequired(FormElement formElement)
          Checks if a form element is a required input field
protected  void paintLabel(org.apache.ecs.html.TD labelCell, FormLabelDesignModel label, java.lang.String linkId)
          Paints the Label of a form element
protected  void paintMessageIndicatior(org.apache.ecs.html.TD msgCell, FormElement formElement)
          Deprecated. use paintMessageIndicator method instead
protected  void paintMessageIndicator(org.apache.ecs.html.TD msgCell, FormElement formElement)
          paints the message indicator
protected  boolean showFrame()
          Checks if the frame should be painted
protected  boolean showMessageIndicator()
           
 
Methods inherited from class com.cc.framework.ui.painter.def.DefPainterBase
createHelpElement, createHelpElement, doCreateHelpButton, doCreateHelpIcon
 
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, doAttachDecorations, 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

ROWTYPE

protected static final java.lang.String ROWTYPE
Custom HTML attribute to identify row types

See Also:
Constant Field Values

ROWTYPE_DESCRIPTION

protected static final java.lang.String ROWTYPE_DESCRIPTION
Row Type: Description

See Also:
Constant Field Values

ROWTYPE_SEPARATOR

protected static final java.lang.String ROWTYPE_SEPARATOR
Row Type: Separator

See Also:
Constant Field Values

ROWTYPE_CONTAINER

protected static final java.lang.String ROWTYPE_CONTAINER
Row Type: Container

See Also:
Constant Field Values

ROWTYPE_BUTTONS

protected static final java.lang.String ROWTYPE_BUTTONS
Row Type: Button Container

See Also:
Constant Field Values

ROWTYPE_CONTROL

protected static final java.lang.String ROWTYPE_CONTROL
Row Type: Control

See Also:
Constant Field Values

ROWTYPE_INNERFRAME

protected static final java.lang.String ROWTYPE_INNERFRAME
Row Type: Inner Frame

See Also:
Constant Field Values

LABEL_EMPTY

protected static final FormLabelDesignModel LABEL_EMPTY
Empty Label


LABEL_MESSAGE

protected static final FormLabelDesignModel LABEL_MESSAGE
Message Label

Constructor Detail

DefFormPainter

public DefFormPainter(PainterContext painterContext,
                      FormControl ctrl)
Constructor for DefFormPainter

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

getForm

public FormControl getForm()
Returns the from control

Returns:
form control

getFormType

public FormType getFormType()
Returns the type of the form

Returns:
FormType

showFrame

protected boolean showFrame()
Checks if the frame should be painted

Returns:
true if the frame should be painted

getFrameWidth

protected java.lang.String getFrameWidth(FormElementContainer container)
Returns the with of the frame surrounding the form

Parameters:
container - the form element container
Returns:
returns the width of the right and left frame. When null is returned no frame will be shown

getMessageWidth

protected java.lang.String getMessageWidth(FormElementContainer container)
Returns the width of the message indicator (for editable forms only)

Parameters:
container - the form element container
Returns:
width

getLabelWidth

protected java.lang.String getLabelWidth(FormElementContainer container,
                                         int columnIndex)
Returns the width of the label column for the given element container

Parameters:
container - the form element container
columnIndex - the index of the form column within the container
Returns:
width

getCellWidth

protected java.lang.String getCellWidth(FormElementContainer container,
                                        int columnIndex)
Returns the width of the control cell for the given element container

Parameters:
container - the form element container
columnIndex - the index of the form column within the container
Returns:
width

getElementClass

public java.lang.String getElementClass(int type)
Description copied from class: ControlPainter
The method returns the HTML style class required for a list or treelist control.

Overrides:
getElementClass in class DefPainterBase
See Also:
ControlPainter.getElementClass(int)

showMessageIndicator

protected boolean showMessageIndicator()
Returns:
returns true when the form should reserve space for the message indicator filed

getCellsPerElement

protected int getCellsPerElement()
Returns the required number of TD-Elements for one form element

Returns:
number of cells

getFormImage

protected ImageModel getFormImage(java.lang.String imageref)
Returns the referenced Image

Parameters:
imageref - the image reference
Returns:
ImageModel or null

doCreateRow

protected org.apache.ecs.ConcreteElement doCreateRow(org.apache.ecs.ConcreteElement rowContent,
                                                     int nestingLevel,
                                                     java.lang.String rowType)
This method creates a row container

Parameters:
rowContent - TD Element(s) with the rows content
nestingLevel - The nesting Level of the row in the form element tree
rowType - an additional attribute for this row. This enables a JavaScript client to identify the row
Returns:
ConcreteElement

doCreateRow

protected org.apache.ecs.ConcreteElement doCreateRow(FormElementContainer container,
                                                     org.apache.ecs.ConcreteElement rowContent,
                                                     int nestingLevel,
                                                     java.lang.String rowType)
This method creates a row container

Parameters:
container - The form element for this new row
rowContent - TD Element(s) with the rows content
nestingLevel - The nesting Level of the row in the form element tree
rowType - an additional attribute for this row. This enables a JavaScript client to identify the row
Returns:
ConcreteElement

getLocale

protected java.util.Locale getLocale(FormLabelDesignModel label)
Retrieves the locale to use for a given label

Parameters:
label - the label
Returns:
Locale

decorateLabel

protected java.lang.String decorateLabel(java.lang.String text,
                                         FormLabelDesignModel label)
Adds the prefix and the suffix to the label

Parameters:
text - The label text
label - The Label Definition
Returns:
enhanced label text

paintLabel

protected void paintLabel(org.apache.ecs.html.TD labelCell,
                          FormLabelDesignModel label,
                          java.lang.String linkId)
Paints the Label of a form element

Parameters:
labelCell - The cell where to put the label
label - The Design Model of the label
linkId - The id of the control to link this label to

getLinkId

protected java.lang.String getLinkId(FormElement formElement)
Retrieves the Control Style id of the control element

Parameters:
formElement - The form element
Returns:
Style Id or null

paintMessageIndicator

protected void paintMessageIndicator(org.apache.ecs.html.TD msgCell,
                                     FormElement formElement)
paints the message indicator

Parameters:
msgCell - The cell where to put the indicator
formElement - The form element

paintMessageIndicatior

protected void paintMessageIndicatior(org.apache.ecs.html.TD msgCell,
                                      FormElement formElement)
Deprecated. use paintMessageIndicator method instead

paints the message indicator

Parameters:
msgCell - The cell where to put the indicator
formElement - The form element

doCreateLabeledElement

protected org.apache.ecs.ConcreteElement doCreateLabeledElement(FormElement formElement,
                                                                int cols)
This method creates the TD's for a labeled form element

Parameters:
formElement - the form element
cols - number of form element columns to span
Returns:
ConcreteElement

attachRight

protected boolean attachRight(FormElement formElement)
This method will check if the required image should be attached left or right to the description This is required for some Controls like the RadioControl or CheckboxControl.

Parameters:
formElement - The FormElement
Returns:
true if the required image should be displayed on the right; false otherwise

getLabel

protected FormLabelDesignModel getLabel(FormElement formElement)
Retrieves the label of a form element

Parameters:
formElement - Form element
Returns:
Label or null

getDescription

protected java.lang.String getDescription(FormElement formElement)
Retrieves the description of a form element

Parameters:
formElement - Form element
Returns:
Description String or null

createElementBody

protected org.apache.ecs.ConcreteElement createElementBody(FormElement formElement,
                                                           java.util.Collection decorations)
This method creates the Body content of a form element

Parameters:
formElement - the form element
decorations - Additional decoration elements that should be rendered next to the elements body
Returns:
ConcreteElement

createButtons

protected org.apache.ecs.ConcreteElement createButtons(FormButtonContainer container)
Creates the buttons of a button container

Parameters:
container - Container definition
Returns:
Button elements

doCreateRowSeparator

protected org.apache.ecs.ConcreteElement doCreateRowSeparator(int cols,
                                                              int nestingLevel)
This method creates a row separator

Parameters:
cols - number of form element columns to span
nestingLevel - The nesting Level of the row in the form element tree
Returns:
ConcreteElement

doCreateInnerFrames

protected org.apache.ecs.ElementContainer doCreateInnerFrames(InnerFrame[] innerFrames,
                                                              int cols,
                                                              int nestingLevel)
This method creates inner frames

Parameters:
innerFrames - The frame definitions
cols - number of form element columns to span
nestingLevel - The nesting Level of the row in the form element tree
Returns:
ConcreteElement

doCreateGroupHeader

protected org.apache.ecs.ConcreteElement doCreateGroupHeader(FormGroupElement group,
                                                             int cols,
                                                             int nestingLevel)
Creates the header row for a form element group

Parameters:
group - the group
cols - the number of form element columns to span
nestingLevel - the nesting level of the group within the form element tree
Returns:
ConcreteElement

doCreateControl

protected org.apache.ecs.ConcreteElement doCreateControl(FormControlElement formElement,
                                                         java.util.Collection decorations)
This method creates the control for a form element of type FormControlElement

Parameters:
formElement - from element
decorations - Additional decoration elements that should be rendered next to the elements body
Returns:
ConcreteElement

doCreateButton

protected org.apache.ecs.ConcreteElement doCreateButton(FormButtonElement formButton)
This method creates the button for a form element of type FormButtonElement

Parameters:
formButton - the button element
Returns:
ConcreteElement

doCreateHtml

protected org.apache.ecs.ConcreteElement doCreateHtml(FormHtmlElement formElement)
This method creates a form element of type FormHtmlElement

Parameters:
formElement - from element
Returns:
ConcreteElement

doCreateTitleButtons

protected java.util.Collection doCreateTitleButtons()
Creates the buttons in the header of the list

Returns:
collection of ConcreteElement Items

doCreateHorizontalContainer

protected org.apache.ecs.ConcreteElement doCreateHorizontalContainer(FormElementContainer container,
                                                                     int cols,
                                                                     int nestingLevel)
This method creates a container with horizontal orientation

Parameters:
container - container element
cols - the number of form element columns to span.
nestingLevel - the nesting level of the group within the form element tree
Returns:
ConcreteElement

doCreateVerticalContainer

protected org.apache.ecs.ConcreteElement doCreateVerticalContainer(FormElementContainer container,
                                                                   int cols,
                                                                   int nestingLevel)
This method creates a container with vertical orientation

Parameters:
container - container element
cols - the number of form element columns to span.
nestingLevel - the nesting level of the group within the form element tree
Returns:
ConcreteElement

getDefaultButton

protected FormButtonElement getDefaultButton(FormElementContainer container)
Searches the FormElement tree for a default button

Parameters:
container - Node of the FormElement Tree
Returns:
Default button or null

doCreateDefaultButton

protected org.apache.ecs.ConcreteElement doCreateDefaultButton()
This method creates a hidden default button for the form

Returns:
Button element or null

doCreateDefaultButton

protected org.apache.ecs.ConcreteElement doCreateDefaultButton(FormButtonElement button)
This method creates a hidden default button for the form

Parameters:
button - the default button
Returns:
Button element or null

doCreateContainer

protected org.apache.ecs.ConcreteElement doCreateContainer(FormElementContainer container,
                                                           int cols,
                                                           int nestingLevel)
This method creates a generic container

Parameters:
container - container element
cols - the number of form element columns to span.
nestingLevel - the nesting level of the group within the form element tree
Returns:
ConcreteElement

doCreateHeader

protected org.apache.ecs.ConcreteElement doCreateHeader()
Creates an additional header.

Returns:
ConcreteElement

createCol

private org.apache.ecs.html.Col createCol(java.lang.String width)

doCreateColGroup

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

Returns:
ConcreteElement

addColGroup

protected void addColGroup(org.apache.ecs.html.Table table,
                           FormElementContainer container)

doCreateBody

protected org.apache.ecs.ConcreteElement doCreateBody()
Creates the from body.

Returns:
ConcreteElement

doCreateFooter

protected org.apache.ecs.ConcreteElement doCreateFooter()
Creates an additional footer. The current layout does not render a footer

Returns:
ConcreteElement

doCreateFrames

protected org.apache.ecs.ConcreteElement doCreateFrames(AlignmentType alignmentFilter)
Creates a frame container with all frames that match the given filter

Parameters:
alignmentFilter - the filter
Returns:
Frame container or null

getFrameTitle

protected FrameTitle getFrameTitle()
Creates the Title for the Frame

Returns:
Frame Title or null

doBeforeCreate

protected void doBeforeCreate()
Description copied from class: ControlPainter
This template method gets called before element creation

Overrides:
doBeforeCreate in class ControlPainter
See Also:
ControlPainter.doBeforeCreate()

doCreateElement

protected org.apache.ecs.ConcreteElement doCreateElement()
Creates the HTML Code for the following Elements:

Specified by:
doCreateElement in class ControlPainter
Returns:
ConcreteElement

doAfterCreate

protected void doAfterCreate()
Description copied from class: ControlPainter
This template method gets called after element creation

Overrides:
doAfterCreate in class ControlPainter
See Also:
ControlPainter.doAfterCreate()

getFormElementId

protected java.lang.String getFormElementId(FormElement formElement)
Returns a id for the element that can be used in java script

Parameters:
formElement - form element
Returns:
Scripting Id or null

isRequired

protected boolean isRequired(FormElement formElement)
Checks if a form element is a required input field

Parameters:
formElement - form element
Returns:
boolean

hasErrorPending

protected boolean hasErrorPending(FormElement formElement)
Checks if a error hint must be painted

Parameters:
formElement - form element
Returns:
boolean

hasMessagePending

protected boolean hasMessagePending(FormElement formElement)
Checks if a message hint must be painted

Parameters:
formElement - form element
Returns:
boolean


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