From 9ad7574e735ae13f07e51c2aa83cd04fa5f0b1d9 Mon Sep 17 00:00:00 2001 From: Jan Eglinger Date: Mon, 13 Aug 2018 17:54:46 +0200 Subject: [PATCH] Add interfaces and abstract class for table display migrated from net.imagej.ui.viewer.table.* in imagej-common --- pom.xml | 2 +- .../table/AbstractTableDisplayViewer.java | 59 +++++++++++++++++++ .../ui/viewer/table/TableDisplayPanel.java | 50 ++++++++++++++++ .../ui/viewer/table/TableDisplayViewer.java | 49 +++++++++++++++ 4 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 src/main/java/org/scijava/ui/viewer/table/AbstractTableDisplayViewer.java create mode 100644 src/main/java/org/scijava/ui/viewer/table/TableDisplayPanel.java create mode 100644 src/main/java/org/scijava/ui/viewer/table/TableDisplayViewer.java diff --git a/pom.xml b/pom.xml index da0f867..7e06178 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ scijava-table - 0.1.1-SNAPSHOT + 0.2.0-SNAPSHOT SciJava Table Table structures for SciJava diff --git a/src/main/java/org/scijava/ui/viewer/table/AbstractTableDisplayViewer.java b/src/main/java/org/scijava/ui/viewer/table/AbstractTableDisplayViewer.java new file mode 100644 index 0000000..8e608a3 --- /dev/null +++ b/src/main/java/org/scijava/ui/viewer/table/AbstractTableDisplayViewer.java @@ -0,0 +1,59 @@ +/* + * #%L + * ImageJ software for multidimensional image processing and analysis. + * %% + * Copyright (C) 2009 - 2017 Board of Regents of the University of + * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck + * Institute of Molecular Cell Biology and Genetics. + * %% + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * #L% + */ + +package org.scijava.ui.viewer.table; + +import org.scijava.table.Table; +import org.scijava.table.TableDisplay; + +import org.scijava.display.Display; +import org.scijava.ui.viewer.AbstractDisplayViewer; + +/** + * Implements the UI-independent elements of a {@link Table} viewer. + * + * @author Curtis Rueden + */ +public abstract class AbstractTableDisplayViewer extends + AbstractDisplayViewer> implements TableDisplayViewer +{ + + @Override + public boolean canView(final Display d) { + return d instanceof TableDisplay; + } + + @Override + public TableDisplay getDisplay() { + return (TableDisplay) super.getDisplay(); + } + +} diff --git a/src/main/java/org/scijava/ui/viewer/table/TableDisplayPanel.java b/src/main/java/org/scijava/ui/viewer/table/TableDisplayPanel.java new file mode 100644 index 0000000..7168c17 --- /dev/null +++ b/src/main/java/org/scijava/ui/viewer/table/TableDisplayPanel.java @@ -0,0 +1,50 @@ +/* + * #%L + * ImageJ software for multidimensional image processing and analysis. + * %% + * Copyright (C) 2009 - 2017 Board of Regents of the University of + * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck + * Institute of Molecular Cell Biology and Genetics. + * %% + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * #L% + */ + +package org.scijava.ui.viewer.table; + +import org.scijava.table.Table; +import org.scijava.table.TableDisplay; + +import org.scijava.ui.viewer.DisplayPanel; + +/** + * This is a panel that can go inside a display window. It displays + * {@link Table}s. + * + * @author Curtis Rueden + */ +public interface TableDisplayPanel extends DisplayPanel { + + @Override + TableDisplay getDisplay(); + +} diff --git a/src/main/java/org/scijava/ui/viewer/table/TableDisplayViewer.java b/src/main/java/org/scijava/ui/viewer/table/TableDisplayViewer.java new file mode 100644 index 0000000..c3e9309 --- /dev/null +++ b/src/main/java/org/scijava/ui/viewer/table/TableDisplayViewer.java @@ -0,0 +1,49 @@ +/* + * #%L + * ImageJ software for multidimensional image processing and analysis. + * %% + * Copyright (C) 2009 - 2017 Board of Regents of the University of + * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck + * Institute of Molecular Cell Biology and Genetics. + * %% + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * #L% + */ + +package org.scijava.ui.viewer.table; + +import org.scijava.table.Table; +import org.scijava.table.TableDisplay; + +import org.scijava.ui.viewer.DisplayViewer; + +/** + * A display viewer for a display of {@link Table}s. + * + * @author Curtis Rueden + */ +public interface TableDisplayViewer extends DisplayViewer> { + + @Override + TableDisplay getDisplay(); + +}