类javax.swing.SizeRequirements源码实例Demo

下面列出了怎么用javax.swing.SizeRequirements的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: TencentKona-8   文件: BlockView.java
/**
 * Adjust the given requirements to the CSS width or height if
 * it is specified along the applicable axis.  Return true if the
 * size is exactly specified, false if the span is not specified
 * in an attribute or the size specified is a percentage.
 */
static boolean spanSetFromAttributes(int axis, SizeRequirements r,
                                     CSS.LengthValue cssWidth,
                                     CSS.LengthValue cssHeight) {
    if (axis == X_AXIS) {
        if ((cssWidth != null) && (! cssWidth.isPercentage())) {
            r.minimum = r.preferred = r.maximum = (int) cssWidth.getValue();
            return true;
        }
    } else {
        if ((cssHeight != null) && (! cssHeight.isPercentage())) {
            r.minimum = r.preferred = r.maximum = (int) cssHeight.getValue();
            return true;
        }
    }
    return false;
}
 
源代码2 项目: jdk1.8-source-analysis   文件: ParagraphView.java
/**
 * Calculate the needs for the paragraph along the minor axis.
 *
 * <p>This uses size requirements of the superclass, modified to take into
 * account the non-breakable areas at the adjacent views edges.  The minimal
 * size requirements for such views should be no less than the sum of all
 * adjacent fragments.</p>
 *
 * <p>If the {@code axis} parameter is neither {@code View.X_AXIS} nor
 * {@code View.Y_AXIS}, {@link IllegalArgumentException} is thrown.  If the
 * {@code r} parameter is {@code null,} a new {@code SizeRequirements}
 * object is created, otherwise the supplied {@code SizeRequirements}
 * object is returned.</p>
 *
 * @param axis  the minor axis
 * @param r     the input {@code SizeRequirements} object
 * @return      the new or adjusted {@code SizeRequirements} object
 * @throws IllegalArgumentException  if the {@code axis} parameter is invalid
 */
@Override
protected SizeRequirements calculateMinorAxisRequirements(int axis,
                                                    SizeRequirements r) {
    r = super.calculateMinorAxisRequirements(axis, r);

    float min = 0;
    float glue = 0;
    int n = getLayoutViewCount();
    for (int i = 0; i < n; i++) {
        View v = getLayoutView(i);
        float span = v.getMinimumSpan(axis);
        if (v.getBreakWeight(axis, 0, v.getMaximumSpan(axis)) > View.BadBreakWeight) {
            // find the longest non-breakable fragments at the view edges
            int p0 = v.getStartOffset();
            int p1 = v.getEndOffset();
            float start = findEdgeSpan(v, axis, p0, p0, p1);
            float end = findEdgeSpan(v, axis, p1, p0, p1);
            glue += start;
            min = Math.max(min, Math.max(span, glue));
            glue = end;
        } else {
            // non-breakable view
            glue += span;
            min = Math.max(min, glue);
        }
    }
    r.minimum = Math.max(r.minimum, (int) min);
    r.preferred = Math.max(r.minimum, r.preferred);
    r.maximum = Math.max(r.preferred, r.maximum);

    return r;
}
 
源代码3 项目: jdk1.8-source-analysis   文件: ParagraphView.java
@Override
protected SizeRequirements calculateMajorAxisRequirements(int axis,
        SizeRequirements r) {
    int oldJustficationData[] = justificationData;
    justificationData = null;
    SizeRequirements ret = super.calculateMajorAxisRequirements(axis, r);
    if (isJustifyEnabled()) {
        justificationData = oldJustficationData;
    }
    return ret;
}
 
源代码4 项目: jdk1.8-source-analysis   文件: TableView.java
/**
 * check the requirements of a table cell that spans a single column.
 */
void checkSingleColumnCell(int axis, int col, View v) {
    SizeRequirements req = columnRequirements[col];
    req.minimum = Math.max((int) v.getMinimumSpan(axis), req.minimum);
    req.preferred = Math.max((int) v.getPreferredSpan(axis), req.preferred);
    req.maximum = Math.max((int) v.getMaximumSpan(axis), req.maximum);
}
 
源代码5 项目: jdk1.8-source-analysis   文件: BlockView.java
/**
 * Constrains <code>want</code> to fit in the minimum size specified
 * by <code>min</code>.
 */
private void constrainSize(int axis, SizeRequirements want,
                           SizeRequirements min) {
    if (min.minimum > want.minimum) {
        want.minimum = want.preferred = min.minimum;
        want.maximum = Math.max(want.maximum, min.maximum);
    }
}
 
