boolean (final CaptionSelection selection) { FormLayout layout = (FormLayout) selection.getContainer().getLayout(); int[][] groups = selection.isRow() ? layout.getRowGroups() : layout.getColumnGroups(); final int[] indices = selection.getSelection(); for (int[] group : groups) { if (intersect(group, indices)) return true; } return false; }