Xviewer autofocus and expand tree [message #1270295] |
Wed, 12 March 2014 16:32  |
Eclipse User |
|
|
|
Hi everybody,
I have been working with Xviewer and i want after a "Search" , if the item is in the tree, that it focus automatically in the item and if necessary made that node expand.
Do you have any idea how do this.
Thanks.
Regards.
|
|
|
Re: Xviewer autofocus and expand tree [message #1336888 is a reply to message #1270295] |
Tue, 06 May 2014 12:14  |
Eclipse User |
|
|
|
Having the matched item have focus might be possible, but it would take focus away from the filter box which might be odd for the user. What is the use case for this and how would you see it being used?
Regarding the expansion of children to match searches, you should be able to subclass XViewerTextFilter to provide for your use case. Here's an example.
public class XBranchTextFilter extends XViewerTextFilter {
public XBranchTextFilter(XViewer viewer) {
super(viewer);
}
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
if (element instanceof TransactionRecord) {
return true;
}
if (element instanceof ArrayList<?>) {
return true;
}
return super.select(viewer, parentElement, element);
}
}
And then make sure that your Xviewer overrides the getXViewerTextFilter method
@Override
public XViewerTextFilter getXViewerTextFilter() {
return new XBranchTextFilter(this);
}
|
|
|
Powered by
FUDForum. Page generated in 0.04415 seconds