1079 px = 0;
1080 for (i = curY; i < (curY + curHeight); i++) {
1081 px = Math.max(px, xMaxArray[i]);
1082 }
1083
1084 curX = px - curX - 1;
1085 if(curX < 0)
1086 curX = 0;
1087 }
1088 else if (curY < 0) {
1089 py = 0;
1090 for (i = curX; i < (curX + curWidth); i++) {
1091 py = Math.max(py, yMaxArray[i]);
1092 }
1093 curY = py - curY - 1;
1094 if(curY < 0)
1095 curY = 0;
1096 }
1097
1098 /* Adjust the grid width and height
1099 * fix for 5005945: unneccessary loops removed
1100 */
1101 px = curX + curWidth;
1102 if (layoutWidth < px) {
1103 layoutWidth = px;
1104 }
1105 py = curY + curHeight;
1106 if (layoutHeight < py) {
1107 layoutHeight = py;
1108 }
1109
1110 /* Adjust xMaxArray and yMaxArray */
1111 for (i = curX; i < (curX + curWidth); i++) {
1112 yMaxArray[i] =py;
1113 }
1114 for (i = curY; i < (curY + curHeight); i++) {
1115 xMaxArray[i] = px;
1116 }
1117
1118
1119 /* Cache the current slave's size. */
1341 r.weightY = new double[maximumArrayXIndex];
1342 r.minWidth = new int[maximumArrayYIndex];
1343 r.minHeight = new int[maximumArrayXIndex];
1344
1345
1346 /*
1347 * Apply minimum row/column dimensions and weights
1348 */
1349 if (columnWidths != null)
1350 System.arraycopy(columnWidths, 0, r.minWidth, 0, columnWidths.length);
1351 if (rowHeights != null)
1352 System.arraycopy(rowHeights, 0, r.minHeight, 0, rowHeights.length);
1353 if (columnWeights != null)
1354 System.arraycopy(columnWeights, 0, r.weightX, 0, Math.min(r.weightX.length, columnWeights.length));
1355 if (rowWeights != null)
1356 System.arraycopy(rowWeights, 0, r.weightY, 0, Math.min(r.weightY.length, rowWeights.length));
1357
1358 /*
1359 * Pass #3
1360 *
1361 * Distribute the minimun widths and weights:
1362 */
1363
1364 nextSize = Integer.MAX_VALUE;
1365
1366 for (i = 1;
1367 i != Integer.MAX_VALUE;
1368 i = nextSize, nextSize = Integer.MAX_VALUE) {
1369 for (compindex = 0 ; compindex < components.length ; compindex++) {
1370 comp = components[compindex];
1371 if (!comp.isVisible())
1372 continue;
1373 constraints = lookupConstraints(comp);
1374
1375 if (constraints.tempWidth == i) {
1376 px = constraints.tempX + constraints.tempWidth; /* right column */
1377
1378 /*
1379 * Figure out if we should use this slave\'s weight. If the weight
1380 * is less than the total weight spanned by the width of the cell,
1381 * then discard the weight. Otherwise split the difference
1561 anchor == GridBagConstraints.BASELINE_TRAILING) {
1562 // Apply the padding to the component, then ask for the baseline.
1563 int w = size.width + constraints.ipadx;
1564 int h = size.height + constraints.ipady;
1565 constraints.ascent = c.getBaseline(w, h);
1566 if (constraints.ascent >= 0) {
1567 // Component has a baseline
1568 int baseline = constraints.ascent;
1569 // Adjust the ascent and descent to include the insets.
1570 constraints.descent = h - constraints.ascent +
1571 constraints.insets.bottom;
1572 constraints.ascent += constraints.insets.top;
1573 constraints.baselineResizeBehavior =
1574 c.getBaselineResizeBehavior();
1575 constraints.centerPadding = 0;
1576 if (constraints.baselineResizeBehavior == Component.
1577 BaselineResizeBehavior.CENTER_OFFSET) {
1578 // Component has a baseline resize behavior of
1579 // CENTER_OFFSET, calculate centerPadding and
1580 // centerOffset (see the description of
1581 // CENTER_OFFSET in the enum for detais on this
1582 // algorithm).
1583 int nextBaseline = c.getBaseline(w, h + 1);
1584 constraints.centerOffset = baseline - h / 2;
1585 if (h % 2 == 0) {
1586 if (baseline != nextBaseline) {
1587 constraints.centerPadding = 1;
1588 }
1589 }
1590 else if (baseline == nextBaseline){
1591 constraints.centerOffset--;
1592 constraints.centerPadding = 1;
1593 }
1594 }
1595 }
1596 return true;
1597 }
1598 else {
1599 constraints.ascent = -1;
1600 return false;
1601 }
|
1079 px = 0;
1080 for (i = curY; i < (curY + curHeight); i++) {
1081 px = Math.max(px, xMaxArray[i]);
1082 }
1083
1084 curX = px - curX - 1;
1085 if(curX < 0)
1086 curX = 0;
1087 }
1088 else if (curY < 0) {
1089 py = 0;
1090 for (i = curX; i < (curX + curWidth); i++) {
1091 py = Math.max(py, yMaxArray[i]);
1092 }
1093 curY = py - curY - 1;
1094 if(curY < 0)
1095 curY = 0;
1096 }
1097
1098 /* Adjust the grid width and height
1099 * fix for 5005945: unnecessary loops removed
1100 */
1101 px = curX + curWidth;
1102 if (layoutWidth < px) {
1103 layoutWidth = px;
1104 }
1105 py = curY + curHeight;
1106 if (layoutHeight < py) {
1107 layoutHeight = py;
1108 }
1109
1110 /* Adjust xMaxArray and yMaxArray */
1111 for (i = curX; i < (curX + curWidth); i++) {
1112 yMaxArray[i] =py;
1113 }
1114 for (i = curY; i < (curY + curHeight); i++) {
1115 xMaxArray[i] = px;
1116 }
1117
1118
1119 /* Cache the current slave's size. */
1341 r.weightY = new double[maximumArrayXIndex];
1342 r.minWidth = new int[maximumArrayYIndex];
1343 r.minHeight = new int[maximumArrayXIndex];
1344
1345
1346 /*
1347 * Apply minimum row/column dimensions and weights
1348 */
1349 if (columnWidths != null)
1350 System.arraycopy(columnWidths, 0, r.minWidth, 0, columnWidths.length);
1351 if (rowHeights != null)
1352 System.arraycopy(rowHeights, 0, r.minHeight, 0, rowHeights.length);
1353 if (columnWeights != null)
1354 System.arraycopy(columnWeights, 0, r.weightX, 0, Math.min(r.weightX.length, columnWeights.length));
1355 if (rowWeights != null)
1356 System.arraycopy(rowWeights, 0, r.weightY, 0, Math.min(r.weightY.length, rowWeights.length));
1357
1358 /*
1359 * Pass #3
1360 *
1361 * Distribute the minimum widths and weights:
1362 */
1363
1364 nextSize = Integer.MAX_VALUE;
1365
1366 for (i = 1;
1367 i != Integer.MAX_VALUE;
1368 i = nextSize, nextSize = Integer.MAX_VALUE) {
1369 for (compindex = 0 ; compindex < components.length ; compindex++) {
1370 comp = components[compindex];
1371 if (!comp.isVisible())
1372 continue;
1373 constraints = lookupConstraints(comp);
1374
1375 if (constraints.tempWidth == i) {
1376 px = constraints.tempX + constraints.tempWidth; /* right column */
1377
1378 /*
1379 * Figure out if we should use this slave\'s weight. If the weight
1380 * is less than the total weight spanned by the width of the cell,
1381 * then discard the weight. Otherwise split the difference
1561 anchor == GridBagConstraints.BASELINE_TRAILING) {
1562 // Apply the padding to the component, then ask for the baseline.
1563 int w = size.width + constraints.ipadx;
1564 int h = size.height + constraints.ipady;
1565 constraints.ascent = c.getBaseline(w, h);
1566 if (constraints.ascent >= 0) {
1567 // Component has a baseline
1568 int baseline = constraints.ascent;
1569 // Adjust the ascent and descent to include the insets.
1570 constraints.descent = h - constraints.ascent +
1571 constraints.insets.bottom;
1572 constraints.ascent += constraints.insets.top;
1573 constraints.baselineResizeBehavior =
1574 c.getBaselineResizeBehavior();
1575 constraints.centerPadding = 0;
1576 if (constraints.baselineResizeBehavior == Component.
1577 BaselineResizeBehavior.CENTER_OFFSET) {
1578 // Component has a baseline resize behavior of
1579 // CENTER_OFFSET, calculate centerPadding and
1580 // centerOffset (see the description of
1581 // CENTER_OFFSET in the enum for details on this
1582 // algorithm).
1583 int nextBaseline = c.getBaseline(w, h + 1);
1584 constraints.centerOffset = baseline - h / 2;
1585 if (h % 2 == 0) {
1586 if (baseline != nextBaseline) {
1587 constraints.centerPadding = 1;
1588 }
1589 }
1590 else if (baseline == nextBaseline){
1591 constraints.centerOffset--;
1592 constraints.centerPadding = 1;
1593 }
1594 }
1595 }
1596 return true;
1597 }
1598 else {
1599 constraints.ascent = -1;
1600 return false;
1601 }
|