123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- /*
- * Copyright 2000-2016 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.dnd.grid;
-
- import com.vaadin.event.dnd.DragSourceExtension;
- import com.vaadin.event.dnd.DropEvent;
- import com.vaadin.shared.ui.grid.DropLocation;
- import com.vaadin.ui.AbstractComponent;
- import com.vaadin.ui.Grid;
- import com.vaadin.ui.GridDropTarget;
-
- /**
- * Drop event on an HTML5 drop target {@link Grid} row.
- *
- * @param <T>
- * The Grid bean type.
- * @author Vaadin Ltd.
- * @see GridDropTarget#addGridDropListener(GridDropListener)
- * @since 8.1
- */
- public class GridDropEvent<T> extends DropEvent<Grid<T>> {
-
- private final T dropTargetRow;
- private final DropLocation dropLocation;
-
- /**
- * Creates a Grid row drop event.
- *
- * @param target
- * Grid that received the drop.
- * @param dataTransferText
- * Data of type {@code "text"} from the {@code DataTransfer}
- * object.
- * @param dragSourceExtension
- * Drag source extension of the component that initiated the drop
- * event.
- * @param dropTargetRow
- * Target row that received the drop.
- * @param dropLocation
- * Location of the drop within the target row.
- */
- public GridDropEvent(Grid<T> target, String dataTransferText,
- DragSourceExtension<? extends AbstractComponent> dragSourceExtension,
- T dropTargetRow, DropLocation dropLocation) {
- super(target, dataTransferText, dragSourceExtension);
-
- this.dropTargetRow = dropTargetRow;
- this.dropLocation = dropLocation;
- }
-
- /**
- * Get the row item source of this event.
- *
- * @return The row item this event was originated from.
- */
- public T getDropTargetRow() {
- return dropTargetRow;
- }
-
- /**
- * Get the location of the drop within the row.
- *
- * @return Location of the drop within the row.
- */
- public DropLocation getDropLocation() {
- return dropLocation;
- }
- }
|