Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » [Zest/Draw2d] Custom figure button event
[Zest/Draw2d] Custom figure button event [message #247248] Thu, 12 February 2009 12:43 Go to next message
Bianca Thelen is currently offline Bianca ThelenFriend
Messages: 26
Registered: July 2009
Junior Member
Hello everybody,

I have a Zest graph to which a custom figure can be added. The simplest
graph looks like this:

--------------
| Step 2 | + | <- StepFigure extends IFigure
--------------
| Document | <- DocumentFigure extends IFigure
--------------
^
|
|
--------------
| Step 1 | + | <- StepFigure extends IFigure
--------------
<- DocumentFigures aren't displayed...

Via the plus button document figures can be added to the step figure.
This works perfectly - but only for the last step figure added to the
graph (in this case Step 2). A document figure can be added to any other
step figure (here Step 1) but it isn't displayed. I've tried calling
revalidate and repaint on the step figure in question but that didn't
help. Does anybody know what I'll have to do to force Step 1 to display
the document figures added?

Kind regards,
Bianca
Re: [Zest/Draw2d] Custom figure button event [message #247297 is a reply to message #247248] Fri, 13 February 2009 16:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: irbull.cs.uvic.ca

It is likely a layout issue. Can you force the size of the StepFigures
to be really big.

Can you post a snippet showing the problem?

cheers,
ian

Bianca wrote:
> Hello everybody,
>
> I have a Zest graph to which a custom figure can be added. The simplest
> graph looks like this:
>
> --------------
> | Step 2 | + | <- StepFigure extends IFigure
> --------------
> | Document | <- DocumentFigure extends IFigure
> --------------
> ^
> |
> |
> --------------
> | Step 1 | + | <- StepFigure extends IFigure
> --------------
> <- DocumentFigures aren't displayed...
>
> Via the plus button document figures can be added to the step figure.
> This works perfectly - but only for the last step figure added to the
> graph (in this case Step 2). A document figure can be added to any other
> step figure (here Step 1) but it isn't displayed. I've tried calling
> revalidate and repaint on the step figure in question but that didn't
> help. Does anybody know what I'll have to do to force Step 1 to display
> the document figures added?
>
> Kind regards,
> Bianca
Re: [Zest/Draw2d] Custom figure button event [message #247312 is a reply to message #247297] Sun, 15 February 2009 16:04 Go to previous messageGo to next message
Bianca Thelen is currently offline Bianca ThelenFriend
Messages: 26
Registered: July 2009
Junior Member
This is a multi-part message in MIME format.
--------------010605010208090200000307
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

> It is likely a layout issue. Can you force the size of the StepFigures
> to be really big.

I set the size of the StepFigure to 1000, 1000 and when I then added the
DocumentFigures they were drawn. So I need to force the StepFigure to
resize. I've tried revalidate(), repaint() and some other calls but
nothing really worked.

> Can you post a snippet showing the problem?

I've attached the classes I wrote to test what I want to achieve with
Zest and Draw2d. The items from the viewer on the left can be dropped on
any node in the graph.

Kind regards
Bianca


--------------010605010208090200000307
Content-Type: application/octet-stream;
name="GraphTest.zip"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="GraphTest.zip"

UEsDBBQACAAIAAuITzoAAAAAAAAAAAAAAAAlAAAAWmVzdFRlc3Qvc3JjL3Rl c3QvRG9jdW1l
bnRGaWd1cmUuamF2YY1TUUvDMBB+L/Q/hD2l0BXniw/DB0WUQQWZ/oEsvWXB NgnJ1Tll/922
SWc7pRpKc819d/flu6th/JUJIAgOl3EUR7Iy2iLRVmTAS2kcZIVl+8siu9k4 tIzjrbYF2OUU
9F6K2sIk5MEys5Pc/QGSRc4OusZJ2Oof9XK2gXISIUBXgPaQrZQDdJ0acWTq TSk54SVzjtxp
Xleg0Ncj8I6gCkfC52cckWb5d4gbR9CkB7XL1QYsTZbfJ9/3JaXfromC/eCc XqVky0oHw7CG
rvc+MtU001IffAbxfaNtvjGr4EiGeFYUHbKTjc7GAbPkLPWz/AA6X6Rkvug9 x1a81vhNOV/x
pN94soYSBRV9R4gA9BYNHSfbbhup2i4LWFvVSRcCGm4X/hlSP5Ec1HrTsiCG SYVnVVLSzywR
wUh7ZrLbfvDocd2I5VIBba7w1OZeA0emRAm0Tx5SNGOIL9rksEWapM1/WZkW G47XUuxw3Knj
SW8/fI3xBVBLBwjmL+H6dAEAANUDAABQSwMEFAAIAAgAC4hPOgAAAAA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
--------------010605010208090200000307--
Re: [Zest/Draw2d] Custom figure button event [message #247453 is a reply to message #247312] Fri, 20 February 2009 15:41 Go to previous messageGo to next message
Bianca Thelen is currently offline Bianca ThelenFriend
Messages: 26
Registered: July 2009
Junior Member
>> It is likely a layout issue.

I've had some more time to debug and found the following.

AbstractLayout#getPreferredSize returns the preferredSize of the figure
to which other figures can be added with no problem. So when I set the
preferredSize to null while debugging this code was run:

Thread [main] (Suspended (breakpoint at line 164 in ToolbarLayout))
ToolbarLayout.calculatePreferredSize(IFigure, int, int) line: 164
ToolbarLayout(AbstractLayout).getPreferredSize(IFigure, int, int) line: 96
ToolbarLayout(AbstractHintLayout).getPreferredSize(IFigure, int, int)
line: 87
StepContainerFigure(Figure).getPreferredSize(int, int) line: 735
FreeformLayout(XYLayout).layout(IFigure) line: 103
Figure$LayoutNotifier.layout(IFigure) line: 1812
ZestRootLayer(Figure).layout() line: 1029
ZestRootLayer(Figure).validate() line: 1739
ScalableFreeformLayeredPane(Figure).validate() line: 1741
FreeformViewport$FreeformViewportLayout.calculatePreferredSi ze(IFigure,
int, int) line: 28
FreeformViewport$FreeformViewportLayout(AbstractLayout).getP referredSize(IFigure,
int, int) line: 93
FreeformViewport$FreeformViewportLayout(AbstractHintLayout). getPreferredSize(IFigure,
int, int) line: 85
FreeformViewport(Figure).getPreferredSize(int, int) line: 735
ScrollPaneSolver.solve(Rectangle, Viewport, int, int, int, int) line: 75
Graph(FigureCanvas).layoutViewport() line: 297
FigureCanvas.access$4(FigureCanvas) line: 295
FigureCanvas$3.notifyValidating() line: 260
DeferredUpdateManager(UpdateManager).fireValidating() line: 123
DeferredUpdateManager.performValidation() line: 203
DeferredUpdateManager.performUpdate() line: 179
DeferredUpdateManager$UpdateRequest.run() line: 48
RunnableLock.run() line: 35
Synchronizer.runAsyncMessages(boolean) line: 133
Display.runAsyncMessages(boolean) line: 3800
Display.readAndDispatch() line: 3425
GraphTest.main(String[]) line: 85

The thing that differs now from the other figure that does resize when a
figure is added to it is this code. But I have no idea where that might
be triggered...

Thread [main] (Suspended (breakpoint at line 164 in ToolbarLayout))
ToolbarLayout.calculatePreferredSize(IFigure, int, int) line: 164
ToolbarLayout(AbstractLayout).getPreferredSize(IFigure, int, int) line: 96
ToolbarLayout(AbstractHintLayout).getPreferredSize(IFigure, int, int)
line: 87
StepContainerFigure(Figure).getPreferredSize(int, int) line: 735
FreeformLayout(XYLayout).layout(IFigure) line: 103
Figure$LayoutNotifier.layout(IFigure) line: 1812
ZestRootLayer(Figure).layout() line: 1029
ZestRootLayer(Figure).validate() line: 1739
ScalableFreeformLayeredPane(Figure).validate() line: 1741
FreeformViewport(Figure).validate() line: 1741
FreeformViewport(Viewport).validate() line: 363
LightweightSystem$RootFigure(Figure).validate() line: 1741
DeferredUpdateManager.performValidation() line: 207
DeferredUpdateManager.performUpdate() line: 179
DeferredUpdateManager$UpdateRequest.run() line: 48
RunnableLock.run() line: 35
Synchronizer.runAsyncMessages(boolean) line: 133
Display.runAsyncMessages(boolean) line: 3800
Display.readAndDispatch() line: 3425
GraphTest.main(String[]) line: 85
Re: [Zest/Draw2d] Custom figure button event [message #247572 is a reply to message #247453] Tue, 03 March 2009 07:25 Go to previous messageGo to next message
Bianca Thelen is currently offline Bianca ThelenFriend
Messages: 26
Registered: July 2009
Junior Member
> --------------
> | Step 2 | + | <- StepFigure extends IFigure
> --------------
> | Document | <- DocumentFigure extends IFigure
> --------------
> ^
> |
> |
> --------------
> | Step 1 | + | <- StepFigure extends IFigure
> --------------
> <- DocumentFigures aren't displayed...
>
> Via the plus button document figures can be added to the step figure.

>>> It is likely a layout issue.

As soon as a figure is moved it isn't repainted/resized when the button
is clicked. Do I need to call any special method or set a flag so that
the figure is repainted again?
Problem with custom figures when moving in the graph [message #248807 is a reply to message #247572] Wed, 06 May 2009 00:35 Go to previous messageGo to next message
Tiago Proenca is currently offline Tiago ProencaFriend
Messages: 6
Registered: July 2009
Junior Member
This move issue is happening with me also... Basically I have a custom
figure that expand/collapse... It works well when I open my view and
switch from expand to collapse and vice-versa. However, if I move some
node the figure doesn't adjust the size. In other words, it stop to
collapse.

Any ideas about that?

Tiago

Bianca wrote:
> > --------------
> > | Step 2 | + | <- StepFigure extends IFigure
> > --------------
> > | Document | <- DocumentFigure extends IFigure
> > --------------
> > ^
> > |
> > |
> > --------------
> > | Step 1 | + | <- StepFigure extends IFigure
> > --------------
> > <- DocumentFigures aren't displayed...
> >
> > Via the plus button document figures can be added to the step figure.
>
>>>> It is likely a layout issue.
>
> As soon as a figure is moved it isn't repainted/resized when the button
> is clicked. Do I need to call any special method or set a flag so that
> the figure is repainted again?
Re: Problem with custom figures when moving in the graph [message #248926 is a reply to message #248807] Tue, 12 May 2009 22:46 Go to previous message
Tiago Proenca is currently offline Tiago ProencaFriend
Messages: 6
Registered: July 2009
Junior Member
I found two solutions:

1) override the method getSize() of GraphNode and return a new
Dimension(-1,-1);

2) When you are collapsing/expanding, before call the algorithm, get the
node's figure and do:

Point loc = getLocation();
Dimension size = new Dimension(-1,-1);
Rectangle bounds = new Rectangle(loc, size);
fig.getParent().setConstraint(fig,bounds);
// Call the collapse/expand algorithm

:)

Tiago Proenca wrote:
> This move issue is happening with me also... Basically I have a custom
> figure that expand/collapse... It works well when I open my view and
> switch from expand to collapse and vice-versa. However, if I move some
> node the figure doesn't adjust the size. In other words, it stop to
> collapse.
>
> Any ideas about that?
>
> Tiago
>
> Bianca wrote:
>> > --------------
>> > | Step 2 | + | <- StepFigure extends IFigure
>> > --------------
>> > | Document | <- DocumentFigure extends IFigure
>> > --------------
>> > ^
>> > |
>> > |
>> > --------------
>> > | Step 1 | + | <- StepFigure extends IFigure
>> > --------------
>> > <- DocumentFigures aren't displayed...
>> >
>> > Via the plus button document figures can be added to the step figure.
>>
>>>>> It is likely a layout issue.
>>
>> As soon as a figure is moved it isn't repainted/resized when the
>> button is clicked. Do I need to call any special method or set a flag
>> so that the figure is repainted again?
Previous Topic:Render partly transparent SVG image for GEF FreeformLayer
Next Topic:[Announce] GEF 3.5.0 I200905121850 is available
Goto Forum:
  


Current Time: Fri Apr 19 08:27:25 GMT 2024

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

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

Back to the top