/** * Adds the specified row index to the last row group. * In case there are no groups, a new group will be created. * * @param rowIndex the index of the row that should be grouped */ public void addGroupedRow(int rowIndex) { int[][] newRowGroups = getRowGroups(); // Create a group if none exists. if (newRowGroups.length == 0) { newRowGroups = new int[][]{{rowIndex}}; } else { int lastGroupIndex = newRowGroups.length-1; int[] lastGroup = newRowGroups[lastGroupIndex]; int groupSize = lastGroup.length; int[] newLastGroup = new int[groupSize+1]; System.arraycopy(lastGroup, 0, newLastGroup, 0, groupSize); newLastGroup[groupSize] = rowIndex; newRowGroups[lastGroupIndex] = newLastGroup; } setRowGroups(newRowGroups); }
/** * Adds the specified row index to the last row group. * In case there are no groups, a new group will be created. * * @param rowIndex the index of the row that should be grouped */ public void addGroupedRow(int rowIndex) { int[][] newRowGroups = getRowGroups(); // Create a group if none exists. if (newRowGroups.length == 0) { newRowGroups = new int[][]{{rowIndex}}; } else { int lastGroupIndex = newRowGroups.length-1; int[] lastGroup = newRowGroups[lastGroupIndex]; int groupSize = lastGroup.length; int[] newLastGroup = new int[groupSize+1]; System.arraycopy(lastGroup, 0, newLastGroup, 0, groupSize); newLastGroup[groupSize] = rowIndex; newRowGroups[lastGroupIndex] = newLastGroup; } setRowGroups(newRowGroups); }
/** * Adds the specified row index to the last row group. In case there are no * groups, a new group will be created. * * @param rowIndex * the index of the row that should be grouped */ public void addGroupedRow(int rowIndex) { int[][] newRowGroups = getRowGroups(); // Create a group if none exists. if (newRowGroups.length == 0) { newRowGroups = new int[][] { { rowIndex } }; } else { int lastGroupIndex = newRowGroups.length - 1; int[] lastGroup = newRowGroups[lastGroupIndex]; int groupSize = lastGroup.length; int[] newLastGroup = new int[groupSize + 1]; System.arraycopy(lastGroup, 0, newLastGroup, 0, groupSize); newLastGroup[groupSize] = rowIndex; newRowGroups[lastGroupIndex] = newLastGroup; } setRowGroups(newRowGroups); }
@Override public void init(JPanel panel) { FormLayout layout = new FormLayout(this.columnSpecs, this.rowSpecs); DefaultFormBuilder builder = new DefaultFormBuilder(layout, panel); if (this.defaultBorder) { builder.setDefaultDialogBorder(); } // Groups if (StringUtils.isNotBlank(this.columnGroups)) { layout.setColumnGroups(parseGroups(this.columnGroups)); } if (StringUtils.isNotBlank(this.rowGroups)) { layout.setRowGroups(parseGroups(this.rowGroups)); } }
/** * Sets the row groups for this form. This call is ignored if the group * contains rows that are invalid. * * @param groups * the row groups for this form. */ public void setRowGroups(FormGroupSet groups) { if (groups != null) { int[][] grp_idxs = groups.toArray(); for (int index = 0; index < grp_idxs.length; index++) { int[] row_grp = grp_idxs[index]; for (int rowidx = 0; rowidx < row_grp.length; rowidx++) { int row = row_grp[rowidx]; if (row < 1 || row > getRowCount()) { FormUtils.safeAssert(false); return; } } } m_formlayout.setRowGroups(grp_idxs); m_row_groups = groups; fireGridEvent(new GridViewEvent(this, GridViewEvent.ROW_GROUPS_CHANGED)); } }
private FormLayout createFormLayout(Element pElement) { String columns= pElement.getChildTextNormalize(SwingXMLBuilder.COLUMNS_ELEMENT); String rows = pElement.getChildTextNormalize(SwingXMLBuilder.ROWS_ELEMENT); if (rows == null) { rows = ""; // to support the builder better } FormLayout formLayout = new FormLayout(columns, rows); String columnGroups= pElement.getChildTextNormalize(SwingXMLBuilder.COLUMNGROUPS_ELEMENT); String rowGroups = pElement.getChildTextNormalize(SwingXMLBuilder.ROWGROUPS_ELEMENT); if (columnGroups != null) { formLayout.setColumnGroups(getGroups(columnGroups)); } if (rowGroups != null) { formLayout.setRowGroups(getGroups(rowGroups)); } return formLayout; }
CellConstraints cc = new CellConstraints(); layout.setRowGroups(rowGroups);