/**
 * Copyright (c) 2011, Martin Foster <martin@ethereal-realms.org>
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without 
 * modification, are permitted provided that the following conditions are met:
 * 
 *     * Redistributions of source code must retain the above copyright notice, 
 *       this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright 
 *       notice, this list of conditions and the following disclaimer in the 
 *       documentation and/or other materials provided with the distribution.
 *     * Neither the name of the Ethereal-Realms.org nor the names of its
 *       contributors may be used to endorse or promote products derived
 *       from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
package org.lyra.Widgets;

import javax.swing.tree.DefaultMutableTreeNode;

/**
 * A slight variant of the DefaultMutableTreeNode class that also aims to add
 * in two identifiers into the mix.  These identifiers permit the application
 * to quickly determine type and name in order to process.
 * <p>
 * @author Martin Foster
 * @version 1.0.4, %Revision, 99%, %LastChangedDate, 17/03/11 8:17PM%
 */
public class LyraMutableTreeNode extends DefaultMutableTreeNode {

	// Serial Mystery
	private static final long serialVersionUID = 1L;

	// Identifier Strings
	private String myGroup;
	private String myName;
	
	
	/**
	 * Creates a tree node that has no parent and no children, but which allows 
	 * children.  There are also no identifier elements installed. 
	 */
	public LyraMutableTreeNode() {
		
		// Just have the super class do its job
		super();
	}
	// End of Constructor Method
	
	
	/**
	 * Creates a tree node with no parent, no children, but which allows
	 * children, and initialises it with the specified user object.  The
	 * lack of nodeName element will create this to support children.
	 * <p>
	 * @param userObject An Object provided by the user that constitutes the node's data
	 * @param nodeGroup A string containing which group this item will be a part of.
	 */
	public LyraMutableTreeNode(Object userObject, String nodeGroup) {
		
		// Pass it onto the super class
		super(userObject, true);
		
		// Pass on Group
		myGroup = nodeGroup;
	}
	// End of Constructor Method

	/**
	 * Creates a tree node with no parent, no children, but which allows
	 * children, and initialises it with the specified user object.  With
	 * nodeName specified children will not be permitted.
	 * <p>
	 * @param userObject An Object provided by the user that constitutes the node's data
	 * @param nodeGroup A string containing which group this item will be a part of.
	 * @param nodeName A string indicating the name identifier of this tree.
	 */
	public LyraMutableTreeNode(Object userObject, String nodeGroup, String nodeName) {
		
		// Pass on to class constructor
		super(userObject, false);
		
		// Pass on the group
		myGroup = nodeGroup;
		myName  = nodeName;
	}
	// End of Constructor Method

	
	/**
	 * Set the group identifier.
	 * <p>
	 * @param nodeGroup String containing group identifier.
	 */
	public void setGroup(String nodeGroup) {
		
		// Pass on
		myGroup = nodeGroup;
	}
	// End of setGroup Method
	
	
	/**
	 * Get the group identifier.
	 * <p>
	 * @return String containing group identifier.
	 */
	public String getGroup() {
		
		// Pass on
		return myGroup;
	}
	// End of setGroup Method
	
	
	/**
	 * Set the name identifier.
	 * <p>
	 * @param nodeName String containing name identifier.
	 */
	public void setName(String nodeName) {
		
		// Pass on
		myName = nodeName;
	}
	// End of setName Method
	
	
	/**
	 * Get the name identifier.
	 * <p>
	 * @return String containing name identifier.
	 */
	public String getName() {
		
		// Pass on
		return myName;
	}
	// End of setName Method
}
