Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

GridDropEvent.java 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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.ui.AbstractComponent;
  20. import com.vaadin.ui.Grid;
  21. /**
  22. * Server side drop event on an HTML5 drop target {@link Grid} row.
  23. *
  24. * @param <T>
  25. * The Grid bean type.
  26. * @author Vaadin Ltd.
  27. * @see com.vaadin.ui.GridDropTargetExtension#addGridDropListener(GridDropListener)
  28. * @since
  29. */
  30. public class GridDropEvent<T> extends DropEvent<Grid<T>> {
  31. private final T dropTargetRow;
  32. /**
  33. * Creates a server side Grid row drop event.
  34. *
  35. * @param target
  36. * Grid that received the drop.
  37. * @param dataTransferText
  38. * Data of type {@code "text"} from the {@code DataTransfer}
  39. * object.
  40. * @param dragSourceExtension
  41. * Drag source extension of the component that initiated the drop
  42. * event.
  43. * @param dropTargetRowKey
  44. * Key of the target row that received the drop.
  45. */
  46. public GridDropEvent(Grid<T> target, String dataTransferText,
  47. DragSourceExtension<? extends AbstractComponent> dragSourceExtension,
  48. String dropTargetRowKey) {
  49. super(target, dataTransferText, dragSourceExtension);
  50. dropTargetRow = target.getDataCommunicator().getKeyMapper()
  51. .get(dropTargetRowKey);
  52. }
  53. /**
  54. * Get the row item source of this event.
  55. *
  56. * @return The row item this event was originated from.
  57. */
  58. public T getDropTargetRow() {
  59. return dropTargetRow;
  60. }
  61. }