Note that there are some explanatory texts on larger screens.

plurals
  1. POChecking Data Binding's value in SWT/Jface
    text
    copied!<p>I am trying to bind my SWT UI to a test model in Java. The binding works. But the value is exactly the value from the model. So in a case if the model is a boolean and it returns true, it will appear literally as "true" on the UI widget, which isn't what I want to show my users. Is there a way where I can check the bound value before putting into the UI widget? Say if the model returns true, I check if the model value was true then decide to show on my label as "It is correct" otherwise "No it is wrong" if false.</p> <p>Similarly, in a case if I have a label and I want to bind it to a model that returns the value of an account's credit balance, my label may already have some text that says "Your account has " and I wish I could just append THE_BOUND_VALUE to the label and not have the whole label's value overwritten by the model's value. Here's how I do my bindings:</p> <pre><code>IObservableValue tableViewer_myTestObserveSingleSelection = ViewersObservables.observeSingleSelection(tableViewer_myTest); IObservableList tableViewer_myTestDataContentObserveDetailList = BeansObservables.observeDetailList(tableViewer_myTestObserveSingleSelection, "DataContent", TestModelData.class); tableViewer_DataContent.setInput(tableViewer_myTestDataContentObserveDetailList); </code></pre> <p>These codes are generated from windowsbuilder pro in eclipse but somehow, I cannot use anything to modify the way bound value to the way I want to display on my UI.</p> <p>Thanks for any help.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload