net.ontopia.topicmaps.viz
Class TopicMapView

java.lang.Object
  extended by net.ontopia.topicmaps.viz.TopicMapView

public class TopicMapView
extends java.lang.Object

INTERNAL: Maintains the TouchGraph view of the topic map.


Nested Class Summary
protected  class TopicMapView.Debug
          INTERNAL: PRIVATE: Purpose: Output debug information
 
Field Summary
protected  VizTopicMapConfigurationManager configman
           
protected  VizController controller
           
protected  TopicIF currentScopingTopic
           
protected  TopicMapView.Debug debug
           
static int EDGE_LOCALITY
           
protected  java.util.List foregroundQueue
           
protected  java.util.ArrayList newNodes
           
static int NODE_LOCALITY
           
protected  java.util.ArrayList objectsByType
           
protected  java.util.ArrayList objectTypeIndex
           
 PerformanceStat stat
           
 PerformanceStat stat1
           
 
Constructor Summary
TopicMapView(VizController controller, TopicMapIF topicmap, com.touchgraph.graphlayout.TGPanel tgPanel, VizTopicMapConfigurationManager configman)
          Creates the view and updates the TGPanel to show the new view.
 
Method Summary
protected  void addAssociation(VizTMObjectIF object)
           
 void addAssociationScopeFilterTopic(TopicIF scopingTopic)
           
protected  TMTopicNode assertNode(TopicIF topic, boolean create)
           
protected  void build()
          Clears the panel and builds a new view.
protected  void buildAll()
           
 void buildAllSilent()
          EXPERIMENTAL: method to redraw the map, without starting a new thread or displaying the progress bar
protected  TMTopicNode buildTopic(TopicIF topic)
           
 void clearFocusNode()
           
 void clearModel()
           
 void createAssociations(TMAbstractNode abstractNode)
          Creates all edges for this node, including type -> instance, instance -> type, and ordinary associations.
 void createAssociations(TMAbstractNode abstractNode, boolean create)
           
 void createAssociations(TMAbstractNode abstractNode, boolean create, boolean createEdgesToExistingNodes)
          Creates all edges for this node, including type -> instance, instance -> type, and ordinary associations.
 void deleteEdge(VizTMObjectIF vizTMObject)
           
 void deleteEdges(java.util.Collection edges)
           
 void deleteEdgeUndoable(VizTMObjectIF edge)
           
 void deleteNode(TMAssociationNode node)
           
 void deleteNode(TMTopicNode node)
           
 void deleteSingleEdge(VizTMObjectIF edge)
           
protected  VizTMObjectIF findObject(java.lang.Object object, TopicIF type)
           
protected  void focusNode(TMAbstractNode node)
           
static java.lang.String fullName(com.touchgraph.graphlayout.Node node)
           
 java.util.Collection getAllTopicTypes()
          Returns a collection of all topic types in the topic map.
 java.util.Collection getAllTopicTypesWithNull()
          Returns a collection of all topic types in the topic map including null (untyped).
 java.util.Collection getAssociationTypes()
          Returns a collection of all association types in the topic map.
protected  TMAssociationEdge getEdge(AssociationIF association)
           
protected  TMRoleEdge getEdge(AssociationRoleIF role)
           
protected  TMClassInstanceAssociation getEdge(TopicIF type, TopicIF instance)
           
 TMAbstractNode getFocusNode()
           
protected  VizController.VizHoverHelpManager getHoverHelpManager()
           
 int getLocality()
           
 int getLocalityAlgorithm()
           
 int getMaxTopicNameLength()
           
protected  TMAssociationNode getNode(AssociationIF association)
           
 java.util.Collection getPagesFor(TopicIF topic)
           
 TMTopicNode getStartNode()
           
 com.touchgraph.graphlayout.TGPanel getTGPanel()
           
 TopicMapIF getTopicMap()
           
protected  java.util.List getTopicNodesFor(TopicIF type)
           
 void headedDebug(java.lang.String header, java.lang.Object object)
           
 void hideNode(TMAbstractNode node)
          Delete a node, all incident edges and all nodes and edges that no longer have a path to the focus node as a consequence of this.
protected  void initializeAssociation(VizTMAssociationIF anInstance)
          Initialize those things only associated with Association Objects
protected  void lenientAddNode(TMAbstractNode node)
          This method was created as a work-around for bug #1898, which happens when two nodes have the same ID (the second node failing to get added to tgPanel.
 java.util.Collection loadNodesInLocality(TMAbstractNode startNode, boolean create, boolean delete)
          If create is true, adds all nodes within locality's reach that were not already visible.
protected  VizTMObjectIF makeAssociation(AssociationIF assoc, TMTopicNode activePlayer, boolean create)
          Create an associations, or, in the case of an n-ary association, if the activePlayer is not null, create the associatin node itself and then only the role that active player is involved in.
protected  TMRoleEdge makeRole(TMAssociationNode assoc, AssociationRoleIF role, boolean create)
           
protected  TMClassInstanceAssociation makeTypeInstanceEdge(TMTopicNode instance, TMTopicNode type)
           
 void outputDebugInfo(java.lang.String operation)
           
 java.util.List performSearch(java.lang.String searchString)
           
protected  void processForegroundQueue(java.awt.Graphics graphics)
           
protected  void queueInForeground(TMAbstractEdge edge)
           
protected  void queueInForeground(TMAbstractNode node)
           
 void removeAssociationScopeFilterTopic(TopicIF scopingTopic)
           
 void removeDisconnectedNodes()
           
 void resetDamper()
           
 void retainNodes(java.util.Collection nodes)
           
 void retainObjects(java.util.Collection nodes)
           
 void setAllNodesFixed(boolean fixed)
          Sets all nodes to fixed (sticky) or not fixed.
 void setAssociationScopeFilterStrictness(int strictness)
          Set the current level of strictness of the association scope filter and remove/add edges where needed.
 void setAssociationTypeLineWeight(TopicIF type, int lineWeight)
           
 void setAssociationTypeShape(TopicIF type, int shape)
           
 void setAssociationTypeVisible(TopicIF type, boolean visible)
          NOTE: The calling method is responsible for calling the method: updateAssociationCountForAllTopics();
 void setConfigManager(VizTopicMapConfigurationManager configman)
          Called when a new configuration has been loaded.
protected  void setFocusNodeOf(TMObjectIF tmObject)
          Find the node of the given TMObjectIF.
protected  void setHighlightNode(TMAbstractNode node, java.awt.Graphics g)
           
 void setLocality(int newLocality)
          Set the locality to a given value and adds/removes nodes where appropriate.
 void setMaxTopicNameLength(int length)
           
 void setMotionKillerEnabled(boolean enabled)
           
 void setPanelBackgroundColour(java.awt.Color aColor)
           
 void setScopingTopic(TopicIF aScope)
           
 void setTopicTypeExcluded(TopicIF aType, boolean excluded)
           
 void setTopicTypeShape(TopicIF type, int shape)
           
 void setTopicTypeShapePadding(TopicIF type, int value)
           
 void setTopicTypeVisible(TopicIF type, boolean visible)
          NOTE! The calling mehtod is itself responsible for calling the method: updateAssociationCountForAllTopics().
 void setTypeColor(TopicIF type, java.awt.Color c)
           
 void setTypeFont(TopicIF type, java.awt.Font font)
           
 void setTypeIcon(TopicIF type, javax.swing.Icon icon)
           
 void shouldDisplayRoleHoverHelp(boolean newValue)
           
 void shouldDisplayScopedAssociationNames(boolean newValue)
           
 void updateAssociationCountForAllTopics()
           
 void updateAssociationCountForMarkedTopics()
           
 void updateDisplay()
           
 void updateDisplayLazily()
           
 void updateDisplayNoWork()
           
 void updateType(TopicIF type)
           
 boolean useNodeLocality()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

configman

protected VizTopicMapConfigurationManager configman

controller

protected VizController controller

newNodes

protected java.util.ArrayList newNodes

objectTypeIndex

protected java.util.ArrayList objectTypeIndex

objectsByType

protected java.util.ArrayList objectsByType

currentScopingTopic

protected TopicIF currentScopingTopic

debug

protected TopicMapView.Debug debug

stat

public PerformanceStat stat

stat1

public PerformanceStat stat1

foregroundQueue

protected java.util.List foregroundQueue

NODE_LOCALITY

public static int NODE_LOCALITY

EDGE_LOCALITY

public static int EDGE_LOCALITY
Constructor Detail

TopicMapView

public TopicMapView(VizController controller,
                    TopicMapIF topicmap,
                    com.touchgraph.graphlayout.TGPanel tgPanel,
                    VizTopicMapConfigurationManager configman)
Creates the view and updates the TGPanel to show the new view. The TGPanel may be showing an old view.

Method Detail

updateDisplay

public void updateDisplay()

updateDisplayLazily

public void updateDisplayLazily()

updateDisplayNoWork

public void updateDisplayNoWork()

resetDamper

public void resetDamper()

retainNodes

public void retainNodes(java.util.Collection nodes)

retainObjects

public void retainObjects(java.util.Collection nodes)

setLocality

public void setLocality(int newLocality)
Set the locality to a given value and adds/removes nodes where appropriate. After a locality increase, all nodes and edges within locality's reach in addition to all nodes and edges that were there before will be visible. After a locality decrease, all nodes and edges that were visible before and that are still within locality's reach will be visible.

