Specific Layout

Hi,
I am evaluating the JGO for one of our requirements. Our requirement wants us to show the graph in a perticular fashion, but the autolayout does not support that kind of layout. I would like know whether this kind of layout can be drawn using JGO autolayout or is there any other workaround.
Here is the Layout that we want:::
There will be a center Node which will have more nodes on both right and left side of it. something like
Node1<— —>node3
| |
<—Center Node—>
| |
Node2<— —>Node4


I tried JGOLayeredDigraph. But this does not seems to be giving the desired results.
Thanks a lot
Mayank Joshi.

What you’ll need to do is split your document into two parts: one part will be laid out toward the left, the other toward the right. After doing both layouts, you’ll need to move one (or both) of the parts so that their "root"s are at the same point, and so that both together fit where you want them to be.
To layout a specific collection of nodes and links, you’ll need to create a JGoNetwork that has JGoNetworkNodes and JGoNetworkLinks that correspond to the half-graph-plus-root that you want to lay out. It might be easiest to create it with the whole document, and then remove the nodes you don’t want:
JGoNetwork net = new JGoNetwork(myDocument);
. . . call net.deleteNode() on each of the JGoNodes that you don’t want to layout in this turn . . .
JGoLayeredDigraphAutoLayout layout = new JGoLayeredDigraphAutoLayout(myDocument, net);
. . . set any layered-digraph options . . .
layout.performLayout();
After doing the first (half) layout, remember the root node position, and then do the second half layout. Then select all the nodes and links from the second layout, and call JGoView.moveSelection with an offset so that the new root node position matches the original one.

Hi Walter
When applying your idea, I have problems with deleteing nodes
Have you a clue where the error comes from?
Thank you,
Ali
HERE IS THE CODE

JGoNetwork netFirstHalf = new JGoNetwork(doc);
JGoNetworkNode[] nodesFirstHalf = netFirstHalf.getNodeArray();
for (int i = 0; i < nodesFirstHalf.length; i++)
{
GraphNode gn = (GraphNode)nodesFirstHalf.getJGoObject();
if ( REVERSED.equalsIgnoreCase(gn.getShapeDirection()) )
{
netFirstHalf.deleteNode( nodesFirstHalf ); <— DEBUGGER STOPS HERE
}
}
HERE IS THE RUNTIME ERROR
java.util.ConcurrentModificationException
at java.util.LinkedList$ListItr.checkForComodification(LinkedLi st.java:552)
at java.util.LinkedList$ListItr.next(LinkedList.java:488)
at com.nwoods.jgo.layout.JGoNetwork.deleteNode(Unknown Source)

I don’t understand how that code could compile, since the argument to JGoNetwork.deleteNode should be either a JGoNetworkNode, or a JGoObject for which it finds a JGoNetworkNode to be deleted from the network.
Normally one would get that error from deleting something from a collection while iterating over that collection.

Thank you !
Sorry about the symbol [ i ] that puts everything in italic (which I didn’t mean) and disappeared from the text I want to show.
HERE AGAIN THE CODE WITH RIGHT TYPE
for (int i = 0; i < nodesFirstHalf.length; i++)
{
GraphNode gn = (GraphNode)nodesFirstHalf[ i ].getJGoObject();
if ( REVERSED.equalsIgnoreCase(gn.getShapeDirection()) )
{
netFirstHalf.deleteNode( nodesFirstHalf[ i ] ); <— DEBUGGER STOPS HERE
}
}

Anyway, thank you for the tip!
Ali