1 7 8 package org.enhydra.snapper.presentation; 9 10 11 12 import org.enhydra.snapper.presentation.html.*; 14 import org.enhydra.snapper.spec.*; 15 import org.enhydra.xml.xmlc.XMLObject; 16 import org.w3c.dom.Node ; 17 import org.w3c.dom.html.HTMLOptionElement; 18 19 20 public class NewSitePresentation extends BasePO { 21 22 23 protected XMLObject getDOM() throws Exception { 24 25 NewSiteHTML newSite; 26 Language[] list; 27 HTMLOptionElement templateOption; 28 29 newSite = (NewSiteHTML)comms.xmlcFactory.create(NewSiteHTML.class); 30 31 if (comms.request.getParameter("err") != null) { 32 34 } 35 36 37 try{ 38 LanguageList ll = LanguageListFactory.createLanguageList("org.enhydra.snapper.business.LanguageListImpl"); 39 list = ll.getList(dbTransaction); 40 41 templateOption = newSite.getElementTemplateLanguage(); 42 Node languageSelect = templateOption.getParentNode(); 43 templateOption.removeAttribute("id"); 44 templateOption.removeChild(templateOption.getFirstChild()); 45 for (int numLanguages = 0; numLanguages < list.length; numLanguages++) { 46 47 Language currentLanguage = list[numLanguages]; 48 HTMLOptionElement clonedOption = (HTMLOptionElement) templateOption.cloneNode(true); 49 clonedOption.setValue(currentLanguage.getHandle()); 50 Node optionTextNode = clonedOption.getOwnerDocument(). 51 createTextNode(currentLanguage.getName()); 52 clonedOption.appendChild(optionTextNode); 53 languageSelect.appendChild(clonedOption); 56 } 57 58 templateOption.getParentNode().removeChild(templateOption); 59 } 60 catch(Exception ex) { 61 System.out.print(ex.toString());} 62 63 64 return newSite; 65 } 66 67 } 68 | Popular Tags |