1. /*
  2. * @(#)TagElement.java 1.11 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.swing.text.html.parser;
  8. import javax.swing.text.html.HTML;
  9. /**
  10. * A generic HTML TagElement class. The methods define how white
  11. * space is interpreted around the tag.
  12. *
  13. * @version 1.11, 12/19/03
  14. * @author Sunita Mani
  15. */
  16. public class TagElement {
  17. Element elem;
  18. HTML.Tag htmlTag;
  19. boolean insertedByErrorRecovery;
  20. public TagElement ( Element elem ) {
  21. this(elem, false);
  22. }
  23. public TagElement (Element elem, boolean fictional) {
  24. this.elem = elem;
  25. htmlTag = HTML.getTag(elem.getName());
  26. if (htmlTag == null) {
  27. htmlTag = new HTML.UnknownTag(elem.getName());
  28. }
  29. insertedByErrorRecovery = fictional;
  30. }
  31. public boolean breaksFlow() {
  32. return htmlTag.breaksFlow();
  33. }
  34. public boolean isPreformatted() {
  35. return htmlTag.isPreformatted();
  36. }
  37. public Element getElement() {
  38. return elem;
  39. }
  40. public HTML.Tag getHTMLTag() {
  41. return htmlTag;
  42. }
  43. public boolean fictional() {
  44. return insertedByErrorRecovery;
  45. }
  46. }