pivot-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roger L. Whitcomb" <Roger.Whitc...@actian.com>
Subject RE: Adding $ symbol for each cell entry in a tableview
Date Mon, 22 Oct 2012 22:54:01 GMT
Okay, after looking at this some more, I think the fundamental problem
boils down to how the cell editor is implemented for the number column
in the TableViewRowEditor that you are using.  In the "endEdit" method
of TableViewRowEditor, it will call "store" for each column in the
editor to put the edited value back into the row object (this is the
code that Sandro highlighted in the earlier reply).  Normally you would
probably use a TextInput for the edit field, but TextInput.store changes
the text in the control to the proper object for storing based on the
TextBindMapping that is defined.  If there is no binding, then it will
be a String that is stored in your row HashMap and then the
TableViewNumberCellRenderer will not put a $ in the data because it only
does that for the Number types.


So, what you need to do is define a small class that implements
TextInput.TextBindMapping, then set an instance of that as the
TextBindMapping for the cell editor used for the TableViewRowEditor.....
The "valueOf(String text)" method of your class would strip off the $
sign and convert the result to a Number..... That will solve your
problem and Pivot doesn't need to change - the functionality you need is
already built in.



~Roger Whitcomb


From: V SANTOSH PAVAN RAJU Bs [mailto:pavanraju.mca@gmail.com] 
Sent: Wednesday, October 17, 2012 2:57 AM
To: user@pivot.apache.org
Subject: Adding $ symbol for each cell entry in a tableview




Iam trying to get a $ symbol for tableview entries. For this i have used
Stock Tracker demo application and it is working fine. Now I created a
table where columns will be changed from time to time so i have created
tableview, where columns will be added dynamically and by using
setCellRenderer method, i have added TableViewNumberCellRenderer class
object to each tableview column. Here also i was able to get the $
symbol for each cell entry.


Now iam supposed to create a tableview with columns number is unknown.
So i used HashMap to create rows and to insert data to each cell. So for
this process how can i add TableViewNumberCellRenderer class object. I
use the following code for this purpose.


TableView.Column column = new TableView.Column();

TableViewNumberCellRenderer cellRenderer = new

HashMap<String, Object> tableData= new HashMap<String, Object>();
tableData.put("column name",null);

// value is null beacuse here i will edit the row and then enter some
value in it.
((List<Object>) (tableView.getTableData())).add(tableData);


Here in place of null if i pass some value (float type) 4 symbol is
appearing. But when i tried to edit the row $ symbol getting
disappeared. So help me how can i resolve this?


Thanks & Regards

B.S.V.S.Pavan Raju.

Skype: skype_pavan1



  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message