aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/main/java/com/vaadin/event/Transferable.java
blob: c5c5ec6376cb83bd5e0c671334e54297a3b4467d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
 * Copyright 2000-2018 Vaadin Ltd.
 *
 * 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 com.vaadin.event;

import java.io.Serializable;
import java.util.Collection;

import com.vaadin.ui.Component;
import com.vaadin.ui.dnd.DragSourceExtension;
import com.vaadin.ui.dnd.event.DropEvent;

/**
 * Transferable wraps the data that is to be imported into another component.
 * Currently Transferable is only used for drag and drop.
 *
 * @since 6.3
 * @deprecated Since 8.1 replaced by
 *             {@link DragSourceExtension#setTransferData(String, String)},
 *             {@link DropEvent#getTransferData(String)}.
 */
@Deprecated
public interface Transferable extends Serializable {

    /**
     * Returns the data from Transferable by its data flavor (aka data type).
     * Data types can be any string keys, but MIME types like "text/plain" are
     * commonly used.
     * <p>
     * Note, implementations of {@link Transferable} often provide a better
     * typed API for accessing data.
     *
     * @param dataFlavor
     *            the data flavor to be returned from Transferable
     * @return the data stored in the Transferable or null if Transferable
     *         contains no data for given data flavour
     */
    public Object getData(String dataFlavor);

    /**
     * Stores data of given data flavor to Transferable. Possibly existing value
     * of the same data flavor will be replaced.
     *
     * @param dataFlavor
     *            the data flavor
     * @param value
     *            the new value of the data flavor
     */
    public void setData(String dataFlavor, Object value);

    /**
     * @return a collection of data flavors ( data types ) available in this
     *         Transferable
     */
    public Collection<String> getDataFlavors();

    /**
     * @return the component that created the Transferable or null if the source
     *         component is unknown
     */
    public Component getSourceComponent();

}