X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.browsing.ui.swt%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fswt%2Fwidgets%2FWidgetImpl.java;h=b80dd1e110c1ff6da54ca1b3a461bf75c9f4eda4;hp=5fe27380f8970ffcac5e302224f539ad13e10eb1;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/widgets/WidgetImpl.java b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/widgets/WidgetImpl.java index 5fe27380f..b80dd1e11 100644 --- a/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/widgets/WidgetImpl.java +++ b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/widgets/WidgetImpl.java @@ -1,83 +1,83 @@ -/******************************************************************************* - * Copyright (c) 2012 Association for Decentralized Information Management in - * Industry THTH ry. - * 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: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.browsing.ui.swt.widgets; - -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.widgets.Control; -import org.simantics.Simantics; -import org.simantics.browsing.ui.swt.widgets.impl.Widget; -import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport; -import org.simantics.db.procedure.Listener; -import org.simantics.db.request.ReadInterface; -import org.simantics.ui.colors.Colors; - -abstract public class WidgetImpl implements Widget { - - protected final WidgetSupport support; - - public WidgetImpl(WidgetSupport support) { - this.support = support; - } - - public abstract Control getControl(); - - public void setFont(Font font) { - getControl().setFont(font); - } - - public void setBackground(Color color) { - getControl().setBackground(color); - } - - public void setBackground(final ReadInterface read) { - - Simantics.getSession().async(read, new Listener() { - - @Override - public void exception(Throwable t) { - t.printStackTrace(); - } - - @Override - public void execute(final org.simantics.datatypes.adt.Color color) { - - if(isDisposed()) return; - - getControl().getDisplay().asyncExec(new Runnable() { - - @Override - public void run() { - getControl().setBackground(Colors.swt(getControl().getDisplay(), color)); - } - - }); - } - - @Override - public boolean isDisposed() { - return getControl().isDisposed(); - } - - }); - - } - - public void setForeground(Color color) { - getControl().setForeground(color); - } - - public void setLayoutData(Object layoutData) { - getControl().setLayoutData(layoutData); - } - -} +/******************************************************************************* + * Copyright (c) 2012 Association for Decentralized Information Management in + * Industry THTH ry. + * 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: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.browsing.ui.swt.widgets; + +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.widgets.Control; +import org.simantics.Simantics; +import org.simantics.browsing.ui.swt.widgets.impl.Widget; +import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport; +import org.simantics.db.procedure.Listener; +import org.simantics.db.request.ReadInterface; +import org.simantics.ui.colors.Colors; + +abstract public class WidgetImpl implements Widget { + + protected final WidgetSupport support; + + public WidgetImpl(WidgetSupport support) { + this.support = support; + } + + public abstract Control getControl(); + + public void setFont(Font font) { + getControl().setFont(font); + } + + public void setBackground(Color color) { + getControl().setBackground(color); + } + + public void setBackground(final ReadInterface read) { + + Simantics.getSession().async(read, new Listener() { + + @Override + public void exception(Throwable t) { + t.printStackTrace(); + } + + @Override + public void execute(final org.simantics.datatypes.adt.Color color) { + + if(isDisposed()) return; + + getControl().getDisplay().asyncExec(new Runnable() { + + @Override + public void run() { + getControl().setBackground(Colors.swt(getControl().getDisplay(), color)); + } + + }); + } + + @Override + public boolean isDisposed() { + return getControl().isDisposed(); + } + + }); + + } + + public void setForeground(Color color) { + getControl().setForeground(color); + } + + public void setLayoutData(Object layoutData) { + getControl().setLayoutData(layoutData); + } + +}