Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How (and when) to choose the scale of figures
How (and when) to choose the scale of figures [message #700974] Sun, 24 July 2011 11:00 Go to next message
Phil  is currently offline Phil Friend
Messages: 4
Registered: April 2010
Junior Member
I'm new to GEF and I'm trying to use it to develop some interactive charts. I have several different kinds of chart but they all share the feature that some of the figures are sized in proportion to an attribute of the corresponding model. The charts typically have several different kinds of figure that should use the same scale (model units/graphics units).

The problem I have is that different parts of the chart use different EditPart and LayoutManager instances but I need to know about all of the figures that go into the scale calculation before I can set the scale. I'd like to keep the EditParts and LayoutManagers reasonably independent of each other to allow reuse across the different kinds of chart and avoid a monolithic chart EditPart.

The attachment shows the simplest of the charts, the blue bars represent data streams, the width of the bars should be proportional to the data rate of the streams, the chart also contains a higher level grouping of data streams into data services (green bars), and a data rate axis. All these sets of figures should be shown at the same X scale. Some of the charts need scaling in the X axis only, some also scale in the Y axis.

My intention is to choose the initial scale of the figures so that the figure that requires the largest scale to meets its minimum size requirement sets the scale for the whole chart. So in the attached example, the scale needed to show the label of stream 1 would set the scale of the other streams, the services and the axis figure.

So three questions:
1. What's the best place in the code that builds the EditPart and Figure trees to get information about the whole figure tree, or at least some subtree that contains all the figures that need to share a common scale.

2. Once I've worked out the scale to use, how should I push that scale information down into layout managers?

3. Is there a better way to do this? Especially one that allows me to reuse components of the charts.

Thanks
Phil
Re: How (and when) to choose the scale of figures [message #701107 is a reply to message #700974] Sun, 24 July 2011 16:28 Go to previous messageGo to next message
Phil  is currently offline Phil Friend
Messages: 4
Registered: April 2010
Junior Member
I defined the scale incorrectly in 3rd sentence. It should say "The charts typically have several different kinds of figure that should use the same scale (graphics units/model units)."
Re: How (and when) to choose the scale of figures [message #701231 is a reply to message #701107] Sun, 24 July 2011 21:16 Go to previous message
Phil  is currently offline Phil Friend
Messages: 4
Registered: April 2010
Junior Member
The neatest solution that I've been able to come up with is:

1. Provide a scale property in the top level of the chart model.
2. Have EditParts override addNotify() to request the minimum scale that their layoutmanagers require after calling super.addNotify(). They also override activate() and deactivate() to add/remove themselves as listeners of chart scale and implement a propertyChange method that updates their layoutmanagers with scale changes and revalidates them.
3. The chart's top level EditPart overrides activate() to fire a scale property change after all the children have been activated.

Seems to work because activate() is called after construction of the initial figure tree is complete and so all components have requested the minimum scale that they require.
Previous Topic:Traversing while in GEF direct edit
Next Topic:Changing text flow background color
Goto Forum:
  


Current Time: Fri Apr 19 07:02:00 GMT 2024

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

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

Back to the top