1 16 package org.apache.cocoon.forms.binding; 17 18 import org.apache.cocoon.forms.binding.library.Library; 19 import org.apache.cocoon.forms.formmodel.Widget; 20 import org.apache.commons.jxpath.JXPathContext; 21 22 25 public abstract class AbstractCustomBinding implements Binding { 26 27 private Binding parent; 29 private String id; 30 31 34 public void setParent(Binding binding) { 35 this.parent = binding; 36 } 37 40 public String getId() { 41 return this.id; 42 } 43 public Binding getClass(String id) { 44 return this.parent.getClass(id); 45 } 46 49 public boolean isValid() { 50 return false; } 52 public Library getLocalLibrary() { 53 return null; 54 } 55 56 65 public final void loadFormFromModel(Widget frmModel, Object objModel) throws BindingException { 66 try { 67 doLoad(frmModel, (JXPathContext)objModel); 68 } catch (Exception e) { 69 throw new BindingException("Error executing custom binding", e); 70 } 71 } 72 73 82 public final void saveFormToModel(Widget frmModel, Object objModel) throws BindingException { 83 try { 84 doSave(frmModel, (JXPathContext)objModel); 85 } catch (Exception e) { 86 throw new BindingException("Error executing custom binding", e); 87 } 88 } 89 90 95 protected abstract void doLoad(Widget frmModel, JXPathContext context) throws Exception ; 96 protected abstract void doSave(Widget frmModel, JXPathContext context) throws Exception ; 97 } 98 | Popular Tags |