summaryrefslogtreecommitdiffstats
path: root/org/madore/damlengine/TodoDateExtraElement.java
blob: f82dfc7c779291b62066fbf697492da23570148b (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
package org.madore.damlengine;

import org.w3c.dom.*;

public final class TodoDateExtraElement extends TodoDefaultElement {

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

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

    @Override
    public void handleNodeOnly() {
	String lang = LangHelper.getLangRec(node);
	String explicitLang = LangHelper.getLangNorec(node);
	if ( explicitLang != null && explicitLang != lang ) {
	    System.err.println("warning: lang attribute on date-extra will be ignored");
	    explicitLang = null;
	}
	if ( ctx.ent == null )
	    throw new IllegalStateException("entry context not defined in date-extra element");
	ctx.ent.headlinkNode.appendChild(ctx.doc.createTextNode(" \u00b7 "+node.getTextContent()));
	node.getParentNode().removeChild(node);
    }

}