Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Double click to open problem caused by label
Double click to open problem caused by label [message #150144] Wed, 12 September 2007 03:08 Go to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 161
Registered: July 2009
Senior Member
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 #150430 is a reply to message #150144] Wed, 12 September 2007 14:30 Go to previous messageGo to next message
Eclipse UserFriend
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 #150779 is a reply to message #150430] Fri, 14 September 2007 02:15 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 161
Registered: July 2009
Senior Member
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> д
Re: Double click to open problem caused by label [message #196588 is a reply to message #150779] Fri, 11 July 2008 09:15 Go to previous message
Hugues Rérolle is currently offline Hugues RérolleFriend
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
>>>
>>>
>>
>
>
Previous Topic:Platform-/ file resource problem
Next Topic:Combining two domain models into one application
Goto Forum:
  


Current Time: Thu Apr 25 23:34:41 GMT 2024

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

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

Back to the top