1 package org.oddjob.designer.arooa; 2 3 import org.oddjob.arooa.ArooaHandler; 4 import org.oddjob.arooa.ArooaContext; 5 import org.oddjob.arooa.ArooaConstants; 6 import org.oddjob.arooa.Lifecycle; 7 import org.oddjob.arooa.reflect.IntrospectionHelper; 8 import org.xml.sax.Attributes ; 9 import org.xml.sax.SAXParseException ; 10 11 22 public class DesignStartHandler extends ArooaHandler { 23 24 25 private final Object rootComponent; 26 33 public DesignStartHandler(Object rootObject) { 34 this.rootComponent = rootObject; 35 } 36 37 48 public void onStartElement(String uri, String tag, String qname, 49 Attributes attrs, 50 ArooaContext context) 51 throws SAXParseException { 52 53 HandlerUtils.setAttributes(uri, attrs, rootComponent); 54 55 context.set(ArooaConstants.CURRENTLY_CONFIGURING, rootComponent); 56 } 57 58 69 public ArooaHandler onStartChild(String uri, String name, String qname, 70 Attributes attrs, 71 ArooaContext context) 72 throws SAXParseException { 73 IntrospectionHelper ih = IntrospectionHelper.getHelper(rootComponent.getClass()); 74 return ih.provideHandler(rootComponent, name, context); 75 } 76 77 89 public void characters(char[] buf, int start, int count, 90 ArooaContext context) 91 throws SAXParseException { 92 IntrospectionHelper ih = IntrospectionHelper.getHelper(rootComponent.getClass()); 93 ih.addText(rootComponent, new String (buf, start, count)); 94 } 95 96 103 public void onEndElement(String uri, String tag, ArooaContext context) { 104 Lifecycle.init(rootComponent); 105 } 106 107 } 108 109 | Popular Tags |