blob: dda6fc5085dd22200991498ae869cad0839ddb51 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2006, 2010 Soyatec (http://www.soyatec.com) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Soyatec - initial API and implementation
*******************************************************************************/
package org.eclipse.xwt.tests.databinding.others;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.xwt.XWT;
/**
* @author jliu jin.liu@soyatec.com
*/
public class EventHandler {
public void setColorYellow(Event event) {
Button widget = (Button) event.widget;
if (widget.getSelection()) {
Shell shell = (Shell) XWT.findElementByName(widget, "Root");
DataFactory dataFactory = (DataFactory) XWT.getDataContext(shell);
dataFactory.setBackground(Display.getCurrent().getSystemColor(
SWT.COLOR_YELLOW));
}
}
public void setColorGray(Event event) {
Button widget = (Button) event.widget;
if (widget.getSelection()) {
Shell shell = (Shell) XWT.findElementByName(event.widget, "Root");
DataFactory dataFactory = (DataFactory) XWT.getDataContext(shell);
dataFactory.setBackground(Display.getCurrent().getSystemColor(
SWT.COLOR_GRAY));
}
}
}