package ru.rsdn.patterns.mvc.samples;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Shell;

import ru.rsdn.patterns.mvc.model.ListModel;

/**
 * Демонстрация
 */
public class TwoListSwitchDemo {
	public static void main(String[] args) {
		final Display display = new Display();
		final Shell shell = new Shell(display);
		shell.setLayout(new FillLayout());
		shell.setText("Списки переключателей");
		final Group group0 = new Group(shell, SWT.NONE);
		group0.setLayout(new FillLayout());
		group0.setText("Первый список");
		final ListModel<Switch> model = new ListModel<Switch>();
		final ListSwitchView view0 = new ListSwitchView(group0);
		view0.setModel(model);
		final Group group1 = new Group(shell, SWT.NONE);
		group1.setLayout(new FillLayout());
		group1.setText("Второй список");
		final ListSwitchView view1 = new ListSwitchView(group1);
		view1.setModel(model);
		shell.pack();
		shell.open();
		while (!shell.isDisposed())
			if (!display.readAndDispatch())
				display.sleep();
		display.dispose();
	}
}
