Mercurial > hg > Members > shoshi > TreeCMS > TreeCMSPrototype1
changeset 9:79592d69632e
added source
author | shoshi |
---|---|
date | Sat, 28 Aug 2010 17:35:20 +0900 |
parents | 8fbe7ba1d820 |
children | f5a4baf70bdf |
files | src/treecms/proto/edit/EditableNodeAPI.java |
diffstat | 1 files changed, 129 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/treecms/proto/edit/EditableNodeAPI.java Sat Aug 28 17:35:20 2010 +0900 @@ -0,0 +1,129 @@ +package treecms.proto.edit; + +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; + +import treecms.proto.api.NodeAPI; + +public class EditableNodeAPI implements NodeAPI +{ + private boolean m_flagChanged; + + private String m_uuid; + private String m_class; + private String m_title; + + private NodeAPI m_orig; + + private LinkedList<NodeAPI> m_children; + + public EditableNodeAPI(String _uuid) + { + m_uuid = _uuid; + m_flagChanged = false; + m_children = new LinkedList<NodeAPI>(); + } + + public boolean isChanged() + { + return m_flagChanged; + } + + public void setOriginal(NodeAPI _orig) + { + m_orig = _orig; + } + + public NodeAPI getOriginal() + { + return m_orig; + } + + public String getUUID() + { + return m_uuid; + } + + + @Override + public List<NodeAPI> getChildList() + { + // TODO Auto-generated method stub + return m_children; + } + + @Override + public boolean isChild(NodeAPI _child) + { + // TODO Auto-generated method stub + return m_children.contains(_child); + } + + @Override + public void addChild(NodeAPI _child) { + // TODO Auto-generated method stub + m_children.add(_child); + m_flagChanged = true; + } + + @Override + public void removeChild(NodeAPI _child) { + // TODO Auto-generated method stub + if(m_children.remove(_child)){ + m_flagChanged = true; + } + } + + @Override + public void up(NodeAPI _child) { + // TODO Auto-generated method stub + int curPos = m_children.indexOf(_child); + if(curPos - 1 > 0){ + m_children.add(curPos - 1,m_children.remove(curPos)); + m_flagChanged = true; + } + } + + @Override + public void down(NodeAPI _child) { + // TODO Auto-generated method stub + int curPos = m_children.indexOf(_child); + if(curPos + 1 < m_children.size()){ + m_children.add(curPos + 1,m_children.remove(curPos)); + m_flagChanged = true; + } + } + + @Override + public void setClassName(String _class) { + // TODO Auto-generated method stub + this.m_class = _class; + m_flagChanged = true; + } + + @Override + public void setTitle(String _title) { + // TODO Auto-generated method stub + this.m_title = _title; + m_flagChanged = true; + } + + @Override + public String getClassName() { + // TODO Auto-generated method stub + return this.m_class; + } + + @Override + public String getTitle() { + // TODO Auto-generated method stub + return this.m_title; + } + + @Override + public Iterator<NodeAPI> iterator() { + // TODO Auto-generated method stub + return m_children.iterator(); + } +}