1 package com.icesoft.faces.component.panelcollapsible; 2 3 import com.icesoft.faces.context.BridgeFacesContext; 4 5 import javax.faces.component.UIComponent; 6 import javax.faces.context.FacesContext; 7 import java.io.Serializable ; 8 import java.util.Map ; 9 10 public class PanelCollapsibleState implements Serializable { 11 12 13 public static PanelCollapsibleState getState(FacesContext context, UIComponent component) { 14 15 String id = component.getClientId(context); 16 String viewNumber = ((BridgeFacesContext) context).getViewNumber(); 17 18 String key = id + viewNumber; 19 Map map = context.getExternalContext().getSessionMap(); 20 PanelCollapsibleState state = (PanelCollapsibleState) map.get(key); 21 if (state == null) { 22 state = new PanelCollapsibleState(); 23 map.put(key, state); 24 } 25 return state; 26 } 27 28 29 private boolean changedViaDecode; 30 private boolean lastExpandedValue; 31 private boolean firstTime = true; 32 33 34 public boolean isChangedViaDecode() { 35 return changedViaDecode; 36 } 37 38 public void setChangedViaDecode(boolean changedViaDecode) { 39 this.changedViaDecode = changedViaDecode; 40 } 41 42 public boolean isLastExpandedValue() { 43 return lastExpandedValue; 44 } 45 46 public void setLastExpandedValue(boolean lastExpandedValue) { 47 this.lastExpandedValue = lastExpandedValue; 48 } 49 50 public boolean isFirstTime() { 51 return firstTime; 52 } 53 54 public void setFirstTime(boolean firstTime) { 55 this.firstTime = firstTime; 56 } 57 } 58 | Popular Tags |