@@ -0,0 +1,2541 @@
+/*%0A * Copyright 2016 Vladimir Kizelbashev%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage com.haulmont.testtask.app;%0A%0Aimport com.haulmont.testtask.entity.Group;%0A%0Aimport com.vaadin.data.util.converter.Converter;%0Aimport java.util.Locale;%0A%0A/**%0A * The class %7B@code GroupConverter%7D is a class to String-Group and Group-String conversion,%0A * to display group data in a table cell.%0A *%0A * @version 1.0%0A * @author Vladimir%0A */%0Aclass GroupConverter implements Converter%3CString, Group%3E %7B%0A%0A    /**%0A     * Method to convert a String to a Group%0A     * @param s The string contains a newline-separated fields in the following form:%0A     *          id %5Cn number %5Cn faculty. Can be null.%0A     * @param aClass The type of the return value.%0A     * @param locale The locale to use for conversion. Can be null.%0A     * @throws ConversionException%0A     */%0A    @Override%0A    public Group convertToModel(String s, Class%3C? extends Group%3E aClass, Locale locale) throws ConversionException %7B%0A        if (s == null) %7B%0A            return null;%0A        %7D%0A        String%5B%5D parts = s.split(%22%5Cn%22);%0A        if (parts.length != 3) %7B%0A            throw new ConversionException(%22Can not convert String to Group: %22 + s);%0A        %7D%0A        Group group = new Group();%0A        try %7B%0A            group.setId(Long.valueOf(parts%5B0%5D));%0A            group.setNumber(Integer.valueOf(parts%5B1%5D));%0A            group.setFaculty(parts%5B2%5D);%0A        %7D catch (Exception e) %7B%0A            throw new ConversionException(e.getMessage());%0A        %7D%0A        return group;%0A    %7D%0A%0A    @Override%0A    public String convertToPresentation(Group group, Class%3C? extends String%3E aClass, Locale locale) throws ConversionException %7B%0A        if (group != null) %7B%0A            return String.valueOf(group.getNumber()) + %22, %22 + group.getFaculty();%0A        %7D else %7B%0A            return null;%0A        %7D%0A    %7D%0A%0A    @Override%0A    public Class%3CGroup%3E getModelType() %7B%0A        return Group.class;%0A    %7D%0A%0A    @Override%0A    public Class%3CString%3E getPresentationType() %7B%0A        return String.class;%0A    %7D%0A%7D%0A

Add class to group model-presentation conversion