|
1 | | -package com.codename1.ui.layouts.mig; |
2 | | - |
3 | | -import com.codename1.compat.java.util.Objects; |
4 | | -import com.codename1.ui.Display; |
5 | | - |
6 | | -import java.util.ArrayList; |
7 | | -import java.util.Arrays; |
8 | | -import java.util.Collection; |
9 | | -import java.util.HashMap; |
10 | | -import java.util.Iterator; |
11 | | -import java.util.LinkedHashMap; |
12 | | -import java.util.Map; |
13 | | -import java.util.TreeSet; |
14 | 1 | /* |
15 | 2 | * License (BSD): |
16 | 3 | * ============== |
|
45 | 32 | * Date: 2006-sep-08 |
46 | 33 | */ |
47 | 34 |
|
| 35 | +package com.codename1.ui.layouts.mig; |
| 36 | + |
| 37 | +import com.codename1.compat.java.util.Objects; |
| 38 | +import com.codename1.ui.Display; |
| 39 | + |
| 40 | +import java.util.ArrayList; |
| 41 | +import java.util.Arrays; |
| 42 | +import java.util.Collection; |
| 43 | +import java.util.HashMap; |
| 44 | +import java.util.Iterator; |
| 45 | +import java.util.LinkedHashMap; |
| 46 | +import java.util.Map; |
| 47 | +import java.util.TreeSet; |
| 48 | + |
48 | 49 | /** |
49 | 50 | * Holds components in a grid. Does most of the logic behind the layout manager. |
50 | 51 | */ |
@@ -197,12 +198,12 @@ public Grid(ContainerWrapper container, LC lc, AC rowConstr, AC colConstr, Map<? |
197 | 198 | continue; // The "external" component should not be handled further. |
198 | 199 | } |
199 | 200 |
|
200 | | - String sgX = rootCc.getHorizontal().getSizeGroup(); |
201 | | - if (sgX != null) { |
| 201 | + String sgX = rootCc.getHorizontal().getSizeGroup(); |
| 202 | + if (sgX != null) { |
202 | 203 | sizeGroupsX++; |
203 | 204 | } |
204 | | - String sgY = rootCc.getVertical().getSizeGroup(); |
205 | | - if (sgY != null) { |
| 205 | + String sgY = rootCc.getVertical().getSizeGroup(); |
| 206 | + if (sgY != null) { |
206 | 207 | sizeGroupsY++; |
207 | 208 | } |
208 | 209 |
|
@@ -256,7 +257,7 @@ public Grid(ContainerWrapper container, LC lc, AC rowConstr, AC colConstr, Map<? |
256 | 257 | } |
257 | 258 | } |
258 | 259 | } else { |
259 | | - if (cx >= 0 || cy >= 0) { |
| 260 | + if (cx >= 0 && cy >= 0) { |
260 | 261 | if (cy >= 0) { |
261 | 262 | cellXY[0] = cx; |
262 | 263 | cellXY[1] = cy; |
@@ -290,7 +291,7 @@ public Grid(ContainerWrapper container, LC lc, AC rowConstr, AC colConstr, Map<? |
290 | 291 | setCell(cellXY[1], cellXY[0], cell); |
291 | 292 |
|
292 | 293 | // Add a rectangle so we can know that spanned cells occupy more space. |
293 | | - if (spanx != 1 || spany != 1) { |
| 294 | + if (spanx > 1 || spany > 1) { |
294 | 295 | spannedRects.add(new int[]{cellXY[0], cellXY[1], spanx, spany}); |
295 | 296 | } |
296 | 297 | } |
@@ -1061,13 +1062,13 @@ private static synchronized void saveGrid(ComponentWrapper parComp, LinkedHashMa |
1061 | 1062 |
|
1062 | 1063 | ArrayList<WeakCell> weakCells = new ArrayList<WeakCell>(grid.size()); |
1063 | 1064 |
|
1064 | | - for (Map.Entry<Integer, Cell> entry : grid.entrySet()) { |
1065 | | - Integer xyInt = entry.getKey(); |
1066 | | - Cell cell = entry.getValue(); |
1067 | | - if (xyInt != null) { |
1068 | | - int x = xyInt & 0x0000ffff; |
1069 | | - int y = xyInt >> 16; |
1070 | | - |
| 1065 | + for (Map.Entry<Integer, Cell> entry : grid.entrySet()) { |
| 1066 | + Integer xyInt = entry.getKey(); |
| 1067 | + Cell cell = entry.getValue(); |
| 1068 | + if (xyInt != null) { |
| 1069 | + int x = xyInt & 0x0000ffff; |
| 1070 | + int y = xyInt >> 16; |
| 1071 | + |
1071 | 1072 | for (CompWrap cw : cell.compWraps) { |
1072 | 1073 | weakCells.add(new WeakCell(cw.comp.getComponent(), x, y, cell.spanx, cell.spany)); |
1073 | 1074 | } |
@@ -1501,11 +1502,11 @@ private void clearGroupLinkBounds() { |
1501 | 1502 | return; |
1502 | 1503 | } |
1503 | 1504 |
|
1504 | | - for (Map.Entry<String, Boolean> entry : linkTargetIDs.entrySet()) { |
1505 | | - if (Boolean.TRUE.equals(entry.getValue())) { |
1506 | | - LinkHandler.clearBounds(container.getLayout(), entry.getKey()); |
1507 | | - } |
1508 | | - } |
| 1505 | + for (Map.Entry<String, Boolean> entry : linkTargetIDs.entrySet()) { |
| 1506 | + if (Boolean.TRUE.equals(entry.getValue())) { |
| 1507 | + LinkHandler.clearBounds(container.getLayout(), entry.getKey()); |
| 1508 | + } |
| 1509 | + } |
1509 | 1510 | } |
1510 | 1511 |
|
1511 | 1512 | private void resetLinkValues(boolean parentSize, boolean compLinks) { |
@@ -1620,8 +1621,8 @@ private int[] getAbsoluteDimBounds(CompWrap cw, int refSize, boolean isHor) { |
1620 | 1621 |
|
1621 | 1622 | // If absolute, use those coordinates instead. |
1622 | 1623 | if (pos != null) { |
1623 | | - UnitValue stUV = pos[isHor ? 0 : 1]; |
1624 | | - UnitValue endUV = pos[isHor ? 2 : 3]; |
| 1624 | + UnitValue stUV = pos[isHor ? 0 : 1]; |
| 1625 | + UnitValue endUV = pos[isHor ? 2 : 3]; |
1625 | 1626 |
|
1626 | 1627 | int minSz = cw.getSize(LayoutUtil.MIN, isHor); |
1627 | 1628 | int maxSz = cw.getSize(LayoutUtil.MAX, isHor); |
|
0 commit comments