Package net.sf.jwan.tutorial

Source Code of net.sf.jwan.tutorial.ComplexWebsite

package net.sf.jwan.tutorial;

import java.util.Properties;

import net.sf.exlp.io.LoggerInit;
import net.sf.jwan.servlet.exception.WanRenderException;
import net.sf.jwan.servlet.gui.elements.WanDiv;
import net.sf.jwan.servlet.gui.elements.WanPage;
import net.sf.jwan.servlet.gui.elements.WanParagraph;
import net.sf.jwan.servlet.gui.layer.AbstractWanServletLayer;
import net.sf.jwan.servlet.gui.layer.WanContentLayer;
import net.sf.jwan.servlet.gui.menu.WanMenu;
import net.sf.jwan.servlet.gui.menu.WanMenuEntry;
import net.sf.jwan.servlet.util.JwanHtmlFormatter;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class ComplexWebsite
{
  static Log logger = LogFactory.getLog(ComplexWebsite.class);
 
  public ComplexWebsite()
  {
   
    ExampleSublayer exSub = new ExampleSublayer();
      exSub.render(new Properties())
     
    WanMenu wmProgram = new WanMenu();
      wmProgram.setTitle("First Menu")
      AbstractWanServletLayer wdl = (AbstractWanServletLayer)exSub;
      WanMenuEntry wmiSub = new WanMenuEntry();
        wmiSub.setName(wdl.getLayerTitle());
        wmiSub.setHtmlref(wdl.getHtmlHref());
        wmProgram.addItem(wmiSub);
   
    WanDiv div = new WanDiv();
      div.setDivclass(WanDiv.DivClass.iBlock);
      div.addContent(new WanParagraph("This is Paragraph"))
     
      WanContentLayer mainLayer = new WanContentLayer("Home");
      mainLayer.setLayerTitle("Home");
      mainLayer.setSubDiv(false);
      mainLayer.addContent(div);
      mainLayer.addContent(wmProgram);
   
    WanPage complexPage = new WanPage("jWAN Complex Example");
      complexPage.setMainLayer(mainLayer);
      complexPage.addSubLayer(exSub);
     
    JwanHtmlFormatter jhf = new JwanHtmlFormatter()
    try{logger.debug(jhf.format(complexPage.render()));}
    catch (WanRenderException e) {logger.error(e);}
  }
 
  public static void main(String args[])
  {
    LoggerInit loggerInit = new LoggerInit("log4j.xml");
      loggerInit.addAltPath("resources/config");
      loggerInit.init();
   
    new ComplexWebsite();
  }
}
TOP

Related Classes of net.sf.jwan.tutorial.ComplexWebsite

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.