Search in sources :

Example 1 with AlarmSeverityUpdatedEvent

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));
}
Also used : AlarmSeverityUpdatedEvent(org.opennms.features.vaadin.nodemaps.internal.gwt.client.event.AlarmSeverityUpdatedEvent)

Example 2 with AlarmSeverityUpdatedEvent

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();
}
Also used : AlarmSeverity(org.opennms.features.vaadin.nodemaps.internal.gwt.client.AlarmSeverity) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) Label(com.google.gwt.user.client.ui.Label) AlarmSeverityUpdatedEvent(org.opennms.features.vaadin.nodemaps.internal.gwt.client.event.AlarmSeverityUpdatedEvent) ListBox(com.google.gwt.user.client.ui.ListBox)

Aggregations

AlarmSeverityUpdatedEvent (org.opennms.features.vaadin.nodemaps.internal.gwt.client.event.AlarmSeverityUpdatedEvent)2 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)1 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)1 Label (com.google.gwt.user.client.ui.Label)1 ListBox (com.google.gwt.user.client.ui.ListBox)1 AlarmSeverity (org.opennms.features.vaadin.nodemaps.internal.gwt.client.AlarmSeverity)1