1. #1
    Sencha User
    Join Date
    Nov 2007
    Posts
    35
    Vote Rating
    0
    albertogiantin is on a distinguished road

      0  

    Default Generic NumberCell

    Generic NumberCell


    Hi all,
    I can't understand why NumberCell extends the typed class AbstractCell<Number>?
    Would not be better if the class were built in this way?

    Code:
    public class NumberCell<T extends Number> extends AbstractCell<T> {
    ...
    With current implementation of NumberCell configuring ColumnConfig like this:

    Code:
    		ColumnConfig<CPP, Long> cpp2 = new ColumnConfig<CPP, Long>(props.cpp2(), 100, constants.fairValue());
    		cpp2.setCell(new NumberCell(cnfmt));
    I get this error: The method setCell(Cell<Long>) in the type ColumnConfig<CPP,Long> is not applicable for the arguments (NumberCell) because the field cpp2 is of type Long.

    The other hand with the implementation of the above, I can write something like:

    Code:
    		ColumnConfig<CPP, Long> cpp2 = new ColumnConfig<CPP, Long>(props.cpp2(), 100, constants.fairValue());
    		cpp2.setCell(new NumberCell<Long>(cnfmt));
    Can anyone tell me if I'm doing something wrong?

  2. #2
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,734
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    It is that way:
    Code:
    package com.sencha.gxt.cell.core.client;
    
    //...
    
    public class NumberCell<N extends Number> extends AbstractCell<N> {
    I think you might be looking at the GWT NumberCell implementation, which does restrict you to Number:
    Code:
    package com.google.gwt.cell.client;
    
    //...
    
    /**
     * A {@link Cell} used to render formatted numbers.
     */
    public class NumberCell extends AbstractCell<Number> {

  3. #3
    Sencha User
    Join Date
    Nov 2007
    Posts
    35
    Vote Rating
    0
    albertogiantin is on a distinguished road

      0  

    Default


    You're right, sorry for this oversight.

Thread Participants: 1