@@ -0,0 +1,3136 @@
+/*-%0A * #%25L%0A * SciJava polyglot kernel for Jupyter.%0A * %25%25%0A * Copyright (C) 2017 Hadrien Mary%0A * %25%25%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 * #L%25%0A */%0A%0Apackage org.scijava.notebook.converter;%0A%0Aimport java.lang.reflect.Type;%0Aimport java.util.List;%0Aimport java.util.Map;%0A%0Aimport org.scijava.convert.ConversionRequest;%0Aimport org.scijava.convert.Converter;%0Aimport org.scijava.notebook.converter.output.HTMLTableNotebookOutput;%0Aimport org.scijava.plugin.Plugin;%0A%0A/**%0A * Converts a %7B@code List%3C?%3E%7D to an html table.%0A *%0A * @author Alison Walter%0A */%0A@Plugin(type = Converter.class)%0Apublic class ListToHTMLTableNotebookConverter extends%0A    HTMLNotebookOutputConverter%3CList%3C?%3E, HTMLTableNotebookOutput%3E%0A%7B%0A%0A    @Override%0A    @SuppressWarnings(%7B %22rawtypes%22, %22unchecked%22 %7D)%0A    public Class%3CList%3C?%3E%3E getInputType() %7B%0A        return (Class) List.class;%0A    %7D%0A%0A    @Override%0A    public Class%3CHTMLTableNotebookOutput%3E getOutputType() %7B%0A        return HTMLTableNotebookOutput.class;%0A    %7D%0A%0A    @Override%0A    public boolean canConvert(final ConversionRequest request) %7B%0A        final Object src = request.sourceObject();%0A        if (src != null && src instanceof List && !(((List%3C?%3E) src).get(%0A            0) instanceof Map))%0A        %7B%0A            return super.canConvert(request);%0A        %7D%0A        return false;%0A%0A    %7D%0A%0A    @Override%0A    public boolean canConvert(final Object src, final Type dest) %7B%0A        if (src == null) return false;%0A        if (src instanceof List && !(((List%3C?%3E) src).get(0) instanceof Map)) %7B%0A            final Class%3C?%3E srcClass = src.getClass();%0A            return super.canConvert(srcClass, dest);%0A        %7D%0A        return false;%0A    %7D%0A%0A    @Override%0A    public boolean canConvert(final Object src, final Class%3C?%3E dest) %7B%0A        if (src == null) return false;%0A        if (src instanceof List && !(((List%3C?%3E) src).get(0) instanceof Map)) %7B%0A            final Class%3C?%3E srcClass = src.getClass();%0A            return super.canConvert(srcClass, dest);%0A        %7D%0A        return false;%0A    %7D%0A%0A    @Override%0A    public HTMLTableNotebookOutput convert(final Object object) %7B%0A        final List%3C?%3E list = (List%3C?%3E) object;%0A%0A        String htmlTable = %22%3Ctable class=%5C%22converted%5C%22%3E%3Ctbody%3E%22;%0A%0A        // Append the rows%0A        for (int i = 0; i %3C list.size(); i++) %7B%0A            final String data = list.get(i) == null ? %22&nbsp;%22 : asHTML(list%0A                .get(i));%0A            htmlTable += HTMLTableBuilder.appendData(data, true, true);%0A        %7D%0A        htmlTable += HTMLTableBuilder.endTable();%0A%0A        return new HTMLTableNotebookOutput(HTMLTableBuilder.getTableStyle(%0A            false) + htmlTable);%0A    %7D%0A%0A%7D%0A

Add list to HTML table converter