package paperscope;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.event.MouseEvent;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.Dimension;
import java.util.Iterator;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JFrame;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JTextArea;
import javax.swing.JDialog;
import javax.swing.JPopupMenu;
import javax.swing.JMenuItem;
import javax.swing.JSeparator;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.plaf.metal.MetalBorders.PopupMenuBorder;
import javax.swing.border.BevelBorder;
import javax.swing.SwingWorker;
import prefuse.Constants;
import prefuse.Display;
import prefuse.Visualization;
import prefuse.action.ActionList;
import prefuse.action.GroupAction;
import prefuse.action.ItemAction;
import prefuse.action.RepaintAction;
import prefuse.action.animate.ColorAnimator;
import prefuse.action.animate.PolarLocationAnimator;
import prefuse.action.animate.QualityControlAnimator;
import prefuse.action.animate.VisibilityAnimator;
import prefuse.action.assignment.ColorAction;
import prefuse.action.assignment.FontAction;
import prefuse.action.assignment.DataShapeAction;
import prefuse.action.filter.VisibilityFilter;
import prefuse.action.filter.GraphDistanceFilter;
import prefuse.action.layout.CollapsedSubtreeLayout;
import prefuse.action.layout.graph.RadialTreeLayout;
import prefuse.action.layout.graph.ForceDirectedLayout;
import prefuse.action.layout.Layout;
import prefuse.activity.SlowInSlowOutPacer;
import prefuse.activity.Activity;
import prefuse.controls.ControlAdapter;
import prefuse.controls.DragControl;
import prefuse.controls.FocusControl;
import prefuse.controls.HoverActionControl;
import prefuse.controls.PanControl;
import prefuse.controls.ZoomControl;
import prefuse.controls.ZoomToFitControl;
import prefuse.data.Graph;
import prefuse.data.Node;
import prefuse.data.Edge;
import prefuse.data.Table;
import prefuse.data.Tuple;
import prefuse.data.Schema;
import prefuse.data.event.TupleSetListener;
import prefuse.data.io.GraphMLReader;
import prefuse.data.query.SearchQueryBinding;
import prefuse.data.search.PrefixSearchTupleSet;
import prefuse.data.search.SearchTupleSet;
import prefuse.data.tuple.DefaultTupleSet;
import prefuse.data.search.KeywordSearchTupleSet;
import prefuse.data.tuple.TupleSet;
import prefuse.data.search.LuceneSearcher;
import prefuse.render.AbstractShapeRenderer;
import prefuse.render.DefaultRendererFactory;
import prefuse.render.EdgeRenderer;
import prefuse.render.LabelRenderer;
import prefuse.util.ColorLib;
import prefuse.util.FontLib;
import prefuse.util.force.*;
import prefuse.util.ui.JFastLabel;
import prefuse.util.ui.JSearchPanel;
import prefuse.util.ui.UILib;
import prefuse.util.ui.JCustomTooltip;
import prefuse.visual.VisualItem;
import prefuse.visual.expression.InGroupPredicate;
import prefuse.visual.sort.TreeDepthItemSorter;
import prefuse.visual.expression.VisiblePredicate;
import prefuse.action.assignment.DataColorAction;
import prefuse.visual.EdgeItem;
import prefuse.visual.NodeItem;
import prefuse.visual.VisualItem;
import java.util.HashMap;
import java.util.HashSet;
import prefuse.render.Renderer;
import prefuse.render.ShapeRenderer;
import prefuse.data.expression.AbstractPredicate;
import prefuse.data.expression.Predicate;
import org.apache.lucene.index.IndexReader;
import edu.stanford.ejalbert.BrowserLauncher;
import java.lang.reflect.*;
/**
* Radial Graph view of ADS Data
* @author Mark Holliman
* @version 1.0
* Built using demo code from @author <a href="http://jheer.org">jeffrey heer</a>
*/
public class RadialGraph extends Display {
public static String DATA_FILE = "";
private final static String tree = "tree";
private final static String treeNodes = "tree.nodes";
private final static String treeEdges = "tree.edges";
private final static String linear = "linear";
private static String m_label = "nodeLabel";
private static PaperScopeSession thisSession;
private static Graph currentGraph;
private static PrefuseTooltip menuTool;
private static KeywordSearchTupleSet search;
private static JPanel graphDisplay;
private static JSearchPanel infoSearch;
private static JTextField citationCount;
private LabelRenderer m_nodeRenderer;
private EdgeRenderer m_edgeRenderer;
public RadialGraph(Graph g, PaperScopeSession this_Session) {
super(new Visualization());
thisSession = this_Session;
currentGraph = g;
// -- set up visualization --
m_vis.add(tree, currentGraph);
m_vis.setInteractive(treeEdges, null, false);
//============================================================
// -- set up renderers --
//============================================================
m_nodeRenderer = new LabelRenderer(m_label);
m_nodeRenderer.setRenderType(AbstractShapeRenderer.RENDER_TYPE_DRAW_AND_FILL);
m_nodeRenderer.setHorizontalAlignment(Constants.CENTER);
m_nodeRenderer.setRoundedCorner(8,8);
m_edgeRenderer = new EdgeRenderer();
m_edgeRenderer.setArrowType(1);
m_edgeRenderer.setArrowHeadSize(8, 8);
DefaultRendererFactory rf = new DefaultRendererFactory(m_nodeRenderer);
rf.add(new InGroupPredicate(treeEdges), m_edgeRenderer);
rf.setDefaultEdgeRenderer(m_edgeRenderer);
m_vis.setRendererFactory(rf);
//====================================================================
// -- set up processing actions --
//====================================================================
//==== color actions
//==== palette for nodes, node color action, and text color action
int[] nodePalette = new int[]{ColorLib.rgb(153,255,153), ColorLib.rgb(255,255,153), ColorLib.rgb(153,153,255)};
ItemAction nodeColor = new NodeColorAction(treeNodes, nodePalette);
ItemAction textColor = new TextColorAction(treeNodes);
m_vis.putAction("textColor", textColor);
m_vis.putAction("nodeColor", nodeColor);
//==== border color for blank borders, and citation count highlighting
ItemAction borderHighlightColor = new ColorAction("citHighlight", VisualItem.STROKECOLOR, ColorLib.rgb(255,0,0));
m_vis.putAction("borderHighlightColor", borderHighlightColor);
ItemAction borderColor = new ColorAction(treeNodes, VisualItem.STROKECOLOR, ColorLib.rgba(0,0,0,0));
m_vis.putAction("borderColor", borderColor);
//==== spreads the nodes out a little bit
NodeSpreadAction spreadNodes = new NodeSpreadAction(treeNodes);
m_vis.putAction("spreadNodes", spreadNodes);
//==== edge color action, and arrow color action
ColorAction edgeColorAction = new ColorAction(treeEdges, VisualItem.STROKECOLOR, ColorLib.rgb(0,0,0));
ColorAction edgeArrowAction = new ColorAction(treeEdges, VisualItem.FILLCOLOR, ColorLib.rgb(0,0,0));
//==== font action, changes font when in focus group
FontAction fonts = new FontAction(treeNodes,
FontLib.getFont("Tahoma", 10));
fonts.add("ingroup('_focus_')", FontLib.getFont("Tahoma", 11));
// recolor
ActionList recolor = new ActionList();
recolor.add(nodeColor);
recolor.add(textColor);
recolor.add(borderColor);
recolor.add(borderHighlightColor);
m_vis.putAction("recolor", recolor);
// repaint
ActionList repaint = new ActionList();
repaint.add(recolor);
repaint.add(new RepaintAction());
m_vis.putAction("repaint", repaint);
// animate paint change
ActionList animatePaint = new ActionList(400);
animatePaint.add(new ColorAnimator(treeNodes));
animatePaint.add(new RepaintAction());
m_vis.putAction("animatePaint", animatePaint);
// create the tree layout action
RadialTreeLayout treeLayout = new RadialTreeLayout(tree);
m_vis.putAction("treeLayout", treeLayout);
CollapsedSubtreeLayout subLayout = new CollapsedSubtreeLayout(tree);
m_vis.putAction("subLayout", subLayout);
// create the filtering and layout
ActionList filter = new ActionList();
filter.add(new ForceDirectedLayout(tree, true));
filter.add(new TreeRootAction(tree));
filter.add(fonts);
filter.add(treeLayout);
filter.add(subLayout);
filter.add(textColor);
filter.add(nodeColor);
filter.add(borderColor);
filter.add(borderHighlightColor);
filter.add(edgeColorAction);
filter.add(edgeArrowAction);
m_vis.putAction("filter", filter);
// animated transition
ActionList animate = new ActionList(1250);
animate.setPacingFunction(new SlowInSlowOutPacer());
animate.add(new QualityControlAnimator());
animate.add(new VisibilityAnimator(tree));
animate.add(new PolarLocationAnimator(treeNodes, linear));
animate.add(new ColorAnimator(treeNodes));
animate.add(new RepaintAction());
m_vis.putAction("animate", animate);
m_vis.alwaysRunAfter("filter", "animate");
// visibility determiner
ActionList visibility = new ActionList();
visibility.add(new VisibilityFilter(new VisiblePredicate()));
m_vis.putAction("visibility", visibility);
visibility.alwaysRunAfter(animate);
/*// add force repulsion
ForceSimulator fsim = new ForceSimulator();
fsim.addForce(new NBodyForce(-1f, .1f, 5f));
fsim.addForce(new DragForce());
*/
ActionList forces = new ActionList(m_vis, 1000);
//forces.add(new ForceDirectedLayout(tree, fsim, false));
forces.add(new RepaintAction());
m_vis.putAction("forces", forces);
forces.alwaysRunAfter(animate);
//======================================================================
// -- initialize the display --
//======================================================================
setSize(900,650);
setItemSorter(new TreeDepthItemSorter());
addControlListener(new DragControl());
addControlListener(new ZoomToFitControl());
addControlListener(new ZoomControl());
addControlListener(new PanControl());
addControlListener(new FocusControl(1, "filter"));
addControlListener(new HoverActionControl("repaint"));
// filter graph and perform layout
m_vis.run("filter");
// maintain a set of items that should be interpolated linearly
// this isn't absolutely necessary, but makes the animations nicer
// the PolarLocationAnimator should read this set and act accordingly
m_vis.addFocusGroup(linear, new DefaultTupleSet());
m_vis.getGroup(Visualization.FOCUS_ITEMS).addTupleSetListener(
new TupleSetListener() {
public void tupleSetChanged(TupleSet t, Tuple[] add, Tuple[] rem) {
TupleSet linearInterp = m_vis.getGroup(linear);
if ( add.length < 1 ) return; linearInterp.clear();
for ( Node n = (Node)add[0]; n!=null; n=n.getParent() )
linearInterp.addTuple(n);
}
}
);
//==== Create a highlight group for adding borders based on citation count
DefaultTupleSet citHighlight = new DefaultTupleSet();
m_vis.addFocusGroup("citHighlight", citHighlight);
//==== Create a group for making nodes with comments have red text
DefaultTupleSet commentHighlight = new DefaultTupleSet();
m_vis.addFocusGroup("commentHighlight", commentHighlight);
//==== Initialize the search group, a change listener for it, and add it to the visualization
TupleSetListener newNodeListener = new TupleSetListener() {
public void tupleSetChanged(TupleSet t, Tuple[] add, Tuple[] rem) {
m_vis.cancel("animatePaint");
m_vis.run("recolor");
m_vis.run("animatePaint");
}
};
search = new KeywordSearchTupleSet();
search.addTupleSetListener(newNodeListener);
Iterator nodeIt = g.nodes();
while(nodeIt.hasNext())
{
VisualItem visualNode = m_vis.getVisualItem(treeNodes, (Node)nodeIt.next());
search.index(visualNode, "hoverLabel");
if(visualNode.getString("commentStatus").equals("t"))
{
m_vis.getFocusGroup("commentHighlight").addTuple(m_vis.getVisualItem(treeNodes, m_vis.getSourceTuple(visualNode)));
}
}
m_vis.addFocusGroup(Visualization.SEARCH_ITEMS, search);
//==== Create the JPanel with the graph content
this.graphDisplay = gui(this);
}
//##################################################################################################
public static JPanel gui(RadialGraph g) {
//==== create a new radial tree view
RadialGraph gview = g;
final Visualization vis = gview.getVisualization();
//==== Add the listeners for the hover text, and the right click menu
gview.addControlListener(new HoverToolTip());
gview.addControlListener(new ClickToolTip());
//==== Create a common font for the search tool and the citation count tool
Font font = new Font("Tahoma", 0, 12);
//==== Create the search box capable of searching all the major paper info (uses hoverLabel as the field searched)
String[] fields = new String[]{"hoverLabel"};
infoSearch = new JSearchPanel((Table)vis.getGroup(treeNodes), (KeywordSearchTupleSet)vis.getGroup(Visualization.SEARCH_ITEMS), fields, false, true);
infoSearch.setShowResultCount(true);
infoSearch.setBorder(BorderFactory.createEmptyBorder(5,5,4,0));
infoSearch.setFont(FontLib.getFont("Tahoma", Font.PLAIN, 11));
infoSearch.setLabelText("Search: Title, Authors, Journal, Date: ");
infoSearch.setShowCancel(false);
infoSearch.setMinimumSize(new Dimension(350, 40));
infoSearch.setFont(font);
//==== Create a box for highlighting papers based on citation count
JLabel citationLabel = new JLabel(" Citation Counts > : ");
citationLabel.setFont(font);
citationCount = new JTextField(4);
citationCount.setFont(font);
citationCount.setMaximumSize(new Dimension(60, 20));
citationCount.setMinimumSize(new Dimension(60, 20));
//==== Create the buttons for submitting the citation count highlight, and clearing it
JButton citationButton = new JButton("Go");
citationButton.setMaximumSize(new Dimension(30, 20));
citationButton.setMinimumSize(new Dimension(30, 20));
citationButton.setToolTipText("Highlight papers with a citation count \n higher than the number listed");
citationButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
citationButtonMouseClicked(vis);
}
});
JButton citationClearButton = new JButton("Clear");
citationClearButton.setMaximumSize(new Dimension(30, 20));
citationClearButton.setMinimumSize(new Dimension(30, 20));
citationClearButton.setToolTipText("Clear citation count highlight");
citationClearButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
citationClearButtonMouseClicked(vis);
}
});
//==== Match the vertical alignments
citationLabel.setAlignmentY(infoSearch.getAlignmentY());
citationCount.setAlignmentY(infoSearch.getAlignmentY());
citationButton.setAlignmentY(infoSearch.getAlignmentY());
citationClearButton.setAlignmentY(infoSearch.getAlignmentY());
//==== Create a simple box layout for the search bar
Box box = new Box(BoxLayout.X_AXIS);
box.add(Box.createHorizontalGlue());
box.add(infoSearch);
box.add(Box.createHorizontalGlue());
box.add(citationLabel);
box.add(citationCount);
box.add(citationButton);
box.add(citationClearButton);
box.add(Box.createHorizontalGlue());
box.createVerticalStrut(20);
box.setBorder(new BevelBorder(1));
//==== Set up the panel layout with the search bar and the graph
BorderLayout layout = new BorderLayout();
JPanel panel = new JPanel(layout);
panel.add(gview, BorderLayout.CENTER);
panel.add(box, BorderLayout.SOUTH);
Color BACKGROUND = Color.WHITE;
Color FOREGROUND = Color.DARK_GRAY;
UILib.setColor(panel, BACKGROUND, FOREGROUND);
return panel;
}
//###############################################################################################
//=== Switch the root of the tree by requesting a new spanning tree at the desired root
public class TreeRootAction extends GroupAction {
public TreeRootAction(String graphGroup) {
super(graphGroup);
}
public void run(double frac) {
TupleSet focus = m_vis.getGroup(Visualization.FOCUS_ITEMS);
if ( focus==null || focus.getTupleCount() == 0 ) return;
Graph g = (Graph)m_vis.getGroup(m_group);
Node f = null;
Iterator tuples = focus.tuples();
while (tuples.hasNext() && !g.containsTuple(f=(Node)tuples.next()))
{
f = null;
}
if ( f == null ) return;
g.getSpanningTree(f);
}
}
//###############################################################################################
//=== Set node fill colors
public class NodeColorAction extends DataColorAction {
public NodeColorAction(String group, int[] nodePalette) {
super(group, "refType", Constants.NOMINAL, VisualItem.FILLCOLOR, nodePalette);
add("_hover", ColorLib.gray(220,230));
add("ingroup('_search_')", ColorLib.rgb(255,153,153));
add("ingroup('_focus_')", ColorLib.rgb(198,229,229));
}
} // end of inner class NodeColorAction
//###############################################################################################
//=== Set node text colors
public class TextColorAction extends ColorAction
{
public TextColorAction(String group) {
super(group, VisualItem.TEXTCOLOR, ColorLib.gray(0));
add("_hover", ColorLib.rgb(255,0,100));
add(new InGroupPredicate("commentHighlight"), ColorLib.rgb(255,0,0));
}
} // end of inner class TextColorAction
//###############################################################################################
//=== Space the nodes out a little more
public class NodeSpreadAction extends Layout
{
public NodeSpreadAction(String group) {
super(group);
}
public void run(double frac)
{
TupleSet allNodes = m_vis.getGroup(treeNodes);
Iterator it = allNodes.tuples();
int mover = 1;
while(it.hasNext())
{
//=== Get the node's tuple
Tuple node = (Node)it.next();
//=== If it isn't a FOCUS node, move it a little
if(node.getString("refType").equals("REFERENCES") || node.getString("refType").equals("CITATIONS"))
{
//=== Get the VisualItem for the node, and it's current location
VisualItem item = m_vis.getVisualItem(treeNodes, node);
double currentX = item.getX();
double currentY = item.getY();
//=== Generate a new X and Y coordinate based off the current location
//=== Current Implementation moves the first node down and left, next one up and right
double newX = 0;
double newY = 0;
if(mover==1)
{
newX = currentX;
newY = currentY;
mover = 2;
}
else if(mover==2)
{
newX = currentX + 15;
newY = currentY + 15;
mover = 1;
}
setX(item, null, newX);
setY(item, null, newY);
}
} //end while, nodes moved
}
}
//###############################################################################################
//=== Set edge fill colors
public class EdgeColorAction extends DataColorAction {
public EdgeColorAction(String group, int[] edgePalette) {
super(group, "edgeType", Constants.NOMINAL, VisualItem.STROKECOLOR, edgePalette);
}
} // end of inner class NodeColorAction
//###############################################################################################
//=== Set Tooltip box to display the Title, Authors, and Date when an item is moused over
public static class HoverToolTip extends ControlAdapter
{
public void itemEntered(VisualItem item, MouseEvent e)
{
//==== If it is a tree node, then display the title and authors
if (item.getGroup().equals("tree.nodes"))
{
Visualization v = item.getVisualization();
Display d = v.getDisplay(0);
String view_text = (((Node)v.getSourceTuple(item)).getString("hoverLabel"));
d.setToolTipText(view_text);
}
}
public void itemExited(VisualItem item, MouseEvent e)
{
Visualization v = item.getVisualization();
Display d = v.getDisplay(0);
d.setToolTipText(null);
//v.run("draw");
}
} //end of class HoverToolTip
//###############################################################################################
//=== Run a query on the bibcode of the node that is clicked on
public static class ClickToolTip extends ControlAdapter
{
public void itemClicked(VisualItem item, MouseEvent e)
{
//==== Bring up menu on Right Click
if (e.isPopupTrigger() || SwingUtilities.isRightMouseButton(e))
{
//==== Get the visualization and display objects associated with the node
Visualization v = item.getVisualization();
Display d = v.getDisplay(0);
//==== Create the click menu panel and the custom tool tip
ClickMenu menu = new ClickMenu(v, item);
menuTool = new PrefuseTooltip(d, menu);
//==== Set the custom tooltip to display the click menu
menuTool.startShowing(e.getX(), e.getY());
}
}
//==== If the mouse is clicked outside of the menu then close it
public void mouseClicked(MouseEvent e)
{
menuTool.stopShowing();
}
} //end of class ClickToolTip
//##############################################################################################
// Class for right click menu on nodes
public static class ClickMenu extends JPopupMenu
{
/** Default Constructor */
public ClickMenu(final Visualization v, final VisualItem item)
{
//==== needed to ensure the menu doesn't disapear
this.setLightWeightPopupEnabled(false);
this.setDefaultLightWeightPopupEnabled(false);
//==== Initialize the menu properties
this.setLabel("Node Menu");
this.setBorder(new PopupMenuBorder());
this.setBorderPainted(true);
this.setVisible(true);
//==== Initialize menu items for expanding the node
JMenuItem expandAllItem = new JMenuItem("Expand All");
JMenuItem expandRefItem = new JMenuItem("Expand References");
JMenuItem expandCitItem = new JMenuItem("Expand Citations");
//==== Initialize menu items for collapsing the node
JMenuItem hideAllItem = new JMenuItem("Hide Paper (and all children)");
JMenuItem hideRefItem = new JMenuItem("Hide References");
JMenuItem hideCitItem = new JMenuItem("Hide Citations");
//==== Initialize the menu item for showing hidden nodes and edges
JMenuItem showHiddenItem = new JMenuItem("Show Hidden nodes");
//==== Initialize the memu item for opening the abstract
JMenuItem viewAbstractItem = new JMenuItem("View Abstract in Browser");
//==== Initialize the menu item for view the paper's information
JMenuItem viewPaperInfoItem = new JMenuItem("View Paper Information");
//==== Initialize the menu item for viewing/editing a paper's comments
JMenuItem viewPaperCommentItem = new JMenuItem("View or Edit Paper Comments");
//==== Set the Tooltip text for each item
expandAllItem.setToolTipText("Show all References from, and Citations to, this paper");
expandRefItem.setToolTipText("Show all References from this paper");
expandCitItem.setToolTipText("Show all Citations to, this paper");
hideAllItem.setToolTipText("Hide this paper and all its References and Citations");
hideRefItem.setToolTipText("Hide this paper's References");
hideCitItem.setToolTipText("Hide the Citations to this paper");
showHiddenItem.setToolTipText("Show all hidden nodes connected to this node");
viewAbstractItem.setToolTipText("View this paper's Abstract in your web browser");
viewPaperInfoItem.setToolTipText("View basic information about this paper");
viewPaperCommentItem.setToolTipText("View or edit comments on this paper");
//==== Initialize the ActionListeners for each menu item
expandAllItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
expandNode(v, item, "all");
}
});
expandRefItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
expandNode(v, item, "ref");
}
});
expandCitItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
expandNode(v, item, "cit");
}
});
hideAllItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
hideNode(v, item, "all");
}
});
hideRefItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
hideNode(v, item, "ref");
}
});
hideCitItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
hideNode(v, item, "cit");
}
});
showHiddenItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
showHiddenNodes(v, item);
}
});
viewAbstractItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
viewAbstractInBrowser(v, item);
}
});
viewPaperInfoItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
//==== Create the window for viewing paper information
PaperInfoWindow paperInfo = new PaperInfoWindow(v, item);
//==== Close the Tooltip menu
menuTool.stopShowing();
}
});
viewPaperCommentItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
//==== Create the window for viewing paper information
PaperInfoWindow edit = new PaperInfoWindow(v, item);
//==== Close the Tooltip menu
menuTool.stopShowing();
}
});
//==== If its not a focus node: menu should have buttons for expanding node, removing node, and opening the abstract
if (!((Node)v.getSourceTuple(item)).getString("refType").equals("FOCUS"))
{
//==== Add the Menu Items to the menu
this.add(expandAllItem);
this.add(expandRefItem);
this.add(expandCitItem);
this.addSeparator();
this.add(hideAllItem);
this.addSeparator();
this.add(viewAbstractItem);
this.add(viewPaperInfoItem);
this.add(viewPaperCommentItem);
}
//==== If it is a focus node its buttons may vary depending on how it is expanded/hidden
else
{
int rowNumber = ((Node)v.getSourceTuple(item)).getInt("DEFAULT_NODE_KEY");
//==== If the references are not expanded, provide menu item to expand them
if(currentGraph.getNodeTable().getString(rowNumber, "refExpanded").equals("false"))
{ this.add(expandRefItem);}
//==== If the citations are not expanded, provide menu item to expand them
if(currentGraph.getNodeTable().getString(rowNumber, "citExpanded").equals("false"))
{ this.add(expandCitItem);}
this.addSeparator();
//==== If the references are not hidden and have been expanded, provide menu item to hide them
if(currentGraph.getNodeTable().getString(rowNumber, "refHidden").equals("false") && currentGraph.getNodeTable().getString(rowNumber, "refExpanded").equals("true"))
{ this.add(hideRefItem);}
//==== If the citations are not hidden, provide menu item to hide them
if(currentGraph.getNodeTable().getString(rowNumber, "citHidden").equals("false") && currentGraph.getNodeTable().getString(rowNumber, "citExpanded").equals("true"))
{ this.add(hideCitItem);}
//==== Provide meu item to hide this node and its children
this.add(hideAllItem);
this.addSeparator();
//==== if either the refs or cits are hidden, provide button to unhide them
if((currentGraph.getNodeTable().getString(rowNumber, "citHidden").equals("true")) || (currentGraph.getNodeTable().getString(rowNumber, "refHidden").equals("true")))
{ this.add(showHiddenItem);}
this.addSeparator();
//==== provide menu item to view the abstract, and one to view the paper's info
this.add(viewAbstractItem);
this.add(viewPaperInfoItem);
this.add(viewPaperCommentItem);
}
} // end default constructor
} // end ClickMenu Class
//###############################################################################################
//==== Expand the node
private static void expandNode(final Visualization v, VisualItem item, final String whichNodes)
{
//==== Get the bibcode and node key of the selected node
final String bibcode = ((Node)v.getSourceTuple(item)).getString("bibcode");
final int nodeKey = ((Node)v.getSourceTuple(item)).getInt("DEFAULT_NODE_KEY");
//==== Set the refType of the clicked node to "FOCUS"
int rowNumber = ((Node)v.getSourceTuple(item)).getInt("DEFAULT_NODE_KEY");
currentGraph.getNodeTable().setString(rowNumber, "refType", "FOCUS");
//==== Record which nodes are expanded, for use by the PrefuseTooltip menu
if (whichNodes.equals("ref"))
{
currentGraph.getNodeTable().setString(rowNumber, "refExpanded", "true");
currentGraph.getNodeTable().setString(rowNumber, "citExpanded", "false");
currentGraph.getNodeTable().setString(rowNumber, "refHidden", "false");
currentGraph.getNodeTable().setString(rowNumber, "citHidden", "false");
}
else if (whichNodes.equals("cit"))
{
currentGraph.getNodeTable().setString(rowNumber, "refExpanded", "false");
currentGraph.getNodeTable().setString(rowNumber, "citExpanded", "true");
currentGraph.getNodeTable().setString(rowNumber, "refHidden", "false");
currentGraph.getNodeTable().setString(rowNumber, "citHidden", "false");
}
else
{
currentGraph.getNodeTable().setString(rowNumber, "refExpanded", "true");
currentGraph.getNodeTable().setString(rowNumber, "citExpanded", "true");
currentGraph.getNodeTable().setString(rowNumber, "refHidden", "false");
currentGraph.getNodeTable().setString(rowNumber, "citHidden", "false");
}
//==== Close the Tooltip menu
menuTool.stopShowing();
//==== Swing worker for executing the secondary query
class SecondaryQueryExecuter extends SwingWorker<JPanel, Void> {
@Override
public JPanel doInBackground() {
//==== Run the query, and reread it into the graph
SecondaryResults results = thisSession.executeSecondaryQuery(bibcode, whichNodes, nodeKey, currentGraph.getNodeTable());
addNodes(results.getGraph(), v);
return getGraphDisplayPanel();
}
@Override
protected void done() {
try {
thisSession.userInterface.stopQueryProgressBar();
rerunQuery();
if(!(citationCount.getText().equals(""))&&!(citationCount.getText().equals(null)))
{ citationButtonMouseClicked(v); }
} catch (Exception ignore) {}
}
} //end class, SecondaryQueryExecuter
//==== Create the runnable
SecondaryQueryExecuter query = new SecondaryQueryExecuter();
//==== Turn on the progress bar (it is turned off when the done() method is called)
thisSession.userInterface.startQueryProgressBar();
//==== Execute the query
query.execute();
//==== Repaint the visualization with the updated graph
v.run("filter");
v.run("visibility");
v.run("repaint");
}
//###############################################################################################
//==== Hide the node and/or the specified children
private static void hideNode(final Visualization v, final VisualItem item, final String whichNodes)
{
//==== Swing worker for hiding the nodes
class MakeInvisibleExecuter extends SwingWorker<JPanel, Void> {
@Override
public JPanel doInBackground() {
//==== Run the function for hiding nodes
makeInvisible(v, item, whichNodes);
return getGraphDisplayPanel();
}
@Override
protected void done() {
try {
thisSession.userInterface.stopQueryProgressBar();
} catch (Exception ignore) {}
}
} //end class, MakeInvisibleExecuter
//==== Close the Tooltip menu
menuTool.stopShowing();
//==== Create the runnable
MakeInvisibleExecuter hide = new MakeInvisibleExecuter();
//==== Turn on the progress bar (it is turned off when the done() method is called)
thisSession.userInterface.startQueryProgressBar();
//==== Execute the query
hide.execute();
//==== Repaint the visualization with the updated graph
v.run("filter");
v.run("visibility");
v.run("repaint");
}
//###############################################################################################
//==== Show all the hidden nodes attached to this node
public static void showHiddenNodes(final Visualization v, final VisualItem item)
{
//==== Swing worker for hiding the nodes
class MakeVisibleExecuter extends SwingWorker<JPanel, Void> {
@Override
public JPanel doInBackground() {
//==== Record all nodes as visible, for use by the PrefuseTootip
int rowNumber = ((Node)v.getSourceTuple(item)).getInt("DEFAULT_NODE_KEY");
currentGraph.getNodeTable().setString(rowNumber, "refHidden", "false");
currentGraph.getNodeTable().setString(rowNumber, "citHidden", "false");
currentGraph.getNodeTable().setString(rowNumber, "visible", "true");
//==== Show the node's edges and children
Iterator edgeIt = ((Node)v.getSourceTuple(item)).edges();
while(edgeIt.hasNext())
{
Edge edge = (Edge)edgeIt.next();
int row = edge.getRow();
v.getVisualItem(treeEdges,edge.getGraph().getEdgeTable().getTuple(row)).setVisible(true);
v.getVisualItem(treeNodes, (Tuple)edge.getAdjacentNode((Node)v.getSourceTuple(item))).setVisible(true);
//=== Set the node's visibility to "true", used when loading saved graphs
edge.getAdjacentNode((Node)v.getSourceTuple(item)).setString("visible", "true");
}
return getGraphDisplayPanel();
}
@Override
protected void done() {
try {
thisSession.userInterface.stopQueryProgressBar();
} catch (Exception ignore) {}
}
} //end class, MakeVisibleExecuter
//==== Close the Tooltip menu
menuTool.stopShowing();
//==== Create the runnable
MakeVisibleExecuter show = new MakeVisibleExecuter();
//==== Turn on the progress bar (it is turned off when the done() method is called)
thisSession.userInterface.startQueryProgressBar();
//==== Execute the query
show.execute();
//==== Repaint the visualization with the updated graph
v.run("filter");
v.run("visibility");
v.run("repaint");
}
//###############################################################################################
//==== View the paper's abstract in the user's browser
private static void viewAbstractInBrowser(Visualization v, VisualItem item)
{
try
{
//==== Get the Abstract URL
String abstractURL = ((Node)v.getSourceTuple(item)).getString("abstractURL");
//==== Create the browser launcher, open the URL in the user's browser
BrowserLauncher launch = new BrowserLauncher();
launch.openURLinBrowser(abstractURL);
//==== Close the Tooltip menu
menuTool.stopShowing();
}
catch (Exception e){
System.out.println(e);
}
}
//###############################################################################################
//==== Add the new nodes to the graph
public static void addNodes(Graph newGraph, Visualization v)
{
//=== Get the backing tables from the new graph
Table newNodes = (Table)newGraph.getNodes();
Table newEdges = (Table)newGraph.getEdges();
//==== add each node from the new graph into the current graph
for (int i=0; i<newNodes.getRowCount(); i++)
{
//=== Add the node to the graph
currentGraph.getNodes().addTuple(newNodes.getTuple(i));
//=== Add the node's tuple to the search group, and add it to the search index
VisualItem newVisualNode = v.getVisualItem(treeNodes, currentGraph.getNodeFromKey(newNodes.getTuple(i).getInt("DEFAULT_NODE_KEY")));
search.index(newVisualNode, "hoverLabel");
}
//=== add each edge from the new graph into the current graph
for (int j=0; j<newEdges.getRowCount(); j++)
{
currentGraph.getEdges().addTuple(newEdges.getTuple(j));
}
v.run("filter");
v.run("visibility");
v.run("repaint");
}
//###############################################################################################
//==== Make the selected nodes invisible
private static void makeInvisible(Visualization v, VisualItem item, String whichNodes)
{
//==== Get the row number for the selected node
int rowNumber = ((Node)v.getSourceTuple(item)).getInt("DEFAULT_NODE_KEY");
if(whichNodes.equals("ref") || whichNodes.equals("cit"))
{
//==== Record which nodes are hidden, for use by the PrefuseTooltip menu
if (whichNodes.equals("ref"))
{
currentGraph.getNodeTable().setString(rowNumber, "refHidden", "true");
}
else if (whichNodes.equals("cit"))
{
currentGraph.getNodeTable().setString(rowNumber, "citHidden", "true");
}
//==== Hide the node's children if unconnected to other nodes, and is selected to be hidden
Iterator childIt = ((Node)v.getSourceTuple(item)).children();
while(childIt.hasNext())
{
//=== Get the child node, add up its incoming and outgoing edges
Node child = ((Node)childIt.next());
int childInEdges = child.getInDegree();
int childOutEdges = child.getOutDegree();
int childEdges = childInEdges + childOutEdges;
int row = child.getRow();
//==== if it only has one edge, hide the node
if (childEdges == 1)
{
if(child.get("refType").equals("REFERENCES") && whichNodes.equals("ref"))
{
v.getVisualItem(treeNodes, child.getGraph().getNodeTable().getTuple(row)).setVisible(false);
child.getGraph().getNodeTable().getTuple(row).setString("visible", "false");
//==== Hide the node's edges
Iterator edgeIt = child.edges();
while(edgeIt.hasNext())
{
Edge edge = (Edge)edgeIt.next();
int edgerow = edge.getRow();
v.getVisualItem(treeEdges,edge.getGraph().getEdgeTable().getTuple(edgerow)).setVisible(false);
}
}
else if(child.get("refType").equals("CITATIONS") && whichNodes.equals("cit"))
{
v.getVisualItem(treeNodes, child.getGraph().getNodeTable().getTuple(row)).setVisible(false);
child.getGraph().getNodeTable().getTuple(row).setString("visible", "false");
//==== Hide the node's edges
Iterator edgeIt = child.edges();
while(edgeIt.hasNext())
{
Edge edge = (Edge)edgeIt.next();
int edgerow = edge.getRow();
v.getVisualItem(treeEdges,edge.getGraph().getEdgeTable().getTuple(edgerow)).setVisible(false);
}
}
}
else if(childEdges < 1)
{
//=== If the child is connected to another node, don't do anything
}
} //end which, all children checked
}
//==== Hide all the attached nodes and edges
else
{
//==== Record all nodes as hidden, for use by the PrefuseTooltip menu
currentGraph.getNodeTable().setString(rowNumber, "refHidden", "true");
currentGraph.getNodeTable().setString(rowNumber, "citHidden", "true");
//==== Hide the node (visual item), and record it as hidden on the graph
item.setVisible(false);
currentGraph.getNodeTable().setString(rowNumber, "visible", "false");
//==== Hide the selected node's edges
Iterator edgeIt = ((Node)v.getSourceTuple(item)).edges();
while(edgeIt.hasNext())
{
Edge edge = (Edge)edgeIt.next();
int row = edge.getRow();
v.getVisualItem(treeEdges, edge).setVisible(false);
//=== Find attached FOCUS nodes and set it so that they know this node has been hidden
Node checkNode = edge.getAdjacentNode((Node)v.getSourceTuple(item));
if(checkNode.getString("refType").equals("FOCUS"))
{
if(edge.getSourceNode().getInt("DEFAULT_NODE_KEY") == checkNode.getInt("DEFAULT_NODE_KEY"))
{
checkNode.setString("refHidden", "true");
}
else if(edge.getTargetNode().getInt("DEFAULT_NODE_KEY") == checkNode.getInt("DEFAULT_NODE_KEY"))
{
checkNode.setString("citHidden", "true");
}
}
}
//==== Hide the node's children if unconnected to other nodes
Iterator childIt = ((Node)v.getSourceTuple(item)).children();
while(childIt.hasNext())
{
//=== Get the child node, add up its incoming and outgoing edges
Node child = ((Node)childIt.next());
int childInEdges = child.getInDegree();
int childOutEdges = child.getOutDegree();
int childEdges = childInEdges + childOutEdges;
int row = child.getRow();
//==== if it only has one edge, hide it
if (childEdges == 1)
{
v.getVisualItem(treeNodes, child).setVisible(false);
child.setString("visible", "false");
}
}
} // end if, all nodes hidden
v.run("filter");
v.run("animate");
v.run("visibility");
}
//##############################################################################################
//==== Rerun the current query in the search panel
private static void rerunQuery()
{
String query = infoSearch.getQuery();
infoSearch.setQuery("");
infoSearch.setQuery(query);
}
//###############################################################################################
//==== Find all papers with a citation count higher than the limit specified and highlight them
private static void citationButtonMouseClicked(Visualization v)
{
//==== Clear the current group
v.getFocusGroup("citHighlight").clear();
//==== Get the number entered by the user, and iterate through all the nodes
String input = citationCount.getText();
if(!input.equals("")&&!input.equals(null));
{
int citLimit = Integer.parseInt(input);
Iterator nodeIt = currentGraph.nodes();
while (nodeIt.hasNext())
{
//=== Get the node
Node node = (Node)nodeIt.next();
//=== If the node has a high enough citCount, add a red border
if(Integer.parseInt(node.getString("citCount"))>citLimit)
{
v.getFocusGroup("citHighlight").addTuple(v.getVisualItem(treeNodes, node));
}
}
}
v.run("repaint");
}
//###############################################################################################
//==== Find all papers with a citation count higher than the limit specified and highlight them
private static void citationClearButtonMouseClicked(Visualization v)
{
//==== Clear the text box of the user's limit
citationCount.setText("");
//==== Clear the highlight group
v.getFocusGroup("citHighlight").clear();
v.run("repaint");
//v.run("filter");
//v.run("animate");
}
//##############################################################################################
//==== Set the node visibility according to the saved values
public void setVisibility()
{
//==== Iterate through all the nodes, hiding those that have visibility set to "false"
Iterator nodeIt = currentGraph.nodes();
while(nodeIt.hasNext())
{
Node node = (Node)nodeIt.next();
if(node.getString("visible").equals("false"))
{
m_vis.getVisualItem(treeNodes, node).setVisible(false);
//==== Hide all the hidden node's edges too
Iterator edgeIt = node.edges();
while(edgeIt.hasNext())
{
m_vis.getVisualItem(treeEdges, (Edge)edgeIt.next()).setVisible(false);
}
}
}
}
//###############################################################################################
//==== Update refType of nodes already on the graph
private static void UpdateNodeRefType(int[] rowNumbers)
{
//=== Go through each row and update the refType provided
for (int i=0; i<Array.getLength(rowNumbers); i++)
{
currentGraph.getNode(rowNumbers[i]).setString("refType", "Z");
}
}
//###############################################################################################
//==== Save the graph layout
public void saveGraphLayout()
{
Iterator nodes = m_vis.items(treeNodes);
while (nodes.hasNext())
{
Node node = (Node)nodes.next();
VisualItem item = m_vis.getVisualItem(treeNodes, node);
double x = item.getX();
double y = item.getY();
node.setDouble("xCoordinate", x);
node.setDouble("yCoordinate", y);
}
}
//###############################################################################################
//==== Load a previously saved graph layout
public void loadGraphLayout()
{
Iterator nodes = m_vis.items(treeNodes);
while (nodes.hasNext())
{
Node node = (Node)nodes.next();
VisualItem item = m_vis.getVisualItem(treeNodes, node);
double x = node.getDouble("xCoordinate");
double y = node.getDouble("yCoordinate");
item.setX(x);
item.setY(y);
}
m_vis.repaint();
}
//###############################################################################################
//==== Hide nodes with a citation count lower than the value provided
public void hideLowCitations(int count)
{
Iterator nodeIt = m_vis.items(treeNodes);
while(nodeIt.hasNext())
{
Node node = (Node)nodeIt.next();
//=== If the citation count for a paper is lower than the limit
if((Integer.parseInt(node.getString("citCount"))<count) && !node.getString("refType").equals("FOCUS"))
{
//== Hide the node's VisualItem, save its status as hidden
m_vis.getVisualItem(treeNodes, node).setVisible(false);
m_vis.getSourceTuple(m_vis.getVisualItem(treeNodes, node)).setString("visible", "false");
//== Hide all edges to the node
Iterator edgeIt = node.edges();
while(edgeIt.hasNext())
{
m_vis.getVisualItem(treeEdges, (Edge)edgeIt.next()).setVisible(false);
}
} //end if
}
m_vis.run("repaint");
}
//###############################################################################################
//==== Hide nodes with a citation count higher than the value provided
public void hideHighCitations(int count)
{
Iterator nodeIt = m_vis.items(treeNodes);
while(nodeIt.hasNext())
{
Node node = (Node)nodeIt.next();
//=== If the citation count for a paper is lower than the limit
if((Integer.parseInt(node.getString("citCount"))>count)&& !node.getString("refType").equals("FOCUS"))
{
//== Hide the node's VisualItem
m_vis.getVisualItem(treeNodes, node).setVisible(false);
m_vis.getSourceTuple(m_vis.getVisualItem(treeNodes, node)).setString("visible", "false");
//== Hide all edges to the node
Iterator edgeIt = node.edges();
while(edgeIt.hasNext())
{
m_vis.getVisualItem(treeEdges, (Edge)edgeIt.next()).setVisible(false);
}
} //end if
}
m_vis.run("repaint");
}
//###############################################################################################
//==== Hide nodes published in a year before the provided value
public void hideYearsBefore(int year)
{
Iterator nodeIt = m_vis.items(treeNodes);
while(nodeIt.hasNext())
{
Node node = (Node)nodeIt.next();
String paperYear = node.getString("date");
int numChars = paperYear.length();
int pYear = 0;
//=== If the paper has a publication date (i.e. it isn't an empty node)
if(numChars>4)
pYear = Integer.parseInt(paperYear.substring(numChars-4));
//=== If the date for a paper is lower than the limit
if((pYear < year)&& !node.getString("refType").equals("FOCUS"))
{
//== Hide the node's VisualItem
m_vis.getVisualItem(treeNodes, node).setVisible(false);
m_vis.getSourceTuple(m_vis.getVisualItem(treeNodes, node)).setString("visible", "false");
//== Hide all edges to the node
Iterator edgeIt = node.edges();
while(edgeIt.hasNext())
{
m_vis.getVisualItem(treeEdges, (Edge)edgeIt.next()).setVisible(false);
}
} //end if
}
m_vis.run("repaint");
}
//###############################################################################################
//==== Hide nodes published in a year after the provided value
public void hideYearsAfter(int year)
{
Iterator nodeIt = m_vis.items(treeNodes);
while(nodeIt.hasNext())
{
Node node = (Node)nodeIt.next();
String paperYear = node.getString("date");
int numChars = paperYear.length();
int pYear = 0;
//=== If the paper has a publication date (i.e. it isn't an empty node)
if(numChars>4)
pYear = Integer.parseInt(paperYear.substring(numChars-4));
//=== If the date for a paper paper is higher than the limit
if((pYear > year)&& !node.getString("refType").equals("FOCUS"))
{
//== Hide the node's VisualItem
m_vis.getVisualItem(treeNodes, node).setVisible(false);
m_vis.getSourceTuple(m_vis.getVisualItem(treeNodes, node)).setString("visible", "false");
//== Hide all edges to the node
Iterator edgeIt = node.edges();
while(edgeIt.hasNext())
{
m_vis.getVisualItem(treeEdges, (Edge)edgeIt.next()).setVisible(false);
}
} //end if
}
m_vis.run("repaint");
}
//##############################################################################################
//==== Hide all nodes not in the search group
public void hideNonSearchNodes()
{
Iterator nodeIt = m_vis.items(treeNodes);
while(nodeIt.hasNext())
{
Node node = (Node)nodeIt.next();
//=== If the paper is not in the search group
if((!m_vis.getGroup(Visualization.SEARCH_ITEMS).containsTuple(node))&& !node.getString("refType").equals("FOCUS"))
{
//== Hide the node's VisualItem
m_vis.getVisualItem(treeNodes, node).setVisible(false);
m_vis.getSourceTuple(m_vis.getVisualItem(treeNodes, node)).setString("visible", "false");
//== Hide all edges to the node
Iterator edgeIt = node.edges();
while(edgeIt.hasNext())
{
m_vis.getVisualItem(treeEdges, (Edge)edgeIt.next()).setVisible(false);
}
} //end if
}
m_vis.run("repaint");
}
//##############################################################################################
//==== Hide all nodes that have only one edge
public void hidePeripheraryNodes()
{
Iterator nodeIt = m_vis.items(treeNodes);
while(nodeIt.hasNext())
{
Node node = (Node)nodeIt.next();
//=== If the node has fewer than 2 edges
if((node.getDegree()<2)&& !node.getString("refType").equals("FOCUS"))
{
//== Hide the node's VisualItem
m_vis.getVisualItem(treeNodes, node).setVisible(false);
m_vis.getSourceTuple(m_vis.getVisualItem(treeNodes, node)).setString("visible", "false");
//== Hide all edges to the node
Iterator edgeIt = node.edges();
while(edgeIt.hasNext())
{
m_vis.getVisualItem(treeEdges, (Edge)edgeIt.next()).setVisible(false);
}
} //end if
}
m_vis.run("repaint");
}
//###############################################################################################
//==== Hide nodes that don't have user comments
public void hideNonCommentNodes()
{
Iterator nodeIt = m_vis.items(treeNodes);
while(nodeIt.hasNext())
{
Node node = (Node)nodeIt.next();
//=== If the citation count for a paper is lower than the limit
if((node.getString("comment").equals(""))&& !node.getString("refType").equals("FOCUS"))
{
//== Hide the node's VisualItem
m_vis.getVisualItem(treeNodes, node).setVisible(false);
m_vis.getSourceTuple(m_vis.getVisualItem(treeNodes, node)).setString("visible", "false");
//== Hide all edges to the node
Iterator edgeIt = node.edges();
while(edgeIt.hasNext())
{
Edge edge = (Edge)edgeIt.next();
m_vis.getVisualItem(treeEdges, edge).setVisible(false);
}
} //end if
}
m_vis.run("repaint");
}
//##############################################################################################
//==== Hide all nodes that have only one edge
public void showAllNodes()
{
Iterator nodeIt = m_vis.items(treeNodes);
while(nodeIt.hasNext())
{
Node node = (Node)nodeIt.next();
//== Show all the nodes
m_vis.getVisualItem(treeNodes, node).setVisible(true);
m_vis.getSourceTuple(m_vis.getVisualItem(treeNodes, node)).setString("visible", "true");
} //end while
//== Show all edges
Iterator edgeIt = m_vis.items(treeEdges);
while(edgeIt.hasNext())
{
Edge edge = (Edge)edgeIt.next();
m_vis.getVisualItem(treeEdges, edge).setVisible(true);
}
m_vis.run("repaint");
}
//##############################################################################################
//==== Return the data graph
public Graph getDataGraph()
{
return this.currentGraph;
}
//##############################################################################################
//==== Return the Visualization object
public Visualization getVisualization()
{
return this.m_vis;
}
//##############################################################################################
//==== Return the JPanel with the RadialGraph contents
public static JPanel getGraphDisplayPanel()
{
return graphDisplay;
}
} // end of class RadialGraph