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.

ComponentDetail.java 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * Copyright 2000-2021 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.client;
  17. import java.util.HashMap;
  18. import java.util.Map;
  19. class ComponentDetail {
  20. private TooltipInfo tooltipInfo = new TooltipInfo();
  21. private ServerConnector connector;
  22. public ComponentDetail() {
  23. }
  24. /**
  25. * Returns a TooltipInfo associated with Component. If element is given,
  26. * returns an additional TooltipInfo.
  27. *
  28. * @param key
  29. * @return the tooltipInfo
  30. */
  31. public TooltipInfo getTooltipInfo(Object key) {
  32. if (key == null) {
  33. return tooltipInfo;
  34. } else {
  35. if (additionalTooltips != null) {
  36. return additionalTooltips.get(key);
  37. } else {
  38. return null;
  39. }
  40. }
  41. }
  42. /**
  43. * @param tooltipInfo
  44. * the tooltipInfo to set
  45. */
  46. public void setTooltipInfo(TooltipInfo tooltipInfo) {
  47. this.tooltipInfo = tooltipInfo;
  48. }
  49. private Map<Object, TooltipInfo> additionalTooltips;
  50. public void putAdditionalTooltip(Object key, TooltipInfo tooltip) {
  51. if (tooltip == null && additionalTooltips != null) {
  52. additionalTooltips.remove(key);
  53. } else {
  54. if (additionalTooltips == null) {
  55. additionalTooltips = new HashMap<>();
  56. }
  57. additionalTooltips.put(key, tooltip);
  58. }
  59. }
  60. public ServerConnector getConnector() {
  61. return connector;
  62. }
  63. public void setConnector(ServerConnector connector) {
  64. this.connector = connector;
  65. }
  66. }