Class CellView

  • All Implemented Interfaces:
    Cell, Serializable

    public class CellView
    extends Object
    implements Cell
    Wrapper for a cell.
    Version:
    $Revision$
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_Owner

        protected Row m_Owner
        the owner.
      • m_Cell

        protected Cell m_Cell
        the wrapped cell.
    • Constructor Detail

      • CellView

        public CellView​(Row owner,
                        Cell cell)
        Initializes the wrapper.
        Parameters:
        owner - the owning row
        cell - the cell to wrap
    • Method Detail

      • setOwner

        public void setOwner​(Row owner)
        Sets the row this cell belongs to.
        Specified by:
        setOwner in interface Cell
        Parameters:
        owner - the owner
      • getOwner

        public Row getOwner()
        Returns the row this cell belongs to.
        Specified by:
        getOwner in interface Cell
        Returns:
        the owner
      • getSpreadSheet

        public SpreadSheet getSpreadSheet()
        Returns the spreadsheet this cell belongs to.
        Specified by:
        getSpreadSheet in interface Cell
        Returns:
        the spreadsheet
      • assign

        public void assign​(Cell cell)
        Obtains the content/type of the other cell, but not the owner.
        Not implemented!
        Specified by:
        assign in interface Cell
        Parameters:
        cell - the cell to get the content/type from
      • setMissing

        public void setMissing()
        Sets the cell to missing.
        Not implemented!
        Specified by:
        setMissing in interface Cell
      • setContent

        public Cell setContent​(Boolean value)
        Sets the content of the cell.
        Not implemented!
        Specified by:
        setContent in interface Cell
        Parameters:
        value - the content; null intepreted as missing value
        Returns:
        the cell itself
      • setContent

        public Cell setContent​(Byte value)
        Sets the content of the cell.
        Not implemented!
        Specified by:
        setContent in interface Cell
        Parameters:
        value - the content; null intepreted as missing value
        Returns:
        the cell itself
      • setContent

        public Cell setContent​(Short value)
        Sets the content of the cell.
        Not implemented!
        Specified by:
        setContent in interface Cell
        Parameters:
        value - the content; null intepreted as missing value
        Returns:
        the cell itself
      • setContent

        public Cell setContent​(Integer value)
        Sets the content of the cell.
        Not implemented!
        Specified by:
        setContent in interface Cell
        Parameters:
        value - the content; null intepreted as missing value
        Returns:
        the cell itself
      • setContent

        public Cell setContent​(Long value)
        Sets the content of the cell.
        Not implemented!
        Specified by:
        setContent in interface Cell
        Parameters:
        value - the content; null intepreted as missing value
        Returns:
        the cell itself
      • setContent

        public Cell setContent​(Float value)
        Sets the content of the cell.
        Not implemented!
        Specified by:
        setContent in interface Cell
        Parameters:
        value - the content; null or NaN is intepreted as missing value
        Returns:
        the cell itself
      • setContent

        public Cell setContent​(Double value)
        Sets the content of the cell.
        Not implemented!
        Specified by:
        setContent in interface Cell
        Parameters:
        value - the content; null or NaN is intepreted as missing value
        Returns:
        the cell itself
      • setContent

        public Cell setContent​(Date value)
        Sets the content of the cell.
        Not implemented!
        Specified by:
        setContent in interface Cell
        Parameters:
        value - the content; null is intepreted as missing value
        Returns:
        the cell itself
      • setContent

        public Cell setContent​(DateTime value)
        Sets the content of the cell.
        Not implemented!
        Specified by:
        setContent in interface Cell
        Parameters:
        value - the content; null is intepreted as missing value
        Returns:
        the cell itself
      • setContent

        public Cell setContent​(DateTimeMsec value)
        Sets the content of the cell.
        Not implemented!
        Specified by:
        setContent in interface Cell
        Parameters:
        value - the content; null is intepreted as missing value
        Returns:
        the cell itself
      • setContent

        public Cell setContent​(Time value)
        Sets the content of the cell.
        Not implemented!
        Specified by:
        setContent in interface Cell
        Parameters:
        value - the content; null is intepreted as missing value
        Returns:
        the cell itself
      • setContent

        public Cell setContent​(TimeMsec value)
        Sets the content of the cell.
        Not implemented!
        Specified by:
        setContent in interface Cell
        Parameters:
        value - the content; null is intepreted as missing value
        Returns:
        the cell itself
      • parseContent

        public Cell parseContent​(String value)
        Attempts to determine the data type of the string.
        Not implemented!
        Specified by:
        parseContent in interface Cell
        Parameters:
        value - the non-empty string to parse
        Returns:
        the cell itself
      • setContent

        public Cell setContent​(String value)
        Sets the content of the cell. Tries to determine whether the cell content is numeric or not.
        Not implemented!
        Specified by:
        setContent in interface Cell
        Parameters:
        value - the content
        Returns:
        the cell itself
      • parseContent

        public Object parseContent​(String value,
                                   Cell.ContentType type)
        Parses the content of the cell using the specified type. If the string cannot be parsed according to the type, missing is used instead.
        Not implemented!
        Specified by:
        parseContent in interface Cell
        Parameters:
        value - the content
        type - the expected type
        Returns:
        the parsed content
      • setContentAsString

        public Cell setContentAsString​(String value)
        Sets the string content of the cell.
        Not implemented!
        Specified by:
        setContentAsString in interface Cell
        Parameters:
        value - the content
        Returns:
        the cell itself
      • setContentAs

        public Cell setContentAs​(String value,
                                 Cell.ContentType type)
        Sets the content of the cell, trying to parse the content using the specified content type.
        Not implemented!
        Specified by:
        setContentAs in interface Cell
        Parameters:
        value - the content
        type - the type to use
        Returns:
        the cell itself
      • setObject

        public Cell setObject​(Object value)
        Sets the object content of the cell.
        Not implemented!
        Specified by:
        setObject in interface Cell
        Parameters:
        value - the content
        Returns:
        the cell itself
      • setFormula

        public Cell setFormula​(String value)
        Sets the formula content of the cell.
        Not implemented!
        Specified by:
        setFormula in interface Cell
        Parameters:
        value - the content
        Returns:
        the cell itself
      • getFormula

        public String getFormula()
        Returns the formula.
        Specified by:
        getFormula in interface Cell
        Returns:
        the formula, null if none used
      • getObject

        public Object getObject()
        Returns the object.
        Specified by:
        getObject in interface Cell
        Returns:
        the object, null if none set
      • getContent

        public String getContent()
        Returns the content of the cell.
        Specified by:
        getContent in interface Cell
        Returns:
        the content
      • setNative

        public Cell setNative​(Object value)
        Determines the best set-method based on the class of the provided object. Fallback is the setObject(Object) method.
        Not implemented!
        Specified by:
        setNative in interface Cell
        Parameters:
        value - the value to set
        Returns:
        the cell itself
      • getNative

        public Object getNative()
        Returns the cell as native object, according to its type. If a cell is missing, the result is the SpreadSheet.MISSING_VALUE string.
        Specified by:
        getNative in interface Cell
        Returns:
        the corresponding object
      • index

        public int index()
        Returns the column this cell is in.
        Specified by:
        index in interface Cell
        Returns:
        the column index, -1 if not available
      • isNumeric

        public boolean isNumeric()
        Checks whether the stored string is numeric.
        Specified by:
        isNumeric in interface Cell
        Returns:
        true if the content is numeric
      • isMissing

        public boolean isMissing()
        Checks whether the cell contains a missing value.
        Specified by:
        isMissing in interface Cell
        Returns:
        true if missing value
      • isBoolean

        public boolean isBoolean()
        Checks whether the cell represents a boolean value.
        Specified by:
        isBoolean in interface Cell
        Returns:
        true if boolean value
      • toBoolean

        public Boolean toBoolean()
        Returns the boolean content, null if not a boolean.
        Specified by:
        toBoolean in interface Cell
        Returns:
        the date, null if not boolean
      • isAnyDateType

        public boolean isAnyDateType()
        Checks whether the cell represents a date, time or date/time value.
        Specified by:
        isAnyDateType in interface Cell
        Returns:
        true if date, time or date/time value
      • toAnyDateType

        public Date toAnyDateType()
        Returns the date content, null if not a date, time or date/time.
        Specified by:
        toAnyDateType in interface Cell
        Returns:
        the date, null if not date, time or date/time
      • isDate

        public boolean isDate()
        Checks whether the cell represents a date value.
        Specified by:
        isDate in interface Cell
        Returns:
        true if date value
      • toDate

        public Date toDate()
        Returns the date content, null if not a date.
        Specified by:
        toDate in interface Cell
        Returns:
        the date, null if not date
      • isDateTime

        public boolean isDateTime()
        Checks whether the cell represents a date/time value.
        Specified by:
        isDateTime in interface Cell
        Returns:
        true if date/time value
      • toDateTime

        public DateTime toDateTime()
        Checks whether the cell represents a date/time with msec value.
        Specified by:
        toDateTime in interface Cell
        Returns:
        true if date/time msec value
      • isDateTimeMsec

        public boolean isDateTimeMsec()
        Checks whether the cell represents a date/time with msec value.
        Specified by:
        isDateTimeMsec in interface Cell
        Returns:
        true if date/time msec value
      • toDateTimeMsec

        public DateTimeMsec toDateTimeMsec()
        Returns the date/time msec content, null if not a date/time.
        Specified by:
        toDateTimeMsec in interface Cell
        Returns:
        the date/time msec, null if not date/time
      • isTime

        public boolean isTime()
        Checks whether the cell represents a time value.
        Specified by:
        isTime in interface Cell
        Returns:
        true if time value
      • toTime

        public Time toTime()
        Returns the time content, null if not a time.
        Specified by:
        toTime in interface Cell
        Returns:
        the time, null if not time
      • isTimeMsec

        public boolean isTimeMsec()
        Checks whether the cell represents a time/msec value.
        Specified by:
        isTimeMsec in interface Cell
        Returns:
        true if time/msec value
      • toTimeMsec

        public TimeMsec toTimeMsec()
        Returns the time/msec content, null if not a time/msec.
        Specified by:
        toTimeMsec in interface Cell
        Returns:
        the time/msec, null if not time/msec
      • isDouble

        public boolean isDouble()
        Returns whether the content represents a double number.
        Specified by:
        isDouble in interface Cell
        Returns:
        true if a double
      • toDouble

        public Double toDouble()
        Returns the content as double, if possible.
        Specified by:
        toDouble in interface Cell
        Returns:
        the content as double, if representing a number, otherwise null
      • isLong

        public boolean isLong()
        Returns whether the content represents a long number.
        Specified by:
        isLong in interface Cell
        Returns:
        true if a long
      • toLong

        public Long toLong()
        Returns the content as long, if possible. First, a Double object is created and then the longValue() method called to return the value.
        Specified by:
        toLong in interface Cell
        Returns:
        the content as long, if representing a number, otherwise null
      • isFormula

        public boolean isFormula()
        Returns whether the content represents a formula.
        Specified by:
        isFormula in interface Cell
        Returns:
        true if a formula
      • isObject

        public boolean isObject()
        Returns whether the content represents an object.
        Specified by:
        isObject in interface Cell
        Returns:
        true if an object
      • calculate

        public void calculate()
        Recalculates the value from the cell's formula.
        Specified by:
        calculate in interface Cell
      • getCell

        public Cell getCell()
        Returns the underlying cell.
        Returns:
        the cell