All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ui4j.spi.DelegatingEventHandler Maven / Gradle / Ivy

There is a newer version: 2.1.0
Show newest version
package com.ui4j.spi;

import com.ui4j.api.event.DomEvent;
import com.ui4j.api.event.EventHandler;

public class DelegatingEventHandler implements EventHandler {

    private String event;

    private String selector;

    private EventHandler eventHandler;

    public DelegatingEventHandler(String event, String selector, EventHandler eventHandler) {
        this.event = event;
        this.selector = selector;
        this.eventHandler = eventHandler;
    }

    @Override
    public void handle(DomEvent event) {
        if (event.getTarget().is(selector)) {
            eventHandler.handle(event);
        }
    }

    public String getSelector() {
        return selector;
    }

    public EventHandler getHandler() {
        return eventHandler;
    }

    public String getEvent() {
        return event;
    }

    @Override
    public String toString() {
        return "DelegatingEventHandler [event=" + event + ", selector="
                + selector + ", eventHandler=" + eventHandler + "]";
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy