Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » [SOLVED] Problem to show a XML hierarchy of objects using GEF
[SOLVED] Problem to show a XML hierarchy of objects using GEF [message #531580] Wed, 05 May 2010 13:23 Go to next message
Alexandre  is currently offline Alexandre
Messages: 4
Registered: May 2010
Junior Member
Hello

I'm new to GEF and I'm trying to show a hierarchy of objects whose are loaded from a XML file (I put an example of my XML file in the end of the post).

In this hierarchy I have only two kinds of objects (KIND_ONE and KIND_TWO).

I've created a org.eclipse.draw2d.Figure and an org.eclipse.draw2d.EditPart for KIND_ONE and a ...Figure and ...EditPart for KIND_TWO.

The XML is loading ok and the EditParts and Figures are also being created ok.

The KIND_ONE figure is using a BorderLayout as it contains sub-elements.

THE PROBLEM: While "rendering" this hierarchical structure only the elements 10,11,12,13 and 14 (the last ones of the hierarchy) are rendered. But if I use the FlowLayout or the ToolbarLayout all the elements are rendered but not as I would like to show them.

I've spent three days trying many things and reading tutorials and I didn't find any solution.

Any help is apreciated.

Thanks,

Alexandre.

I'm using:
Eclipse 3.4.2
GEF 3.5.1

Classes:
ScrollingGraphicalViewer
ScalableRootEditPart
AbstractGraphicalEditPart
Figure

My XML file:
<XML>
<KIND_ONE ID="1">
    <KIND_ONE ID="2">
        <KIND_ONE ID="3">
        </KIND_ONE>

        <KIND_TWO ID="4"/>

        <KIND_ONE ID="5">
        </KIND_ONE>

        <KIND_TWO ID="6"/>

        <KIND_ONE ID="7">
        </KIND_ONE>

        <KIND_TWO ID="8"/>

    </KIND_ONE>

    </KIND_TWO ID="9">

    <KIND_ONE ID="10">
        <KIND_ONE ID="11">
        </KIND_ONE>

        <KIND_TWO ID="12"/>

    </KIND_ONE>
    
    <KIND_TWO ID="13"/>

</KIND_ONE>

<KIND_TWO ID="14"/>
</XML>

[Updated on: Fri, 07 May 2010 10:02]

Report message to a moderator

Re: Problem to show a XML hierarchy of objects using GEF [message #532134 is a reply to message #531580] Fri, 07 May 2010 09:55 Go to previous messageGo to next message
Alexandre  is currently offline Alexandre
Messages: 4
Registered: May 2010
Junior Member
Ok, problem solved! Very Happy

After a week digging into documentation and tutorials I've found the solution by my self.

The problem was the arrangement of different layouts.

Firstly (when I was having problems) I was just using BorderLayout. After I've reimplemented my project as a generic version and I realized that I was adding all the sub-elements with the constraint BorderLayout.CENTER. Thus, all the sub-elements were put in the center of the Figure (one above the other) and doing this just the last figure of the last added sub-element was apearing on the screen.

SOLUTION: I've combined the use of BorderLayout and ToolbarLayout to get the desired effect I was looking for and now it works.

I'm finishing to implement a generic version of my project as an example of how to combine the different Layouts to get the desired effect and I can send to someone if interested.
Re: Problem to show a XML hierarchy of objects using GEF [message #854516 is a reply to message #532134] Tue, 24 April 2012 02:42 Go to previous message
song yang is currently offline song yang
Messages: 1
Registered: April 2012
Junior Member
would you mind send me a copy of your project ,i am troubled in the same question when using GEF.thank you very much .my email:scn19860727@163.com
Previous Topic:To delete an object in gef using the delete key
Next Topic:Force the GraphicalViewer of a GraphicalEditorWithFlyoutPalette to show a specific composite
Goto Forum:
  


Current Time: Sat Oct 25 09:43:36 GMT 2014

Powered by FUDForum. Page generated in 0.01640 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software