net.ontopia.topicmaps.nav2.utils
Class TreeWidget

java.lang.Object
  extended by net.ontopia.topicmaps.nav2.utils.TreeWidget

public class TreeWidget
extends java.lang.Object

PUBLIC: This class can output a nice collapsing/expanding tree view of a topic map which uses tolog queries to produce the tree. The class is configurable in various ways, and can also be subclassed to further fine-tune the rendering.

Since:
2.1

Constructor Summary
TreeWidget()
          PUBLIC: Sets up the widget ready for use.
TreeWidget(TopicMapIF topicmap, java.lang.String query, java.lang.String topquery, java.lang.String ownpage, java.lang.String nodepage)
          PUBLIC: Sets up the widget ready for use.
 
Method Summary
 void run(javax.servlet.http.HttpServletRequest request, java.io.Writer writer)
          PUBLIC: Runs the widget, producing the output.
 void run(javax.servlet.jsp.PageContext ctxt, java.io.Writer writer)
          PUBLIC: Runs the widget, producing the output.
 void setAddAnchor(boolean addAnchor)
          PUBLIC: If set to true the widget will add anchors on all links that open/close nodes in the tree.
 void setImageUrl(java.lang.String imageurl)
          PUBLIC: The URL at which the graphics used by the widget are found.
 void setNodeFrame(java.lang.String nodeFrame)
          PUBLIC: The name of the HTML frame in which to open links to nodes.
 void setNodePageUrl(java.lang.String nodePageUrl)
          PUBLIC: The URL of of the page that shows the nodes.
 void setNodeQueryString(java.lang.String nodeQuery)
          PUBLIC: Sets the tolog query that given a node generates its children.
 void setOwnPageUrl(java.lang.String ownPageUrl)
          PUBLIC: The URL of the page the widget is on.
 void setTopicMap(TopicMapIF topicmap)
          PUBLIC: Sets the topic map used by the widget.
 void setTopQueryString(java.lang.String topQuery)
          PUBLIC: Sets the tolog query that generates the list of top nodes.
 void setWidgetName(java.lang.String name)
          PUBLIC: The name of the session key in which the set of open nodes is stored.
 void setWindowSize(int windowSize)
          PUBLIC: Sets the maximum number of nodes displayed by the widget at once.
 java.lang.String toString(TopicIF topic)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeWidget

public TreeWidget()
PUBLIC: Sets up the widget ready for use. The default constructor must be accompanied by the appropriate setter methods.


TreeWidget

public TreeWidget(TopicMapIF topicmap,
                  java.lang.String query,
                  java.lang.String topquery,
                  java.lang.String ownpage,
                  java.lang.String nodepage)
PUBLIC: Sets up the widget ready for use.

Parameters:
topicmap - The topic map being displayed.
query - A tolog query that given a node generates its children. Use the %parent% parameter to reference the parent node in the query. Make sure the query produces a 1-column result.
topquery - A tolog query that generates the list of top nodes. Make sure the query produces a 1-column result.
ownpage - The URL of the page the widget is on. The widget will append request parameters in the form "a=b&c=d&e=f..."
nodepage - The URL of of the page that shows the nodes.
Method Detail

setTopicMap

public void setTopicMap(TopicMapIF topicmap)
PUBLIC: Sets the topic map used by the widget.


setWidgetName

public void setWidgetName(java.lang.String name)
PUBLIC: The name of the session key in which the set of open nodes is stored. Using the same session key for different widgets will make them share open/closed information.


setTopQueryString

public void setTopQueryString(java.lang.String topQuery)
PUBLIC: Sets the tolog query that generates the list of top nodes. Make sure the query produces a 1-column result.


setNodeQueryString

public void setNodeQueryString(java.lang.String nodeQuery)
PUBLIC: Sets the tolog query that given a node generates its children. Use the %parent% parameter to reference the parent node in the query. Make sure the query produces a 1-column result.


setOwnPageUrl

public void setOwnPageUrl(java.lang.String ownPageUrl)
PUBLIC: The URL of the page the widget is on. The widget will append request parameters in the form "a=b&c=d&e=f..."


setNodePageUrl

public void setNodePageUrl(java.lang.String nodePageUrl)
PUBLIC: The URL of of the page that shows the nodes.


setImageUrl

public void setImageUrl(java.lang.String imageurl)
PUBLIC: The URL at which the graphics used by the widget are found. The widget will produce HTML like <img src="[imageurl]spacer.gif"> to refer to the graphics.


setAddAnchor

public void setAddAnchor(boolean addAnchor)
PUBLIC: If set to true the widget will add anchors on all links that open/close nodes in the tree. The default is true.


setWindowSize

public void setWindowSize(int windowSize)
PUBLIC: Sets the maximum number of nodes displayed by the widget at once. If the number of nodes to display exceeds the maximum the widget will break the display into multiple "pages".


setNodeFrame

public void setNodeFrame(java.lang.String nodeFrame)
PUBLIC: The name of the HTML frame in which to open links to nodes.


run

public void run(javax.servlet.jsp.PageContext ctxt,
                java.io.Writer writer)
         throws java.io.IOException,
                InvalidQueryException,
                net.ontopia.topicmaps.nav2.core.NavigatorRuntimeException
PUBLIC: Runs the widget, producing the output.

Throws:
java.io.IOException
InvalidQueryException
net.ontopia.topicmaps.nav2.core.NavigatorRuntimeException

run

public void run(javax.servlet.http.HttpServletRequest request,
                java.io.Writer writer)
         throws java.io.IOException,
                InvalidQueryException,
                net.ontopia.topicmaps.nav2.core.NavigatorRuntimeException
PUBLIC: Runs the widget, producing the output.

Throws:
java.io.IOException
InvalidQueryException
net.ontopia.topicmaps.nav2.core.NavigatorRuntimeException
Since:
2.2.1

toString

public java.lang.String toString(TopicIF topic)


Copyright © 2000-2009 Ontopia.