Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » [JFace] tristate tree viewer
[JFace] tristate tree viewer [message #334836] Mon, 02 March 2009 18:04 Go to next message
Eclipse UserFriend
Originally posted by: alamothe.ptt.yu

Hi,
I'm unsuccessfully trying to get a tristate behaviour in CheckboxTreeViewer,
that is an item can be checked, grayed or unchecked. Is this the limitation
of JFace, SWT Tree control or I'm doing something wrong??
Re: [JFace] tristate tree viewer [message #334840 is a reply to message #334836] Mon, 02 March 2009 18:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: alamothe.ptt.yu

It appears to be a limitation of SWT...

Nikola Mihajlovic wrote:
> Hi,
> I'm unsuccessfully trying to get a tristate behaviour in
> CheckboxTreeViewer, that is an item can be checked, grayed or
> unchecked. Is this the limitation of JFace, SWT Tree control or I'm
> doing something wrong??
Re: [JFace] tristate tree viewer [message #334841 is a reply to message #334840] Mon, 02 March 2009 19:11 Go to previous messageGo to next message
Mircea Luchian is currently offline Mircea LuchianFriend
Messages: 89
Registered: July 2009
Member
This is a multi-part message in MIME format.
--------------050407000607050803020700
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Use "checkboxTreeViewer.setChecked()" and
"checkboxTreeViewer.setGrayChecked()". This will give you the tristate
behavior.

Mircea

Nikola Mihajlovic wrote:
> It appears to be a limitation of SWT...
>
> Nikola Mihajlovic wrote:
>
>> Hi,
>> I'm unsuccessfully trying to get a tristate behaviour in
>> CheckboxTreeViewer, that is an item can be checked, grayed or
>> unchecked. Is this the limitation of JFace, SWT Tree control or I'm
>> doing something wrong??
>>
>
>
>


--------------050407000607050803020700
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Use "checkboxTreeViewer.setChecked()" and
"checkboxTreeViewer.setGrayChecked()". This will give you the tristate
behavior. <br>
&nbsp;<br>
Mircea<br>
<br>
Nikola Mihajlovic wrote:
<blockquote cite="midgoh8bt$eht$1@build.eclipse.org" type="cite">
<pre wrap="">It appears to be a limitation of SWT...

Nikola Mihajlovic wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hi,
I'm unsuccessfully trying to get a tristate behaviour in
CheckboxTreeViewer, that is an item can be checked, grayed or
unchecked. Is this the limitation of JFace, SWT Tree control or I'm
doing something wrong??
</pre>
</blockquote>
<pre wrap=""><!---->

</pre>
</blockquote>
<br>
</body>
</html>

--------------050407000607050803020700--
Re: [JFace] tristate tree viewer [message #334843 is a reply to message #334841] Mon, 02 March 2009 22:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: alamothe.ptt.yu

While I can programatically set one of the three states, a user cannot cycle
between three states with a mouse click, but only between two. Since it's a
problem with SWT, I've posted this on their newsgroup (the same problem
exists with a regular checkbox, that is not inside the Tree)

Mircea Luchian wrote:
> Use "checkboxTreeViewer.setChecked()" and
> "checkboxTreeViewer.setGrayChecked()". This will give you the tristate
> behavior.
>
> Mircea
>
> Nikola Mihajlovic wrote:
>> It appears to be a limitation of SWT...
>>
>> Nikola Mihajlovic wrote:
>>
>>> Hi,
>>> I'm unsuccessfully trying to get a tristate behaviour in
>>> CheckboxTreeViewer, that is an item can be checked, grayed or
>>> unchecked. Is this the limitation of JFace, SWT Tree control or I'm
>>> doing something wrong??
Re: [JFace] tristate tree viewer [message #334849 is a reply to message #334843] Tue, 03 March 2009 11:28 Go to previous messageGo to next message
Hitesh  is currently offline Hitesh Friend
Messages: 19
Registered: July 2009
Junior Member
It should be possible to work around this.I thought I'll share this - hope
it helps.
It is possible to add a ICheckStateListener and manipulate the state, for
example :

chkBoxViewer.addCheckStateListener(new ICheckStateListener(){
public void checkStateChanged(CheckStateChangedEvent event) {

MyModel item=(MyModel) event.getElement();
switch (item.state) {
case 0:{
chkBoxViewer.setGrayChecked(item, true);
break;
}
case 1:{
chkBoxViewer.setGrayed(item, false);
chkBoxViewer.setChecked(item, true);
break;
}
case 2:{
chkBoxViewer.setGrayChecked(item, false);
break;
}
}
item.state=++item.state%3;
}
});


Hitesh

Nikola Mihajlovic wrote:

> While I can programatically set one of the three states, a user cannot cycle
> between three states with a mouse click, but only between two. Since it's a
> problem with SWT, I've posted this on their newsgroup (the same problem
> exists with a regular checkbox, that is not inside the Tree)

> Mircea Luchian wrote:
>> Use "checkboxTreeViewer.setChecked()" and
>> "checkboxTreeViewer.setGrayChecked()". This will give you the tristate
>> behavior.
>>
>> Mircea
>>
>> Nikola Mihajlovic wrote:
>>> It appears to be a limitation of SWT...
>>>
>>> Nikola Mihajlovic wrote:
>>>
>>>> Hi,
>>>> I'm unsuccessfully trying to get a tristate behaviour in
>>>> CheckboxTreeViewer, that is an item can be checked, grayed or
>>>> unchecked. Is this the limitation of JFace, SWT Tree control or I'm
>>>> doing something wrong??
Re: [JFace] tristate tree viewer [message #334850 is a reply to message #334849] Tue, 03 March 2009 13:13 Go to previous message
Eclipse UserFriend
Originally posted by: alamothe.ptt.yu

Thanks! It's exactly how I solved this problem :-)

Hitesh wrote:
> It should be possible to work around this.I thought I'll share this -
> hope it helps.
> It is possible to add a ICheckStateListener and manipulate the state,
> for example :
>
> chkBoxViewer.addCheckStateListener(new ICheckStateListener(){
> public void checkStateChanged(CheckStateChangedEvent event) {
>
> MyModel item=(MyModel) event.getElement();
> switch (item.state) {
> case 0:{
> chkBoxViewer.setGrayChecked(item, true);
> break;
> }
> case 1:{
> chkBoxViewer.setGrayed(item, false);
> chkBoxViewer.setChecked(item, true);
> break;
> }
> case 2:{
> chkBoxViewer.setGrayChecked(item, false);
> break;
> }
> }
> item.state=++item.state%3;
> }
> });
>
>
> Hitesh
>
> Nikola Mihajlovic wrote:
>
>> While I can programatically set one of the three states, a user
>> cannot cycle between three states with a mouse click, but only
>> between two. Since it's a problem with SWT, I've posted this on
>> their newsgroup (the same problem exists with a regular checkbox,
>> that is not inside the Tree)
>
>> Mircea Luchian wrote:
>>> Use "checkboxTreeViewer.setChecked()" and
>>> "checkboxTreeViewer.setGrayChecked()". This will give you the
>>> tristate behavior.
>>>
>>> Mircea
>>>
>>> Nikola Mihajlovic wrote:
>>>> It appears to be a limitation of SWT...
>>>>
>>>> Nikola Mihajlovic wrote:
>>>>
>>>>> Hi,
>>>>> I'm unsuccessfully trying to get a tristate behaviour in
>>>>> CheckboxTreeViewer, that is an item can be checked, grayed or
>>>>> unchecked. Is this the limitation of JFace, SWT Tree control or
>>>>> I'm doing something wrong??
Previous Topic:unasked for breakpoint
Next Topic:Ganymede SR2 update updates eclipse.ini !
Goto Forum:
  


Current Time: Fri Apr 19 21:20:59 GMT 2024

Powered by FUDForum. Page generated in 0.02522 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top