Class TableWrapper


  • public class TableWrapper
    extends java.lang.Object
    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.List<? extends Roi> ijRois)
      Constructor of the class TableWrapper.
      TableWrapper​(Client client, ResultsTable results, java.lang.Long imageId, java.util.List<? 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.List<? extends Roi> ijRois)
      Adds rows from an ImageJ ResultsTable.
      void addRows​(Client client, ResultsTable results, java.lang.Long imageId, java.util.List<? 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
    • 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.List<? 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.List<? 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 ROIWrapper.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.List<? extends Roi> ijRois)
                     throws ServiceException,
                            AccessException,
                            java.util.concurrent.ExecutionException
        Adds rows from an ImageJ ResultsTable.
        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.
      • addRows

        public void addRows​(Client client,
                            ResultsTable results,
                            java.lang.Long imageId,
                            java.util.List<? extends Roi> ijRois,
                            java.lang.String roiProperty)
                     throws ServiceException,
                            AccessException,
                            java.util.concurrent.ExecutionException
        Adds rows from an ImageJ ResultsTable.
        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 ROIWrapper.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
        Returns:
        the value contained in the table.
      • getData

        public java.lang.Object getData​(int x,
                                        int y)
        Gets a certain value of the 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.
        Returns:
        See above.
      • setFileId

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

        public java.lang.Long getId()
        Returns the table ID.
        Returns:
        See above.
      • setId

        public void setId​(java.lang.Long id)
        Sets the id of the table.
        Parameters:
        id - New id.
      • getName

        public java.lang.String getName()
        Returns the name of the table.
        Returns:
        See above.
      • setName

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

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

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

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

        public int getRowCount()
        Returns the number of rows in the 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
        Parameters:
        rowCount - New rowCount.
      • isComplete

        public boolean isComplete()
        Checks if the table is complete
        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.
        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.
        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
      • createTable

        public TableData createTable()
        Creates the corresponding TableData object.
        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.
        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.