|
|
Re: one kind of children in one editpart - limitation of gef??? [message #192600 is a reply to message #192577] |
Sat, 20 August 2005 09:40 |
Eclipse User |
|
|
|
Originally posted by: christian.sell.netcologne.de
> building models for gef. How can I hide some model elements in graphics?
> For example A has B as children, and B has C as children. But I just
> want to show A and C in my graphics. B is only important in model. And
in the getModelChildren() method of the A edit part, return the result
of summing up all C's from all B children, like
List result = ...
for all b children
for all b.c children
result.add(c)
return result;
Thus, the graphics will only show A's with C children.
> how can I show children figures seprated from the parent figures?
> Has anyone solutions for the problems mentioned above?
dont understand. What do you mean by "separated"?
christian
|
|
|
|
Re: ??: one kind of children in one editpart - limitation of gef??? [message #192617 is a reply to message #192608] |
Sat, 20 August 2005 10:53 |
Eclipse User |
|
|
|
Originally posted by: Sebastian.Zarnekow.gmx.de
Hi Lucia,
A.getBs() returns the list by reference. If you try to add Cs to the list
of Bs, the underlying implementation of EList throws the exception.
Try the following:
protected List getModelChildren() {
List list = new ArrayList( getA().getBs() );
list.addAll(getA().getCs());
return list;
}
--
Cheers,
Sebastian
L> Hi, Andreas,
L>
L> Thank you for your answer. But...
L>
L> I've tried this exactly as you said. My model is as following:
L> ##############################################
L> public interface A extends EObject{
L> /**
L> * @model
L> */
L> EList getBs();
L> /**
L> * @model
L> */
L> EList getCs();
L> }
L> ###############################################
L>
L> And the editpart of A has the following method:
L> ###############################################
L> protected List getModelChildren() {
L> List list = getA().getBs();
L> list.addAll(getA().getCs());
L> return list;
L> }
L> ###############################################
L> And I got the error message:
L> ############################################################ #########
L> ######
L> java.lang.ArrayStoreException
L> at
L> org.eclipse.emf.common.util.BasicEList.assign(BasicEList.jav a:187)
L> at
L> org.eclipse.emf.common.util.BasicEList.addAllUnique(BasicELi st.java:7
L> 72)
L> at
L> org.eclipse.emf.common.notify.impl.NotifyingListImpl.addAllU nique(Not
L> ifyingListImpl.java:428)
L> at
L> org.eclipse.emf.common.notify.impl.NotifyingListImpl.addAllU nique(Not
L> ifyingListImpl.java:367)
L> at
L> org.eclipse.emf.common.util.BasicEList.addAll(BasicEList.jav a:686)
L> at
L> wzl.cosmos.engr.ganttcharteditor.parts.A_EditPart.getModelCh ildren(A_
L> EditPart.java:75)
L> ############################################################ #########
L> #######
L>
L> It will be ok if I just return getA().getBs() or getA().getCs().
L>
L> Can you explain this?
L>
L> thanks in advance
L>
L> Lucia
L>
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03349 seconds