/*
 * Copyright (C) 2005 NTT DATA Corporation
 * 
 */
package org.postgresforest.tool.bean;

import java.util.ArrayList;
import java.util.List;

/**
 * TODO To change the template for this generated type comment go to Window -
 * Preferences - Java - Code Style - Code Templates
 */
public class TreeNode {
	
	protected String content;

	protected String m_imageKey = null;

	protected List children = new ArrayList();


	protected TreeNode parent;

	protected Object m_treeObject = null;
	/**
	 * @param content
	 * @param imageKey
	 */
	public TreeNode(String content, String imageKey) {
		this.content = content;
		m_imageKey = imageKey;
	}
	public TreeNode(String node) {
		this.setContent(node);
	}

	public void setParent(TreeNode parent) {
		this.parent = parent;
	}

	public TreeNode getParent() {
		return parent;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getContent() {
		return content;
	}

	public void clear() {
		children.clear();
	}

	public void add(TreeNode child) {
		children.add(child);
		child.setParent(this);
	}

	public int size() {
		return children.size();
	}

	public TreeNode get(int index) {
		return (TreeNode) children.get(index);
	}

	public List getChildren() {
		return  children;
	}

	public Object[] getChildrenArray() {
		return  children.toArray(new Object[0]);
	}

	/**
	 * @return imageKey を戻します。
	 */
	public String getImageKey() {
		return m_imageKey;
	}
	/**
	 * @param imageKey imageKey を設定。
	 */
	public void setImageKey(String imageKey) {
		m_imageKey = imageKey;
	}
	//TODOMASU 要確認ここにオブジェクト設定を追加（パーティション設定画面のため）多分、子クラスで実装しているのがあるはずのなで
	public Object getObject(){
		return m_treeObject;
	}
	public void setObject(Object lObject){
		this.m_treeObject = lObject;
	}
	
}