{"id":242,"date":"2015-01-23T11:21:19","date_gmt":"2015-01-23T09:21:19","guid":{"rendered":"http:\/\/www.descher.at\/descher-vu\/?p=242"},"modified":"2015-01-23T11:21:19","modified_gmt":"2015-01-23T09:21:19","slug":"jface-databinding-with-pojoproperties-on-boolean","status":"publish","type":"post","link":"http:\/\/www.descher.at\/descher-vu\/2015\/01\/jface-databinding-with-pojoproperties-on-boolean\/","title":{"rendered":"JFace Databinding with PojoProperties on Boolean"},"content":{"rendered":"<p>Consider the following Pojo Foo<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n\r\npublic class Foo {\r\n  boolean boolProp;\r\n\r\n  public void setBoolProp(boolean boolProp){\r\n    this.boolProp = boolProp;\r\n  }\r\n\r\n  public boolean isBoolProp() {\r\n    return boolProp;\r\n  }\r\n}\r\n\r\n<\/pre>\n<p>then you might assume, that you can databind that with master-detail pattern given a SWT.Button with the following code<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nIObservableValue uiObs = WidgetProperties.selection().observe(button);\r\nIObservableValue prescObs = PojoProperties.value(&quot;boolProp&quot;, Boolean.class).\r\n    observeDetail(observable);\r\ndbc.bindValue(uiObs, prescObs);\r\n<\/pre>\n<p>Well this will not work, you actually have to have a method <\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n  public boolean getBoolProp() {\r\n    return isBoolProp();\r\n  }\r\n<\/pre>\n<p>in your Pojo to make it work.<\/p>\n<p>I am not sure, why this is the case, as one tries to programm according to bean style, where you have the isX and setX for Boolean properties. I am also not sure wether this is different for newer versions of JFace (this is 3.8.0). Just find it worth mentioning, and am hoping for some comments on this \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Consider the following Pojo Foo public class Foo { boolean boolProp; public void setBoolProp(boolean boolProp){ this.boolProp = boolProp; } public boolean isBoolProp() { return boolProp; } } then you might assume, that you can databind that with master-detail pattern given a SWT.Button with the following code IObservableValue uiObs = WidgetProperties.selection().observe(button); IObservableValue prescObs = PojoProperties.value(&quot;boolProp&quot;, Boolean.class). &hellip; <a href=\"http:\/\/www.descher.at\/descher-vu\/2015\/01\/jface-databinding-with-pojoproperties-on-boolean\/\" class=\"more-link\"><span class=\"screen-reader-text\">JFace Databinding with PojoProperties on Boolean<\/span> weiterlesen <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"_links":{"self":[{"href":"http:\/\/www.descher.at\/descher-vu\/wp-json\/wp\/v2\/posts\/242"}],"collection":[{"href":"http:\/\/www.descher.at\/descher-vu\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.descher.at\/descher-vu\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.descher.at\/descher-vu\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.descher.at\/descher-vu\/wp-json\/wp\/v2\/comments?post=242"}],"version-history":[{"count":5,"href":"http:\/\/www.descher.at\/descher-vu\/wp-json\/wp\/v2\/posts\/242\/revisions"}],"predecessor-version":[{"id":247,"href":"http:\/\/www.descher.at\/descher-vu\/wp-json\/wp\/v2\/posts\/242\/revisions\/247"}],"wp:attachment":[{"href":"http:\/\/www.descher.at\/descher-vu\/wp-json\/wp\/v2\/media?parent=242"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.descher.at\/descher-vu\/wp-json\/wp\/v2\/categories?post=242"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.descher.at\/descher-vu\/wp-json\/wp\/v2\/tags?post=242"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}