// Record layout
graph.recordLayout();
// Create updated graph
pathway p = graph.getPathway();
// Update pathway components if update needed
if (withContent != null)
{
for (pathwayComponent pc : new HashSet<pathwayComponent>(p.getPATHWAY_COMPONENTS()))
{
p.removePATHWAY_COMPONENTS(pc);
}
Set<conversion> convSet = new HashSet<conversion>();
for (GraphObject go : withContent)
{
if (go instanceof Conversion)
{
Conversion conv = (Conversion) go;
conversion cnv = conv.getConversion();
convSet.add(cnv);
}
}
Set<pathwayComponent> components = p.getPATHWAY_COMPONENTS();
for (conversion cnv : convSet)
{
if (!components.contains(cnv))
{
p.addPATHWAY_COMPONENTS(cnv);
}
}
}
// Excise pathway
BioPAXGraph newGraph = main.getRootGraph().excise(p);
newGraph.setName(p.getNAME());
newGraph.setAsRoot();
// Replace the graph
viewer.setContents(newGraph);