Skip to main content



      Home
Home » Eclipse Projects » Nebula » Xviewer autofocus and expand tree(if i search an item and it is found has to be focus automatically.)
Xviewer autofocus and expand tree [message #1270295] Wed, 12 March 2014 16:32 Go to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend

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);
}
Previous Topic:SWT ComboViewer with ContentProposal and Pagination Control (large anmount of data)
Next Topic:missing feature org.eclipse.nebula.widgets.formattedtext
Goto Forum:
  


Current Time: Sat May 03 07:53:38 EDT 2025

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

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

Back to the top