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.

ComponentDetail.java 1.9KB

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