Overwrite derived column in prefuse

37 views Asked by At

In a prefuse graph I have a derived column named "distance" created with Table.addColumn(String name, Expression expr) and a boolean runtime variable called normalize. Now I want to change the expression used to calculate the column value during runtime, depending on the value of normalize, but there is no such thing as replaceColumn() or deleteColumn(). When I try to overwrite the old column by calling addColumn() again, I get a 'Table already has column with name "distance"'.

Can I somehow programatically change the expression used to calculate the column value of distance or make it dependend from the runtime variable normalize? I would rather not have two columns with different names, because the value is used from many places in the project and I would therefor have to implement a lot of case distinctions.

1

There are 1 answers

2
alex.rind On

prefuse has an IfExpression so you can make the derived column depend on normalize.

Alternatively there is a method removeColumn(String) in Table.