1 16 package org.apache.myfaces.custom.savestate; 17 18 import javax.faces.component.UIParameter; 19 import javax.faces.context.FacesContext; 20 import javax.faces.el.ValueBinding; 21 22 28 public class UISaveState 29 extends UIParameter 30 { 31 public Object saveState(FacesContext context) 32 { 33 Object values[] = new Object [2]; 34 values[0] = super.saveState(context); 35 values[1] = getValue(); 36 return ((Object ) (values)); 37 } 38 39 public void restoreState(FacesContext context, Object state) 40 { 41 Object values[] = (Object [])state; 42 super.restoreState(context, values[0]); 43 Object value = values[1]; 44 ValueBinding vb = getValueBinding("value"); 45 if (vb != null) 46 { 47 vb.setValue(context, value); 48 } 49 } 50 51 53 public static final String COMPONENT_TYPE = "org.apache.myfaces.SaveState"; 54 public static final String COMPONENT_FAMILY = "javax.faces.Parameter"; 55 56 57 public UISaveState() 58 { 59 } 60 61 public String getFamily() 62 { 63 return COMPONENT_FAMILY; 64 } 65 66 67 } 69 | Popular Tags |