package com.test.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.FileUpload;
import com.google.gwt.user.client.ui.RootPanel;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.FileItem;
import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.VLayout;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class TestApp implements EntryPoint {
	@Override
	public void onModuleLoad() {

		VLayout vTest=new VLayout();
		vTest.setBackgroundColor("#D3D3D3");
		
		VLayout fileVLayout = new VLayout(10);
		fileVLayout.setAutoWidth();
		fileVLayout.setAutoHeight();
		fileVLayout.setPadding(10);
		final DynamicForm form = new DynamicForm();

		TextItem filename = new TextItem();
		filename.setTitle("File Name");
		TextItem uploader = new TextItem();
		uploader.setTitle("uploader name");
		uploader.setWrapTitle(false);

		final FileItem uploadfile = new FileItem();
		uploadfile.setTitle("File Item");
		uploadfile.setAlign(Alignment.CENTER);

		final FileUpload fileTest = new FileUpload();
		fileTest.setTitle("File Upload");

		form.setItems(filename, uploader, uploadfile);
		form.draw();

		HLayout fileHLayout = new HLayout(10);
		fileHLayout.setHeight(10);
		Label fileNameStaticLabel = new Label();
		fileNameStaticLabel.setContents("File Upload");
		fileNameStaticLabel.setWrap(false);
		fileNameStaticLabel.setHeight("25px");
		fileNameStaticLabel.setAlign(Alignment.RIGHT);

		fileVLayout.addMember(form);
		fileHLayout.addMember(fileNameStaticLabel);
		fileHLayout.addMember(fileTest);
		
		vTest.addMember(fileVLayout);
		vTest.addMember(fileHLayout);
		
		RootPanel.get().add(vTest);

	}
}
