How can I do a node non movable? [message #155302] |
Mon, 15 October 2007 11:39 |
Eclipse User |
|
|
|
Originally posted by: ijerez2001.gmail.com
Hello all,
I try to do a node that it cannot move because a I implement the location
for this.
I have seen another post that ask for this problem but it is not answered.
Thanks.
|
|
|
Re: How can I do a node non movable? [message #155544 is a reply to message #155302] |
Tue, 16 October 2007 08:58 |
Eclipse User |
|
|
|
Originally posted by: jan.herriger.gmx.de
Hi,
you could override the LayoutEditPolicy in your DiagramEditPart like this:
installEditPolicy(EditPolicy.LAYOUT_ROLE, new XYLayoutEditPolicy(){
protected Command getMoveChildrenCommand(Request request) {
boolean containsUnmoveable = false;
for(Object o : ((ChangeBoundsRequest)request).getEditParts())
{
if (o instanceof MyUnmoveableEditPart)
containsUnmoveable = true;
break;
}
return containsUnmoveable?UnexecutableCommand.INSTANCE:
getResizeChildrenCommand((ChangeBoundsRequest)request);
}
});
Iván Jerez schrieb:
> Hello all,
>
> I try to do a node that it cannot move because a I implement the
> location for this.
> I have seen another post that ask for this problem but it is not answered.
>
> Thanks.
|
|
|
Re: How can I do a node non movable? [message #155595 is a reply to message #155544] |
Tue, 16 October 2007 10:58 |
Eclipse User |
|
|
|
Originally posted by: ijerez2001.gmail.com
It work perfect!
Thank you very much
"Jan Herriger" <jan.herriger@gmx.de> escribió en el mensaje de
noticias:ff1ues$n18$1@build.eclipse.org...
> Hi,
>
> you could override the LayoutEditPolicy in your DiagramEditPart like this:
>
> installEditPolicy(EditPolicy.LAYOUT_ROLE, new XYLayoutEditPolicy(){
> protected Command getMoveChildrenCommand(Request request) {
>
> boolean containsUnmoveable = false; for(Object o :
> ((ChangeBoundsRequest)request).getEditParts())
> {
> if (o instanceof MyUnmoveableEditPart)
> containsUnmoveable = true;
> break;
> }
> return containsUnmoveable?UnexecutableCommand.INSTANCE:
> getResizeChildrenCommand((ChangeBoundsRequest)request);
> }
> });
>
> Iván Jerez schrieb:
>> Hello all,
>>
>> I try to do a node that it cannot move because a I implement the location
>> for this.
>> I have seen another post that ask for this problem but it is not
>> answered.
>>
>> Thanks.
|
|
|
Re: How can I do a node non movable? [message #155625 is a reply to message #155595] |
Tue, 16 October 2007 11:12 |
Eclipse User |
|
|
|
Originally posted by: jan.herriger.gmx.de
Oh... wait a minute.
In your EditPart, you should find a methos like this:
public EditPolicy getPrimaryDragEditPolicy() {
EditPolicy result = super.getPrimaryDragEditPolicy();
if (result instanceof ResizableEditPolicy) {
ResizableEditPolicy ep = (ResizableEditPolicy) result;
ep.setResizeDirections(PositionConstants.NONE);
//dont't move me
ep.setDragAllowed(false);
}
return result;
}
Adding the line under the comment should be prefered, I think. So, you
don't have to override DiagramEditPart's LayoutEditPolicy.
Iván Jerez schrieb:
> It work perfect!
> Thank you very much
>
> "Jan Herriger" <jan.herriger@gmx.de> escribió en el mensaje de
> noticias:ff1ues$n18$1@build.eclipse.org...
>> Hi,
>>
>> you could override the LayoutEditPolicy in your DiagramEditPart like
>> this:
>>
>> installEditPolicy(EditPolicy.LAYOUT_ROLE, new XYLayoutEditPolicy(){
>> protected Command getMoveChildrenCommand(Request request) {
>>
>> boolean containsUnmoveable = false; for(Object o :
>> ((ChangeBoundsRequest)request).getEditParts())
>> {
>> if (o instanceof MyUnmoveableEditPart)
>> containsUnmoveable = true;
>> break;
>> }
>> return containsUnmoveable?UnexecutableCommand.INSTANCE:
>> getResizeChildrenCommand((ChangeBoundsRequest)request);
>> }
>> });
>>
>> Iván Jerez schrieb:
>>> Hello all,
>>>
>>> I try to do a node that it cannot move because a I implement the
>>> location for this.
>>> I have seen another post that ask for this problem but it is not
>>> answered.
>>>
>>> Thanks.
>
|
|
|
Re: How can I do a node non movable? [message #155675 is a reply to message #155625] |
Tue, 16 October 2007 11:20 |
Eclipse User |
|
|
|
Originally posted by: ijerez2001.gmail.com
Yes, I add this piece of code:
protected Command getMoveChildrenCommand(Request request) {
boolean containsUnmoveable = false;
for(Object o : ((ChangeBoundsRequest)request).getEditParts())
{
if (o instanceof MyUnmoveableEditPart)
containsUnmoveable = true;
break;
}
return containsUnmoveable?UnexecutableCommand.INSTANCE:
getResizeChildrenCommand((ChangeBoundsRequest)request);
}
to the method createLayoutEditPolicy(), that it contained one.
Thanks again.
"Jan Herriger" <jan.herriger@gmx.de> escribió en el mensaje de
noticias:ff26b2$no4$1@build.eclipse.org...
> Oh... wait a minute.
>
> In your EditPart, you should find a methos like this:
>
> public EditPolicy getPrimaryDragEditPolicy() {
> EditPolicy result = super.getPrimaryDragEditPolicy();
> if (result instanceof ResizableEditPolicy) {
> ResizableEditPolicy ep = (ResizableEditPolicy) result;
> ep.setResizeDirections(PositionConstants.NONE);
>
> //dont't move me
> ep.setDragAllowed(false);
> }
> return result;
> }
>
> Adding the line under the comment should be prefered, I think. So, you
> don't have to override DiagramEditPart's LayoutEditPolicy.
>
> Iván Jerez schrieb:
>> It work perfect!
>> Thank you very much
>>
>> "Jan Herriger" <jan.herriger@gmx.de> escribió en el mensaje de
>> noticias:ff1ues$n18$1@build.eclipse.org...
>>> Hi,
>>>
>>> you could override the LayoutEditPolicy in your DiagramEditPart like
>>> this:
>>>
>>> installEditPolicy(EditPolicy.LAYOUT_ROLE, new XYLayoutEditPolicy(){
>>> protected Command getMoveChildrenCommand(Request request) {
>>>
>>> boolean containsUnmoveable = false; for(Object o :
>>> ((ChangeBoundsRequest)request).getEditParts())
>>> {
>>> if (o instanceof MyUnmoveableEditPart)
>>> containsUnmoveable = true;
>>> break;
>>> }
>>> return containsUnmoveable?UnexecutableCommand.INSTANCE:
>>> getResizeChildrenCommand((ChangeBoundsRequest)request);
>>> }
>>> });
>>>
>>> Iván Jerez schrieb:
>>>> Hello all,
>>>>
>>>> I try to do a node that it cannot move because a I implement the
>>>> location for this.
>>>> I have seen another post that ask for this problem but it is not
>>>> answered.
>>>>
>>>> Thanks.
>>
|
|
|
Re: How can I do a node non movable? [message #164882 is a reply to message #155625] |
Mon, 10 December 2007 12:27 |
Eclipse User |
|
|
|
Originally posted by: trommas.yahoo.com
Jan Herriger wrote:
> In your EditPart, you should find a methos like this:
>
> public EditPolicy getPrimaryDragEditPolicy() {
> EditPolicy result = super.getPrimaryDragEditPolicy();
> if (result instanceof ResizableEditPolicy) {
> ResizableEditPolicy ep = (ResizableEditPolicy) result;
> ep.setResizeDirections(PositionConstants.NONE);
>
> //dont't move me
> ep.setDragAllowed(false);
> }
> return result;
> }
I've implemented this method in the EditPart of a Node. It works, but my
problem is that the figure overlaps existing figures. The running the
setLocation method yields no effect.
How can I solve this?
Best Regards,
Tomas Zijdemans
|
|
|
Powered by
FUDForum. Page generated in 0.03672 seconds