Package com.wiquery.plugins.demo.code

Source Code of com.wiquery.plugins.demo.code.CodeTabPanel

package com.wiquery.plugins.demo.code;

import java.util.List;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.panel.Panel;
import org.odlabs.wiquery.plugin.layout.Layout;

/**
* @author Ernesto Reinaldo Barreiro (reiern70@gmail.com)
*
*/
public class CodeTabPanel extends Panel {

  private static final long serialVersionUID = 1L;
 
  private int active = 0;

  private List<SourceInfo> code;
 
  /**
   * @param id
   */
  public CodeTabPanel(String id, List<SourceInfo> code) {
    super(id);
 
    setOutputMarkupId(true);
    this.code = code;
     
  }
 
  @Override
  protected void onBeforeRender() {
    Layout layout = new Layout("layout", false) {
     
      private static final long serialVersionUID = 1L;
     
      @Override
      public Panel getLayoutWestComponent(String wicketId) {
        return new ListOfCodePanel(wicketId, code);
      }
      public Panel getLayoutCenterComponent(String wicketId) {
        return new CodeReaderPanel(wicketId, code.get(CodeTabPanel.this.getActive()));
      }
    };
    addOrReplace(layout);
    super.onBeforeRender();
  }
 
  public void setActiveFile(int active, AjaxRequestTarget target) {
    this.active = active;
    if(target != null) {
      target.addComponent(this);
    }
  }

  public int getActive() {
    return active;
  }
}
TOP

Related Classes of com.wiquery.plugins.demo.code.CodeTabPanel

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.