KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > faces > core > renderer > html > NodeMenuRenderer


1 /***************************************************************************
2  * Copyright 2001-2003 The eXo Platform SARL All rights reserved. *
3  * Please look at license.txt in info directory for more license detail. *
4  **************************************************************************/

5 package org.exoplatform.faces.core.renderer.html;
6
7 import java.util.Map JavaDoc;
8 import javax.faces.component.UIComponent;
9 import javax.faces.context.FacesContext;
10 import org.exoplatform.faces.FacesConstants;
11 import org.exoplatform.faces.core.component.UIExoComponent;
12 import org.exoplatform.faces.core.component.UINode ;
13 import org.exoplatform.faces.core.component.model.Parameter;
14
15 public class NodeMenuRenderer extends HtmlBasicRenderer {
16
17   protected static Parameter SELECT_TAB = new Parameter(FacesConstants.ACTION , "selectTab") ;
18   
19   public void decode(FacesContext context, UIComponent component) {
20     Map JavaDoc paramMap = context.getExternalContext().getRequestParameterMap() ;
21     String JavaDoc action = (String JavaDoc) paramMap.get(FacesConstants.ACTION) ;
22     if ("selectTab".equals(action)) {
23       String JavaDoc tabId = (String JavaDoc) paramMap.get("tabId") ;
24       UIExoComponent uiComponent = (UIExoComponent) component ;
25       UIExoComponent target = uiComponent.findComponentById(tabId);
26       if(target != null) {
27         UINode uiNode = (UINode) target.getParent() ;
28         uiNode.setRenderedComponent(tabId) ;
29         context.renderResponse() ;
30       }
31     }
32   }
33 }
Popular Tags