Skip to main content



      Home
Home » Eclipse Projects » GEF » Make Label in LogicEditor example resizble
Make Label in LogicEditor example resizble [message #23953] Fri, 04 October 2002 20:31 Go to next message
Eclipse UserFriend
Hi,

Could someone please tell me how to make Label in the logic editor example
resizable? I compare the edit policy of Label (non-resizable) with
ContainerEditPolicy (used by Circuit, which is resizable), I can't tell what
make Circuit resizable.

Thank you for any help.
Re: Make Label in LogicEditor example resizble [message #24027 is a reply to message #23953] Sat, 05 October 2002 01:06 Go to previous messageGo to next message
Eclipse UserFriend
The LogicContainerEditPart (which the main LogicDiagram is) has a
LogicXYLayoutEditPolicy as its LAYOUT_ROLE. When a child is created in a
container, createChildEditPolicy(...) returns the appropriate EditPolicy
(resizable or nonresizable) to be installed as the PRIMARY_DRAG_ROLE on the
child EditPart. These are the edit policies that create the move and/or resize
commands.



LogicXYLayoutEditPolicy.createChildEditPolicy looks like this...

protected EditPolicy createChildEditPolicy(EditPart child){
if (child instanceof LEDEditPart ||
child instanceof OutputEditPart ||
child instanceof LogicLabelEditPart) {
return new org.eclipse.gef.editpolicies.NonResizableEditPolicy();
}
return new org.eclipse.gef.editpolicies.ResizableEditPolicy();
}

So, when a LogicLabelEditPart gets created, it gets a NonResizableEditPolicy,
while a CircuitEditPart would get a ResizableEditPolicy.


Hope this helps.

Eric


Sam Cheung wrote:
> Hi,
>
> Could someone please tell me how to make Label in the logic editor example
> resizable? I compare the edit policy of Label (non-resizable) with
> ContainerEditPolicy (used by Circuit, which is resizable), I can't tell what
> make Circuit resizable.
>
> Thank you for any help.
>
>
Re: Make Label in LogicEditor example resizble [message #24194 is a reply to message #24027] Sat, 05 October 2002 17:09 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sy_cheung.yahoo.com

Eric,

Thanks for your help. How can I make a NonResizableEditPolicy NOT
movable also? I don't see there is a method in NonResiableEditPolicy to
make it not-movable also.

Thank you.


Eric Bordeau wrote:
> The LogicContainerEditPart (which the main LogicDiagram is) has a
> LogicXYLayoutEditPolicy as its LAYOUT_ROLE. When a child is created in
> a container, createChildEditPolicy(...) returns the appropriate
> EditPolicy (resizable or nonresizable) to be installed as the
> PRIMARY_DRAG_ROLE on the child EditPart. These are the edit policies
> that create the move and/or resize commands.
>
>
>
> LogicXYLayoutEditPolicy.createChildEditPolicy looks like this...
>
> protected EditPolicy createChildEditPolicy(EditPart child){
> if (child instanceof LEDEditPart ||
> child instanceof OutputEditPart ||
> child instanceof LogicLabelEditPart) {
> return new org.eclipse.gef.editpolicies.NonResizableEditPolicy();
> }
> return new org.eclipse.gef.editpolicies.ResizableEditPolicy();
> }
>
> So, when a LogicLabelEditPart gets created, it gets a
> NonResizableEditPolicy, while a CircuitEditPart would get a
> ResizableEditPolicy.
>
>
> Hope this helps.
>
> Eric
>
>
> Sam Cheung wrote:
>
>> Hi,
>>
>> Could someone please tell me how to make Label in the logic editor
>> example
>> resizable? I compare the edit policy of Label (non-resizable) with
>> ContainerEditPolicy (used by Circuit, which is resizable), I can't
>> tell what
>> make Circuit resizable.
>>
>> Thank you for any help.
>>
>>
>
Re: Make Label in LogicEditor example resizble [message #24234 is a reply to message #24194] Sat, 05 October 2002 20:32 Go to previous message
Eclipse UserFriend
Originally posted by: hudsonr.us.eye-bee-em.com

If you have something that is not draggable, you should probably try to make
it look like a TreeItem or ListItem. So you might show selection by
changing the background to dark blue
(ColorConstants.menuBackgroundSelected), and the font color to white
(ColorConstants.menuForegroundSelected). Maybe handles don't make sense.

Handles are not the only way to drag something. You will also need to
override EditPart.getDragTracker() to return the SelectEditPartTracker(),
which doesn't allow dragging.

"Sam" <sy_cheung@yahoo.com> wrote in message
news:annj3m$ouh$1@rogue.oti.com...
>
> Eric,
>
> Thanks for your help. How can I make a NonResizableEditPolicy NOT
> movable also? I don't see there is a method in NonResiableEditPolicy to
> make it not-movable also.
>
> Thank you.
>
>
> Eric Bordeau wrote:
> > The LogicContainerEditPart (which the main LogicDiagram is) has a
> > LogicXYLayoutEditPolicy as its LAYOUT_ROLE. When a child is created in
> > a container, createChildEditPolicy(...) returns the appropriate
> > EditPolicy (resizable or nonresizable) to be installed as the
> > PRIMARY_DRAG_ROLE on the child EditPart. These are the edit policies
> > that create the move and/or resize commands.
> >
> >
> >
> > LogicXYLayoutEditPolicy.createChildEditPolicy looks like this...
> >
> > protected EditPolicy createChildEditPolicy(EditPart child){
> > if (child instanceof LEDEditPart ||
> > child instanceof OutputEditPart ||
> > child instanceof LogicLabelEditPart) {
> > return new
org.eclipse.gef.editpolicies.NonResizableEditPolicy();
> > }
> > return new org.eclipse.gef.editpolicies.ResizableEditPolicy();
> > }
> >
> > So, when a LogicLabelEditPart gets created, it gets a
> > NonResizableEditPolicy, while a CircuitEditPart would get a
> > ResizableEditPolicy.
> >
> >
> > Hope this helps.
> >
> > Eric
> >
> >
> > Sam Cheung wrote:
> >
> >> Hi,
> >>
> >> Could someone please tell me how to make Label in the logic editor
> >> example
> >> resizable? I compare the edit policy of Label (non-resizable) with
> >> ContainerEditPolicy (used by Circuit, which is resizable), I can't
> >> tell what
> >> make Circuit resizable.
> >>
> >> Thank you for any help.
> >>
> >>
> >
>
Previous Topic:Make part of Label editable?
Next Topic:How to add edit part to a PolyLineConnection
Goto Forum:
  


Current Time: Sat May 10 08:02:54 EDT 2025

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

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

Back to the top