| /* |
| * |
| * 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.data; |
| |
| import java.util.Locale; |
| |
| import com.vaadin.data.util.converter.Converter; |
| |
| // TODO: Auto-generated Javadoc |
| /** |
| * A converter to convert from EmfItemPropertyDescritor to its String value. |
| */ |
| @SuppressWarnings("serial") |
| public class EmfItemPropertyDescritorLabelConverter implements |
| Converter<String, EmfItemPropertyDescritor> { |
| |
| /* (non-Javadoc) |
| * @see com.vaadin.data.util.converter.Converter#convertToModel(java.lang.Object, java.lang.Class, java.util.Locale) |
| */ |
| @Override |
| public EmfItemPropertyDescritor convertToModel(String value, |
| Class<? extends EmfItemPropertyDescritor> targetType, Locale locale) |
| throws com.vaadin.data.util.converter.Converter.ConversionException { |
| throw new UnsupportedOperationException(); |
| } |
| |
| /* (non-Javadoc) |
| * @see com.vaadin.data.util.converter.Converter#convertToPresentation(java.lang.Object, java.lang.Class, java.util.Locale) |
| */ |
| @Override |
| public String convertToPresentation(EmfItemPropertyDescritor value, |
| Class<? extends String> targetType, Locale locale) |
| throws com.vaadin.data.util.converter.Converter.ConversionException { |
| return value.getDisplayName(); |
| } |
| |
| /* (non-Javadoc) |
| * @see com.vaadin.data.util.converter.Converter#getModelType() |
| */ |
| @Override |
| public Class<EmfItemPropertyDescritor> getModelType() { |
| return EmfItemPropertyDescritor.class; |
| } |
| |
| /* (non-Javadoc) |
| * @see com.vaadin.data.util.converter.Converter#getPresentationType() |
| */ |
| @Override |
| public Class<String> getPresentationType() { |
| return String.class; |
| } |
| |
| } |