/** * Adds the specified column index to the last column group. * In case there are no groups, a new group will be created. * * @param columnIndex the column index to be set grouped */ public void addGroupedColumn(int columnIndex) { int[][] newColGroups = getColumnGroups(); // Create a group if none exists. if (newColGroups.length == 0) { newColGroups = new int[][]{{columnIndex}}; } else { int lastGroupIndex = newColGroups.length-1; int[] lastGroup = newColGroups[lastGroupIndex]; int groupSize = lastGroup.length; int[] newLastGroup = new int[groupSize+1]; System.arraycopy(lastGroup, 0, newLastGroup, 0, groupSize); newLastGroup[groupSize] = columnIndex; newColGroups[lastGroupIndex] = newLastGroup; } setColumnGroups(newColGroups); }
/** * Adds the specified column index to the last column group. * In case there are no groups, a new group will be created. * * @param columnIndex the column index to be set grouped */ public void addGroupedColumn(int columnIndex) { int[][] newColGroups = getColumnGroups(); // Create a group if none exists. if (newColGroups.length == 0) { newColGroups = new int[][]{{columnIndex}}; } else { int lastGroupIndex = newColGroups.length-1; int[] lastGroup = newColGroups[lastGroupIndex]; int groupSize = lastGroup.length; int[] newLastGroup = new int[groupSize+1]; System.arraycopy(lastGroup, 0, newLastGroup, 0, groupSize); newLastGroup[groupSize] = columnIndex; newColGroups[lastGroupIndex] = newLastGroup; } setColumnGroups(newColGroups); }
/** * Adds the specified column index to the last column group. In case there * are no groups, a new group will be created. * * @param columnIndex * the column index to be set grouped */ public void addGroupedColumn(int columnIndex) { int[][] newColGroups = getColumnGroups(); // Create a group if none exists. if (newColGroups.length == 0) { newColGroups = new int[][] { { columnIndex } }; } else { int lastGroupIndex = newColGroups.length - 1; int[] lastGroup = newColGroups[lastGroupIndex]; int groupSize = lastGroup.length; int[] newLastGroup = new int[groupSize + 1]; System.arraycopy(lastGroup, 0, newLastGroup, 0, groupSize); newLastGroup[groupSize] = columnIndex; newColGroups[lastGroupIndex] = newLastGroup; } setColumnGroups(newColGroups); }
public ColorListEditorPanelBuilder(List<Color> colors) { super(); this.colors = new ArrayList<>(); panel = new JPanel(); panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); formlayout = new FormLayout( "FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:108DLU:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE", ""); cc = new CellConstraints(); formlayout.setColumnGroups(new int[][] { { 5, 7, 9, 11 } }); panel.setLayout(formlayout); buttons = new ArrayList<>(); this.colors.clear(); this.colors.addAll(colors); addAddColorButton(); addColorButtons(); }
FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,}); fl_contentPanel.setColumnGroups(new int[][]{new int[]{4, 2}}); contentPanel.setLayout(fl_contentPanel);
@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)); } }
FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,}); fl_whateverPanel.setColumnGroups(new int[][]{new int[]{4, 6, 8, 10}}); whateverPanel.setLayout(fl_whateverPanel); FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,}); fl_feederPanel.setColumnGroups(new int[][]{new int[]{4, 6, 8, 10}}); feederPanel.setLayout(fl_feederPanel);
/** * Sets the column groups for this form. This call is ignored if the group * contains columns that are invalid. * * @param groups * the column groups to set for this form. */ public void setColumnGroups(FormGroupSet groups) { if (groups != null) { int[][] grp_idxs = groups.toArray(); for (int index = 0; index < grp_idxs.length; index++) { int[] col_grp = grp_idxs[index]; for (int colidx = 0; colidx < col_grp.length; colidx++) { int col = col_grp[colidx]; if (col < 1 || col > getColumnCount()) { FormUtils.safeAssert(false); return; } } } m_formlayout.setColumnGroups(grp_idxs); m_col_groups = groups; fireGridEvent(new GridViewEvent(this, GridViewEvent.COLUMN_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; }