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.

ServerSideCriterion.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.dd.acceptcriteria;
  17. import com.vaadin.event.Transferable;
  18. import com.vaadin.server.PaintException;
  19. import com.vaadin.server.PaintTarget;
  20. /**
  21. * Parent class for criteria which are verified on the server side during a drag
  22. * operation to accept/discard dragged content (presented by
  23. * {@link Transferable}).
  24. * <p>
  25. * Subclasses should implement the
  26. * {@link AcceptCriterion#accept(com.vaadin.event.dd.DragAndDropEvent)} method.
  27. * <p>
  28. * As all server side state can be used to make a decision, this is more
  29. * flexible than {@link ClientSideCriterion}. However, this does require
  30. * additional requests from the browser to the server during a drag operation.
  31. *
  32. * @see AcceptCriterion
  33. * @see ClientSideCriterion
  34. *
  35. * @since 6.3
  36. */
  37. public abstract class ServerSideCriterion
  38. implements AcceptCriterion {
  39. private static final long serialVersionUID = 2128510128911628902L;
  40. @Override
  41. public final boolean isClientSideVerifiable() {
  42. return false;
  43. }
  44. @Override
  45. public void paint(PaintTarget target) throws PaintException {
  46. target.startTag("-ac");
  47. target.addAttribute("name", getIdentifier());
  48. paintContent(target);
  49. target.endTag("-ac");
  50. }
  51. public void paintContent(PaintTarget target) {
  52. }
  53. @Override
  54. public void paintResponse(PaintTarget target) throws PaintException {
  55. }
  56. protected String getIdentifier() {
  57. return ServerSideCriterion.class.getCanonicalName();
  58. }
  59. }