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

com.vaadin.event.dd.TargetDetailsImpl Maven / Gradle / Ivy

There is a newer version: 8.27.3
Show newest version
/*
 * Copyright (C) 2000-2024 Vaadin Ltd
 *
 * This program is available under Vaadin Commercial License and Service Terms.
 *
 * See  for the full
 * license.
 */
package com.vaadin.event.dd;

import java.util.HashMap;
import java.util.Map;

import com.vaadin.shared.MouseEventDetails;
import com.vaadin.ui.dnd.event.DropEvent;

/**
 * A HashMap backed implementation of {@link TargetDetails} for terminal
 * implementation and for extension.
 *
 * @since 6.3
 * @deprecated Replaced in 8.1 by {@link DropEvent#getDataTransferData(String)}
 */
@Deprecated
@SuppressWarnings("serial")
public class TargetDetailsImpl implements TargetDetails {

    private Map data = new HashMap<>();
    private DropTarget dropTarget;

    protected TargetDetailsImpl(Map rawDropData) {
        data.putAll(rawDropData);
    }

    public TargetDetailsImpl(Map rawDropData,
            DropTarget dropTarget) {
        this(rawDropData);
        this.dropTarget = dropTarget;
    }

    /**
     * @return details about the actual event that caused the event details.
     *         Practically mouse move or mouse up.
     */
    public MouseEventDetails getMouseEvent() {
        return MouseEventDetails.deSerialize((String) getData("mouseEvent"));
    }

    @Override
    public Object getData(String key) {
        return data.get(key);
    }

    public Object setData(String key, Object value) {
        return data.put(key, value);
    }

    @Override
    public DropTarget getTarget() {
        return dropTarget;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy