org.dussan.vaadin.dcharts.client.events.EventProcessor.java Source code

Java tutorial

Introduction

Here is the source code for org.dussan.vaadin.dcharts.client.events.EventProcessor.java

Source

/**
 * Copyright (C) 2012-2013  Duan Vejnovi?  <vaadin@dussan.org>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.dussan.vaadin.dcharts.client.events;

import java.util.Map;

import com.google.gwt.event.logical.shared.HasValueChangeHandlers;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.vaadin.client.VConsole;

public class EventProcessor {

    private static <T> void fire(HasValueChangeHandlers<T> source, T value) {
        try {
            ValueChangeEvent.fire(source, value);
        } catch (IndexOutOfBoundsException e) {
            VConsole.error("Failed to fire event.");
        }
    }

    @SuppressWarnings("unchecked")
    public static <T> void fireEvent(HasValueChangeHandlers<T> source, Map<String, String> event) {
        fire(source, (T) new Object[] { event });
    }

}