Expression to color/StyleClass map transform example

Though I could certainly write a standalone expression binding, this example in the documentation piqued my interest.

Perhaps I'm completely misunderstanding the example (very possible), but I duplicated the transform and cannot get it to return anything but the fallback value.

[...] the original value of the property binding is 15. For each expression past the first, a single bit of that integer is being tested. Since none of bits 0, 1, or 2 are true, we get the fallback.

  • 15 is 1111 in binary...
  • What is the value of Fault_Mask in this example? 32768?
  • How does any transform (checking for equality) between an integer (15) and a boolean (results of getBit() function) test single bits of the aforementioned integer? It's clearly not performing a bitwise AND between Fault_Code and Fault_Mask

I ended up swapping Fault_Code and Fault_Mask, setting Fault_Mask to 1 and then the getBit() expression properly checked for bits in Fault_Code.

On a side note, how is the map transform handled if the value matches multiple rows? Seems it tests all rows and returns the last row that matches - it does not stop after the first match. This does not seem to be specified in the documentation. Is this desired behavior?

2 Likes