i quite new @ scala. use tableview has custom type "constraint", , need iterate row.
here have gotten far:
class constraintview(val stage : stage) { var obs : observablebuffer[constraint]=observablebuffer() var listconst : list[constrainttrait]=list() val checkcolumn=new tablecolumn[constraint, java.lang.boolean] { text = "" cellvaluefactory=_.value.initialselection.delegate } checkcolumn.setcellfactory(checkboxtablecell.fortablecolumn(checkcolumn)) stage.title="constraint table view" stage.scene=new scene { val tab=new tableview[constraint](obs) { editable=true columns ++=list(checkcolumn, new tablecolumn[constraint, string] { text="constraint name" cellvaluefactory=_.value.constraintnameprop }, new tablecolumn[constraint, string] { text = "result" cellvaluefactory=_.value.resultprop } ) } content=tab }
in java, do
for (constraint c : tab.getitems()) { // c }
or
tab.getitems().foreach(c -> { // c });
i don't know scala, perhaps enough able translate.
Comments
Post a Comment