View Javadoc
1 /* 2 * Angkor Web Framework 3 * 4 * Distributable under LGPL license. 5 * See terms of license at gnu.org. 6 */ 7 8 package com.tirsen.angkor; 9 10 import com.tirsen.angkor.RenderContext; 11 import com.tirsen.angkor.View; 12 import com.tirsen.angkor.process.Pipeline; 13 import com.tirsen.angkor.process.ParseValve; 14 import com.tirsen.angkor.process.RenderPageValve; 15 import com.tirsen.angkor.widget.Container; 16 import com.tirsen.angkor.widget.Menu; 17 18 import java.io.IOException; 19 import java.util.LinkedList; 20 import java.util.List; 21 22 /*** 23 * TODO document Page 24 * 25 * @author $Author: tirsen $ 26 * @version $Revision: 1.1 $ 27 * <BR> 28 * $Id: Page.java,v 1.1 2002/10/13 19:59:22 tirsen Exp $ 29 */ 30 public class Page extends Container 31 { 32 private Menu menu; 33 private View mainView; 34 private Application application; 35 36 public Page() 37 { 38 } 39 40 public Page(View singleElement) 41 { 42 add(singleElement); 43 } 44 45 public Menu getMenu() 46 { 47 return menu; 48 } 49 50 public void setMenu(Menu menu) 51 { 52 // remove the old one 53 if (this.menu != null) 54 { 55 this.menu.setContainer(null); 56 } 57 this.menu = menu; 58 menu.setContainer(this); 59 } 60 61 public View getMainView() 62 { 63 return mainView; 64 } 65 66 public void setMainView(View view) 67 { 68 if (this.mainView != null) 69 { 70 this.mainView.setContainer(null); 71 } 72 this.mainView = view; 73 mainView.setContainer(this); 74 } 75 76 public void render(RenderContext context) throws IOException 77 { 78 context.startTag("HTML"); 79 context.startTag("HEAD"); 80 context.emptyTag("BASE HREF=\"" + context.getRequest().getScheme() + "://" + context.getRequest().getServerName() + ":" + context.getRequest().getServerPort() + context.getRequest().getContextPath() + "/\""); 81 context.endTag("HEAD"); 82 context.startTag("BODY bgcolor=\"#FFFFFF\" text=\"#000000\" link=\"#000000\" alink=\"#000000\" vlink=\"#000000\" leftmargin=\"0\" topmargin=\"0\" marginheight=\"0\" marginwidth=\"0\""); 83 if (getMenu() != null) getMenu().render(context); 84 if (getMainView() != null) getMainView().render(context); 85 renderChildren(context); 86 context.endTag("BODY"); 87 context.endTag("HTML"); 88 } 89 90 public Pipeline createProcessPipeline() 91 { 92 Pipeline pipeline = getApplication().createBasicPipeline(); 93 pipeline.addValve(new ParseValve()); 94 pipeline.addValve(new RenderPageValve(this)); 95 return pipeline; 96 } 97 98 public Application getApplication() 99 { 100 return application; 101 } 102 103 public void setApplication(Application application) 104 { 105 this.application = application; 106 } 107 }

This page was automatically generated by Maven