| /** |
| * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), 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 v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Florian Pirchner - Initial implementation |
| */ |
| |
| package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.services; |
| |
| import java.util.Map; |
| |
| import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart; |
| import org.eclipse.osbp.ecview.core.common.editpart.emf.ElementEditpart; |
| import org.eclipse.osbp.ecview.core.common.model.core.YElement; |
| import org.eclipse.osbp.ecview.core.common.services.AbstractWidgetAssocationsService; |
| |
| import com.vaadin.ui.Component; |
| |
| public class WidgetAssocationsService extends |
| AbstractWidgetAssocationsService<Component, YElement> { |
| |
| @Override |
| public YElement getModelElement(String id) { |
| synchronized (associations) { |
| for (Map.Entry<Component, YElement> entry : associations.entrySet()) { |
| YElement yElement = entry.getValue(); |
| if (yElement.getId() != null && yElement.getId().equals(id)) { |
| return yElement; |
| } |
| } |
| } |
| return null; |
| } |
| |
| @Override |
| public IElementEditpart getEditpart(String id) { |
| YElement yElement = getModelElement(id); |
| return yElement != null ? ElementEditpart.findEditPartFor(yElement) : null; |
| } |
| |
| } |