Parameters:
newLocality - The new locality.

loadNodesInLocality

public java.util.Collection loadNodesInLocality(TMAbstractNode startNode,
                                                boolean create,
                                                boolean delete)
If create is true, adds all nodes within locality's reach that were not already visible. Then (independent of 'create') collects all edges just beyond locality's reach and returns them. An edge with both end-points within locality's reach is counted as within locality's reach.. ALTERNATIVE EDGE ALGORITHM: An edge is within locality's reach if one end-point is attached to a node at least one step closer than locality's reach.

Parameters:
startNode - The node to start from.
create - Whether to create new nodes and edges.
Returns:
edges beyond locality's reach.

setTypeFont

public void setTypeFont(TopicIF type,
                        java.awt.Font font)

setTopicTypeShape

public void setTopicTypeShape(TopicIF type,
                              int shape)

setTypeColor

public void setTypeColor(TopicIF type,
                         java.awt.Color c)

setTopicTypeShapePadding

public void setTopicTypeShapePadding(TopicIF type,
                                     int value)

setTypeIcon

public void setTypeIcon(TopicIF type,
                        javax.swing.Icon icon)

updateType

public void updateType(TopicIF type)

getTopicNodesFor

protected java.util.List getTopicNodesFor(TopicIF type)

setAssociationTypeShape

public void setAssociationTypeShape(TopicIF type,
                                    int shape)

setAssociationTypeLineWeight

public void setAssociationTypeLineWeight(TopicIF type,
                                         int lineWeight)

focusNode

protected void focusNode(TMAbstractNode node)

clearFocusNode

public void clearFocusNode()

setConfigManager

public void setConfigManager(VizTopicMapConfigurationManager configman)
Called when a new configuration has been loaded. Switches the view over to the new configuration.


hideNode

public void hideNode(TMAbstractNode node)
Delete a node, all incident edges and all nodes and edges that no longer have a path to the focus node as a consequence of this.

Parameters:
node - The base node to delete.

fullName

public static java.lang.String fullName(com.touchgraph.graphlayout.Node node)

headedDebug

public void headedDebug(java.lang.String header,
                        java.lang.Object object)

setTopicTypeVisible

public void setTopicTypeVisible(TopicIF type,
                                boolean visible)
NOTE! The calling mehtod is itself responsible for calling the method: updateAssociationCountForAllTopics().


setAssociationTypeVisible

public void setAssociationTypeVisible(TopicIF type,
                                      boolean visible)
NOTE: The calling method is responsible for calling the method: updateAssociationCountForAllTopics();

Parameters:
type - The type to set (in)visible.
visible - true if 'type' should be set visible. Otherwise false.

setAssociationScopeFilterStrictness

public void setAssociationScopeFilterStrictness(int strictness)
Set the current level of strictness of the association scope filter and remove/add edges where needed.

Parameters:
strictness - The new level of strictness

removeAssociationScopeFilterTopic

public void removeAssociationScopeFilterTopic(TopicIF scopingTopic)

addAssociationScopeFilterTopic

public void addAssociationScopeFilterTopic(TopicIF scopingTopic)

updateAssociationCountForAllTopics

public void updateAssociationCountForAllTopics()

updateAssociationCountForMarkedTopics

public void updateAssociationCountForMarkedTopics()

getTopicMap

public TopicMapIF getTopicMap()

getPagesFor

public java.util.Collection getPagesFor(TopicIF topic)

getAssociationTypes

public java.util.Collection getAssociationTypes()
Returns a collection of all association types in the topic map. Does not work with remote topic maps.


getAllTopicTypesWithNull

public java.util.Collection getAllTopicTypesWithNull()
Returns a collection of all topic types in the topic map including null (untyped). Does not work with remote topic maps.


getAllTopicTypes

public java.util.Collection getAllTopicTypes()
Returns a collection of all topic types in the topic map. Does not work with remote topic maps.


build

protected void build()
Clears the panel and builds a new view. Assumes there is no existing graph.


buildTopic

protected TMTopicNode buildTopic(TopicIF topic)

buildAllSilent

public void buildAllSilent()
EXPERIMENTAL: method to redraw the map, without starting a new thread or displaying the progress bar


buildAll

protected void buildAll()

assertNode

protected TMTopicNode assertNode(TopicIF topic,
                                 boolean create)

queueInForeground

protected void queueInForeground(TMAbstractNode node)

queueInForeground

protected void queueInForeground(TMAbstractEdge edge)

setHighlightNode

protected void setHighlightNode(TMAbstractNode node,
                                java.awt.Graphics g)

processForegroundQueue

