/** Adds a docking cell. That cell is outside the normal cell indexes. * @param dockInsets The current dock insets. Will be updated! * @param side top == 0, left == 1, bottom = 2, right = 3. * @param cw The compwrap to put in a cell and add. */ private void addDockingCell(int[] dockInsets, int side, CompWrap cw) { int r, c, spanx = 1, spany = 1; switch (side) { case 0: case 2: r = side == 0 ? dockInsets[0]++ : dockInsets[2]--; c = dockInsets[1]; spanx = dockInsets[3] - dockInsets[1] + 1; // The +1 is for cell 0. colIndexes.add(dockInsets[3]); // Make sure there is a receiving cell break; case 1: case 3: c = side == 1 ? dockInsets[1]++ : dockInsets[3]--; r = dockInsets[0]; spany = dockInsets[2] - dockInsets[0] + 1; // The +1 is for cell 0. rowIndexes.add(dockInsets[2]); // Make sure there is a receiving cell break; default: throw new IllegalArgumentException("Internal error 123."); } rowIndexes.add(r); colIndexes.add(c); grid.put((r << 16) + (c & 0xffff), new Cell(cw, spanx, spany, spanx > 1)); }
Cell cell = grid.get(null); if (cell == null) { grid.put(null, new Cell(cw)); } else { cell.compWraps.add(cw); int spany = Math.min(!isRowInGridMode && !lc.isFlowX() ? LayoutUtil.INF : rootCc.getSpanY(), MAX_GRID - cellXY[1]); cell = new Cell(spanx, spany, cellFlowX != null ? cellFlowX : lc.isFlowX());