Here you can find the source of convertSpanToSparseGrid(final int curIx, final int span, final TreeSet
Parameter | Description |
---|---|
span | The span un the uncompressed grid. <code>LayoutUtil.INF</code> will be interpreted to span the rest of the column/row excluding the surrounding docking components. |
indexes | The indexes in the correct dimension. |
private static int convertSpanToSparseGrid(final int curIx, final int span, final TreeSet<Integer> indexes)
//package com.java2s; import java.util.TreeSet; public class Main { /**/*from ww w. j a va 2 s . co m*/ * Spanning is specified in the uncompressed grid number. They can for instance be more than 60000 for the outer * edge dock grid cells. When the grid is compressed and indexed after only the cells that area occupied the span * is erratic. This method use the row/col indexes and corrects the span to be correct for the compressed grid. * * @param span The span un the uncompressed grid. <code>LayoutUtil.INF</code> will be interpreted to span the rest * of the column/row excluding the surrounding docking components. * @param indexes The indexes in the correct dimension. * @return The converted span. */ private static int convertSpanToSparseGrid(final int curIx, final int span, final TreeSet<Integer> indexes) { final int lastIx = curIx + span; int retSpan = 1; for (final Integer ix : indexes) { if (ix <= curIx) { continue; // We have not arrived to the correct index yet } if (ix >= lastIx) { break; } retSpan++; } return retSpan; } }