1 7 package org.enhydra.pim.presentation.enhydrapim; 8 9 import java.util.Vector ; 10 11 import org.enhydra.pim.business.api.ContactTypeI; 12 import org.enhydra.pim.presentation.BasePO; 13 import org.enhydra.pim.spec.ContactTypeManagerFactory; 14 import org.enhydra.xml.xmlc.XMLObject; 15 import org.w3c.dom.Node ; 16 import org.w3c.dom.html.HTMLOptionElement; 17 18 import com.lutris.appserver.server.httpPresentation.HttpPresentationException; 19 20 25 public class Find extends BasePO { 26 27 public static final String FIRSTNAME = "firstname"; 28 29 public static final String LASTNAME = "lastname"; 30 31 public static final String NICKNAME = "nickname"; 32 33 public static final String CONTACTTYPE = "contacttype"; 34 35 public static final String ID_CONTACTTYPE = "contactType"; 36 37 public static final String ID_CONTACTTYPEVALUE = "contactTypeValue"; 38 39 public static final String CONTACTDATA = "contactdata"; 40 41 46 47 public XMLObject handleDefault() throws HttpPresentationException { 48 FindHTML page = (FindHTML) myComms.xmlcFactory.create(FindHTML.class); 49 try { 50 51 54 HTMLOptionElement selectRow = page.getElementContactTypeValue(); 55 Node selectField = selectRow.getParentNode(); 56 57 59 selectRow.removeAttribute("id"); 60 61 selectRow.setAttribute("value", ""); 62 selectRow.getFirstChild().setNodeValue(""); 63 selectField.appendChild(selectRow.cloneNode(true)); 64 65 Vector selectItems = ContactTypeManagerFactory.getContactTypeManager().getContactTypes(); 66 for (int i = 0; i < selectItems.size(); i++) { 67 ContactTypeI cType = (ContactTypeI) selectItems.elementAt(i); 68 selectRow.setAttribute("value", cType.getContact_type()); 69 selectRow.getFirstChild().setNodeValue(cType.getContact_type()); 70 Node clonedRow = selectRow.cloneNode(true); 71 selectField.appendChild(clonedRow); 72 } 73 74 selectRow.getParentNode().removeChild(selectRow); 77 } catch (Exception ex) { 78 return showErrorPage("Error during Find:" + ex.getMessage()); 79 } 80 return page; 82 } 83 84 89 protected boolean loggedInUserRequired() { 90 return true; 92 } 93 94 } | Popular Tags |