源代码6 项目: jdk1.8-source-analysis   文件: TableView.java
/**
 * Constructs a TableView for the given element.
 *
 * @param elem the element that this view is responsible for
 */
public TableView(Element elem) {
    super(elem, View.Y_AXIS);
    rows = new Vector<RowView>();
    gridValid = false;
    captionIndex = -1;
    totalColumnRequirements = new SizeRequirements();
}
 
源代码7 项目: jdk1.8-source-analysis   文件: TableView.java
protected SizeRequirements calculateMajorAxisRequirements(int axis, SizeRequirements r) {
    SizeRequirements req = new SizeRequirements();
    req.minimum = totalColumnRequirements.minimum;
    req.maximum = totalColumnRequirements.maximum;
    req.preferred = totalColumnRequirements.preferred;
    req.alignment = 0f;
    return req;
}
 
源代码8 项目: jdk1.8-source-analysis   文件: TableView.java
@Override
protected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements r) {
    SizeRequirements rv = super.calculateMinorAxisRequirements(axis, r);
    //for the cell the minimum should be derived from the child views
    //the parent behaviour is to use CSS for that
    int n = getViewCount();
    int min = 0;
    for (int i = 0; i < n; i++) {
        View v = getView(i);
        min = Math.max((int) v.getMinimumSpan(axis), min);
    }
    rv.minimum = Math.min(rv.minimum, min);
    return rv;
}
 
源代码9 项目: dragonwell8_jdk   文件: ParagraphView.java
/**
 * Calculate the needs for the paragraph along the minor axis.
 *
 * <p>This uses size requirements of the superclass, modified to take into
 * account the non-breakable areas at the adjacent views edges.  The minimal
 * size requirements for such views should be no less than the sum of all
 * adjacent fragments.</p>
 *
 * <p>If the {@code axis} parameter is neither {@code View.X_AXIS} nor
 * {@code View.Y_AXIS}, {@link IllegalArgumentException} is thrown.  If the
 * {@code r} parameter is {@code null,} a new {@code SizeRequirements}
 * object is created, otherwise the supplied {@code SizeRequirements}
 * object is returned.</p>
 *
 * @param axis  the minor axis
 * @param r     the input {@code SizeRequirements} object
 * @return      the new or adjusted {@code SizeRequirements} object
 * @throws IllegalArgumentException  if the {@code axis} parameter is invalid
 */
@Override
protected SizeRequirements calculateMinorAxisRequirements(int axis,
                                                    SizeRequirements r) {
    r = super.calculateMinorAxisRequirements(axis, r);

    float min = 0;
    float glue = 0;
    int n = getLayoutViewCount();
    for (int i = 0; i < n; i++) {
        View v = getLayoutView(i);
        float span = v.getMinimumSpan(axis);
        if (v.getBreakWeight(axis, 0, v.getMaximumSpan(axis)) > View.BadBreakWeight) {
            // find the longest non-breakable fragments at the view edges
            int p0 = v.getStartOffset();
            int p1 = v.getEndOffset();
            float start = findEdgeSpan(v, axis, p0, p0, p1);
            float end = findEdgeSpan(v, axis, p1, p0, p1);
            glue += start;
            min = Math.max(min, Math.max(span, glue));
            glue = end;
        } else {
            // non-breakable view
            glue += span;
            min = Math.max(min, glue);
        }
    }
    r.minimum = Math.max(r.minimum, (int) min);
    r.preferred = Math.max(r.minimum, r.preferred);
    r.maximum = Math.max(r.preferred, r.maximum);

    return r;
}
 
源代码10 项目: jdk8u-dev-jdk   文件: TableView.java
protected SizeRequirements calculateMajorAxisRequirements(int axis, SizeRequirements r) {
    SizeRequirements req = new SizeRequirements();
    req.minimum = totalColumnRequirements.minimum;
    req.maximum = totalColumnRequirements.maximum;
    req.preferred = totalColumnRequirements.preferred;
    req.alignment = 0f;
    return req;
}
 
源代码11 项目: dragonwell8_jdk   文件: BlockView.java
/**
 * Constrains <code>want</code> to fit in the minimum size specified
 * by <code>min</code>.
 */
private void constrainSize(int axis, SizeRequirements want,
                           SizeRequirements min) {
    if (min.minimum > want.minimum) {
        want.minimum = want.preferred = min.minimum;
        want.maximum = Math.max(want.maximum, min.maximum);
    }
}
 
