Custom GEF edit part questions [message #129722] |
Wed, 09 August 2006 12:42  |
Eclipse User |
|
|
|
Hello,
I have questions on the custom GEF edit part.
We have our own Composite class. In runtime, it will contain some visual information to display, but in JVE, it is displayed as a
blank square.
So we decided to write a custom GEF edit part and show a string property of our own Composite as a Label. I could write the code by
looking at the "VE Rules" example in "Extending The Visual Editor Tutorial". It worked, but I found two problems:
1. When the string property is very long, the string on the Label is truncated. From users' perspective, the Composite should
become bigger if the string property is very long. In the createFigure() method of my custom GEF edit part, I could get the
preferred size of the label. I guess we should use the size for layout, but do not know how.
2. The label is not changed when the string property is updated either on Java source code or on Property sheet. I may need to use
a kind of listener, but could not find examples.
Still on a steep learning curve... Any suggestions would be welcomed. Thank you.
Tami
|
|
|
|
|
|
|
Re: Custom GEF edit part questions [message #129943 is a reply to message #129774] |
Tue, 15 August 2006 16:38  |
Eclipse User |
|
|
|
Fedor Löhrig wrote:
> We had a similar requirement. I believe VE's ContainerGraphicalEditPart to
> be a good example. Have a look at the usage of containerAdapter there, which
> amongst other is listening to changes of the "layout" property.
>
> - Fedor
Thank you for your comments. I gave up writing our own GEF edit part
this time, but when it is needed in the future, I will take a look at
ContanierGraphicalEditPart code.
Tami
|
|
|
Re: Custom GEF edit part questions [message #613747 is a reply to message #129722] |
Wed, 09 August 2006 17:54  |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
I don't recommend trying to create your own custom GEF edit part. The
composite needs to act like a composite. The size of the composite is
determined by the size of the composite. It won't get bigger unless it
is on another composite that has a layout manager and the composites
preferred size has changed.
--
Thanks,
Rich Kulp
|
|
|
|
Re: Custom GEF edit part questions [message #613752 is a reply to message #129722] |
Thu, 10 August 2006 06:47  |
Eclipse User |
|
|
|
Originally posted by: f-l.gmx.net
"Tami Takamiya" <ttakamiy@us.ibm.com> schrieb im Newsbeitrag
news:ebd38r$n5e$1@utils.eclipse.org...
>
> 2. The label is not changed when the string property is updated either on
> Java source code or on Property sheet. I may need to use a kind of
> listener, but could not find examples.
We had a similar requirement. I believe VE's ContainerGraphicalEditPart to
be a good example. Have a look at the usage of containerAdapter there, which
amongst other is listening to changes of the "layout" property.
- Fedor
|
|
|
Re: Custom GEF edit part questions [message #613754 is a reply to message #129749] |
Thu, 10 August 2006 09:20  |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
I may of spoken too aggressively. I was thinking you would be making
custom edit part that was not a subclass of CompositeGraphicalEditPart.
You can make a subclass of CompositeGraphicalEditPart which can put
another GEF figure on top of the standard one just to add your message.
That way it will still act just like a composite to the model but you
can display other things. Take a look at ControlGraphicalEditPart
itself. It adds other figures to the ContentPaneFigure. Do not add
anything to the figure that is set into the
contentPaneFigure.setContentPane(figure) . That is because the "figure"
here is the main one for the control itself and it can only have
children figures that come from the child model editparts, not the extra
figures you want to add.
Tami Takamiya wrote:
> Rich Kulp wrote:
>
>> I don't recommend trying to create your own custom GEF edit part.
>
>
> Rich,
>
> Thank you for your comments (always). I will try to find another
> approach to satisfy the requirement.
>
> Tami
--
Thanks,
Rich Kulp
|
|
|
Re: Custom GEF edit part questions [message #613778 is a reply to message #129774] |
Tue, 15 August 2006 16:38  |
Eclipse User |
|
|
|
Fedor Löhrig wrote:
> We had a similar requirement. I believe VE's ContainerGraphicalEditPart to
> be a good example. Have a look at the usage of containerAdapter there, which
> amongst other is listening to changes of the "layout" property.
>
> - Fedor
Thank you for your comments. I gave up writing our own GEF edit part
this time, but when it is needed in the future, I will take a look at
ContanierGraphicalEditPart code.
Tami
|
|
|
Powered by
FUDForum. Page generated in 0.06098 seconds