1. /*
  2. * @(#)TabableView.java 1.10 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;
  8. /**
  9. * Interface for <code>View</code>s that have size dependent upon tabs.
  10. *
  11. * @author Timothy Prinzing
  12. * @author Scott Violet
  13. * @version 1.10 12/19/03
  14. * @see TabExpander
  15. * @see LabelView
  16. * @see ParagraphView
  17. */
  18. public interface TabableView {
  19. /**
  20. * Determines the desired span when using the given
  21. * tab expansion implementation. If a container
  22. * calls this method, it will do so prior to the
  23. * normal layout which would call getPreferredSpan.
  24. * A view implementing this should give the same
  25. * result in any subsequent calls to getPreferredSpan
  26. * along the axis of tab expansion.
  27. *
  28. * @param x the position the view would be located
  29. * at for the purpose of tab expansion >= 0.
  30. * @param e how to expand the tabs when encountered.
  31. * @return the desired span >= 0
  32. */
  33. float getTabbedSpan(float x, TabExpander e);
  34. /**
  35. * Determines the span along the same axis as tab
  36. * expansion for a portion of the view. This is
  37. * intended for use by the TabExpander for cases
  38. * where the tab expansion involves aligning the
  39. * portion of text that doesn't have whitespace
  40. * relative to the tab stop. There is therefore
  41. * an assumption that the range given does not
  42. * contain tabs.
  43. *
  44. * @param p0 the starting location in the text document >= 0
  45. * @param p1 the ending location in the text document >= p0
  46. * @return the span >= 0
  47. */
  48. float getPartialSpan(int p0, int p1);
  49. }