源代码12 项目: dragonwell8_jdk   文件: TableView.java
/**
 * Constructs a TableView for the given element.
 *
 * @param elem the element that this view is responsible for
 */
public TableView(Element elem) {
    super(elem, View.Y_AXIS);
    rows = new Vector<RowView>();
    gridValid = false;
    captionIndex = -1;
    totalColumnRequirements = new SizeRequirements();
}
 
源代码13 项目: Bytecoder   文件: TableView.java
/**
 * Constructs a TableView for the given element.
 *
 * @param elem the element that this view is responsible for
 */
public TableView(Element elem) {
    super(elem, View.Y_AXIS);
    rows = new Vector<RowView>();
    gridValid = false;
    captionIndex = -1;
    totalColumnRequirements = new SizeRequirements();
}
 
源代码14 项目: openjdk-jdk8u-backup   文件: TableView.java
/**
 * check the requirements of a table cell that spans a single column.
 */
void checkSingleColumnCell(int axis, int col, View v) {
    SizeRequirements req = columnRequirements[col];
    req.minimum = Math.max((int) v.getMinimumSpan(axis), req.minimum);
    req.preferred = Math.max((int) v.getPreferredSpan(axis), req.preferred);
    req.maximum = Math.max((int) v.getMaximumSpan(axis), req.maximum);
}
 
源代码15 项目: TencentKona-8   文件: ParagraphView.java
/**
 * Calculate the needs for the paragraph along the minor axis.
 *
 * <p>This uses size requirements of the superclass, modified to take into
 * account the non-breakable areas at the adjacent views edges.  The minimal
 * size requirements for such views should be no less than the sum of all
 * adjacent fragments.</p>
 *
 * <p>If the {@code axis} parameter is neither {@code View.X_AXIS} nor
 * {@code View.Y_AXIS}, {@link IllegalArgumentException} is thrown.  If the
 * {@code r} parameter is {@code null,} a new {@code SizeRequirements}
 * object is created, otherwise the supplied {@code SizeRequirements}
 * object is returned.</p>
 *
 * @param axis  the minor axis
 * @param r     the input {@code SizeRequirements} object
 * @return      the new or adjusted {@code SizeRequirements} object
 * @throws IllegalArgumentException  if the {@code axis} parameter is invalid
 */
@Override
protected SizeRequirements calculateMinorAxisRequirements(int axis,
                                                    SizeRequirements r) {
    r = super.calculateMinorAxisRequirements(axis, r);

    float min = 0;
    float glue = 0;
    int n = getLayoutViewCount();
    for (int i = 0; i < n; i++) {
        View v = getLayoutView(i);
        float span = v.getMinimumSpan(axis);
        if (v.getBreakWeight(axis, 0, v.getMaximumSpan(axis)) > View.BadBreakWeight) {
            // find the longest non-breakable fragments at the view edges
            int p0 = v.getStartOffset();
            int p1 = v.getEndOffset();
            float start = findEdgeSpan(v, axis, p0, p0, p1);
            float end = findEdgeSpan(v, axis, p1, p0, p1);
            glue += start;
            min = Math.max(min, Math.max(span, glue));
            glue = end;
        } else {
            // non-breakable view
            glue += span;
            min = Math.max(min, glue);
        }
    }
    r.minimum = Math.max(r.minimum, (int) min);
    r.preferred = Math.max(r.minimum, r.preferred);
    r.maximum = Math.max(r.preferred, r.maximum);

    return r;
}
 
源代码16 项目: Java8CN   文件: TableView.java
protected SizeRequirements calculateMajorAxisRequirements(int axis, SizeRequirements r) {
    SizeRequirements req = new SizeRequirements();
    req.minimum = totalColumnRequirements.minimum;
    req.maximum = totalColumnRequirements.maximum;
    req.preferred = totalColumnRequirements.preferred;
    req.alignment = 0f;
    return req;
}
 
源代码17 项目: jdk8u-jdk   文件: TableView.java
/**
 * Constructs a TableView for the given element.
 *
 * @param elem the element that this view is responsible for
 */
public TableView(Element elem) {
    super(elem, View.Y_AXIS);
    rows = new Vector<RowView>();
    gridValid = false;
    captionIndex = -1;
    totalColumnRequirements = new SizeRequirements();
}
 
源代码18 项目: openjdk-jdk9   文件: TableView.java
@Override
protected SizeRequirements calculateMajorAxisRequirements(int axis, SizeRequirements r) {
    SizeRequirements req = new SizeRequirements();
    req.minimum = totalColumnRequirements.minimum;
    req.maximum = totalColumnRequirements.maximum;
    req.preferred = totalColumnRequirements.preferred;
    req.alignment = 0f;
    return req;
}
 
