1 5 6 package simpleapp.presentation; 7 8 import java.util.Date ; 9 import org.enhydra.xml.xmlc.*; 10 import com.lutris.appserver.server.httpPresentation.*; 11 import org.w3c.dom.html.*; 12 import org.w3c.dom.*; 13 14 15 public class SimplePresentation implements HttpPresentation { 16 17 String [][] discList = 18 { { "Felonious Monk Fish", "Deep Sea Blues", "Jazz", "Yes" }, 19 { "Funky Urchin", "Lovely Spines", "Techno Pop", "Yes" }, 20 { "Stinky Pups", "Shark Attack", "Hardcore", "No" } }; 21 22 public void run(HttpPresentationComms comms) 23 throws HttpPresentationException { 24 25 String now = new Date ().toString(); 26 SimpleHTML simple =(SimpleHTML)comms.xmlcFactory.create(SimpleHTML.class); 28 29 simple.setTextTime(now); 30 31 HTMLTableRowElement templateRow = simple.getElementTemplateRow(); 32 HTMLElement artistCellTemplate = simple.getElementArtist(); 33 HTMLElement titleCellTemplate = simple.getElementTitle(); 34 HTMLElement genreCellTemplate = simple.getElementGenre(); 35 HTMLElement likeThisDisc = simple.getElementLikeThisDisc(); 36 37 templateRow.removeAttribute("id"); 38 artistCellTemplate.removeAttribute("id"); 39 titleCellTemplate.removeAttribute("id"); 40 genreCellTemplate.removeAttribute("id"); 41 likeThisDisc.removeAttribute("id"); 42 43 Node discTable = templateRow.getParentNode(); 44 45 for(int numDiscs = 0; numDiscs < discList.length; numDiscs++) { 46 simple.setTextArtist(discList[numDiscs][0]); 47 simple.setTextTitle(discList[numDiscs][1]); 48 simple.setTextGenre(discList[numDiscs][2]); 49 simple.setTextLikeThisDisc(discList[numDiscs][3]); 50 discTable.appendChild(templateRow.cloneNode(true)); 51 } 52 53 discTable.removeChild(templateRow); 54 55 comms.response.writeHTML(simple.toDocument()); 56 } 57 58 }
| Popular Tags
|