Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » TableTreeViewer and CheckBoxCellEditor working but...
TableTreeViewer and CheckBoxCellEditor working but... [message #453452] Tue, 05 April 2005 23:39 Go to next message
Olivier Crameri is currently offline Olivier CrameriFriend
Messages: 1
Registered: July 2009
Junior Member
Hi,

I have a TableTreeViewer using a CheckboxCellEditor for one of the colum.
I'm able to display my checkbox images and to toggle the state properly
in the model using my ICellModifier.

Then, when the state changes, in order for my view to reflect the state
I can either use tabletreeviewer.refresh() or
tabletreeviewer.update(...). While the former works correctly
(eventhough that's not the optimal way to do it), the later one gives
me a strange result: Let's say I want to toggle the state a column in
row 5, instead of displaying the result in row 5, it displays the
updated content of row 5 in the first row of the column.

If anyone has an idea of what I did wrong.

Thanks,
Olivier
Re: TableTreeViewer and CheckBoxCellEditor working but... [message #453463 is a reply to message #453452] Wed, 06 April 2005 13:16 Go to previous message
Koen is currently offline KoenFriend
Messages: 26
Registered: July 2009
Junior Member
Hello Oliver,

I'm not able to help you, but I have a simular problem.

First I want to mentione that the tabletree is deprecated in version 3.1. So
I use a tree and add treeColumn's to it.
The problem that I have is that I can't find a way to add a listener to the
second column. The only listeners I can
add are on the tree and the tree is in the first column. What I actually
want to do is implement drag and drop only
from the second column on and not directly from the tree.

I also did some tests with celleditor and cellmodifier and only the first
row could be edited. I tracked this down to
the following function of the TreeEditorImpl used in the TreeViewer:
/**
* Activate a cell editor for the given mouse position.
*/
private void activateCellEditor(MouseEvent event) {
if (treeItem == null || treeItem.isDisposed()) {
//item no longer exists
return;
}
int columnToEdit;
int columns = getColumnCount();
if (columns == 0) {
// If no TreeColumn, Tree acts as if it has a single column
// which takes the whole width.
columnToEdit = 0;
} else {
columnToEdit = -1;
for (int i = 0; i < columns; i++) {
Rectangle bounds = getBounds(treeItem, i);
if (bounds.contains(event.x, event.y))
{ <==
columnToEdit = i;
break;
}
}
if (columnToEdit == -1) {
return;
}
}

columnNumber = columnToEdit;
activateCellEditor();
}

The bounds.contains function returns false. Because the bounds only points
to the first cell.


Good luck,

Koen
"Olivier Crameri" <olivier.crameri@epfl.ch> wrote in message
news:d2v7pt$jvo$1@news.eclipse.org...
> Hi,
>
> I have a TableTreeViewer using a CheckboxCellEditor for one of the colum.
> I'm able to display my checkbox images and to toggle the state properly
> in the model using my ICellModifier.
>
> Then, when the state changes, in order for my view to reflect the state
> I can either use tabletreeviewer.refresh() or
> tabletreeviewer.update(...). While the former works correctly
> (eventhough that's not the optimal way to do it), the later one gives
> me a strange result: Let's say I want to toggle the state a column in
> row 5, instead of displaying the result in row 5, it displays the
> updated content of row 5 in the first row of the column.
>
> If anyone has an idea of what I did wrong.
>
> Thanks,
> Olivier
>
Previous Topic:[Announce] Jayasoft announce SWTBinding
Next Topic:Making a Text resizing with it's composite
Goto Forum:
  


Current Time: Fri Mar 29 07:07:58 GMT 2024

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

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

Back to the top