package cz.example.myproject.client;

import com.google.gwt.core.client.EntryPoint;
import com.smartgwt.client.types.ContentsType;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.plugins.Applet;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class LayoutWithApplet implements EntryPoint {
	
	private static final boolean USE_IFRAME = false;
	
	 public void onModuleLoad() {  
		VLayout tmpLayout = new VLayout();
		tmpLayout.setWidth100();
		tmpLayout.setHeight100();
		tmpLayout.setOverflow(Overflow.VISIBLE);
		
		VLayout tmpInnerLayout = new VLayout();
		tmpInnerLayout.setWidth100();
		tmpInnerLayout.setHeight("*");
		tmpInnerLayout.setBackgroundColor("#6AB3FF");
		
		Canvas tmpTop = new Canvas();
		tmpTop.setHeight(150);
		tmpTop.setWidth100();
		tmpTop.setShowResizeBar(true);
		
		Canvas tmpBottom = new Canvas();
		tmpBottom.setOverflow(Overflow.AUTO);
		tmpBottom.setHeight100();
		tmpBottom.setWidth100();
		if(USE_IFRAME) {
			HTMLFlow tmpApplet = new HTMLFlow();
			tmpApplet.setHeight100();
			tmpApplet.setWidth100();
			tmpApplet.setContentsType(ContentsType.PAGE);
			tmpApplet.setContentsURL("frameContent.html");
			tmpBottom.addChild(tmpApplet);
		} else {
			Applet tmpApplet = new Applet();
			tmpApplet.setWidth(300);
			tmpApplet.setHeight(200);
			tmpApplet.setCode("Calculator");
			tmpBottom.addChild(tmpApplet);
		}
		
		tmpInnerLayout.addMember(tmpTop);
		tmpInnerLayout.addMember(tmpBottom);
		
		
		Canvas tmpStatusBar = new Canvas();
		tmpStatusBar.setHeight(25);
		
		Label tmpStatus = new Label("Status");
		tmpStatusBar.addChild(tmpStatus);
		
		
		tmpLayout.addMember(tmpInnerLayout);
		tmpLayout.addMember(tmpStatusBar);
		tmpLayout.draw();
		
     }  
}
