Package net.ontopia.topicmaps.viz
Class TopicMapView
- java.lang.Object
-
- net.ontopia.topicmaps.viz.TopicMapView
-
public class TopicMapView extends Object
INTERNAL: Maintains the TouchGraph view of the topic map.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
TopicMapView.Debug
INTERNAL: PRIVATE: Purpose: Output debug information
-
Field Summary
Fields Modifier and Type Field Description protected VizTopicMapConfigurationManager
configman
protected VizController
controller
protected TopicIF
currentScopingTopic
protected TopicMapView.Debug
debug
static int
EDGE_LOCALITY
protected List
foregroundQueue
protected MotionKiller
motionKiller
protected ArrayList
newNodes
static int
NODE_LOCALITY
protected Collection
nodesUpdateCount
protected ArrayList
objectsByType
protected ArrayList
objectTypeIndex
PerformanceStat
stat
PerformanceStat
stat1
protected VizigatorUser
vizigatorUser
-
Constructor Summary
Constructors Constructor Description 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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 barprotected 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(Collection edges)
void
deleteEdgeUndoable(VizTMObjectIF edge)
void
deleteNode(TMAssociationNode node)
void
deleteNode(TMTopicNode node)
void
deleteSingleEdge(VizTMObjectIF edge)
protected VizTMObjectIF
findObject(Object object, TopicIF type)
protected void
focusNode(TMAbstractNode node)
static String
fullName(com.touchgraph.graphlayout.Node node)
Collection
getAllTopicTypes()
Returns a collection of all topic types in the topic map.Collection
getAllTopicTypesWithNull()
Returns a collection of all topic types in the topic map including null (untyped).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)
Collection
getPagesFor(TopicIF topic)
TMTopicNode
getStartNode()
com.touchgraph.graphlayout.TGPanel
getTGPanel()
TopicMapIF
getTopicMap()
protected List
getTopicNodesFor(TopicIF type)
void
headedDebug(String header, 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 Objectsprotected 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.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(String operation)
List
performSearch(String searchString)
protected void
processForegroundQueue(Graphics graphics)
protected void
queueInForeground(TMAbstractEdge edge)
protected void
queueInForeground(TMAbstractNode node)
void
removeAssociationScopeFilterTopic(TopicIF scopingTopic)
void
removeDisconnectedNodes()
void
resetDamper()
void
retainNodes(Collection nodes)
void
retainObjects(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, 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(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, Color c)
void
setTypeFont(TopicIF type, Font font)
void
setTypeIcon(TopicIF type, 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()
-
-
-
Field Detail
-
configman
protected VizTopicMapConfigurationManager configman
-
controller
protected VizController controller
-
newNodes
protected ArrayList newNodes
-
objectTypeIndex
protected ArrayList objectTypeIndex
-
objectsByType
protected ArrayList objectsByType
-
currentScopingTopic
protected TopicIF currentScopingTopic
-
debug
protected TopicMapView.Debug debug
-
nodesUpdateCount
protected Collection nodesUpdateCount
-
stat
public PerformanceStat stat
-
stat1
public PerformanceStat stat1
-
motionKiller
protected MotionKiller motionKiller
-
vizigatorUser
protected VizigatorUser vizigatorUser
-
foregroundQueue
protected 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(Collection nodes)
-
retainObjects
public void retainObjects(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 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.
-
setTopicTypeShape
public void setTopicTypeShape(TopicIF type, int shape)
-
setTopicTypeShapePadding
public void setTopicTypeShapePadding(TopicIF type, int value)
-
updateType
public void updateType(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 String fullName(com.touchgraph.graphlayout.Node node)
-
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 Collection getPagesFor(TopicIF topic)
-
getAssociationTypes
public Collection getAssociationTypes()
Returns a collection of all association types in the topic map. Does not work with remote topic maps.
-
getAllTopicTypesWithNull
public 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 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, Graphics g)
-
processForegroundQueue
protected void processForegroundQueue(Graphics graphics)
-
findObject
protected VizTMObjectIF findObject(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(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(Color aColor)
-
removeDisconnectedNodes
public void removeDisconnectedNodes()
-
setTopicTypeExcluded
public void setTopicTypeExcluded(TopicIF aType, boolean excluded)
-
getLocality
public int getLocality()
-
getStartNode
public TMTopicNode getStartNode()
-
getFocusNode
public TMAbstractNode getFocusNode()
-
getTGPanel
public com.touchgraph.graphlayout.TGPanel getTGPanel()
-
outputDebugInfo
public void outputDebugInfo(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)
-
-