You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

GridDropEvent.java 2.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * Copyright 2000-2016 Vaadin Ltd.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.vaadin.event.dnd.grid;
  17. import com.vaadin.event.dnd.DragSourceExtension;
  18. import com.vaadin.event.dnd.DropEvent;
  19. import com.vaadin.shared.ui.grid.DropLocation;
  20. import com.vaadin.ui.AbstractComponent;
  21. import com.vaadin.ui.Grid;
  22. /**
  23. * Drop event on an HTML5 drop target {@link Grid} row.
  24. *
  25. * @param <T>
  26. * The Grid bean type.
  27. * @author Vaadin Ltd.
  28. * @see com.vaadin.ui.GridDropTargetExtension#addGridDropListener(GridDropListener)
  29. * @since
  30. */
  31. public class GridDropEvent<T> extends DropEvent<Grid<T>> {
  32. private final T dropTargetRow;
  33. private final DropLocation dropLocation;
  34. /**
  35. * Creates a Grid row drop event.
  36. *
  37. * @param target
  38. * Grid that received the drop.
  39. * @param dataTransferText
  40. * Data of type {@code "text"} from the {@code DataTransfer}
  41. * object.
  42. * @param dragSourceExtension
  43. * Drag source extension of the component that initiated the drop
  44. * event.
  45. * @param dropTargetRow
  46. * Target row that received the drop.
  47. * @param dropLocation
  48. * Location of the drop within the target row.
  49. */
  50. public GridDropEvent(Grid<T> target, String dataTransferText,
  51. DragSourceExtension<? extends AbstractComponent> dragSourceExtension,
  52. T dropTargetRow, DropLocation dropLocation) {
  53. super(target, dataTransferText, dragSourceExtension);
  54. this.dropTargetRow = dropTargetRow;
  55. this.dropLocation = dropLocation;
  56. }
  57. /**
  58. * Get the row item source of this event.
  59. *
  60. * @return The row item this event was originated from.
  61. */
  62. public T getDropTargetRow() {
  63. return dropTargetRow;
  64. }
  65. /**
  66. * Get the location of the drop within the row.
  67. *
  68. * @return Location of the drop within the row.
  69. */
  70. public DropLocation getDropLocation() {
  71. return dropLocation;
  72. }
  73. }