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