1 20 package org.enhydra.barracuda.contrib.dbroggisch.examples.view.pages; 21 22 import java.io.IOException ; 23 import java.util.List ; 24 import java.util.Locale ; 25 import javax.servlet.ServletException ; 26 import org.w3c.dom.Document ; 27 import org.enhydra.barracuda.core.comp.BComponent; 29 import org.enhydra.barracuda.core.comp.BList; 30 import org.enhydra.barracuda.core.comp.DefaultListModel; 31 import org.enhydra.barracuda.core.comp.DefaultView; 32 import org.enhydra.barracuda.core.comp.ViewContext; 33 import org.enhydra.barracuda.core.event.EventException; 34 import org.enhydra.barracuda.core.util.dom.DefaultDOMLoader; 35 import org.apache.log4j.Logger; 36 37 import org.enhydra.barracuda.contrib.dbroggisch.examples.view.xmlc.*; 38 39 40 public class FileUploadPage extends ExampleBasePage { 41 42 private static final Logger logger = Logger.getLogger(FileUploadPage.class.getName()); 43 44 List _names; 45 46 public void setNames(List names) { 47 _names = names; 48 } 49 50 public void render(BComponent root, ViewContext vec, Document pDoc) 51 throws EventException, ServletException , IOException { 52 super.render(root, vec, pDoc); 53 FileUploadHTML doc = (FileUploadHTML)pDoc; 54 BList fList = new BList(); 55 fList.setView(new DefaultView(doc.getElementFileNames())); 56 DefaultListModel dlm = new DefaultListModel(); 57 dlm.addAll(_names); 58 fList.setModel(dlm); 59 root.addChild(fList); 60 } 61 62 public Document getDocument(Locale iLocale) { 63 65 Document doc = null; 66 try {doc = DefaultDOMLoader.getGlobalInstance().getDOM(FileUploadHTML.class, iLocale);} 68 catch (IOException ioe) {logger.fatal ("Fatal Error loading DOM template:", ioe);} 69 return doc; 70 } 71 72 } 73 | Popular Tags |