/*
 * Created on Jan 9, 2004
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package gov.va.med.esr.ui.common.beans;

import java.io.Serializable;
import java.util.Enumeration;
import java.util.Stack;

/**
 * @author VHAIVMKOCKN
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class BreadCrumbHeaderBean implements Serializable {
	private static final long serialVersionUID = 8654448689990317691L;
	private String currentpagename;
    private String currentpageurl;
	private Stack breadtrail;
	private Enumeration breadpageurls;
	
	
	public Enumeration getBreadpageurls() {
	
	    this.breadpageurls = breadtrail.elements();
	    
	    return breadpageurls;
	}
	
	/**
	 * @return Returns the Current Page name.
	 */
	public String getCurrentpagename() {
		return currentpagename;
	}
	
	/**
	 * @param name The Current Page name to set.
	 */
	public void setCurrentpagename(String currentname) {
		this.currentpagename = currentname;
	}
	
	
	/**
	 * @return Returns the Current Page url.
	 */
	public Stack getBreadtrail() {
		return breadtrail;
	}
	/**
	 * @param url The Current Page url to set.
	 */
	public void setBreadtrail(Stack breadtrail) {
		this.breadtrail = breadtrail;
	}
	
	/**
	 * @return Returns the Current Page url.
	 */
	public String getCurrentpageurl() {
		return currentpageurl;
	}
	
	/**
	 * @param url The Current Page url to set.
	 */
	public void setCurrentpageurl(String currenturl) {
		this.currentpageurl = currenturl;
	}
	
	public void PushPageOnStack(String currentpage, String currenturl){
	    //First check if page is in stack
	    //Push Page, URL Strings on to stack.
	    if (breadtrail.search(currentpage) < 0)
	    {
	        breadtrail.push(currentpage);
	        breadtrail.push(currenturl);
	    }
	}
	
	public String PopTopPageOffStack(){
	    //Pop the Url and the Page
	    breadtrail.pop();
	    return breadtrail.pop().toString();
	    
	}
	
}
