/*
 * $Id: ClusterTreeViewForm.java,v 1.1 2005/06/23 00:58:34 aram Exp $
 *
 * Copyright (c) Siemens AG 2008 
 *           (c) Universität Paderborn 2008 
 * Licensed under EUPL 1.1. 
 *
 * $Log: ClusterTreeViewForm.java,v $
 * Revision 1.1  2005/06/23 00:58:34  aram
 * + Initiale Version
 *
 */
package vkc.util.treeview;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

public final class ClusterTreeViewForm extends ActionForm {
	private HttpSession session = null;

	private Integer categoryId = null;
    private Integer selectedId = null;

    private String action = "";

    public void reset(ActionMapping mapping, HttpServletRequest request) {
		super.reset(mapping, request);
		
		categoryId = null;
		selectedId = null;
	    action = "";
		session = request.getSession();
    }

    public TreeViewItem getTreeItem(String id) {
		TreeView tree = (TreeView)getSession().getAttribute(TreeView.CLUSTER_TREE_KEY);
		
		if (tree != null) {
		    return tree.getTreeViewItemById(id);
		}
		
		return null;
    }
    
    public String getAction() {
		return action;
	}

	public void setAction(String string) {
		action = string;
	}
	
	public boolean refresh(){
		return getAction().equalsIgnoreCase("refresh");
	}	
    
	public HttpSession getSession() {
        return session;
    }
    
	public void setSession(HttpSession session) {
        this.session = session;
    }
    
	public Integer getSelectedId() {
        return selectedId;
    }
    
	public void setSelectedId(Integer selectedId) {
        this.selectedId = selectedId;
    }

	public Integer getCategoryId() {
        return categoryId;
    }
    
	public void setCategoryId(Integer categoryId) {
        this.categoryId = categoryId;
    }
}