Bug 300025 - [GraphLayout] CompoundDirectedGraph does not layout properly
Summary: [GraphLayout] CompoundDirectedGraph does not layout properly
Status: NEW
Alias: None
Product: GEF
Classification: Tools
Component: GEF-Legacy GEF (MVC) (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: gef-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-19 03:40 EST by Vijay Raj CLA
Modified: 2012-03-22 10:10 EDT (History)
3 users (show)

See Also:


Attachments
GEF Flow Editor Example File (3.43 KB, application/octet-stream)
2010-01-19 03:41 EST, Vijay Raj CLA
no flags Details
Same error visible in my implementation (23.94 KB, image/gif)
2010-01-19 03:43 EST, Vijay Raj CLA
no flags Details
Same error visible in my implementation (23.52 KB, image/gif)
2010-01-19 03:44 EST, Vijay Raj CLA
no flags Details
Problematic GEF FlowDiagram (9.28 KB, image/png)
2012-03-22 10:10 EDT, Arieh Bibliowicz CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vijay Raj CLA 2010-01-19 03:40:14 EST
Build Identifier: Build id: I20091030-1201

I have created a file using GEF Flow example,
When opened using Flow Example editor you can see that the a particular sub graph (parallel flow is not visible fully),

I can implemented a flow chart using the same graphlayoutmanager principle in that this type of error occurs frequently.

I will attach both files so that you can view them.

Reproducible: Always

Steps to Reproduce:
1.Take GEF Flow example plugin.
2.Run it as an eclipse application.
3.Open the attached layouterror.flow in GEF FLOW editor.
4.At the end of the diagram you can see a particular subgraph(parallel flow not visible fully)
Comment 1 Vijay Raj CLA 2010-01-19 03:41:36 EST
Created attachment 156483 [details]
GEF Flow Editor Example File
Comment 2 Vijay Raj CLA 2010-01-19 03:43:25 EST
Created attachment 156484 [details]
Same error visible in my implementation
Comment 3 Vijay Raj CLA 2010-01-19 03:44:03 EST
Created attachment 156485 [details]
Same error visible in my implementation
Comment 4 Vijay Raj CLA 2010-01-29 07:48:55 EST
The problems seems to be the subgraphs which has no children....

public void contributeNodesToGraph(CompoundDirectedGraph graph, Subgraph s, Map map)
    {
        GraphAnimation.recordInitialState(getContentPane());
        Subgraph me = new Subgraph(this, s);
        // me.rowOrder = getActivity().getSortIndex();
        me.outgoingOffset = 5;
        me.incomingOffset = 5;
        IFigure fig = getFigure();
        if (fig instanceof SubgraphFigure)
        {
            me.width = fig.getPreferredSize(me.width, me.height).width;
            int tagHeight = ((SubgraphFigure)  fig).getHeader().getPreferredSize().height;
            me.insets.top = tagHeight;
            me.insets.left = 0;
            me.insets.bottom = tagHeight;
        }
        me.innerPadding = INNER_PADDING;
        me.setPadding(PADDING);
        map.put(this, me);
        graph.nodes.add(me);
        for (int i = 0; i < getChildren().size(); i++)
        {
            ActivityPart activity = (ActivityPart) getChildren().get(i);
            activity.contributeNodesToGraph(graph, me, map);
        }
        *if (getChildren().size() == 0)
        *{
        *    Object object = new Object();
        *    Node n = new Node(object, me);
        *    n.outgoingOffset = getAnchorOffset();
        *    n.incomingOffset = getAnchorOffset();
        *    n.width = 10;
        *    n.height = 10;
        *    n.setPadding(new Insets(10, 8, 10, 12));
        *    map.put(object, n);
        *    graph.nodes.add(n);
        *}
    }

See the * code...
if i add these line the result is different..
Comment 5 Vijay Raj CLA 2010-09-15 06:33:09 EDT
Any progress on this...

will it be fixed or not????
Comment 6 Alex Boyko CLA 2010-09-15 14:36:27 EDT
Why do you think it's a CompoundGraphLayout problem?
It's just a graph layout, has nothing to do with figure layout, clipping and rendering. The nodes that are clipped (to which connections are going, but nodes themselves don't show) most likely are children of the compartments (editparts other than the diagram editpart) the layout installed on figures of those editparts is not allowing for sizing the figure such that it fits its contents. If you had a ScrollPane than you'd be able to scroll to those editparts. What's the layout constraint for container (or compartment)  editparts? (should be a rectangle (x,y,-1,-1))
Comment 7 Vijay Raj CLA 2010-09-16 04:20:51 EDT
(In reply to comment #6)
> Why do you think it's a CompoundGraphLayout problem?

Cuz as specified in comment 4 the problem is fixed when i add a dummy node to the subgraph

> It's just a graph layout, has nothing to do with figure layout, clipping and
> rendering. The nodes that are clipped (to which connections are going, but
> nodes themselves don't show) most likely are children of the compartments
> (editparts other than the diagram editpart) the layout installed on figures of
> those editparts is not allowing for sizing the figure such that it fits its
> contents. If you had a ScrollPane than you'd be able to scroll to those
> editparts. What's the layout constraint for container (or compartment) 
> editparts? (should be a rectangle (x,y,-1,-1))

I have attached flowExample2.flow file which can be opened using GEF Flow editor example,once you open this file you will notice the bug,hence the issue is inherent in CompoundDirectedGraphLayout.some how when some subgraphs are empty or nested the CompoundDirectedGraphLayout fails to calculate the positions relative to subgraps ,instead it calculates them as absolute.
Comment 8 Arieh Bibliowicz CLA 2012-03-22 10:10:49 EDT
Created attachment 213055 [details]
Problematic GEF FlowDiagram

Something in the diagram's layout or rendering is not correct. A link is not attached to any visible element in the diagram