Bug 154465 - [JFace] CheckboxTableViewer only fires CheckStateChangedEvent by user interaction
Summary: [JFace] CheckboxTableViewer only fires CheckStateChangedEvent by user interac...
Status: REOPENED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: PC Linux-GTK
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 154467
  Show dependency tree
 
Reported: 2006-08-20 08:50 EDT by Benjamin Muskalla CLA
Modified: 2021-02-08 06:06 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Muskalla CLA 2006-08-20 08:50:23 EDT
CheckboxTableViewer doesn't fire CheckStateChangedEvent correctly when you set the checked states programmatically with setChecked(Object,boolean).

I'm about to write a patch for the CheckboxTableViewer and maybe some tests to cover this scenario.

Or is this behavior volitional?

Using Eclipse Version: 3.3.0
Build id: N20060812-0010
Comment 1 Florian Priester CLA 2006-08-20 10:27:56 EDT
See also bug 150805 (which is about the tree viewer).
Comment 2 Boris Bokowski CLA 2006-08-21 11:27:59 EDT
In general, SWT will only fire events if they are generated by the window system (e.g. caused by the user), not when you change state programmatically.  We try to follow the same design principle in JFace.

Since this is not causing a bug (like bug 150805), I'm closing this as WONTFIX.
Comment 3 Benjamin Muskalla CLA 2006-08-21 15:37:27 EDT
Boris, if the JFace team does not like the idea - no problem. But it seems that the users really want this feature. i would propose the do it like this:
add new methods to the CheckBoxTable/TreeViewer like this:

setChecked(Object element, boolean state, boolean informListeners)
in which we have the functionality + fire events if informListeners = true
the old
setChecked(Object element, boolean state) only calls setChecked(element,state,false);

Just an idea...but i like it :)
(maybe you could reopen this for some discussions)
Comment 4 Boris Bokowski CLA 2006-08-21 15:47:57 EDT
(In reply to comment #3)
> Boris, if the JFace team does not like the idea - no problem. But it seems that
> the users really want this feature. 

Feel free to reopen this bug, but we would need an argumentation why the current behaviour is not sufficient.
Comment 5 Christoph Laeubrich CLA 2021-02-08 06:06:39 EST
I'll reopen this. This makes it really hard to use this class away from dump user selection.

Lets say I want to have a "select all" or "select filtered" or whatever button. I can update the internal state but from the outside world it seems nothing has changed (listener is not called), e.g. if I have a page that listens for changes and set it as done if at least one item is selected I have to code this twice.

If it is decided to not change the current behavior, my suggestion would be to add a new method accepting a boolean if or not listeners should be notified about the change.

e.g. CheckboxTableViewer.setGrayed(Object item, boolean state, boolean notifyListener)