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