Mercurial > hg > Members > shoshi > TreeCMSv1
view src/treecms/proto/simple/SimpleTreeBuilder.java @ 26:9b91329e8a04
commit for zemi , doent move
author | ShoshiTAMAKI |
---|---|
date | Tue, 02 Nov 2010 18:44:21 +0900 |
parents | 99346c04a3cf |
children |
line wrap: on
line source
package treecms.proto.simple; import treecms.proto.api.Node; import treecms.proto.api.TreeBuilder; import treecms.proto.id.IncrementalNodeIDFactory; public class SimpleTreeBuilder implements TreeBuilder { private Node m_root; private IncrementalNodeIDFactory m_idFactory; public SimpleTreeBuilder() { m_idFactory = new IncrementalNodeIDFactory(); m_root = createNode(); } public Node getContents() { return m_root; } public Node createNode() { return new SimpleNode(m_idFactory.createNewID()); } @Override public Node cloneNode(Node _node) { // TODO Auto-generated method stub if(!(_node instanceof SimpleNode)){ throw new IllegalArgumentException("cant clone , _node is not instance of SimpleNode"); } SimpleNode clone = new SimpleNode(m_idFactory.updateExistID(_node.getID())); clone.setClassName(_node.getClassName()); clone.setTitle(_node.getTitle()); clone.addChildren(_node.getChildList()); return clone; } }