package org.richfaces.realworld.tree;

import java.util.Iterator;

import javax.faces.component.UIGraphic;

import org.richfaces.model.TreeNode;
import org.richfaces.realworld.domain.Image;

public class TreeImageItem implements TreeNode {
	/**
	 * 
	 */
	private static final long serialVersionUID = 6514596192023597908L;
	private long id;
	private Image image;
	
	private UIGraphic uiImage;
	private TreeAlbumItem album;

	public TreeImageItem(long id, TreeAlbumItem album, Image image) {
		this.id = id;
		this.album = album;
		this.image = image;
		this.uiImage = new UIGraphic();
		this.uiImage.setUrl(image.getPath());
	}
	
	public void addChild(Object identifier, TreeNode child) {
		
	}

	public TreeNode getChild(Object id) {
		return null;
	}

	public Iterator getChildren() {
		return null;
	}

	public Object getData() {
		return this;
	}

	public TreeNode getParent() {
		return album;
	}

	public boolean isLeaf() {
		return true;
	}

	public void removeChild(Object id) {
		
	}

	public void setData(Object data) {
	}

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

	public long getId() {
		return id;
	}
	
	public String getType() {
		return "image";
	}

	public Image getImage() {
		return image;
	}

	public void setImage(Image image) {
		this.image = image;
	}

	public UIGraphic getUiImage() {
		return uiImage;
	}

	public void setUiImage(UIGraphic uiImage) {
		this.uiImage = uiImage;
	}
	
}
