1 package net.sourceforge.formview.displayer.test; 2 3 import java.io.IOException ; 4 import java.io.InputStream ; 5 6 import org.xml.sax.SAXException ; 7 8 import net.sourceforge.formview.FieldView; 9 import net.sourceforge.formview.FormViewException; 10 import net.sourceforge.formview.displayer.DisplayerConfig; 11 import net.sourceforge.formview.displayer.DisplayersConfigResources; 12 13 public class TestDisplayersConfig { 14 15 18 public static void main(String [] args) throws FormViewException, IOException , SAXException { 19 InputStream inDisplayerConfig = null; 20 DisplayersConfigResources resources = null; 22 try { 23 24 inDisplayerConfig = DisplayersConfigResources.class.getResourceAsStream("displayers-config.xml"); 25 resources = new DisplayersConfigResources(inDisplayerConfig); 26 27 } finally { 28 if (inDisplayerConfig != null) { 30 inDisplayerConfig.close(); 31 } 32 33 } 34 35 DisplayerConfig displayerConfig = resources.getDisplayerConfig("input_text"); 37 System.out.println(displayerConfig.toString()); 38 39 displayerConfig = resources.getDisplayerConfig("select"); 41 System.out.println(displayerConfig.toString()); 42 43 FieldView field = new FieldView(); 45 field.setProperty("nom"); 46 47 48 String htmlInputContent = getHtmlInputContent(); 49 System.out.println(htmlInputContent); 51 52 } 53 54 private static String getHtmlInputContent() { 55 StringBuffer htmlContent = new StringBuffer (""); 56 htmlContent.append("<input name=\"nom\" type=\"text\" >\n"); 57 return htmlContent.toString(); 58 } 59 60 } 61 | Popular Tags |