View | Details | Raw Unified | Return to bug 194278 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/draw2d/text/FlowUtilities.java (-11 / +21 lines)
Lines 25-31 Link Here
25
/**
25
/**
26
 * Utility class for FlowFigures.
26
 * Utility class for FlowFigures.
27
 * @author hudsonr
27
 * @author hudsonr
28
 * @since 2.1
28
 * @since 3.4
29
 */
29
 */
30
public class FlowUtilities 
30
public class FlowUtilities 
31
{
31
{
Lines 155-172 Link Here
155
        return getTextUtilities().getStringExtents(string.substring(0, guess), font).width;
155
        return getTextUtilities().getStringExtents(string.substring(0, guess), font).width;
156
}
156
}
157
157
158
protected void setupFragment(TextFragmentBox frag, Font f, String s) {
158
/**
159
    if (frag.getWidth() == -1 || frag.isTruncated()) {
159
 * Sets up the fragment width based using the font and string passed in.
160
 * 
161
 * @param fragment
162
 *            the text fragment whose width will be set
163
 * @param font
164
 *            the font to be used in the calculation
165
 * @param string
166
 *            the string to be used in the calculation
167
 */
168
final protected void setupFragment(TextFragmentBox fragment, Font font, String string) {
169
    if (fragment.getWidth() == -1 || fragment.isTruncated()) {
160
        int width;
170
        int width;
161
        if (s.length() == 0 || frag.length == 0)
171
        if (string.length() == 0 || fragment.length == 0)
162
            width = 0;
172
            width = 0;
163
        else if (frag.requiresBidi()) {
173
        else if (fragment.requiresBidi()) {
164
            width = getTextLayoutBounds(s, f, 0, frag.length - 1).width;
174
            width = getTextLayoutBounds(string, font, 0, fragment.length - 1).width;
165
        } else
175
        } else
166
            width = getTextUtilities().getStringExtents(s.substring(0, frag.length), f).width;
176
            width = getTextUtilities().getStringExtents(string.substring(0, fragment.length), font).width;
167
        if (frag.isTruncated())
177
        if (fragment.isTruncated())
168
            width += getEllipsisWidth(f);
178
            width += getEllipsisWidth(font);
169
        frag.setWidth(width);
179
        fragment.setWidth(width);
170
    }
180
    }
171
}
181
}
172
182
Lines 183-189 Link Here
183
 * @return the number of characters that will fit in the given space; can be 0 (eg., when
193
 * @return the number of characters that will fit in the given space; can be 0 (eg., when
184
 * the first character of the given string is a newline)
194
 * the first character of the given string is a newline)
185
 */
195
 */
186
protected int wrapFragmentInContext(TextFragmentBox frag, String string,
196
final protected int wrapFragmentInContext(TextFragmentBox frag, String string,
187
		FlowContext context, LookAhead lookahead, Font font, int wrapping) {
197
		FlowContext context, LookAhead lookahead, Font font, int wrapping) {
188
	frag.setTruncated(false);
198
	frag.setTruncated(false);
189
	int strLen = string.length();
199
	int strLen = string.length();
(-)src/org/eclipse/draw2d/text/TextFlow.java (-2 / +2 lines)
Lines 632-638 Link Here
632
 * calculations.
632
 * calculations.
633
 * 
633
 * 
634
 * @return a <code>FlowUtilities</code> instance
634
 * @return a <code>FlowUtilities</code> instance
635
 * @since 3.2
635
 * @since 3.4
636
 */
636
 */
637
protected FlowUtilities getFlowUtilities() {
637
protected FlowUtilities getFlowUtilities() {
638
    return FlowUtilities.INSTANCE;
638
    return FlowUtilities.INSTANCE;
Lines 643-649 Link Here
643
 * calculations.
643
 * calculations.
644
 * 
644
 * 
645
 * @return a <code>TextUtilities</code> instance
645
 * @return a <code>TextUtilities</code> instance
646
 * @since 3.2
646
 * @since 3.4
647
 */
647
 */
648
protected TextUtilities getTextUtilities() {
648
protected TextUtilities getTextUtilities() {
649
    return TextUtilities.INSTANCE;
649
    return TextUtilities.INSTANCE;
(-)src/org/eclipse/draw2d/Label.java (-1 / +1 lines)
Lines 659-665 Link Here
659
 * calculations.
659
 * calculations.
660
 * 
660
 * 
661
 * @return a <code>TextUtilities</code> instance
661
 * @return a <code>TextUtilities</code> instance
662
 * @since 3.2
662
 * @since 3.4
663
 */
663
 */
664
public TextUtilities getTextUtilities() {
664
public TextUtilities getTextUtilities() {
665
    return TextUtilities.INSTANCE;
665
    return TextUtilities.INSTANCE;

Return to bug 194278