return null;
}
public SceneGraphObjectHolder addAnimator(Animator an, Object source){
// look for the first parent branch group
SceneGraphObjectHolder holder=getHolder().getParentHolder();
while(holder!=null && ! (holder.getSceneGraphObject() instanceof BranchGroup)){
holder=holder.getParentHolder();
}
if(holder==null){
throw new RuntimeException("Can not find a branch group to hold the new animator");
}
// look for one animator group node
ArrayList<SceneGraphObjectHolder> list=new ArrayList<SceneGraphObjectHolder>();
holder.getChildrenHolders(list);
SceneGraphObjectHolder ang=null;
for(SceneGraphObjectHolder h : list){
if(h.getSceneGraphObject() instanceof AnimatorGroup){
ang=h;
break;
}
}
CompoundEdit ce=new CompoundEdit();
if(ang==null){
// create one
AnimatorGroup ag=new AnimatorGroup();
holder.addSceneGraphObject(ag);
AddEdit ae=new AddEdit(holder,ag,null);
ce.addEdit(ae);
}
list.clear();
holder.getChildrenHolders(list);
for(SceneGraphObjectHolder h : list){
if(h.getSceneGraphObject() instanceof AnimatorGroup){
ang=h;
break;
}
}
if(ang==null){
throw new RuntimeException("Can not retrieve holder for animator group");
}
ang.addSceneGraphObject(an);
AddEdit ae=new AddEdit(ang,an,null);
ce.addEdit(ae);
holder.getUndoableEditListener().undoableEditHappened(
new UndoableEditEvent(source, ce));
ArrayList<SceneGraphObjectHolder> cl=new ArrayList<SceneGraphObjectHolder>();
ang.getChildrenHolders(cl);
holder=null;
for(SceneGraphObjectHolder h : cl){
if(h.getSceneGraphObject()==an){
holder=h;
break;