Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

VIsOverId.java 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Copyright 2000-2013 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. /**
  17. *
  18. */
  19. package com.vaadin.client.ui.dd;
  20. import com.vaadin.client.ComponentConnector;
  21. import com.vaadin.client.UIDL;
  22. import com.vaadin.shared.ui.dd.AcceptCriterion;
  23. import com.vaadin.ui.AbstractSelect;
  24. @AcceptCriterion(AbstractSelect.TargetItemIs.class)
  25. final public class VIsOverId extends VAcceptCriterion {
  26. @Override
  27. protected boolean accept(VDragEvent drag, UIDL configuration) {
  28. try {
  29. String pid = configuration.getStringAttribute("s");
  30. VDropHandler currentDropHandler = VDragAndDropManager.get()
  31. .getCurrentDropHandler();
  32. ComponentConnector dropHandlerConnector = currentDropHandler
  33. .getConnector();
  34. String pid2 = dropHandlerConnector.getConnectorId();
  35. if (pid2.equals(pid)) {
  36. Object searchedId = drag.getDropDetails().get("itemIdOver");
  37. String[] stringArrayAttribute = configuration
  38. .getStringArrayAttribute("keys");
  39. for (String string : stringArrayAttribute) {
  40. if (string.equals(searchedId)) {
  41. return true;
  42. }
  43. }
  44. }
  45. } catch (Exception e) {
  46. }
  47. return false;
  48. }
  49. }