summaryrefslogtreecommitdiffstats
path: root/org/madore/damlengine/TodoKillAElement.java
blob: f230ee028104f375b8fda8267be5ea85e7f113d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package org.madore.damlengine;

import java.util.ArrayList;
import org.w3c.dom.*;

public final class TodoKillAElement extends TodoDefaultElement {

    public static class Factory extends TodoElement.Factory {
	@Override
	public TodoKillAElement newItem(Element node,
					Context ctx,
					TodoItem caller) {
	    return new TodoKillAElement(node, ctx, caller);
	}
    }

    public TodoKillAElement(Element node,
			    Context ctx,
			    TodoItem caller) {
	super(node, ctx, caller);
    }

    @Override
    public void handleNodeOnly() {
	String explicitLang = LangHelper.getLangNorec(this.node);
	ArrayList<Node> childList = getChildList(node);
	ArrayList<TodoElement> toProcess = new ArrayList<TodoElement>(childList.size());
	for ( Node child : childList ) {
	    node.getParentNode().insertBefore(child, node);
	    if ( child.getNodeType() == Node.ELEMENT_NODE ) {
		if ( explicitLang != null )
		    LangHelper.setWeakLangNorec((Element)child, explicitLang);
		TodoElement it
		    = TodoElement.getTodoElement((Element)child, this.ctx, this);
		toProcess.add(it);
	    }
	}
	node.getParentNode().removeChild(node);
	this.ownerDeque.registerAtStart(toProcess);
    }

}