com.cc.framework.ui.control
Class TreeControl

java.lang.Object
  extended bycom.cc.framework.ui.control.Control
      extended bycom.cc.framework.ui.control.TreeControl
All Implemented Interfaces:
AccessControlled, ActionBehavior, ClientHandler, java.io.Serializable, StateModel, TreeStateModel

public class TreeControl
extends Control
implements TreeStateModel

TreeControl

Since:
1.0
Version:
$Revision: 1.40 $
Author:
Harald Schulz
See Also:
Serialized Form

Field Summary
private  TreeGroupDataModel dataModel
          Data model
private  TreeDesignModel designModel
          Design model
static java.lang.String PROP_CHECKED
          Property for the checked nodes -> this is not really part of the controls state model. but we need a way to synchronize the state of checkboxes.
private static long serialVersionUID
          Serial Version UID
private  TreeStateModel stateModel
          State model
 
Fields inherited from class com.cc.framework.ui.control.Control
log
 
Fields inherited from interface com.cc.framework.ui.model.TreeStateModel
PROP_EXPANDED, PROP_SELECTED
 
Fields inherited from interface com.cc.framework.ui.model.StateModel
PROP_CONTROL
 
Constructor Summary
TreeControl()
          Constructor
 
Method Summary
protected  int calcVisibleNodes(TreeNodeDataModel root)
          Die Methode berechnet die Anzahl der sichtbaren (=aufgeklappten) Einträge des Baumes.
 void collapse(java.lang.String nodeKey)
          The specified group node will be collapsed
 void collapse(TreeNodeDataModel node)
          Collapses the given node
 void collapseAll()
          Collapses all tree nodes
protected  TreeStateModel doCreateStateModel()
          Creates the state model for this control instance
 void expand(java.lang.String key)
          The specified group node will be expanded
 void expand(TreeNodeDataModel node)
          Expands the given node
 void expandAll()
          Expands the whole tree.
 void expandToLevel(int level)
          Expands the tree up to the given level.
 DataModel getDataModel()
          Returns the data model of the Control
 ControlDesignModel getDesignModel()
          Returns the design model of the control
protected  TreeNodeDataModel getFirstNode()
          Returns the first node to be displayed
 java.lang.String[] getMarked()
          Retrieves all marked items
 java.lang.String getScrollHeight()
          Retrieves the height of the scroll container
 java.lang.String getSelected()
          Returns the key of the selected node
 StateModel getStateModel()
          Returns the state model of the control
 int getTotalRowCount()
          Liefert die Anzahl der tatsächlich vorhandenen Zeilen zurück.
 boolean isExpanded(java.lang.String nodeKey)
          Checks if the specified group node is expanded
 boolean isExpanded(TreeNodeDataModel node)
          Checks if the given node is expanded
 boolean isMarked(java.lang.String nodeKey)
          Checks if the specified row is highlighted.
 boolean isSelected(java.lang.String nodeKey)
          Checks if the specified node is selected.
 boolean isSelected(TreeNodeDataModel node)
          Checks if the given node is selected
 void mark(java.lang.String uniqueKey)
          Selects a specified row.
 void onCheck(ControlRequestContext ctx, java.lang.String key, SelectMode mode, boolean check)
          Default handler for the onCheck Event
 void onCollapse(ControlRequestContext ctx, java.lang.String key)
          Default handler for the onCollapse Event
 void onDrilldown(ControlRequestContext ctx, java.lang.String key)
          Default handler for the onDrilldown Event
 void onExpand(ControlRequestContext ctx, java.lang.String key)
          Default handler for the onExpand Event
 void onExpandEx(ControlRequestContext ctx, java.lang.String key)
          Default handler for the onExpandEx Event
 void reset()
          Resets the actual state of a control to the initial state
protected  void resetExpandInfo(boolean keepExpanded)
          Resets all expanded Nodes
 void select(java.lang.String nodeKey)
          Selects the specified node.
 void select(TreeNodeDataModel node)
          Marks the given node as selected
 void setDataModel(TreeGroupDataModel dataModel)
          Sets the data model
 void setDataModel(TreeGroupDataModel dataModel, boolean keepState)
          Sets the data model
 void setDesignModel(TreeDesignModel designModel)
          Sets the DesignModel
 void setStateModel(TreeStateModel stateModel)
          Sets the StateModel
 void synchronizeState(RequestContext ctx, PropertyMap properties)
          This method applies the given state properties to the controls state model
 void unmark(java.lang.String nodeKey)
          Highlights a specified row.
 void unmarkAll()
          Resets all highlighted rows
 void unselectAll()
          Unselects the current selection of the tree
 
