Skip to main content



      Home
Home » Eclipse Projects » GEF » Change figure of an edit part dynamically
Change figure of an edit part dynamically [message #61996] Wed, 05 February 2003 05:58 Go to next message
Eclipse UserFriend
Hi
I have an EditPart which i want to change it's figure according to some data
in the model
I tried overriding getFigure() but when calling
setLayoutConstraint(this,getFigure()) , the following exception occurs

java.lang.IllegalArgumentException: IWAG0004E Figure.setConstraint(..):
Figure is not a child
at org.eclipse.draw2d.Figure.setConstraint(Figure.java:1236)
at
org.eclipse.gef.editparts.AbstractGraphicalEditPart.setLayou tConstraint(Abst
ractGraphicalEditPart.java:763)
at
com.ibm.bpmworkbench.ui.ProcessGraphModeler.parts.SContainer Part.refreshVisu
als(SContainerPart.java:216)
at
org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractE ditPart.java:716
)
at
org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh( AbstractGraphica
lEditPart.java:534)

I figured out that the problem is that the Parent EditPart registers the
figure of the children parts once when creating them , so when it tries to
setConstraint() on a different Figure , it blows

What Can I do ?
Re: Change figure of an edit part dynamically [message #62068 is a reply to message #61996] Wed, 05 February 2003 09:26 Go to previous messageGo to next message
Eclipse UserFriend
Could you just change the current figure instead of replacing it with an entirely new one?

Eric


Shady Said wrote:
> Hi
> I have an EditPart which i want to change it's figure according to some data
> in the model
> I tried overriding getFigure() but when calling
> setLayoutConstraint(this,getFigure()) , the following exception occurs
>
> java.lang.IllegalArgumentException: IWAG0004E Figure.setConstraint(..):
> Figure is not a child
> at org.eclipse.draw2d.Figure.setConstraint(Figure.java:1236)
> at
> org.eclipse.gef.editparts.AbstractGraphicalEditPart.setLayou tConstraint(Abst
> ractGraphicalEditPart.java:763)
> at
> com.ibm.bpmworkbench.ui.ProcessGraphModeler.parts.SContainer Part.refreshVisu
> als(SContainerPart.java:216)
> at
> org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractE ditPart.java:716
> )
> at
> org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh( AbstractGraphica
> lEditPart.java:534)
>
> I figured out that the problem is that the Parent EditPart registers the
> figure of the children parts once when creating them , so when it tries to
> setConstraint() on a different Figure , it blows
>
> What Can I do ?
>
>
Re: Change figure of an edit part dynamically [message #62115 is a reply to message #62068] Wed, 05 February 2003 10:30 Go to previous messageGo to next message
Eclipse UserFriend
No , I want a completly differnt figure not the same one with different
attributes(background color for ex.)
This is important in the semantics of my application


"Eric Bordeau" <ebordeau@us.ibm.com> wrote in message
news:b1r5k2$7fb$1@rogue.oti.com...
> Could you just change the current figure instead of replacing it with an
entirely new one?
>
> Eric
>
>
> Shady Said wrote:
> > Hi
> > I have an EditPart which i want to change it's figure according to some
data
> > in the model
> > I tried overriding getFigure() but when calling
> > setLayoutConstraint(this,getFigure()) , the following exception occurs
> >
> > java.lang.IllegalArgumentException: IWAG0004E Figure.setConstraint(..):
> > Figure is not a child
> > at org.eclipse.draw2d.Figure.setConstraint(Figure.java:1236)
> > at
> >
org.eclipse.gef.editparts.AbstractGraphicalEditPart.setLayou tConstraint(Abst
> > ractGraphicalEditPart.java:763)
> > at
> >
com.ibm.bpmworkbench.ui.ProcessGraphModeler.parts.SContainer Part.refreshVisu
> > als(SContainerPart.java:216)
> > at
> >
org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractE ditPart.java:716
> > )
> > at
> >
org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh( AbstractGraphica
> > lEditPart.java:534)
> >
> > I figured out that the problem is that the Parent EditPart registers the
> > figure of the children parts once when creating them , so when it tries
to
> > setConstraint() on a different Figure , it blows
> >
> > What Can I do ?
> >
> >
>
Re: Change figure of an edit part dynamically [message #62139 is a reply to message #62115] Wed, 05 February 2003 10:35 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

For now you will have to implement this yourself by creating a wrapper
figure.

The wrapper Figure should be a plain figure in StackLayout with one child
that is one of your current figures. When you want to "swap the figure",
remove the wrappers child and replace it with another. The EditParts figure
will not change, since it will be the wrapper.

If your EditPart has children, you will have to move all of the childrens'
figures to the swapped figure.

"Shady Said" <sh_said@yahoo.com> wrote in message
news:b1r95v$e1d$1@rogue.oti.com...
> No , I want a completly differnt figure not the same one with different
> attributes(background color for ex.)
> This is important in the semantics of my application
>
>
> "Eric Bordeau" <ebordeau@us.ibm.com> wrote in message
> news:b1r5k2$7fb$1@rogue.oti.com...
> > Could you just change the current figure instead of replacing it with an
> entirely new one?
> >
> > Eric
> >
> >
> > Shady Said wrote:
> > > Hi
> > > I have an EditPart which i want to change it's figure according to
some
> data
> > > in the model
> > > I tried overriding getFigure() but when calling
> > > setLayoutConstraint(this,getFigure()) , the following exception occurs
> > >
> > > java.lang.IllegalArgumentException: IWAG0004E
Figure.setConstraint(..):
> > > Figure is not a child
> > > at org.eclipse.draw2d.Figure.setConstraint(Figure.java:1236)
> > > at
> > >
>
org.eclipse.gef.editparts.AbstractGraphicalEditPart.setLayou tConstraint(Abst
> > > ractGraphicalEditPart.java:763)
> > > at
> > >
>
com.ibm.bpmworkbench.ui.ProcessGraphModeler.parts.SContainer Part.refreshVisu
> > > als(SContainerPart.java:216)
> > > at
> > >
>
org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractE ditPart.java:716
> > > )
> > > at
> > >
>
org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh( AbstractGraphica
> > > lEditPart.java:534)
> > >
> > > I figured out that the problem is that the Parent EditPart registers
the
> > > figure of the children parts once when creating them , so when it
tries
> to
> > > setConstraint() on a different Figure , it blows
> > >
> > > What Can I do ?
> > >
> > >
> >
>
>
Previous Topic:Please help me debug this
Next Topic:Add an icon in the LogicLabel
Goto Forum:
  


Current Time: Fri May 09 11:46:16 EDT 2025

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

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

Back to the top