Re: formatting floats in a table



Thank you for the responses.

1. I would prefer setting a renderer for each column, rather than
assigning renderer for datatypes of that table. This is simply because
of the way i am implementing this. I have an interface named IBehavior
that declares one method, "doBehavior()". My TableCellRender contains
a list of Behaviors. Behaviors are rendering specific actions that
should occur for a given column/cell (i.e. change
foreground/background/border colors depending on the value being
shown). This way i can add multiple behaviors that should be executed
for a given column/cell and simply iterate thru the Behavior list for
that column and call doBheavior. I think i can implment my Formatter
as simply another IBehavior

2. I think you may have answered my question. Currently, i do use a
custom TableModel, and it does indeed override getColumnClass to return
value.getClass. This is how i have gotten sorting to work correctly
(before it sorting was incorrect because everything was being treated
as String).
The following snippet of your code i think answers my question:

protected void setValue(Object value) {
if (value instanceof Number) {
value = formatter.format(value);
}
super.setValue(value);
}

Above, formatter.format(value) will return a String. What you are
saying is that this does not matter for sorting, since my sorting is
being driven off the TableModel and there my getColumnClass method will
return the correct Class Type. Basically, the code above is strictly
for display purposes...and should not affect my sorting, is that
correct?

.



Relevant Pages

  • Re: How to process millions of strings?
    ... bit heavier they have alot of the behaviors you want built in i.e. sorting ... > I have been using arraylists for manipulating text data. ... > sorting and combining the data. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: preserving capacity of a vector
    ... >| For my renderer at each frame I'm filling a vector with CVisual* elements, ... >| sorting it, rendering the objects and then clearing the vector again. ...
    (comp.lang.cpp)
  • preserving capacity of a vector
    ... For my renderer at each frame I'm filling a vector with CVisual* elements, ... sorting it, rendering the objects and then clearing the vector again. ... I suspect there will be an overhead if the vector is resizing it's capacity ...
    (comp.lang.cpp)