|
Re: Change the Figure after it is first created [message #65483 is a reply to message #65458] |
Tue, 18 February 2003 20:54 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
There are workarounds, please open a feature request for this.
you might try overriding:
protected void setFigure(IFigure newFigure) {
if (figure != null) {
unregisterVisuals();
IFigure parent = figure.getParent();
int index = parent.indexOf(figure);
Object constraint = parent.getLayoutManager().getConstraint(figure);
figure = newFigure;
parent.add(figure, constraint, index);
registerVisuals();
} else
super.setFigure(newFigure);
}
"yinglcs" <yinglcs@netscape.com> wrote in message
news:b2u4ej$eb1$1@rogue.oti.com...
> Hi,
>
> GEF uses MVC pattern, so every model has 1 figure. But can I change that
> figure after it is first created thru a command? For example, I have a
model
> which represents as a Square (a figure), can I have a command in the menu
to
> switch that to a Circle? I notice the createFigure() only called once per
> EditPart.
>
> My question is if it is possible to swap that figure after it is initially
> created.
> Thank you.
>
>
|
|
|
|
|
Re: Change the Figure after it is first created [message #65691 is a reply to message #65649] |
Wed, 19 February 2003 16:13 |
Eclipse User |
|
|
|
Originally posted by: john-mason.shackelford.pearson.com
Randy,
What do you think about adding something like this to the API for Figure
and EditPart? Certaily could be handled by subclasses, but perhaps handy
enough to consider making more readily available. What do you think?
public int getChildCount(Class c) {
int i = 0;
Iterator iter = children.iterator();
while (iter.hasNext()) {
if (c.isAssignableFrom(iter.next().getClass())) {
i++;
}
}
return i;
}
--
John-Mason Shackelford
Software Developer
Pearson Educational Measurement - eMeasurement Group
2510 North Dodge St.
Iowa City, IA 52245
ph. 319-354-9200x6214
john-mason.shackelford@pearson.com
http://etest.ncspearson.com
|
|
|
Re: Change the Figure after it is first created [message #65713 is a reply to message #65691] |
Wed, 19 February 2003 16:25 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
What would this be used for?
"John-Mason P. Shackelford" <john-mason.shackelford@pearson.com> wrote in
message news:3E53AD2E.80208@pearson.com...
> Randy,
>
>
> What do you think about adding something like this to the API for Figure
> and EditPart? Certaily could be handled by subclasses, but perhaps handy
> enough to consider making more readily available. What do you think?
>
> public int getChildCount(Class c) {
> int i = 0;
> Iterator iter = children.iterator();
> while (iter.hasNext()) {
> if (c.isAssignableFrom(iter.next().getClass())) {
> i++;
> }
> }
> return i;
> }
>
> --
>
> John-Mason Shackelford
>
> Software Developer
> Pearson Educational Measurement - eMeasurement Group
>
> 2510 North Dodge St.
> Iowa City, IA 52245
> ph. 319-354-9200x6214
> john-mason.shackelford@pearson.com
> http://etest.ncspearson.com
>
|
|
|
Powered by
FUDForum. Page generated in 0.03995 seconds