* @return Object[] Array of parallel edges (include edge passed on
* argument)
*/
protected Object[] getParallelEdges(GraphLayoutCache cache, EdgeView edge,
CellView cellView1, CellView cellView2) {
GraphModel model = cache.getModel();
Object cell1 = cellView1.getCell();
Object cell2 = cellView2.getCell();
// Need to exit if a load has just been performed and the model
// isn't in place properly yet
Object[] roots = DefaultGraphModel.getRoots(model);
if (roots.length == 0) {
return null;
}
// Need to order cells so direction of the edges doesn't
// affect the ordering of the output edges
Object[] cells = new Object[] { cell1, cell2 };
cells = DefaultGraphModel.order(model, cells);
if (cells == null || cells.length < 2) {
return null;
}
cell1 = cells[0];
cell2 = cells[1];
// System.out
// .println("cell1 of parallel edges = "
// + String.valueOf(((DefaultGraphCell) cell1)
// .getUserObject()));
while (model.getParent(cell1) != null && !cache.isVisible(cell1)) {
cell1 = model.getParent(cell1);
// if (cache.isVisible(cell1)) {
// System.out
// .println("cell1 promoted to = "
// + String.valueOf(((DefaultGraphCell) cell1)
// .getUserObject()));
// }
}
// System.out
// .println("cell2 of parallel edges = "
// + String.valueOf(((DefaultGraphCell) cell2)
// .getUserObject()));
while (model.getParent(cell2) != null && !cache.isVisible(cell2)) {
cell2 = model.getParent(cell2);
// if (cache.isVisible(cell2)) {
// System.out
// .println("cell2 promoted to = "
// + String.valueOf(((DefaultGraphCell) cell2)
// .getUserObject()));