protected void processForegroundQueue(java.awt.Graphics graphics)

findObject

protected VizTMObjectIF findObject(java.lang.Object object,
                                   TopicIF type)

makeTypeInstanceEdge

protected TMClassInstanceAssociation makeTypeInstanceEdge(TMTopicNode instance,
                                                          TMTopicNode type)

makeAssociation

protected VizTMObjectIF makeAssociation(AssociationIF assoc,
                                        TMTopicNode activePlayer,
                                        boolean create)
Create an associations, or, in the case of an n-ary association, if the activePlayer is not null, create the associatin node itself and then only the role that active player is involved in.


lenientAddNode

protected void lenientAddNode(TMAbstractNode node)
This method was created as a work-around for bug #1898, which happens when two nodes have the same ID (the second node failing to get added to tgPanel. I don't know why two nodes sometimes get the same ID, which is important information needed to avoid it, hence this work-around. Adds a systematic suffix and tries to add the node until no exception occurrs.

Parameters:
node - The node that should be added to tgPanel.

setFocusNodeOf

protected void setFocusNodeOf(TMObjectIF tmObject)
Find the node of the given TMObjectIF. If no such node exists, then it should be created. Then set that node to be the focus node, recomputing the graph from this new focus node. Supports TMObjectsIFs instanceof TopicIF or AssociationIF.

Parameters:
tmObject - from which to create the node.

makeRole

protected TMRoleEdge makeRole(TMAssociationNode assoc,
                              AssociationRoleIF role,
                              boolean create)

initializeAssociation

protected void initializeAssociation(VizTMAssociationIF anInstance)
Initialize those things only associated with Association Objects

Parameters:
anInstance -

addAssociation

protected void addAssociation(VizTMObjectIF object)

getHoverHelpManager

protected VizController.VizHoverHelpManager getHoverHelpManager()

createAssociations

public void createAssociations(TMAbstractNode abstractNode)
Creates all edges for this node, including type -> instance, instance -> type, and ordinary associations.


createAssociations

public void createAssociations(TMAbstractNode abstractNode,
                               boolean create)

createAssociations

public void createAssociations(TMAbstractNode abstractNode,
                               boolean create,
                               boolean createEdgesToExistingNodes)
Creates all edges for this node, including type -> instance, instance -> type, and ordinary associations. If create, then newnodes are created.


getLocalityAlgorithm

public int getLocalityAlgorithm()

useNodeLocality

public boolean useNodeLocality()

deleteEdges

public void deleteEdges(java.util.Collection edges)

deleteEdgeUndoable

public void deleteEdgeUndoable(VizTMObjectIF edge)

deleteEdge

public void deleteEdge(VizTMObjectIF vizTMObject)

deleteSingleEdge

public void deleteSingleEdge(VizTMObjectIF edge)

deleteNode

public void deleteNode(TMAssociationNode node)

deleteNode

public void deleteNode(TMTopicNode node)

getEdge

protected TMAssociationEdge getEdge(AssociationIF association)

getEdge

protected TMRoleEdge getEdge(AssociationRoleIF role)

getEdge

protected TMClassInstanceAssociation getEdge(TopicIF type,
                                             TopicIF instance)

getNode

protected TMAssociationNode getNode(AssociationIF association)

shouldDisplayRoleHoverHelp

public void shouldDisplayRoleHoverHelp(boolean newValue)

setMotionKillerEnabled

public void setMotionKillerEnabled(boolean enabled)

shouldDisplayScopedAssociationNames

public void shouldDisplayScopedAssociationNames(boolean newValue)

setPanelBackgroundColour

public void setPanelBackgroundColour(java.awt.Color aColor)

removeDisconnectedNodes

public void removeDisconnectedNodes()

setTopicTypeExcluded

public void setTopicTypeExcluded(TopicIF aType,
                                 boolean excluded)

performSearch

public java.util.List performSearch(java.lang.String searchString)

getLocality

public int getLocality()

getStartNode

public TMTopicNode getStartNode()

getFocusNode

public TMAbstractNode getFocusNode()

getTGPanel

public com.touchgraph.graphlayout.TGPanel getTGPanel()

outputDebugInfo

public void outputDebugInfo(java.lang.String operation)

setScopingTopic

public void setScopingTopic(TopicIF aScope)

clearModel

public void clearModel()

setAllNodesFixed

public void setAllNodesFixed(boolean fixed)
Sets all nodes to fixed (sticky) or not fixed.

Parameters:
fixed - true(/false) if all nodes should get a (un)fixed position.

getMaxTopicNameLength

public int getMaxTopicNameLength()

setMaxTopicNameLength

public void setMaxTopicNameLength(int length)


Copyright © 2000-2012 Ontopia.