FileDocCategorySizeDatePackage
NavigationTag.javaAPI DocJBoss 4.2.13682Fri Jul 13 21:02:12 BST 2007org.jboss.console.plugins.helpers.servlet

NavigationTag

public class NavigationTag extends javax.servlet.jsp.tagext.TagSupport

Fields Summary
private ArrayList
tabs
private String
selectedTabName
Constructors Summary
Methods Summary
public intdoEndTag()

		try
		{
			pageContext.getOut().write(
				"<table width='100%' height='24' border='0' cellspacing='0' cellpadding='0'>");
			pageContext.getOut().write("<tr valign='bottom'>");
			for (int i = 0; i < tabs.size(); i++)
			{
				Tab tab = (Tab) tabs.get(i);
				String name = tab.getName();		
				
				pageContext.getOut().write("<td width='8' align='left' class='tabSpacer'>");
				pageContext.getOut().write("<p><img src='images/spacer.gif' width='8' height='24'></p>");
				pageContext.getOut().write("</td>");
				pageContext.getOut().write("<td align='left' nowrap class=");
				
				if (isSelected(tab))
				{					
					pageContext.getOut().write("'tab'>");
				}
				else
				{
					pageContext.getOut().write("'tabOff'>");
				}
				pageContext.getOut().write("<p>");
				if (tab.getHref() != null)
				{
					pageContext.getOut().write("<a href='" + tab.getHref() + "'>");
				}
				pageContext.getOut().write(name);
				if (tab.getHref() != null)
				{
					pageContext.getOut().write("</a>");
				}					
				pageContext.getOut().write("</p></td>");
			}
			//last spacer takes up rest of the space
			pageContext.getOut().write("<td width='100%' align='left' class='tabSpacer'><p> </p></td>");
			pageContext.getOut().write("</tr>");
			pageContext.getOut().write("</table>");
		}
		catch (IOException e)
		{
			throw new JspTagException(e.toString());
		}
		return EVAL_PAGE;
	
public intdoStartTag()

	
	    
	
		tabs.clear();
		return EVAL_BODY_INCLUDE;
	
public java.lang.StringgetSelectedTabName()

return

		return selectedTabName;
	
private booleanisSelected(Tab tab)

param
tab
return

		boolean selected = false;
		
		if (tab.isSelected())
		{
			selected = true;			
		}
		
		//navigation parent setting overrides if set			
		if (selectedTabName != null && !selectedTabName.equals("")) 
		{  			
			selected = tab.getName().equals(selectedTabName);
		}
		
		return selected;		
	
public voidsetSelectedTabName(java.lang.String string)

param
string

		selectedTabName = string;
	
public final voidsetTabs(Tab tab)

		tabs.add(tab);