| /* |
| * |
| * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) |
| * |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Florian Pirchner - Initial implementation |
| * Loetz GmbH&Co.KG |
| * |
| */ |
| package org.eclipse.osbp.vaadin.emf.views; |
| |
| import com.vaadin.ui.UI; |
| |
| // TODO: Auto-generated Javadoc |
| /** |
| * An abstraction to sync changes with the UI. Is required to sync model changes |
| * with the UI, since the model could also become modified in a NON-UI-Thread. |
| */ |
| public class UiSync { |
| |
| /** The ui. */ |
| private final UI ui; |
| |
| /** |
| * Instantiates a new ui sync. |
| * |
| * @param ui |
| * the ui |
| */ |
| public UiSync(UI ui) { |
| super(); |
| this.ui = ui; |
| } |
| |
| /** |
| * Syncs the runnable with the UI-Thread. |
| * |
| * @param runnable |
| * the runnable |
| */ |
| public void sync(Runnable runnable) { |
| ui.accessSynchronously(runnable); |
| } |
| |
| } |