use of alma.acs.eventbrowser.status.StatusLineWriter in project ACS by ACS-Community.
the class ArchivingListPart method postConstruct.
@PostConstruct
public void postConstruct(Composite parent, IEventBroker eventBroker) {
try {
em = EventModel.getInstance();
} catch (Throwable thr) {
thr.printStackTrace();
IStatus someStatus = statusReporter.newStatus(IStatus.ERROR, "Connection with NCs failed.", thr);
statusReporter.report(someStatus, StatusReporter.SHOW);
throw new RuntimeException(thr);
}
logger = em.getLogger();
GridLayout gridLayout = new GridLayout();
gridLayout.marginHeight = 0;
gridLayout.marginWidth = 0;
gridLayout.verticalSpacing = 0;
parent.setLayout(gridLayout);
// buildCustomToolBar(parent);
viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
Table table = viewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);
/*
* "Time "+timeStamp+" "+m_channelName+" "+component+" "+count+"
* "+channelEventCount+" " +" "+evtTypeName+"
* "+evtCounter.get(evtTypeName)
*/
TableViewerColumn tvcol = new TableViewerColumn(viewer, SWT.NONE, 0);
tvcol.setLabelProvider(new TimeStampLabelProvider());
TableColumn col = tvcol.getColumn();
col.setText("Timestamp");
col.setWidth(190);
col.setAlignment(SWT.LEFT);
tvcol = new TableViewerColumn(viewer, SWT.NONE, 1);
tvcol.setLabelProvider(new EventSourceLabelProvider());
col = tvcol.getColumn();
col.setText("Device");
col.setWidth(100);
col.setAlignment(SWT.LEFT);
tvcol = new TableViewerColumn(viewer, SWT.NONE, 2);
tvcol.setLabelProvider(new BaciParameterLabelProvider());
col = tvcol.getColumn();
col.setText("Property");
col.setWidth(100);
col.setAlignment(SWT.LEFT);
tvcol = new TableViewerColumn(viewer, SWT.NONE, 3);
tvcol.setLabelProvider(new BaciPropertyValueLabelProvider());
col = tvcol.getColumn();
col.setText("Value");
col.setWidth(100);
col.setAlignment(SWT.LEFT);
GridDataFactory.fillDefaults().grab(true, true).applyTo(viewer.getTable());
viewer.setContentProvider(new ArchivingListContentProvider(em));
viewer.setInput(new Object());
pel = new PopulateEventList(logger, viewer, new StatusLineWriter(eventBroker), em.getArchQueue(), "Monitor points");
eventListThread = pel.getThreadForEventList();
eventListThread.start();
}
use of alma.acs.eventbrowser.status.StatusLineWriter in project ACS by ACS-Community.
the class ChannelTreePart method postConstruct.
/**
* See http://www.vogella.com/articles/EclipseJFaceTree/article.html
*/
@PostConstruct
public void postConstruct(Composite parent, final IEclipseContext context, EMenuService menuService, IEventBroker eventBroker) {
try {
eventModel = EventModel.getInstance();
} catch (Throwable thr) {
thr.printStackTrace();
IStatus someStatus = statusReporter.newStatus(IStatus.ERROR, "Connection with NCs failed.", thr);
statusReporter.report(someStatus, StatusReporter.SHOW);
throw new RuntimeException(thr);
}
// eventModel.getLogger().info("ChannelTreePart got EventModel instance.");
statusLineWriter = new StatusLineWriter(eventBroker);
viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
viewer.setContentProvider(new ChannelTreeContentProvider());
viewer.setLabelProvider(new ChannelTreeLabelProvider());
// Expand the tree. '2' means to show only the visible top-level nodes.
viewer.setAutoExpandLevel(2);
viewer.setComparator(new ServiceViewerComparator());
// Provide the root node to the ContentProvider
viewer.setInput(eventModel.getNotifyServicesRoot());
// Expand with doubleclick
viewer.addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent event) {
IStructuredSelection thisSelection = (IStructuredSelection) event.getSelection();
Object selectedNode = thisSelection.getFirstElement();
viewer.setExpandedState(selectedNode, !viewer.getExpandedState(selectedNode));
}
});
// Attach a selection listener to our tree that will post selections to the ESelectionService
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
selectionService.setSelection(selection.size() == 1 ? selection.getFirstElement() : selection.toArray());
}
});
// TODO: Take care of help system. Here's the E3 code:
// // Create the help context id for the viewer's control
// PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(), "alma.acs.eventbrowser.viewer");
hookContextMenu(menuService);
// TODO: this could be used by handlers etc, currently it's not
context.set(ChannelTreePart.class, this);
}
use of alma.acs.eventbrowser.status.StatusLineWriter in project ACS by ACS-Community.
the class EventListPart method postConstruct.
/**
*/
@PostConstruct
public void postConstruct(Composite parent, final IEclipseContext context, IEventBroker eventBroker, EMenuService menuService) {
try {
em = EventModel.getInstance();
} catch (Throwable thr) {
thr.printStackTrace();
IStatus someStatus = statusReporter.newStatus(IStatus.ERROR, "Connection with NCs failed.", thr);
statusReporter.report(someStatus, StatusReporter.SHOW);
throw new RuntimeException(thr);
}
logger = em.getLogger();
GridLayout gridLayout = new GridLayout();
gridLayout.marginHeight = 0;
gridLayout.marginWidth = 0;
gridLayout.verticalSpacing = 0;
parent.setLayout(gridLayout);
// TODO: We currently have the filter text control in the regular view toolbar.
// The e3 eventGUI had a "custom tool bar" inserted here.
// We should decide which way it's better.
viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
Table table = viewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);
/*
* "Time "+timeStamp+" "+m_channelName+" "+component+" "+count+"
* "+channelEventCount+" " +" "+evtTypeName+"
* "+evtCounter.get(evtTypeName)
*/
TableViewerColumn tvcol = new TableViewerColumn(viewer, SWT.NONE, 0);
tvcol.setLabelProvider(new TimeStampLabelProvider());
TableColumn col = tvcol.getColumn();
col.setText("Timestamp");
col.setWidth(180);
col.setAlignment(SWT.LEFT);
tvcol = new TableViewerColumn(viewer, SWT.NONE, 1);
tvcol.setLabelProvider(new EventSourceLabelProvider());
col = tvcol.getColumn();
col.setText("Event source");
col.setWidth(150);
col.setAlignment(SWT.LEFT);
tvcol = new TableViewerColumn(viewer, SWT.NONE, 2);
tvcol.setLabelProvider(new CountLabelProvider());
col = tvcol.getColumn();
col.setText("# Events in channel");
col.setWidth(50);
col.setAlignment(SWT.LEFT);
tvcol = new TableViewerColumn(viewer, SWT.NONE, 3);
tvcol.setLabelProvider(new EventTypeLabelProvider());
col = tvcol.getColumn();
col.setText("Event type");
col.setWidth(150);
col.setAlignment(SWT.LEFT);
tvcol = new TableViewerColumn(viewer, SWT.NONE, 4);
tvcol.setLabelProvider(new EventTypeCountLabelProvider());
col = tvcol.getColumn();
col.setText("# Events this type");
col.setWidth(50);
col.setAlignment(SWT.LEFT);
GridDataFactory.fillDefaults().grab(true, true).applyTo(viewer.getTable());
viewer.setContentProvider(new EventListViewContentProvider(em));
// Attach a selection listener to our event list that will post the selected event for the event details list
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
if (selection.size() == 1) {
selectionService.setSelection(selection.getFirstElement());
}
}
});
viewer.setInput(new Object());
hookContextMenu(menuService);
pel = new PopulateEventList(logger, viewer, new StatusLineWriter(eventBroker), em.getEventQueue(), "NC Events");
eventListThread = pel.getThreadForEventList();
eventListThread.start();
}
Aggregations