Class TableWrapper

  • All Implemented Interfaces:
    Table

    public class TableWrapper
    extends java.lang.Object
    implements Table
    Class containing the information to create a Table in OMERO.

    The TableData itself is not contained, only the elements to create it, because once created the TableData cannot be altered.

    To get the TableData corresponding to the elements contained use createTable.

    • Constructor Summary

      Constructors 
      Constructor Description
      TableWrapper​(int columnCount, java.lang.String name)
      Constructor of the class TableWrapper
      TableWrapper​(Client client, ResultsTable results, java.lang.Long imageId, java.util.Collection<? extends Roi> ijRois)
      Constructor of the class TableWrapper.
      TableWrapper​(Client client, ResultsTable results, java.lang.Long imageId, java.util.Collection<? extends Roi> ijRois, java.lang.String roiProperty)
      Constructor of the class TableWrapper.
      TableWrapper​(TableData table)
      Constructor of the class TableWrapper.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addRow​(java.lang.Object... os)
      Adds a row to the table.
      void addRows​(Client client, ResultsTable results, java.lang.Long imageId, java.util.Collection<? extends Roi> ijRois, java.lang.String roiProperty)
      Adds rows from an ImageJ ResultsTable.
      TableData createTable()
      Creates the corresponding TableData object.
      int getColumnCount()
      Returns the number of columns in the table.
      java.lang.String getColumnName​(int column)
      Returns the name of the column.
      TableDataColumn[] getColumns()
      Gets the TableDataColumn which contains information on each column of the table
      java.lang.Class<?> getColumnType​(int column)
      Returns the type of the column.
      java.lang.Object[][] getData()
      Gets the value contained in the table
      java.lang.Object getData​(int x, int y)
      Gets a certain value of the table
      java.lang.Long getFileId()
      Returns the fileId of the table.
      java.lang.Long getId()
      Returns the table ID.
      java.lang.String getName()
      Returns the name of the table.
      int getRowCount()
      Returns the number of rows in the table.
      boolean isComplete()
      Checks if the table is complete
      void saveAs​(java.lang.String path, char delimiter)
      Saves the current table as a character-delimited text file.
      void setColumn​(int column, java.lang.String columnName, java.lang.Class<?> type)
      Sets the information about a certain column.
      void setFileId​(java.lang.Long fileId)
      Sets the fileId of the table.
      void setId​(java.lang.Long id)
      Sets the ID of the table.
      void setName​(java.lang.String name)
      Sets the name of the table.
      void setRowCount​(int rowCount)
      Sets the number of row in the table.
      java.lang.String toString()
      Overridden to return the name of the class and the object id.
      void truncateRow()
      Deletes all unused row in the table
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface fr.igred.omero.annotations.Table

        addRows
    • Constructor Detail

      • TableWrapper

        public TableWrapper​(int columnCount,
                            java.lang.String name)
        Constructor of the class TableWrapper
        Parameters:
        columnCount - Number of column in the table.
        name - Name of the table.
      • TableWrapper

        public TableWrapper​(TableData table)
        Constructor of the class TableWrapper. Uses an already existing table to create.
        Parameters:
        table - The table.
      • TableWrapper

        public TableWrapper​(Client client,
                            ResultsTable results,
                            java.lang.Long imageId,
                            java.util.Collection<? extends Roi> ijRois)
                     throws ServiceException,
                            AccessException,
                            java.util.concurrent.ExecutionException
        Constructor of the class TableWrapper. Uses an ImageJ ResultsTable to create.
        Parameters:
        client - The client handling the connection.
        results - An ImageJ results table.
        imageId - An image ID.
        ijRois - A list of ImageJ Rois.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
      • TableWrapper

        public TableWrapper​(Client client,
                            ResultsTable results,
                            java.lang.Long imageId,
                            java.util.Collection<? extends Roi> ijRois,
                            java.lang.String roiProperty)
                     throws ServiceException,
                            AccessException,
                            java.util.concurrent.ExecutionException
        Constructor of the class TableWrapper. Uses an ImageJ ResultsTable to create.
        Parameters:
        client - The client handling the connection.
        results - An ImageJ results table.
        imageId - An image ID.
        ijRois - A list of ImageJ Rois.
        roiProperty - The Roi property storing the local index/label. Defaults to ROI.IJ_PROPERTY if null or empty.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
    • Method Detail

      • toString

        public java.lang.String toString()
        Overridden to return the name of the class and the object id.
        Overrides:
        toString in class java.lang.Object
      • addRows

        public void addRows​(Client client,
                            ResultsTable results,
                            java.lang.Long imageId,
                            java.util.Collection<? extends Roi> ijRois,
                            java.lang.String roiProperty)
                     throws ServiceException,
                            AccessException,
                            java.util.concurrent.ExecutionException
        Adds rows from an ImageJ ResultsTable.
        Specified by:
        addRows in interface Table
        Parameters:
        client - The client handling the connection.
        results - An ImageJ results table.
        imageId - An image ID.
        ijRois - A list of ImageJ Rois.
        roiProperty - The Roi property storing the local ROI index/label. Defaults to ROI.IJ_PROPERTY if null or empty.
        Throws:
        ServiceException - Cannot connect to OMERO.
        AccessException - Cannot access data.
        java.util.concurrent.ExecutionException - A Facility can't be retrieved or instantiated.
      • getData

        public java.lang.Object[][] getData()
        Gets the value contained in the table
        Specified by:
        getData in interface Table
        Returns:
        the value contained in the table.
      • getData

        public java.lang.Object getData​(int x,
                                        int y)
        Gets a certain value of the table
        Specified by:
        getData in interface Table
        Parameters:
        x - Row position.
        y - Column position.
        Returns:
        the value at position data[y][x].
      • getFileId

        public java.lang.Long getFileId()
        Returns the fileId of the table.
        Specified by:
        getFileId in interface Table
        Returns:
        See above.
      • setFileId

        public void setFileId​(java.lang.Long fileId)
        Sets the fileId of the table.
        Specified by:
        setFileId in interface Table
        Parameters:
        fileId - New fileId.
      • getId

        public java.lang.Long getId()
        Returns the table ID.
        Specified by:
        getId in interface Table
        Returns:
        See above.
      • setId

        public void setId​(java.lang.Long id)
        Sets the ID of the table.
        Specified by:
        setId in interface Table
        Parameters:
        id - New id.
      • getName

        public java.lang.String getName()
        Returns the name of the table.
        Specified by:
        getName in interface Table
        Returns:
        See above.
      • setName

        public void setName​(java.lang.String name)
        Sets the name of the table.
        Specified by:
        setName in interface Table
        Parameters:
        name - New name.
      • getColumnCount

        public int getColumnCount()
        Returns the number of columns in the table.
        Specified by:
        getColumnCount in interface Table
        Returns:
        See above.
      • getColumnName

        public java.lang.String getColumnName​(int column)
        Returns the name of the column.
        Specified by:
        getColumnName in interface Table
        Parameters:
        column - Column number.
        Returns:
        See above.
      • getColumnType

        public java.lang.Class<?> getColumnType​(int column)
        Returns the type of the column.
        Specified by:
        getColumnType in interface Table
        Parameters:
        column - Column number.
        Returns:
        See above.
      • getRowCount

        public int getRowCount()
        Returns the number of rows in the table.
        Specified by:
        getRowCount in interface Table
        Returns:
        See above.
      • setRowCount

        public void setRowCount​(int rowCount)
        Sets the number of row in the table. Copies already existing data if some were already in the data
        Specified by:
        setRowCount in interface Table
        Parameters:
        rowCount - New rowCount.
      • isComplete

        public boolean isComplete()
        Checks if the table is complete
        Specified by:
        isComplete in interface Table
        Returns:
        true if the table is completed, false if some rows are still empty.
      • setColumn

        public void setColumn​(int column,
                              java.lang.String columnName,
                              java.lang.Class<?> type)
        Sets the information about a certain column.
        Specified by:
        setColumn in interface Table
        Parameters:
        column - Column number.
        columnName - Name of the column.
        type - Type of the column.
        Throws:
        java.lang.IndexOutOfBoundsException - Column number is bigger than actual number of column in the table.
      • addRow

        public void addRow​(java.lang.Object... os)
        Adds a row to the table.
        Specified by:
        addRow in interface Table
        Parameters:
        os - Value for each column for the row.
        Throws:
        java.lang.IndexOutOfBoundsException - Table is not initialized or already full.
        java.lang.IllegalArgumentException - Incorrect argument number.
      • truncateRow

        public void truncateRow()
        Deletes all unused row in the table
        Specified by:
        truncateRow in interface Table
      • createTable

        public TableData createTable()
        Creates the corresponding TableData object.
        Specified by:
        createTable in interface Table
        Returns:
        See above.
      • saveAs

        public void saveAs​(java.lang.String path,
                           char delimiter)
                    throws java.io.FileNotFoundException,
                           java.io.UnsupportedEncodingException
        Saves the current table as a character-delimited text file.
        Specified by:
        saveAs in interface Table
        Parameters:
        path - The path to the file where the table will be saved.
        delimiter - The character used to specify the boundary between columns.
        Throws:
        java.io.FileNotFoundException - The requested file cannot be written.
        java.io.UnsupportedEncodingException - If the UTF8 charset is not supported.