源代码19 项目: TencentKona-8   文件: TableView.java
/**
 * check the requirements of a table cell that spans a single column.
 */
void checkSingleColumnCell(int axis, int col, View v) {
    SizeRequirements req = columnRequirements[col];
    req.minimum = Math.max((int) v.getMinimumSpan(axis), req.minimum);
    req.preferred = Math.max((int) v.getPreferredSpan(axis), req.preferred);
    req.maximum = Math.max((int) v.getMaximumSpan(axis), req.maximum);
}
 
源代码20 项目: openjdk-8-source   文件: TableView.java
/**
 * check the requirements of a table cell that spans a single column.
 */
void checkSingleColumnCell(int axis, int col, View v) {
    SizeRequirements req = columnRequirements[col];
    req.minimum = Math.max((int) v.getMinimumSpan(axis), req.minimum);
    req.preferred = Math.max((int) v.getPreferredSpan(axis), req.preferred);
    req.maximum = Math.max((int) v.getMaximumSpan(axis), req.maximum);
}
 
源代码21 项目: TencentKona-8   文件: BlockView.java
/**
 * Constrains <code>want</code> to fit in the minimum size specified
 * by <code>min</code>.
 */
private void constrainSize(int axis, SizeRequirements want,
                           SizeRequirements min) {
    if (min.minimum > want.minimum) {
        want.minimum = want.preferred = min.minimum;
        want.maximum = Math.max(want.maximum, min.maximum);
    }
}
 
源代码22 项目: TencentKona-8   文件: TableView.java
/**
 * Constructs a TableView for the given element.
 *
 * @param elem the element that this view is responsible for
 */
public TableView(Element elem) {
    super(elem, View.Y_AXIS);
    rows = new Vector<RowView>();
    gridValid = false;
    captionIndex = -1;
    totalColumnRequirements = new SizeRequirements();
}
 
源代码23 项目: TencentKona-8   文件: TableView.java
protected SizeRequirements calculateMajorAxisRequirements(int axis, SizeRequirements r) {
    SizeRequirements req = new SizeRequirements();
    req.minimum = totalColumnRequirements.minimum;
    req.maximum = totalColumnRequirements.maximum;
    req.preferred = totalColumnRequirements.preferred;
    req.alignment = 0f;
    return req;
}
 
源代码24 项目: jdk8u60   文件: ParagraphView.java
/**
 * Calculate the needs for the paragraph along the minor axis.
 *
 * <p>This uses size requirements of the superclass, modified to take into
 * account the non-breakable areas at the adjacent views edges.  The minimal
 * size requirements for such views should be no less than the sum of all
 * adjacent fragments.</p>
 *
 * <p>If the {@code axis} parameter is neither {@code View.X_AXIS} nor
 * {@code View.Y_AXIS}, {@link IllegalArgumentException} is thrown.  If the
 * {@code r} parameter is {@code null,} a new {@code SizeRequirements}
 * object is created, otherwise the supplied {@code SizeRequirements}
 * object is returned.</p>
 *
 * @param axis  the minor axis
 * @param r     the input {@code SizeRequirements} object
 * @return      the new or adjusted {@code SizeRequirements} object
 * @throws IllegalArgumentException  if the {@code axis} parameter is invalid
 */
@Override
protected SizeRequirements calculateMinorAxisRequirements(int axis,
                                                    SizeRequirements r) {
    r = super.calculateMinorAxisRequirements(axis, r);

    float min = 0;
    float glue = 0;
    int n = getLayoutViewCount();
    for (int i = 0; i < n; i++) {
        View v = getLayoutView(i);
        float span = v.getMinimumSpan(axis);
        if (v.getBreakWeight(axis, 0, v.getMaximumSpan(axis)) > View.BadBreakWeight) {
            // find the longest non-breakable fragments at the view edges
            int p0 = v.getStartOffset();
            int p1 = v.getEndOffset();
            float start = findEdgeSpan(v, axis, p0, p0, p1);
            float end = findEdgeSpan(v, axis, p1, p0, p1);
            glue += start;
            min = Math.max(min, Math.max(span, glue));
            glue = end;
        } else {
            // non-breakable view
            glue += span;
            min = Math.max(min, glue);
        }
    }
    r.minimum = Math.max(r.minimum, (int) min);
    r.preferred = Math.max(r.minimum, r.preferred);
    r.maximum = Math.max(r.preferred, r.maximum);

    return r;
}
 
