package com.hp.isomorphic.client.issues;

import com.smartgwt.client.widgets.Button;
import com.smartgwt.client.widgets.Window;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.SpinnerItem;
import com.smartgwt.client.widgets.layout.Layout;

public class WindowSpinnerCursorKeys extends Layout {

	public WindowSpinnerCursorKeys() {

		SpinnerItem spinnerItem = new SpinnerItem();
		spinnerItem.setTitle("Spinner Item");
		spinnerItem.setValue(1234);

		final DynamicForm form = new DynamicForm();
		form.setHeight("*"); //$NON-NLS-1$
		form.setWidth(300);
		form.setFields(spinnerItem);

		SpinnerItem windowSpinnerItem = new SpinnerItem();
		windowSpinnerItem.setTitle("Spinner Item");
		windowSpinnerItem.setValue(1234);

		final DynamicForm windowForm = new DynamicForm();
		windowForm.setHeight("*"); //$NON-NLS-1$
		windowForm.setWidth(300);
		windowForm.setFields(windowSpinnerItem);

		Button launch = new Button("Launch Window...");
		launch.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				Window window = new Window();
				window.setSize("400", "400");
				window.addItem(windowForm);
				window.draw();
			}
		});

		addMember(form);
		addMember(launch);
	}
}
