package org.cmdline.sudoku;

import javax.swing.*;
import javax.swing.tree.*;
import java.awt.Font;

public class PuzzleNode extends DefaultMutableTreeNode implements TreeNode {
	private boolean leaf = false;
	private Icon icon = null;
	private Font font = null;
	
	public PuzzleNode(String name) {
		super(name);
	}

	
	public PuzzleNode(String name,boolean leaf) { 
		super(name);
		this.leaf = leaf;
	}
	
	public PuzzleNode(String name,boolean leaf,Icon icon) {
		super(name);
		this.leaf = leaf;
		this.icon = icon;
	}
	
	public Icon getIcon() {
		if (icon != null) return icon;
		return isLeaf() ? UIManager.getIcon("FileView.fileIcon") : 
			UIManager.getIcon("FileView.directoryIcon");		
	}

	public void setIcon(Icon icon) {
		this.icon = icon;
	}
	
	public void setFont(Font font) {
		this.font = font;
	}
	
	public Font getFont() {
		return font;
	}
/*
	public boolean getAllowsChildren() {
		return isLeaf();
	}
	
	public boolean isLeaf() { return leaf; }
*/	
}