|
Re: Double click to open problem caused by label [message #150430 is a reply to message #150144] |
Wed, 12 September 2007 14:30 |
Eclipse User |
|
|
|
Originally posted by: slorenc.infogix.com
The problem you are facing is that the figure you have is using StackLayout.
So the label figure is drawn on top of the figure below and it occupies the
whole area occupied by the whole figure. In my case I had a figure which
was an image and a label on top of it. I decided that the only way around
the double click being eaten is to design a figure (via Figure Descriptor)
which consists of Rectangle, with a FlowLayout and then I placed my image
figure inside it. I also decided to move the label below the image so that
when I click on the image, the double click is handled by image figure and
not the label.
In addition to this I also had to change the way the label figure is added
to the list of children figures of the rectangle figure. In my generated
inner class which derives from RectangleFigure I overrode the following
method so that a child (a label) is always added at the end of the list of
children. For some reason the GMF or GEF code is always adding it at index
which is derived from a loop counter. the loop loops over the children
items that don't have edit parts and creates them and then adds them at
index. Well since the only child without and edit part was a label it
creates it at index 0 so it resulted in the label appearing above my image.
After overriding add method it started appearing below.
@Override
public void add(IFigure figure, Object constraint, int index) {
super.add(figure, constraint, -1); // add it at the end of children list
}
Swavek
"Hao Zhang" <bjzhanghao@21cn.com> wrote in message
news:fc7l8d$htf$1@build.eclipse.org...
> Hi all,
> I use editpolicyProvider to open a dialog when user double clicks an
> editpart (ActionEditPart), the problem is the label figure got selected
> when user double clicks because label figure is on top of action figure,
> so open request is not sent to ActionEditpart but ActionLabelEditpart. Is
> there any way to make the label figure "transparent" in this situation?
>
> Regards,
> Hao
>
>
|
|
|
|
Re: Double click to open problem caused by label [message #196588 is a reply to message #150779] |
Fri, 11 July 2008 09:15 |
Hugues Rérolle Messages: 60 Registered: July 2009 |
Member |
|
|
Hi Hao,
I have the same problem and I want to install editplociy on the label,
but it's not an EditPart.
Did you solved your problem ?
Have you some hints ?
Thanks in advance
Hugues
Hao Zhang wrote:
> My workaround is to install an editpolicy for label editpart like this:
>
> installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy() {
>
> @Override
> public EditPart getTargetEditPart(Request request) {
> if (understandsRequest(request))
> return getHost().getParent();
> return super.getTargetEditPart(request);
> }
>
> });
>
>
> "Swavek Lorenc" <slorenc@infogix.com> дÈëÏûÏ¢ÐÂÎÅ:fc8t5s$ucj$1@build.eclipse.org...
>> The problem you are facing is that the figure you have is using
>> StackLayout. So the label figure is drawn on top of the figure below and
>> it occupies the whole area occupied by the whole figure. In my case I had
>> a figure which was an image and a label on top of it. I decided that the
>> only way around the double click being eaten is to design a figure (via
>> Figure Descriptor) which consists of Rectangle, with a FlowLayout and then
>> I placed my image figure inside it. I also decided to move the label
>> below the image so that when I click on the image, the double click is
>> handled by image figure and not the label.
>>
>> In addition to this I also had to change the way the label figure is added
>> to the list of children figures of the rectangle figure. In my generated
>> inner class which derives from RectangleFigure I overrode the following
>> method so that a child (a label) is always added at the end of the list of
>> children. For some reason the GMF or GEF code is always adding it at
>> index which is derived from a loop counter. the loop loops over the
>> children items that don't have edit parts and creates them and then adds
>> them at index. Well since the only child without and edit part was a
>> label it creates it at index 0 so it resulted in the label appearing above
>> my image. After overriding add method it started appearing below.
>>
>> @Override
>> public void add(IFigure figure, Object constraint, int index) {
>>
>> super.add(figure, constraint, -1); // add it at the end of children list
>>
>> }
>>
>> Swavek
>>
>>
>> "Hao Zhang" <bjzhanghao@21cn.com> wrote in message
>> news:fc7l8d$htf$1@build.eclipse.org...
>>> Hi all,
>>> I use editpolicyProvider to open a dialog when user double clicks an
>>> editpart (ActionEditPart), the problem is the label figure got selected
>>> when user double clicks because label figure is on top of action figure,
>>> so open request is not sent to ActionEditpart but ActionLabelEditpart. Is
>>> there any way to make the label figure "transparent" in this situation?
>>>
>>> Regards,
>>> Hao
>>>
>>>
>>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03236 seconds