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