use of org.opennms.features.vaadin.nodemaps.internal.gwt.client.event.AlarmSeverityUpdatedEvent in project opennms by OpenNMS.
the class AlarmControl method doOnRemove.
public void doOnRemove() {
LOG.info("doOnRemove() called");
m_eventManager.removeHandler(AlarmSeverityUpdatedEvent.TYPE, this);
m_eventManager.fireEvent(new AlarmSeverityUpdatedEvent(AlarmSeverity.NORMAL));
}
use of org.opennms.features.vaadin.nodemaps.internal.gwt.client.event.AlarmSeverityUpdatedEvent in project opennms by OpenNMS.
the class AlarmControl method doOnAdd.
public Element doOnAdd() {
LOG.info("AlarmControl.doOnAdd()");
final AlarmControlCss css = AlarmControlBundle.INSTANCE.css();
css.ensureInjected();
m_eventManager.addHandler(AlarmSeverityUpdatedEvent.TYPE, this);
this.setStylePrimaryName("leaflet-control-alarm");
this.addStyleName("leaflet-bar");
this.addStyleName("leaflet-control");
final Label label = new Label("Show Severity >=");
label.getElement().setAttribute("for", "alarmControl");
label.addStyleName(css.label());
m_severityBox = new ListBox(false);
m_severityBox.getElement().setId("alarmControl");
for (final AlarmSeverity sev : AlarmSeverity.values()) {
m_severityBox.addItem(sev.getLabel());
}
m_severityBox.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(final ChangeEvent event) {
final int selected = m_severityBox.getSelectedIndex();
LOG.info("new selection index = " + selected);
final String value = m_severityBox.getValue(selected);
LOG.info("new severity = " + value);
m_eventManager.fireEvent(new AlarmSeverityUpdatedEvent(AlarmSeverity.get(value)));
event.stopPropagation();
}
});
m_severityBox.addStyleName(css.label());
this.add(label);
this.add(m_severityBox);
LOG.info("AlarmControl.doOnAdd(): finished, returning: " + this.getElement());
m_componentTracker.ready(getClass());
return this.getElement();
}
Aggregations