
import com.google.gwt.core.client.EntryPoint;
import com.smartgwt.client.types.TitleOrientation;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.Window;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.TextItem;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public final class CoreModule implements  EntryPoint {

	@Override
	public void onModuleLoad() {
		SuppliersDialog sup = new SuppliersDialog();
		sup.show();
	}

	
	class SuppliersDialog extends Window {

		private TextItem field1;
		private TextItem field2;
		private TextItem field3;
		private TextItem field4;
		private TextItem field5;
		private TextItem field6;
		private TextItem field7;

		private DynamicForm firstDetailsForm;
		private DynamicForm secondForm;

		public SuppliersDialog() {
			this.setTitle("something");

			field1 = new TextItem("field1",
					"field1");
			field1.setGlobalTabIndex(1);
			field2 = new TextItem("field2",
					"field2");
			field2.setGlobalTabIndex(2);


			field2.setLength(28);
			field3 = new TextItem("field3", "field3");
			field3.setGlobalTabIndex(3);
			field4 = new TextItem("field4",
					"field4");
			field4.setGlobalTabIndex(4);
			field5 = new TextItem("field5", "field5");
			field5.setTitleOrientation(TitleOrientation.RIGHT);
			field5.setGlobalTabIndex(5);			
			field6 = new TextItem("field6", "field6");
			field6.setGlobalTabIndex(6);
			field7 = new TextItem("field7", "field7");
			field7.setGlobalTabIndex(7);
			

			firstDetailsForm = new DynamicForm();
			firstDetailsForm.setNumCols(2);
			firstDetailsForm.setWidth(300);
			firstDetailsForm.setItems(field1, field2, field3,
					field4, field6, field7);
			firstDetailsForm.setTitleWidth(140);

			secondForm = new DynamicForm();
			secondForm.setNumCols(1);
			secondForm.setItems(field5);
			secondForm.setWidth(80);
			secondForm.setLeft(firstDetailsForm.getWidth() - 88);
			secondForm.setTop(78);

			Canvas formLayout = new Canvas();
			formLayout.addChild(firstDetailsForm);
			formLayout.addChild(secondForm);

			this.setWidth(500);
			this.setHeight(200);
			this.centerInPage();
			this.addItem(formLayout);
			this.setIsModal(true);	
		}

	}
}
