Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community Forums[Zest/Draw2d] Custom figure button event
https://www.eclipse.org/forums/index.php/mv/msg/79545/247248/#msg_247248
I have a Zest graph to which a custom figure can be added. The simplest
graph looks like this:
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?
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]]>2009-02-13T16:53:31-00:00Re: [Zest/Draw2d] Custom figure button event
https://www.eclipse.org/forums/index.php/mv/msg/79545/247312/#msg_247312
--------------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.
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:
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...
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?]]>Bianca Thelen2009-03-03T07:25:28-00:00Problem with custom figures when moving in the graph
https://www.eclipse.org/forums/index.php/mv/msg/79545/248807/#msg_248807
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?]]>Tiago Proenca2009-05-06T00:35:45-00:00Re: Problem with custom figures when moving in the graph
https://www.eclipse.org/forums/index.php/mv/msg/79545/248926/#msg_248926
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?]]>Tiago Proenca2009-05-12T22:46:39-00:00