View Javadoc
1   package com.starphoenixmedia.candle_pos.util;
2   
3   import javax.swing.Icon;
4   import javax.swing.tree.DefaultMutableTreeNode;
5   
6   /**
7    *
8    * @author jlhawkwell
9    */
10  public class IconTreeNode extends DefaultMutableTreeNode
11  {
12  	private static final long serialVersionUID = 1L;
13  	private Icon icon;
14  	private String tableName;
15  
16  	public IconTreeNode() { super(); }
17  
18  	public IconTreeNode(Icon icon, String tableName)
19  	{
20  		super();
21  		this.icon = icon;
22  		this.tableName = tableName;
23  	}
24  
25  	public IconTreeNode(Icon icon, String tableName, Object userObject)
26  	{
27  		super(userObject);
28  		this.icon = icon;
29  		this.tableName = tableName;
30  	}
31  
32  	public IconTreeNode(Icon icon, String tableName, Object userObject, boolean allowsChildren)
33  	{
34  		super(userObject, allowsChildren);
35  		this.icon = icon;
36  		this.tableName = tableName;
37  	}
38  
39  	public Icon getIcon() { return icon; }
40  	public String getTableName() { return tableName; }
41  	public void setIcon(Icon icon) { this.icon = icon; }
42  	public void setTableName(String tableName) { this.tableName = tableName; }
43  
44  	@Override public String toString()
45  	{
46  		if ( userObject != null ) { return userObject.toString(); }
47  		else if ( tableName != null ) { return tableName; }
48  		else if ( icon != null ) { return icon.toString(); }
49  		else { return super.toString(); }
50  	}
51  }