package com.sbs.jpm.client;

import com.google.gwt.core.client.EntryPoint;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.events.SubmitValuesEvent;
import com.smartgwt.client.widgets.form.events.SubmitValuesHandler;
import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.layout.HLayout;

public class TestCase implements EntryPoint {

	private Panel panel;

	public void onModuleLoad() {

		SC.showConsole();

		panel = new Panel();
		panel.setWidth100();
		panel.setHeight100();

		panel.draw();
	}

	public class Panel extends HLayout {

		public Panel() {	
			TextItem text = new TextItem();
			DynamicForm form = new DynamicForm();
			form.addSubmitValuesHandler(new SubmitValuesHandler() {
				@Override
				public void onSubmitValues(SubmitValuesEvent event) {
					SC.logWarn("submit values");
				}
			});
			text.setSaveOnEnter(true);
			text.setImplicitSaveOnBlur(true);
			text.setShowHintInField(true);
			text.setHint("List name");
			text.setShowTitle(false);
			
			form.setFields(text);
			form.setSaveOnEnter(true);
			form.setImplicitSaveOnBlur(true);
			
			
			this.setMembers(form);
		}
	}
}
