Home » Eclipse Projects » GEF » change figure associated with an edit-part dynamically
change figure associated with an edit-part dynamically [message #225322] |
Mon, 30 October 2006 08:49  |
Eclipse User |
|
|
|
Originally posted by: prashanto.chatterjee.softwareag.com
Hi,
I have this scenario wherein I need to change the figure associated with an
edit-part. What I do in the concerned edit-part is:
Map partMap = getViewer().getVisualPartMap();
partMap.remove(oldFigureInstance);
partMap.put(newFigureInstance, this);
This however has no effect and the old figure persists in the viewer. Is
there a central place wherein I can update the EditPart to Figure mapping?
How do I change the figure associated with an edit-part dynamically at
runtime?
Appreciate your help.
Kind Regards,
Prashanto
|
|
|
Re: change figure associated with an edit-part dynamically [message #225348 is a reply to message #225322] |
Mon, 30 October 2006 11:31   |
Eclipse User |
|
|
|
在 2006-10-30一的 14:49 +0100,Prashanto Chatterjee写道:
> Hi,
> I have this scenario wherein I need to change the figure associated with an
> edit-part. What I do in the concerned edit-part is:
>
> Map partMap = getViewer().getVisualPartMap();
> partMap.remove(oldFigureInstance);
> partMap.put(newFigureInstance, this);
>
> This however has no effect and the old figure persists in the viewer. Is
> there a central place wherein I can update the EditPart to Figure mapping?
> How do I change the figure associated with an edit-part dynamically at
> runtime?
>
> Appreciate your help.
>
> Kind Regards,
> Prashanto
>
>
Hi,
Maybe Pratik and Hudson not advice you do like above yet.:)
OK, this part with an only figure, and once created, no dead if no
exception.How?
1, get parent model, remove this child model, update;
and add this model, update. It works.
2, let a Figure object contains really needed figure.
and editpart can control this parent virtual figure update status
according concret condition.
Hope this help.
Regards,
Qinxian.
|
|
|
Re: change figure associated with an edit-part dynamically [message #225449 is a reply to message #225348] |
Tue, 31 October 2006 01:44   |
Eclipse User |
|
|
|
Originally posted by: prashanto.chatterjee.softwareag.com
Thanks for responding.
In the meantime I tried out the following sequence:
unregisterVisuals();
setFigure(newFigure);
registerVisuals();
But even this didn't work :(. I get the old figure with connections and the
new Figure without the connections.
This is baffling. I was wondering whether GEF has any update mechanism that
automatically updates any mappings with the corresponding figure?
Any help would be appreciated.
Regards,
Prashanto
"Xiang Qinxian" <fyaoxy@gmail.com> wrote in message
news:1162225891.30390.6.camel@qinxian.xiang...
? 2006-10-30?? 14:49 +0100,Prashanto Chatterjee??:
> Hi,
> I have this scenario wherein I need to change the figure associated with
> an
> edit-part. What I do in the concerned edit-part is:
>
> Map partMap = getViewer().getVisualPartMap();
> partMap.remove(oldFigureInstance);
> partMap.put(newFigureInstance, this);
>
> This however has no effect and the old figure persists in the viewer. Is
> there a central place wherein I can update the EditPart to Figure mapping?
> How do I change the figure associated with an edit-part dynamically at
> runtime?
>
> Appreciate your help.
>
> Kind Regards,
> Prashanto
>
>
Hi,
Maybe Pratik and Hudson not advice you do like above yet.:)
OK, this part with an only figure, and once created, no dead if no
exception.How?
1, get parent model, remove this child model, update;
and add this model, update. It works.
2, let a Figure object contains really needed figure.
and editpart can control this parent virtual figure update status
according concret condition.
Hope this help.
Regards,
Qinxian.
|
|
|
Re: change figure associated with an edit-part dynamically [message #225472 is a reply to message #225449] |
Tue, 31 October 2006 04:07   |
Eclipse User |
|
|
|
在 2006-10-31二的 07:44 +0100,Prashanto Chatterjee写道:
> Thanks for responding.
>
> In the meantime I tried out the following sequence:
> unregisterVisuals();
> setFigure(newFigure);
> registerVisuals();
Hi,
This way could work yet, try to get a place update it or notifiy it's
update.
Try to add refreshVisuals();
Regards,
Qinxian
> But even this didn't work :(. I get the old figure with connections and the
> new Figure without the connections.
>
> This is baffling. I was wondering whether GEF has any update mechanism that
> automatically updates any mappings with the corresponding figure?
>
> Any help would be appreciated.
>
> Regards,
> Prashanto
>
> "Xiang Qinxian" <fyaoxy@gmail.com> wrote in message
> news:1162225891.30390.6.camel@qinxian.xiang...
> ? 2006-10-30?? 14:49 +0100,Prashanto Chatterjee??:
> > Hi,
> > I have this scenario wherein I need to change the figure associated with
> > an
> > edit-part. What I do in the concerned edit-part is:
> >
> > Map partMap = getViewer().getVisualPartMap();
> > partMap.remove(oldFigureInstance);
> > partMap.put(newFigureInstance, this);
> >
> > This however has no effect and the old figure persists in the viewer. Is
> > there a central place wherein I can update the EditPart to Figure mapping?
> > How do I change the figure associated with an edit-part dynamically at
> > runtime?
> >
> > Appreciate your help.
> >
> > Kind Regards,
> > Prashanto
> >
> >
> Hi,
> Maybe Pratik and Hudson not advice you do like above yet.:)
> OK, this part with an only figure, and once created, no dead if no
> exception.How?
> 1, get parent model, remove this child model, update;
> and add this model, update. It works.
> 2, let a Figure object contains really needed figure.
> and editpart can control this parent virtual figure update status
> according concret condition.
>
> Hope this help.
>
> Regards,
>
> Qinxian.
>
>
|
|
|
Re: change figure associated with an edit-part dynamically [message #225644 is a reply to message #225472] |
Wed, 01 November 2006 01:25   |
Eclipse User |
|
|
|
Originally posted by: prashanto.chatterjee.softwareag.com
Hi,
I already have that. I call refresh() which calls both refreshVisuals() and
refreshChildren(). But still it does not help :(
Regards,
Prashanto
"Xiang Qinxian" <fyaoxy@gmail.com> wrote in message
news:1162285623.14126.14.camel@qinxian.xiang...
? 2006-10-31?? 07:44 +0100,Prashanto Chatterjee??:
> Thanks for responding.
>
> In the meantime I tried out the following sequence:
> unregisterVisuals();
> setFigure(newFigure);
> registerVisuals();
Hi,
This way could work yet, try to get a place update it or notifiy it's
update.
Try to add refreshVisuals();
Regards,
Qinxian
> But even this didn't work :(. I get the old figure with connections and
> the
> new Figure without the connections.
>
> This is baffling. I was wondering whether GEF has any update mechanism
> that
> automatically updates any mappings with the corresponding figure?
>
> Any help would be appreciated.
>
> Regards,
> Prashanto
>
> "Xiang Qinxian" <fyaoxy@gmail.com> wrote in message
> news:1162225891.30390.6.camel@qinxian.xiang...
> ? 2006-10-30?? 14:49 +0100,Prashanto Chatterjee??:
> > Hi,
> > I have this scenario wherein I need to change the figure associated with
> > an
> > edit-part. What I do in the concerned edit-part is:
> >
> > Map partMap = getViewer().getVisualPartMap();
> > partMap.remove(oldFigureInstance);
> > partMap.put(newFigureInstance, this);
> >
> > This however has no effect and the old figure persists in the viewer. Is
> > there a central place wherein I can update the EditPart to Figure
> > mapping?
> > How do I change the figure associated with an edit-part dynamically at
> > runtime?
> >
> > Appreciate your help.
> >
> > Kind Regards,
> > Prashanto
> >
> >
> Hi,
> Maybe Pratik and Hudson not advice you do like above yet.:)
> OK, this part with an only figure, and once created, no dead if no
> exception.How?
> 1, get parent model, remove this child model, update;
> and add this model, update. It works.
> 2, let a Figure object contains really needed figure.
> and editpart can control this parent virtual figure update status
> according concret condition.
>
> Hope this help.
>
> Regards,
>
> Qinxian.
>
>
|
|
| |
Re: change figure associated with an edit-part dynamically [message #226235 is a reply to message #226222] |
Wed, 08 November 2006 05:42  |
Eclipse User |
|
|
|
Originally posted by: prashanto.chatterjee.softwareag.com
Hi Pratik,
Thanks for your response. I have done as you had suggested and it works like
a wonder.
However, I have one single doubt. What I've currently done is:
------------------------------------------------------------ ------------------------------------------------------------ ------------------
protected IFigure createFigure() {
stackFigure = new Figure();
stackFigure.setLayoutManager(new StackLayout());
stackFigure.add(_insertionPointFigure = new
ImageFigure(InsertionPoint.INSERTION_POINT_IMAGE.createImage ()));
stackFigure.add(_enabledBreakpointFigure = new
ImageFigure(InsertionPoint.ENABLED_BREAKPOINT_IMAGE.createIm age()));
stackFigure.add(_disabledBreakpointFigure = new
ImageFigure(InsertionPoint.DISABLED_BREAKPOINT_IMAGE.createI mage()));
resetFigure();
if (getModel() instanceof TreeNode) {
stackFigure.setToolTip(((TreeNode)getModel()).getToolTip());
}
return stackFigure;
}
------------------------------------------------------------ ------------------------------------------------------------ ------------------
followed by:
------------------------------------------------------------ ------------------------------------------------------------ ------------------
public void resetFigure() {
if(getCastedModel().containsBreakpoint()){
if(getCastedModel().isBreakpointEnabled()){
stackFigure.add(_enabledBreakpointFigure);
}else{
stackFigure.add(_disabledBreakpointFigure);
}
}else{
stackFigure.add(_insertionPointFigure);
}
}
------------------------------------------------------------ ------------------------------------------------------------ ------------------
Is this the correct way to use a StackLayout? Why isn't there an option for
something like a top-control in StackLayout?
Thanks once again.
Regards,
Prashanto
"Pratik Shah" <none@unknown.com> wrote in message
news:eirrsl$def$1@utils.eclipse.org...
> There's a simple solution to this. In your createFigure() method, first
> create a figure with a stack layout. In there, you put the figure that
> you expect to be changed. Then, simply switch that figure whenever you
> need to, leaving the parent figure (the one returned by getFigure())
> alone. It gets trickier if this editpart can have children.
>
> "Prashanto Chatterjee" <prashanto.chatterjee@softwareag.com> wrote in
> message news:ei4vst$ci9$1@utils.eclipse.org...
>> Hi,
>> I have this scenario wherein I need to change the figure associated with
>> an edit-part. What I do in the concerned edit-part is:
>>
>> Map partMap = getViewer().getVisualPartMap();
>> partMap.remove(oldFigureInstance);
>> partMap.put(newFigureInstance, this);
>>
>> This however has no effect and the old figure persists in the viewer. Is
>> there a central place wherein I can update the EditPart to Figure
>> mapping?
>> How do I change the figure associated with an edit-part dynamically at
>> runtime?
>>
>> Appreciate your help.
>>
>> Kind Regards,
>> Prashanto
>>
>
>
|
|
|
Goto Forum:
Current Time: Mon May 19 21:20:22 EDT 2025
Powered by FUDForum. Page generated in 0.05474 seconds
|