1 33 34 package com.icesoft.icefaces.samples.showcase.components.menuBar; 35 36 import javax.faces.component.UIComponent; 37 import javax.faces.context.FacesContext; 38 import javax.faces.event.ActionEvent; 39 import java.util.Map ; 40 41 46 public class MenuBarBean { 47 48 private String actionFired; 50 51 private String param; 53 54 private String orientation = "horizontal"; 56 57 62 public String getParam() { 63 return param; 64 } 65 66 69 public void setParam(String param) { 70 this.param = param; 71 } 72 73 78 public String getActionFired() { 79 return actionFired; 80 } 81 82 88 public void primaryListener(ActionEvent e) { 89 90 actionFired = (String ) ((UIComponent) e.getSource()) 91 .getClientId(FacesContext.getCurrentInstance()); 92 int menuIndex = actionFired.indexOf("menu:"); 94 actionFired = actionFired.substring(menuIndex, actionFired.length()); 95 96 FacesContext facesContext = FacesContext.getCurrentInstance(); 97 Map params = facesContext.getExternalContext().getRequestParameterMap(); 98 String myParam = (String ) params.get("myParam"); 99 if (myParam != null && myParam.length() > 0) { 100 setParam(myParam); 101 } else { 102 setParam("not defined"); 103 } 104 105 } 106 107 112 public String getOrientation() { 113 return orientation; 114 } 115 116 121 public void setOrientation(String orientation) { 122 this.orientation = orientation; 123 } 124 } | Popular Tags |