info.aduna.gee.spectacle.gee
Class SectionRenderer

java.lang.Object
  extended by info.aduna.gee.spectacle.gee.SectionRenderer
Direct Known Subclasses:
DefaultSectionRenderer, JitSectionRenderer

public abstract class SectionRenderer
extends Object

Class SectionRenderer provides a mechanism to fully realize NavigationSpecification. The NavigationSpecification is instantiated occurding to a set of Entities and this results in a NavigationTree. The NavigationTree is rendered in a Channel.


Field Summary
protected  Channel _channel
           
protected  EntityContext _context
           
protected  int _maxDepth
          The maximum depth allowed for the navigation, i.e.
protected  int _minBranchEntities
          The minimum number of Entities required to calculate deeper branches.
protected  int _recordOccurringLabels
          Do you need a set of Occurring labels at each node ? Either ALL, NONE or SOME.
protected  Set _recordTheseOccurringLabels
          The restricted set of Occurring labels at each node in case of SOME.
protected  char _slash
          The default character that replaces '/' in tree node names.
protected  NavigationTree _theTree
           
static int ALL
           
static int NONE
           
static int SOME
           
 
Constructor Summary
SectionRenderer()
           
 
Method Summary
protected abstract  void _render(String path, NavigationTree tree)
          Perform the actual rendering of a node in the tree.
protected  void _setTreeRoot(NavigationTree tree)
          Set the root of the tree currently rendered.
 Channel getChannel()
           
 int getMaxDepth()
           
 int getMinBranchEntities()
           
 int getRecordOccurringLabels()
           
 Set getRecordTheseOccurringLabels()
           
 char getSlash()
           
 NavigationTree getTreeRoot()
          Get the root of the tree currently rendered (or null otherwise).
 void render(NavigationSpecification navigationSpec, EntityContext context, Channel channel)
          Perform the actual rendering.
 void setMaxDepth(int max)
          Set the maximum depth allowed for the navigation, i.e.
 void setMinBranchEntities(int min)
          Most applications stop the navigation when e.g.
 void setRecordEntities(int value)
          Deprecated. the call is totally ignored
 void setRecordOccurringLabels(int value, Set labels)
          This method exists for memory or CPU tuning only.
 void setSlash(char slash)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NONE

public static final int NONE
See Also:
Constant Field Values

SOME

public static final int SOME
See Also:
Constant Field Values

ALL

public static final int ALL
See Also:
Constant Field Values

_context

protected EntityContext _context

_channel

protected Channel _channel

_theTree

protected NavigationTree _theTree

_minBranchEntities

protected int _minBranchEntities
The minimum number of Entities required to calculate deeper branches.


_maxDepth

protected int _maxDepth
The maximum depth allowed for the navigation, i.e. the maximum number of navigation steps to a leaf.


_slash

protected char _slash
The default character that replaces '/' in tree node names. You might handle this earlier, e.g. in the Classifiers. If you want to handle this later, e.g. in the _render function, assign '/' to it.


_recordOccurringLabels

protected int _recordOccurringLabels
Do you need a set of Occurring labels at each node ? Either ALL, NONE or SOME.


_recordTheseOccurringLabels

protected Set _recordTheseOccurringLabels
The restricted set of Occurring labels at each node in case of SOME.

Constructor Detail

SectionRenderer

public SectionRenderer()
Method Detail

getMinBranchEntities

public int getMinBranchEntities()
Returns:
the minimum number (inclusive) of Entities required to offer further subnavigation

setMinBranchEntities

public void setMinBranchEntities(int min)
Most applications stop the navigation when e.g. 10 objects remain. However, the default behavior is to stop when only 1 object remains.

Parameters:
min - the minimum number (inclusive) of Entities required to offer further subnavigation

getMaxDepth

public int getMaxDepth()
Returns:
the maximum number (inclusive) of navigation steps

setMaxDepth

public void setMaxDepth(int max)
Set the maximum depth allowed for the navigation, i.e. the maximum number of navigation steps to a leaf.

Parameters:
max - the maximum number (inclusive) of navigation steps

getSlash

public char getSlash()
Returns:
the character that replaces '/' in each navigation step

setSlash

public void setSlash(char slash)
Parameters:
slash - the character that replaces '/' in each navigation step

setRecordEntities

public void setRecordEntities(int value)
Deprecated. the call is totally ignored


getRecordOccurringLabels

public int getRecordOccurringLabels()
Returns:
one of ALL, NONE or SOME.

getRecordTheseOccurringLabels

public Set getRecordTheseOccurringLabels()
Returns:
the restricted set of Occurring labels at each node in case of SOME.

setRecordOccurringLabels

public void setRecordOccurringLabels(int value,
                                     Set labels)
This method exists for memory or CPU tuning only. Don't use it if your application does not require it. And don't start with this tuning if you think you need it, there is probably something else that is a more effective tuning. For a lot applications there is no need to know the labels at all of all objects in a section. If that's true, you may use this function to disable recording of the "occurring" labels completely. For other applications, you don't need to register all occurring labels, but only a subset of all possible labels. If that's true, you may use this function to restrict recording of the "occurring" labels to the subset.

Parameters:
value - one of ALL, NONE, SOME
labels - the set to record (if value equals SOME) or null

render

public void render(NavigationSpecification navigationSpec,
                   EntityContext context,
                   Channel channel)
            throws ChannelException
Perform the actual rendering. As a side effect, a view that corresponds to the resulting channel is registered in the context.

Parameters:
navigationSpec - the NavigationSpecification to render
context - the EntityContext that provides the Entities
channel - the Channel in which to render the sections
Throws:
ChannelException

_render

protected abstract void _render(String path,
                                NavigationTree tree)
                         throws ChannelException
Perform the actual rendering of a node in the tree.

Parameters:
path - the current path in the NavigationTree, i.e. the name of the Section to render
tree - the node in the NavigationTree to render
Throws:
ChannelException

getChannel

public Channel getChannel()
Returns:
the current channel while rendering or null when not rendering

getTreeRoot

public NavigationTree getTreeRoot()
Get the root of the tree currently rendered (or null otherwise).

Returns:
the root of the tree while rendering, null otherwise

_setTreeRoot

protected void _setTreeRoot(NavigationTree tree)
Set the root of the tree currently rendered.



Copyright © 1997-2008 Aduna. All Rights Reserved.