Package com.wiquery.plugins.demo

Source Code of com.wiquery.plugins.demo.BasePage

package com.wiquery.plugins.demo;

import java.util.ArrayList;
import java.util.List;

import org.apache.wicket.Component;
import org.apache.wicket.markup.html.CSSPackageResource;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.panel.Panel;
import org.odlabs.wiquery.plugin.layout.Layout;
import org.odlabs.wiquery.plugin.layout.Layout.PanePositionEnum;

import com.wiquery.plugin.antilia.grid.resources.DefaultStyle;
import com.wiquery.plugins.demo.code.SourceInfo;
import com.wiquery.plugins.demo.code.SourceInfo.FORMAT;
import com.wiquery.plugins.demo.resources.Styles;

/**
* Base page.
*/
public abstract class BasePage extends WebPage {

  private static final long serialVersionUID = 1L;

  /**
   * Constructor that is invoked when page is invoked without a session.
   *
   * @param parameters
   *            Page parameters
   */
    public BasePage() {
      add(CSSPackageResource.getHeaderContribution(DefaultStyle.CSS_MAIN));
      add(CSSPackageResource.getHeaderContribution(Styles.CSS_MAIN));
      Layout layout = new Layout("layout", true) {
         
          private static final long serialVersionUID = 1L;

          @Override
          public Panel getLayoutWestComponent(String wicketId) {
            return new NavigationPanel(wicketId);
          }
         
          @Override
          public Panel getLayoutNorthComponent(String wicketId) {
            return new HeaderPanel(wicketId);
          }
         
          @Override
          public Panel getLayoutCenterComponent(final String wicketId) {
            return new IndicatorPanel(wicketId, creaAyuda()) {
             
              private static final long serialVersionUID = 1L;

          @Override
              public Component newContents(String id) {
                return BasePage.this.getLayoutCenterComponent(id);
              }
            };           
          }
         
        };
        add(layout);
        layout.setResizable(PanePositionEnum.NORTH, false)
        .setClosable(PanePositionEnum.NORTH, false)
        .setSpacingOpen(PanePositionEnum.NORTH, 0)
        .setMinSize(PanePositionEnum.NORTH, 80)
        .setMaxSize(PanePositionEnum.NORTH, 82);
       
    }
   
    /**
   * En este metodo se crea la venatana emergente que contine las explicaciones
   * del ccodigo.
   */
  private  List<SourceInfo> creaAyuda() {
    List<SourceInfo> codeInfos = new ArrayList<SourceInfo>();
    addThisSourceCode(codeInfos);
    addSourceCode(codeInfos);   
    return codeInfos;
  }
 
  /**
   * Use this method to add INFO pages.
   *
   * @param codeInfos
   */
  private void addThisSourceCode(List<SourceInfo> codeInfos) {
    codeInfos.add(new SourceInfo(BasePage.class));
    codeInfos.add(new SourceInfo(BasePage.class, FORMAT.HTML, "BasePage.html", "BasePage.html"));
  }
 
  /**
   * Use this method to add INFO pages.
   *
   * @param codeInfos
   */
  protected void addSourceCode(List<SourceInfo> codeInfos) {
 
  }
 
    protected abstract Panel getLayoutCenterComponent(String wicketId);
}
TOP

Related Classes of com.wiquery.plugins.demo.BasePage

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.