Methods inherited from class com.cc.framework.ui.control.Control
addButton, allowAjaxRendering, execute, execute, execute, execute, execute, execute, execute, getAction, getAjaxId, getButtons, getControlName, getDesignRules, getFrameworkString, getHandler, getHandlers, getHeight, getHelp, getId, getLocaleName, getName, getPermission, getPrincipal, getProperty, getRunAt, getStyle, getStyleClass, getStyleId, getSummary, getTabIndex, getTooltip, getTransaction, getUniqueStyleId, getWidth, isAjaxEnabled, isDisabled, isFormElement, markDirty, onHelp, setAjaxAttribute, setHandler, setPrincipal, setValue, show, showButton, synchronizeState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.cc.framework.ui.model.StateModel
synchronizeState
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Serial Version UID

See Also:
Constant Field Values

PROP_CHECKED

public static final java.lang.String PROP_CHECKED
Property for the checked nodes -> this is not really part of the controls state model. but we need a way to synchronize the state of checkboxes. The checkbox state is part of the controls data model

See Also:
Constant Field Values

dataModel

private TreeGroupDataModel dataModel
Data model


designModel

private TreeDesignModel designModel
Design model


stateModel

private TreeStateModel stateModel
State model

Constructor Detail

TreeControl

public TreeControl()
Constructor

Method Detail

doCreateStateModel

protected TreeStateModel doCreateStateModel()
Creates the state model for this control instance

Returns:
State model instance

getDataModel

public DataModel getDataModel()
Description copied from class: Control
Returns the data model of the Control

Specified by:
getDataModel in class Control
Returns:
The data model
See Also:
Control.getDataModel()

setDataModel

public void setDataModel(TreeGroupDataModel dataModel)
Sets the data model

Parameters:
dataModel - TreeGroupDataModel

setDataModel

public void setDataModel(TreeGroupDataModel dataModel,
                         boolean keepState)
Sets the data model

Parameters:
dataModel - TreeGroupDataModel
keepState - when set to true the treelist control will keep its current state (Expanded nodes current page etc.)

getDesignModel

public ControlDesignModel getDesignModel()
Description copied from class: Control
Returns the design model of the control

Specified by:
getDesignModel in class Control
Returns:
The ControlDesignModel
See Also:
Control.getDesignModel()

setDesignModel

public void setDesignModel(TreeDesignModel designModel)
Sets the DesignModel

Parameters:
designModel - TreeDesignModel

getStateModel

public StateModel getStateModel()
Description copied from class: Control
Returns the state model of the control

Specified by:
getStateModel in class Control
Returns:
The state model
See Also:
Control.getStateModel()

setStateModel

public void setStateModel(TreeStateModel stateModel)
Sets the StateModel

Parameters:
stateModel - TreeStateModel

reset

public void reset()
Description copied from interface: StateModel
Resets the actual state of a control to the initial state

Specified by:
reset in interface StateModel
See Also:
StateModel.reset()

resetExpandInfo

protected void resetExpandInfo(boolean keepExpanded)
Resets all expanded Nodes

Parameters:
keepExpanded - true to keep the current expansion state of the control

isExpanded

public boolean isExpanded(TreeNodeDataModel node)
Checks if the given node is expanded

Parameters:
node - The node to check
Returns:
returns true if the node is expanded

isExpanded

public boolean isExpanded(java.lang.String nodeKey)
Description copied from interface: TreeStateModel
Checks if the specified group node is expanded

Specified by:
isExpanded in interface TreeStateModel
Parameters:
nodeKey - the nodes unique key
Returns:
boolean
See Also:
TreeStateModel.isExpanded(java.lang.String)

expand

public void expand(TreeNodeDataModel node)
Expands the given node

Parameters:
node - the node to expand

expand

public void expand(java.lang.String key)
Description copied from interface: TreeStateModel
The specified group node will be expanded

Specified by:
expand in interface TreeStateModel
Parameters:
key - the nodes unique key
See Also:
TreeStateModel.expand(java.lang.String)

expandAll

public void expandAll()
Expands the whole tree. Note: Only the nodes in memory will be expanded!


expandToLevel

public void expandToLevel(int level)
Expands the tree up to the given level. Note: Only the nodes in memory will be expanded!

Parameters:
level - Tree level (0 = root level)

collapseAll

public void collapseAll()
Description copied from interface: TreeStateModel
Collapses all tree nodes

Specified by:
collapseAll in interface TreeStateModel
See Also:
TreeStateModel.collapseAll()

collapse

public void collapse(TreeNodeDataModel node)
Collapses the given node

Parameters:
node - the node to collapse

collapse

public void collapse(java.lang.String nodeKey)
Description copied from interface: TreeStateModel
The specified group node will be collapsed

Specified by:
collapse in interface TreeStateModel
Parameters:
nodeKey - the nodes unique key
See Also:
TreeStateModel.collapse(java.lang.String)

select

public void select(TreeNodeDataModel node)
Marks the given node as selected

Parameters:
node - Tree node

select

public void select(java.lang.String nodeKey)
Description copied from interface: TreeStateModel
Selects the specified node. Within a tree there can only exists one selected node

Specified by:
select in interface TreeStateModel
Parameters:
nodeKey - the nodes unique key
See Also:
TreeStateModel.select(java.lang.String)

unselectAll

public void unselectAll()
Description copied from interface: TreeStateModel
Unselects the current selection of the tree

