KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > barracuda > contrib > dbroggisch > examples > view > pages > FileUploadPage


1 /*
2  * Copyright (C) 2003 Diez B. Roggisch [deets@web.de]
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * $Id: FileUploadPage.java,v 1.2 2004/02/01 05:16:27 christianc Exp $
19  */

20 package org.enhydra.barracuda.contrib.dbroggisch.examples.view.pages;
21
22 import java.io.IOException JavaDoc;
23 import java.util.List JavaDoc;
24 import java.util.Locale JavaDoc;
25 import javax.servlet.ServletException JavaDoc;
26 import org.w3c.dom.Document JavaDoc;
27 //import org.enhydra.xml.xmlc.XMLCStdFactory;
28
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 JavaDoc _names;
45
46     public void setNames(List JavaDoc names) {
47         _names = names;
48     }
49
50     public void render(BComponent root, ViewContext vec, Document JavaDoc pDoc)
51             throws EventException, ServletException JavaDoc, IOException JavaDoc {
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 JavaDoc getDocument(Locale JavaDoc iLocale) {
63         //return new XMLCStdFactory(null, null).create(FileUploadHTML.class);
64

65         Document JavaDoc doc = null;
66         //load the localized DOM template
67
try {doc = DefaultDOMLoader.getGlobalInstance().getDOM(FileUploadHTML.class, iLocale);}
68         catch (IOException JavaDoc ioe) {logger.fatal ("Fatal Error loading DOM template:", ioe);}
69         return doc;
70     }
71
72 }
73
Popular Tags