public void actionPerformed(ActionEvent e) {
Collection picked =new HashSet(vv.getPickedVertexState().getPicked());
if(picked.size() == 1) {
Object root = picked.iterator().next();
Forest inGraph = (Forest)layout.getGraph();
try {
collapser.collapse(vv.getGraphLayout(), inGraph, root);
} catch (InstantiationException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IllegalAccessException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
vv.getPickedVertexState().clear();
vv.repaint();
}
}});
JButton expand = new JButton("Expand");
expand.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Collection picked = vv.getPickedVertexState().getPicked();
for(Object v : picked) {
if(v instanceof Forest) {
Forest inGraph = (Forest)layout.getGraph();
collapser.expand(inGraph, (Forest)v);
}
vv.getPickedVertexState().clear();
vv.repaint();
}