源代码25 项目: jdk8u60   文件: ParagraphView.java
@Override
protected SizeRequirements calculateMajorAxisRequirements(int axis,
        SizeRequirements r) {
    int oldJustficationData[] = justificationData;
    justificationData = null;
    SizeRequirements ret = super.calculateMajorAxisRequirements(axis, r);
    if (isJustifyEnabled()) {
        justificationData = oldJustficationData;
    }
    return ret;
}
 
源代码26 项目: jdk8u60   文件: TableView.java
/**
 * check the requirements of a table cell that spans a single column.
 */
void checkSingleColumnCell(int axis, int col, View v) {
    SizeRequirements req = columnRequirements[col];
    req.minimum = Math.max((int) v.getMinimumSpan(axis), req.minimum);
    req.preferred = Math.max((int) v.getPreferredSpan(axis), req.preferred);
    req.maximum = Math.max((int) v.getMaximumSpan(axis), req.maximum);
}
 
源代码27 项目: jdk8u-jdk   文件: ParagraphView.java
@Override
protected SizeRequirements calculateMajorAxisRequirements(int axis,
        SizeRequirements r) {
    int oldJustficationData[] = justificationData;
    justificationData = null;
    SizeRequirements ret = super.calculateMajorAxisRequirements(axis, r);
    if (isJustifyEnabled()) {
        justificationData = oldJustficationData;
    }
    return ret;
}
 
源代码28 项目: jdk8u60   文件: TableView.java
/**
 * Constructs a TableView for the given element.
 *
 * @param elem the element that this view is responsible for
 */
public TableView(Element elem) {
    super(elem, View.Y_AXIS);
    rows = new Vector<RowView>();
    gridValid = false;
    captionIndex = -1;
    totalColumnRequirements = new SizeRequirements();
}
 
源代码29 项目: jdk8u-dev-jdk   文件: ParagraphView.java
/**
 * Calculate the needs for the paragraph along the minor axis.
 *
 * <p>This uses size requirements of the superclass, modified to take into
 * account the non-breakable areas at the adjacent views edges.  The minimal
 * size requirements for such views should be no less than the sum of all
 * adjacent fragments.</p>
 *
 * <p>If the {@code axis} parameter is neither {@code View.X_AXIS} nor
 * {@code View.Y_AXIS}, {@link IllegalArgumentException} is thrown.  If the
 * {@code r} parameter is {@code null,} a new {@code SizeRequirements}
 * object is created, otherwise the supplied {@code SizeRequirements}
 * object is returned.</p>
 *
 * @param axis  the minor axis
 * @param r     the input {@code SizeRequirements} object
 * @return      the new or adjusted {@code SizeRequirements} object
 * @throws IllegalArgumentException  if the {@code axis} parameter is invalid
 */
@Override
protected SizeRequirements calculateMinorAxisRequirements(int axis,
                                                    SizeRequirements r) {
    r = super.calculateMinorAxisRequirements(axis, r);

    float min = 0;
    float glue = 0;
    int n = getLayoutViewCount();
    for (int i = 0; i < n; i++) {
        View v = getLayoutView(i);
        float span = v.getMinimumSpan(axis);
        if (v.getBreakWeight(axis, 0, v.getMaximumSpan(axis)) > View.BadBreakWeight) {
            // find the longest non-breakable fragments at the view edges
            int p0 = v.getStartOffset();
            int p1 = v.getEndOffset();
            float start = findEdgeSpan(v, axis, p0, p0, p1);
            float end = findEdgeSpan(v, axis, p1, p0, p1);
            glue += start;
            min = Math.max(min, Math.max(span, glue));
            glue = end;
        } else {
            // non-breakable view
            glue += span;
            min = Math.max(min, glue);
        }
    }
    r.minimum = Math.max(r.minimum, (int) min);
    r.preferred = Math.max(r.minimum, r.preferred);
    r.maximum = Math.max(r.preferred, r.maximum);

    return r;
}
 
源代码30 项目: hottub   文件: TableView.java
/**
 * check the requirements of a table cell that spans a single column.
 */
void checkSingleColumnCell(int axis, int col, View v) {
    SizeRequirements req = columnRequirements[col];
    req.minimum = Math.max((int) v.getMinimumSpan(axis), req.minimum);
    req.preferred = Math.max((int) v.getPreferredSpan(axis), req.preferred);
    req.maximum = Math.max((int) v.getMaximumSpan(axis), req.maximum);
}
 
 类所在包
 同包方法