0

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.

leppie
  • 115,091
  • 17
  • 196
  • 297
jederik
  • 352
  • 2
  • 7

1 Answers1

0

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

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

alex.rind
  • 465
  • 2
  • 8
  • Ok, now I created an `IfExpression` passing an `AbstractPredicate` with `getBoolean()` overwritten to return `normalize`, but it seems that the derived column values are calculated when calling `addColumn(col, expr)` and not when calling the `Tuple.get...()` methods. So the returned values of the `IfExpression` chnage, when changing `normalize` but the values returned by `Tuple.get...()` don't. – jederik May 13 '14 at 12:50
  • Furthermore I tried `Table.removeColumn()` but here prefuse crashed passing a `TableEvent` to the cascaded visual table. – jederik May 13 '14 at 12:53