use of org.opennms.features.topology.api.VerticesUpdateManager.VerticesUpdateEvent in project opennms by OpenNMS.
the class NodeMapsApplication method init.
@Override
protected void init(final VaadinRequest vaadinRequest) {
m_request = vaadinRequest;
LOG.debug("initializing");
final VaadinApplicationContextImpl context = new VaadinApplicationContextImpl();
final UI currentUI = UI.getCurrent();
context.setSessionId(currentUI.getSession().getSession().getId());
context.setUiId(currentUI.getUIId());
context.setUsername(vaadinRequest.getRemoteUser());
Assert.notNull(m_alarmTable);
Assert.notNull(m_nodeTable);
final String searchString = vaadinRequest.getParameter("search");
final Integer maxClusterRadius = Integer.getInteger("gwt.maxClusterRadius", 350);
LOG.info("Starting search string: {}, max cluster radius: {}", searchString, maxClusterRadius);
m_alarmTable.setVaadinApplicationContext(context);
final EventProxy eventProxy = new EventProxy() {
@Override
public <T> void fireEvent(final T eventObject) {
LOG.debug("got event: {}", eventObject);
if (eventObject instanceof VerticesUpdateEvent) {
final VerticesUpdateEvent event = (VerticesUpdateEvent) eventObject;
final List<Integer> nodeIds = new ArrayList<>();
for (final VertexRef ref : event.getVertexRefs()) {
if ("nodes".equals(ref.getNamespace()) && ref.getId() != null) {
nodeIds.add(Integer.valueOf(ref.getId()));
}
}
m_nodeMapComponent.setSelectedNodes(nodeIds);
return;
}
LOG.warn("Unsure how to deal with event: {}", eventObject);
}
@Override
public <T> void addPossibleEventConsumer(final T possibleEventConsumer) {
LOG.debug("(ignoring) add consumer: {}", possibleEventConsumer);
/* throw new UnsupportedOperationException("Not yet implemented!"); */
}
};
m_alarmTable.setEventProxy(eventProxy);
m_nodeTable.setEventProxy(eventProxy);
createMapPanel(searchString, maxClusterRadius);
createRootLayout();
addRefresher();
// Notify the user if no tileserver url or options are set
if (!configuration.isValid()) {
new InvalidConfigurationWindow(configuration).open();
}
}
Aggregations