use of org.netxms.webui.mobile.pages.helpers.ObjectListLabelProvider in project netxms by netxms.
the class ObjectBrowser method createContent.
/* (non-Javadoc)
* @see org.netxms.webui.mobile.pages.AbstractPage#createContent(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Composite createContent(Composite parent) {
viewer = new TableViewer(parent, SWT.FULL_SELECTION);
viewer.setContentProvider(new ArrayContentProvider());
viewer.setLabelProvider(new ObjectListLabelProvider());
viewer.setComparator(new ViewerComparator() {
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
return ((AbstractObject) e1).getObjectName().compareToIgnoreCase(((AbstractObject) e2).getObjectName());
}
});
viewer.addPostSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
AbstractObject o = (AbstractObject) ((IStructuredSelection) viewer.getSelection()).getFirstElement();
handleSelection(o);
}
});
NXCSession session = (NXCSession) ConsoleSharedData.getSession();
viewer.setInput(session.findObjectById(rootObjectId).getChildsAsArray());
setTitle(session.getObjectName(rootObjectId));
return null;
}
Aggregations