java - Editing value of TableView column -


i encountered problem unable solve. thing is, tableview populated , need cells match criteria set value zero. have variable korzemljiste , if condition fullfilled cells in column colosnovica need set value 0.00.

here tried:

    if (korzemljiste < 10000)     {         tbltabela.getitems().stream().foreach((o)            -> {                 colosnovica.setcellfactory(textfieldtablecell.fortablecolumn());                 colosnovica.setoneditcommit(                     new eventhandler<celleditevent<nepokretnost, number>>() {                     @override                     public void handle(celleditevent<nepokretnost, number> t) {                         ((nepokretnost) t.gettableview().getitems().get(                         t.gettableposition().getrow())                         ).setosnovica(t.getnewvalue());     } });});} 

sorry, ugly end of code, couldn't make copy properly.

this part modified oracle example , error:

error: incompatible types: no instance(s) of type variable(s) s exist callback<tablecolumn<s,string>,tablecell<s,string>> conforms callback<tablecolumn<nepokretnost,number>,tablecell<nepokretnost,number>>                 colosnovica.setcellfactory(textfieldtablecell.fortablecolumn()); 

where s type-variable: s extends object declared in method fortablecolumn()

error: incompatible types: number cannot converted double                         ).setosnovica(t.getnewvalue()); 

my tableview using <nepokretnost, number> form.

note: guess don't need example oracle site because don't want manually change contents of cell in column, want set them value 0.00.

some easy solution anyone?

thanks in advance.

for first error, since table column type not string, cannot use no-argument version of textfieldtablecell.fortablecolumn(). underlying problem that, edit cell, text field provides string , data in cell number. need provide converter, using overloaded form of textfieldtablecell.fortablecolumn(...):

colosnovica.setcellfactory(textfieldtablecell.fortablecolumn(new numberstringconverter())); 

for second error, replace t.getnewvalue() (which returns number) t.getnewvalue().doublevalue() (which gets double representation of number).


Comments

  1. Merkur 23C and 33C medical grade titanium earrings
    Merkur 23C titanium block and 33C are polished titanium the finest quality quality, quality and affordable titanium nitride craft products nipple piercing jewelry titanium from Merkur. Choose from a titanium ore selection of quality products

    ReplyDelete

Post a Comment

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -