1 17 package org.alfresco.web.ui.common.component.evaluator; 18 19 import javax.faces.context.FacesContext; 20 import javax.faces.el.ValueBinding; 21 22 27 public class StringEqualsEvaluator extends BaseEvaluator 28 { 29 35 public boolean evaluate() 36 { 37 boolean result = false; 38 39 try 40 { 41 result = getCondition().equals((String )getValue()); 42 } 43 catch (Exception err) 44 { 45 s_logger.debug("Expected String value for evaluation: " + getValue()); 47 } 48 49 return result; 50 } 51 52 55 public void restoreState(FacesContext context, Object state) 56 { 57 Object values[] = (Object [])state; 58 super.restoreState(context, values[0]); 60 this.condition = (String )values[1]; 61 } 62 63 66 public Object saveState(FacesContext context) 67 { 68 Object values[] = new Object [2]; 69 values[0] = super.saveState(context); 71 values[1] = this.condition; 72 return (values); 73 } 74 75 80 public String getCondition() 81 { 82 ValueBinding vb = getValueBinding("condition"); 83 if (vb != null) 84 { 85 this.condition = (String )vb.getValue(getFacesContext()); 86 } 87 88 return this.condition; 89 } 90 91 96 public void setCondition(String condition) 97 { 98 this.condition = condition; 99 } 100 101 102 103 private String condition = null; 104 } 105 | Popular Tags |