javax.swing.SizeRequirements Java Examples
The following examples show how to use
javax.swing.SizeRequirements.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BlockView.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * 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; }
Example #2
Source File: TableView.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@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; }
Example #3
Source File: BlockView.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * 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); } }
Example #4
Source File: BlockView.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * 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); } }
Example #5
Source File: TableView.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * 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(); }
Example #6
Source File: ParagraphView.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * 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; }
Example #7
Source File: TableView.java From JDKSourceCode1.8 with MIT License | 5 votes |
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; }
Example #8
Source File: TableView.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * 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(); }
Example #9
Source File: ParagraphView.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@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; }
Example #10
Source File: TableView.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * 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); }
Example #11
Source File: ParagraphView.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * 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; }
Example #12
Source File: TableView.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@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; }
Example #13
Source File: TableView.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
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; }
Example #14
Source File: ParagraphView.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * 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; }
Example #15
Source File: TableView.java From Java8CN with Apache License 2.0 | 5 votes |
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; }
Example #16
Source File: TableView.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * 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(); }
Example #17
Source File: TableView.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * 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(); }
Example #18
Source File: TableView.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * 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); }
Example #19
Source File: TableView.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * 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); }
Example #20
Source File: BlockView.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * 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); } }
Example #21
Source File: TableView.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * 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(); }
Example #22
Source File: TableView.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * 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); }
Example #23
Source File: ParagraphView.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * 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; }
Example #24
Source File: ParagraphView.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * 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; }
Example #25
Source File: TableView.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
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; }
Example #26
Source File: TableView.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * 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(); }
Example #27
Source File: ParagraphView.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * 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; }
Example #28
Source File: ParagraphView.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@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; }
Example #29
Source File: ParagraphView.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@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; }
Example #30
Source File: TableView.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * 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); }