com.cc.framework.ui.painter.html
Class HtmlMultiLevelSelectPainter

java.lang.Object
  extended bycom.cc.framework.ui.painter.ControlPainter
      extended bycom.cc.framework.ui.painter.html.HtmlPainterBase
          extended bycom.cc.framework.ui.painter.html.HtmlMultiLevelSelectPainter

public class HtmlMultiLevelSelectPainter
extends HtmlPainterBase

Painter for the multi level select control

Author:
Harald Schulz

Field Summary
private  TreeNodeDataModel[] selectedNodes
          The selected nodes in the tree hierarchy
 
Fields inherited from class com.cc.framework.ui.painter.ControlPainter
log
 
Constructor Summary
HtmlMultiLevelSelectPainter(PainterContext painterContext, MultiLevelSelectControl ctrl)
          Constructor for HtmlSelectPainter
 
Method Summary
private  java.lang.StringBuffer appendNodes(TreeNodeDataModel node, int level)
          Appends the tree nodes as java scripting variables
private  void appendNodes(TreeNodeDataModel root, java.util.List nodes, boolean deep)
          Adds the nodes of the given subtree to a list.
protected  JavaScript createClientScript()
          Creates the Javascript needed to render the tree on the client
protected  org.apache.ecs.html.Option createEmptyOption(int level)
          Creates the empty element for the given level
protected  OptionsIterator createIterator()
          Creates an option iterator
protected  org.apache.ecs.html.Option createOption(TreeNodeDataModel node, boolean isSelected)
          Creates the option element for the given tree node
protected  org.apache.ecs.ConcreteElement doCreateColGroup()
          Creates the HTML <colgroup> Element for the list
protected  org.apache.ecs.ConcreteElement doCreateDisplayElement()
          Creates the element for display only.
protected  org.apache.ecs.ConcreteElement doCreateElement()
          Creates the HTML-Element.
protected  org.apache.ecs.ConcreteElement doCreateSelect()
          Creates the table of select elements
protected  org.apache.ecs.ConcreteElement doCreateSelect(int level)
          Creates the select element for the given level
protected  MultiLevelSelectControl getCtrl()
          Retrieves the control for this painter
protected  java.lang.String getJavaScriptName()
           
private  java.util.List getLevelNodes(int level)
          Returns the option list for the given level
protected  TreeNodeDataModel getLevelRoot(int level)
          Returns the root node for the given level
protected  TreeNodeDataModel getRoot()
           
protected  TreeNodeDataModel getSelectedNode()
           
protected  TreeNodeDataModel getSelectedNode(int level)
          returns the selected node for the given tree level
protected  java.lang.Object getValue()
          Retrieves the selected tree node item
protected  boolean isSelectable(TreeNodeDataModel node)
          Checks if the given node is selectable by the user
private  boolean selectNodes(TreeNodeDataModel root, int childIndex, java.lang.String key, int level)
          Retrieves all nodes on the selection path of the tree structure
protected  boolean showEmptyElement(int level)
           
 
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, getElementClass, 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

selectedNodes

private TreeNodeDataModel[] selectedNodes
The selected nodes in the tree hierarchy

Constructor Detail

HtmlMultiLevelSelectPainter

public HtmlMultiLevelSelectPainter(PainterContext painterContext,
                                   MultiLevelSelectControl ctrl)
Constructor for HtmlSelectPainter

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

getCtrl

protected MultiLevelSelectControl getCtrl()
Retrieves the control for this painter

Returns:
Control

getRoot

protected TreeNodeDataModel getRoot()
Returns:
returns the root element of the option tree

selectNodes

private boolean selectNodes(TreeNodeDataModel root,
                            int childIndex,
                            java.lang.String key,
                            int level)
Retrieves all nodes on the selection path of the tree structure

Parameters:
root - the root of the tree
childIndex - the index of the root node
key - the key of the selected element
level - the current tree level
Returns:
returns true when the given root node is in the selection path

getSelectedNode

protected TreeNodeDataModel getSelectedNode(int level)
returns the selected node for the given tree level

Parameters:
level - the tree level
Returns:
selected node or null when there is no node selected for the given level

getSelectedNode

protected TreeNodeDataModel getSelectedNode()

getLevelRoot

protected TreeNodeDataModel getLevelRoot(int level)
Returns the root node for the given level

Parameters:
level - the tree level
Returns:
the root node or null when the given level is not selected

appendNodes

private void appendNodes(TreeNodeDataModel root,
                         java.util.List nodes,
                         boolean deep)
Adds the nodes of the given subtree to a list.

Parameters:
root - root node of the subtree
nodes - the node list
deep - when set to true all nodes of the subtree will be added to the list.

getLevelNodes

private java.util.List getLevelNodes(int level)
Returns the option list for the given level

Parameters:
level - the level
Returns:
list of nodes that should be displayed for the given level

createEmptyOption

protected org.apache.ecs.html.Option createEmptyOption(int level)
Creates the empty element for the given level

Parameters:
level - the level
Returns:
option element

createOption

protected org.apache.ecs.html.Option createOption(TreeNodeDataModel node,
                                                  boolean isSelected)
Creates the option element for the given tree node

Parameters:
node - the tree node
isSelected - indicates if the node is selected
Returns:
option element

doCreateSelect

protected org.apache.ecs.ConcreteElement doCreateSelect(int level)
Creates the select element for the given level

Parameters:
level - the level
Returns:
select element

doCreateColGroup

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

Returns:
ConcreteElement

doCreateSelect

protected org.apache.ecs.ConcreteElement doCreateSelect()
Creates the table of select elements

Returns:
table

createIterator

protected OptionsIterator createIterator()
Creates an option iterator

Returns:
Iterator

doCreateDisplayElement

protected org.apache.ecs.ConcreteElement doCreateDisplayElement()
Creates the element for display only. It shows the selected values

Returns:
HTML Element

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()

getJavaScriptName

protected java.lang.String getJavaScriptName()

createClientScript

protected JavaScript createClientScript()
Creates the Javascript needed to render the tree on the client

Returns:
The Javascript fragment

appendNodes

private java.lang.StringBuffer appendNodes(TreeNodeDataModel node,
                                           int level)
Appends the tree nodes as java scripting variables

Parameters:
node - the node
level - the tree level of the node for pretty printing
Returns:
returns the generated JavaScript code

isSelectable

protected boolean isSelectable(TreeNodeDataModel node)
Checks if the given node is selectable by the user

Parameters:
node - the node to check
Returns:
boolean

showEmptyElement

protected boolean showEmptyElement(int level)

getValue

protected java.lang.Object getValue()
Retrieves the selected tree node item

Returns:
value


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