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.

AbstractEmbedded.java 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * Copyright 2000-2014 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.ui;
  17. import com.vaadin.server.Resource;
  18. import com.vaadin.shared.ui.AbstractEmbeddedState;
  19. /**
  20. * Abstract base for embedding components.
  21. *
  22. * @author Vaadin Ltd.
  23. * @version
  24. * @VERSION@
  25. * @since 7.0
  26. */
  27. @SuppressWarnings("serial")
  28. public abstract class AbstractEmbedded extends AbstractComponent {
  29. @Override
  30. protected AbstractEmbeddedState getState() {
  31. return (AbstractEmbeddedState) super.getState();
  32. }
  33. @Override
  34. protected AbstractEmbeddedState getState(boolean markAsDirty) {
  35. return (AbstractEmbeddedState) super.getState(markAsDirty);
  36. }
  37. /**
  38. * Sets the object source resource. The dimensions are assumed if possible.
  39. * The type is guessed from resource.
  40. *
  41. * @param source
  42. * the source to set.
  43. */
  44. public void setSource(Resource source) {
  45. setResource(AbstractEmbeddedState.SOURCE_RESOURCE, source);
  46. }
  47. /**
  48. * Get the object source resource.
  49. *
  50. * @return the source
  51. */
  52. public Resource getSource() {
  53. return getResource(AbstractEmbeddedState.SOURCE_RESOURCE);
  54. }
  55. /**
  56. * Sets this component's alternate text that can be presented instead of the
  57. * component's normal content for accessibility purposes.
  58. *
  59. * @param altText
  60. * A short, human-readable description of this component's
  61. * content.
  62. */
  63. public void setAlternateText(String altText) {
  64. getState().alternateText = altText;
  65. }
  66. /**
  67. * Gets this component's alternate text that can be presented instead of the
  68. * component's normal content for accessibility purposes.
  69. *
  70. * @returns Alternate text
  71. */
  72. public String getAlternateText() {
  73. return getState(false).alternateText;
  74. }
  75. }