Specified by:
unselectAll in interface TreeStateModel
See Also:
TreeStateModel.unselectAll()

isSelected

public boolean isSelected(TreeNodeDataModel node)
Checks if the given node is selected

Parameters:
node - the node to check
Returns:
returns true if the node is checked

isSelected

public boolean isSelected(java.lang.String nodeKey)
Description copied from interface: TreeStateModel
Checks if the specified node is selected.

Specified by:
isSelected in interface TreeStateModel
Parameters:
nodeKey - the nodes unique key
Returns:
boolean
See Also:
TreeStateModel.isSelected(java.lang.String)

getSelected

public java.lang.String getSelected()
Description copied from interface: TreeStateModel
Returns the key of the selected node

Specified by:
getSelected in interface TreeStateModel
Returns:
Key or null
See Also:
TreeStateModel.getSelected()

getFirstNode

protected TreeNodeDataModel getFirstNode()
Returns the first node to be displayed

Returns:
TreeNodeDataModel

getTotalRowCount

public int getTotalRowCount()
Liefert die Anzahl der tatsächlich vorhandenen Zeilen zurück.

Returns:
Anzahl der tatsächlich vorhandenen Zeilen des Datenmodells

getScrollHeight

public java.lang.String getScrollHeight()
Retrieves the height of the scroll container

Returns:
height

calcVisibleNodes

protected int calcVisibleNodes(TreeNodeDataModel root)
Die Methode berechnet die Anzahl der sichtbaren (=aufgeklappten) Einträge des Baumes.

Parameters:
root - TreeNodeDataModel
Returns:
int

synchronizeState

public void synchronizeState(RequestContext ctx,
                             PropertyMap properties)
                      throws java.lang.Exception
Description copied from class: Control
This method applies the given state properties to the controls state model

Overrides:
synchronizeState in class Control
Parameters:
ctx - RequestContext
properties - State properties
Throws:
java.lang.Exception - is thrown when an error occurs during execution
See Also:
Control.synchronizeState( com.cc.framework.adapter.RequestContext, com.cc.framework.util.PropertyMap)

onDrilldown

public void onDrilldown(ControlRequestContext ctx,
                        java.lang.String key)
                 throws java.lang.Exception
Default handler for the onDrilldown Event

Parameters:
ctx - ControlRequestContext
key - Unique Id as generated by the data model to identify the Row
Throws:
java.lang.Exception - is thrown when an error occurs

onExpandEx

public void onExpandEx(ControlRequestContext ctx,
                       java.lang.String key)
                throws java.lang.Exception
Default handler for the onExpandEx Event

Parameters:
ctx - ControlRequestContext
key - Unique Id as generated by the data model to identify the Row
Throws:
java.lang.Exception - is thrown when an error occurs

onExpand

public void onExpand(ControlRequestContext ctx,
                     java.lang.String key)
              throws java.lang.Exception
Default handler for the onExpand Event

Parameters:
ctx - ControlRequestContext
key - Unique Id as generated by the data model to identify the Row
Throws:
java.lang.Exception - is thrown when an error occurs

onCollapse

public void onCollapse(ControlRequestContext ctx,
                       java.lang.String key)
                throws java.lang.Exception
Default handler for the onCollapse Event

Parameters:
ctx - ControlRequestContext
key - Unique Id as generated by the data model to identify the Row
Throws:
java.lang.Exception - is thrown when an error occurs

onCheck

public void onCheck(ControlRequestContext ctx,
                    java.lang.String key,
                    SelectMode mode,
                    boolean check)
             throws java.lang.Exception
Default handler for the onCheck Event

Parameters:
ctx - ControlRequestContext
key - Unique Id as generated by the data model to identify the Row
mode - SelectMode
check - true if the Node is checked
Throws:
java.lang.Exception - is thrown when an error occurs

mark

public void mark(java.lang.String uniqueKey)
Description copied from interface: TreeStateModel
Selects a specified row.

Specified by:
mark in interface TreeStateModel
Parameters:
uniqueKey - The unique key of the row which should be selected
See Also:
TreeStateModel.mark(java.lang.String)

isMarked

public boolean isMarked(java.lang.String nodeKey)
Description copied from interface: TreeStateModel
Checks if the specified row is highlighted.

Specified by:
isMarked in interface TreeStateModel
Parameters:
nodeKey - the nodes unique key
Returns:
boolean Returns true if the row is selected; false otherwise
See Also:
TreeStateModel.isMarked(java.lang.String)

getMarked

public java.lang.String[] getMarked()
Retrieves all marked items

Specified by:
getMarked in interface TreeStateModel
Returns:
Array with the keys of the marked items

unmark

public void unmark(java.lang.String nodeKey)
Highlights a specified row.

Specified by:
unmark in interface TreeStateModel
Parameters:
nodeKey - the nodes unique key

unmarkAll

public void unmarkAll()
Resets all highlighted rows

Specified by:
unmarkAll in interface TreeStateModel


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