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

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