List of usage examples for com.jgoodies.forms.layout FormLayout setColumnGroups
public void setColumnGroups(int[][] groupOfIndices)
From source file:ch.fork.AdHocRailway.ui.PreferencesDialog.java
License:Open Source License
private void initGUI() { final FormLayout layout = new FormLayout("5dlu, pref, 10dlu, pref, 5dlu", "5dlu, pref, 3dlu, top:pref,3dlu, pref, 3dlu, top:pref, 3dlu, pref, 5dlu"); layout.setColumnGroups(new int[][] { { 2, 4 } }); final PanelBuilder builder = new PanelBuilder(layout); final CellConstraints cc = new CellConstraints(); builder.addSeparator("General", cc.xy(2, 2)); builder.add(createGUISettingsTab(), cc.xy(2, 4)); builder.addSeparator("Digital", cc.xy(4, 2)); builder.add(createDigitalDataTab(), cc.xy(4, 4)); builder.addSeparator("SRCP-Server", cc.xy(2, 6)); builder.add(createSrcpServerTab(), cc.xy(2, 8)); builder.addSeparator("AdHoc-Server", cc.xy(4, 6)); builder.add(createAdHocServerTab(), cc.xy(4, 8)); final JButton okButton = new JButton("OK", ImageTools.createImageIconFromIconSet("dialog-ok-apply.png")); okButton.addActionListener(new ApplyChangesAction()); final JButton cancelButton = new JButton("Cancel", ImageTools.createImageIconFromIconSet("dialog-cancel.png")); cancelPressed = false;//from w w w .j a va 2 s.c om cancelButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { cancelPressed = true; PreferencesDialog.this.setVisible(false); } }); builder.add(ButtonBarFactory.buildRightAlignedBar(okButton, cancelButton), cc.xyw(2, 10, 3)); add(builder.getPanel()); loadPreferences(); pack(); SwingUtils.addEscapeListener(this); setLocationRelativeTo(getParent()); setVisible(true); }
From source file:ch.fork.AdHocRailway.ui.routes.configuration.RoutesConfigurationDialog.java
License:Open Source License
private void buildPanel() { initComponents();/* w ww . j a v a2 s. c om*/ initEventHandling(); final FormLayout layout = new FormLayout("pref, 5dlu, pref, 5dlu", "pref, 3dlu, pref, 3dlu, pref, 3dlu, pref:grow, 3dlu, pref:grow, 3dlu, pref, 3dlu, pref"); builder = new PanelBuilder(layout); layout.setColumnGroups(new int[][] { { 1, 3 } }); builder.setDefaultDialogBorder(); final CellConstraints cc = new CellConstraints(); builder.addSeparator("Route Groups", cc.xyw(1, 1, 1)); builder.add(new JScrollPane(routeGroupList), cc.xy(1, 3)); builder.add(routeGroupConfig, cc.xy(1, 5)); builder.add(buildRouteGroupButtonBar(), cc.xy(1, 7)); builder.addSeparator("Routes", cc.xyw(3, 1, 1)); builder.add(new JScrollPane(routesList), cc.xywh(3, 3, 1, 3)); builder.add(buildRouteButtonBar(), cc.xy(3, 7)); builder.add(buildMainButtonBar(), cc.xyw(1, 9, 4)); add(builder.getPanel()); }
From source file:ch.fork.AdHocRailway.ui.turnouts.configuration.TurnoutConfig.java
License:Open Source License
private void buildPanel() { initComponents();/* w w w.j ava2 s.c o m*/ final FormLayout layout = new FormLayout( "right:pref, 3dlu, pref:grow, 30dlu, right:pref, 3dlu, pref:grow, 3dlu,pref:grow, 30dlu, pref", "p:grow, 3dlu,p:grow, 3dlu,p:grow, 3dlu,p:grow, 3dlu, p:grow, 3dlu, p:grow, 10dlu,p:grow"); layout.setColumnGroups(new int[][] { { 1, 5 }, { 3, 7 } }); layout.setRowGroups(new int[][] { { 3, 5, 7, 9, 11 } }); builder = new PanelBuilder(layout); builder.setDefaultDialogBorder(); final CellConstraints cc = new CellConstraints(); builder.addSeparator("General", cc.xyw(1, 1, 3)); builder.addLabel("Number", cc.xy(1, 3)); builder.add(numberTextField, cc.xy(3, 3)); builder.addLabel("Description", cc.xy(1, 5)); builder.add(descTextField, cc.xy(3, 5)); builder.addLabel("Type", cc.xy(1, 7)); builder.add(turnoutTypeComboBox, cc.xy(3, 7)); builder.addLabel("Default State", cc.xy(1, 9)); builder.add(turnoutDefaultStateComboBox, cc.xy(3, 9)); builder.addLabel("Orientation", cc.xy(1, 11)); builder.add(turnoutOrientationComboBox, cc.xy(3, 11)); builder.addSeparator("Interface", cc.xyw(5, 1, 5)); builder.addLabel("Bus 1", cc.xy(5, 3)); builder.add(bus1TextField, cc.xy(7, 3)); builder.addLabel("Address 1", cc.xy(5, 5)); builder.add(address1TextField, cc.xy(7, 5)); builder.addLabel("Bus 2", cc.xy(5, 7)); builder.add(bus2TextField, cc.xy(7, 7)); builder.addLabel("Address 2", cc.xy(5, 9)); builder.add(address2TextField, cc.xy(7, 9)); builder.add(switched1Checkbox, cc.xy(9, 5)); builder.add(switched2Checkbox, cc.xy(9, 9)); builder.addSeparator("Test", cc.xy(11, 1)); builder.add(testTurnoutWidget, cc.xywh(11, 3, 1, 9)); builder.add(errorPanel, cc.xyw(1, 13, 7)); builder.add(buildButtonBar(), cc.xyw(7, 13, 5)); add(builder.getPanel()); }
From source file:ch.thomasmueller.saltyfiles.ui.MainView.java
License:Open Source License
/** * @return the layout to be used./* ww w . j a v a 2s .co m*/ */ private FormLayout layout() { FormLayout layout = new FormLayout("right:70dlu, 3dlu, pref, 3dlu, right:pref, 3dlu, left:3dlu, 3dlu, pref", // columns // general rows "p, 3dlu, p, 3dlu, p, 3dlu, p,3dlu p, 9dlu," + // encript rows "p, 3dlu, p, 3dlu, p, 3dlu, p,9dlu," + // decript rows "p, 3dlu, p, 3dlu, p, 9dlu," + // buttonbar row "p, 3dlu,p"); // Specify that columns 1 & 5 as well as 3 & 7 have equal widths. layout.setColumnGroups(new int[][] { { 1, 5 }, { 3, 7 } }); return layout; }
From source file:com.alcatel_lucent.nz.wnmsextract.WNMSTransformGUI.java
License:Open Source License
private JComponent buildButtonPanel() { FormLayout layout = new FormLayout("pref,pref", //cols "pref"); // rows layout.setColumnGroups(new int[][] { { 1, 2 } }); PanelBuilder builder = new PanelBuilder(layout); CellConstraints cc = new CellConstraints(); //builder.addSeparator("",cc.xywh(1, 7, 5, 1)); builder.add(start, cc.xy(1, 1));/*w w w .j av a2 s . c o m*/ builder.add(exit, cc.xy(2, 1)); return builder.getPanel(); }
From source file:com.intellij.uiDesigner.actions.GroupRowsColumnsAction.java
License:Apache License
protected void actionPerformed(CaptionSelection selection) { FormLayout layout = (FormLayout) selection.getContainer().getLayout(); int[][] oldGroups = selection.isRow() ? layout.getRowGroups() : layout.getColumnGroups(); int[][] newGroups = new int[oldGroups.length + 1][]; System.arraycopy(oldGroups, 0, newGroups, 0, oldGroups.length); int[] cellsToGroup = getCellsToGroup(selection); newGroups[oldGroups.length] = new int[cellsToGroup.length]; for (int i = 0; i < cellsToGroup.length; i++) { newGroups[oldGroups.length][i] = cellsToGroup[i] + 1; }//from w w w . jav a2 s . co m if (selection.isRow()) { layout.setRowGroups(newGroups); } else { layout.setColumnGroups(newGroups); } }
From source file:com.intellij.uiDesigner.actions.UngroupRowsColumnsAction.java
License:Apache License
protected void actionPerformed(CaptionSelection selection) { FormLayout layout = (FormLayout) selection.getContainer().getLayout(); int[][] oldGroups = selection.isRow() ? layout.getRowGroups() : layout.getColumnGroups(); List<int[]> newGroups = new ArrayList<int[]>(); int[] selInts = selection.getSelection(); for (int[] group : oldGroups) { if (!GroupRowsColumnsAction.intersect(group, selInts)) { newGroups.add(group);/*from w ww . j av a 2 s.co m*/ } } int[][] newGroupArray = newGroups.toArray(new int[newGroups.size()][]); if (selection.isRow()) { layout.setRowGroups(newGroupArray); } else { layout.setColumnGroups(newGroupArray); } }
From source file:com.intellij.uiDesigner.radComponents.RadFormLayoutManager.java
License:Apache License
@Override public int deleteGridCells(final RadContainer grid, final int cellIndex, final boolean isRow) { int result = 1; FormLayout formLayout = (FormLayout) grid.getLayout(); adjustDeletedCellOrigins(grid, cellIndex, isRow); if (isRow) {/*from ww w. ja v a 2 s. c om*/ int[][] groupIndices = formLayout.getRowGroups(); groupIndices = removeDeletedCell(groupIndices, cellIndex + 1); formLayout.setRowGroups(groupIndices); formLayout.removeRow(cellIndex + 1); updateGridConstraintsFromCellConstraints(grid); if (formLayout.getRowCount() > 0 && formLayout.getRowCount() % 2 == 0) { int gapRowIndex = (cellIndex >= grid.getGridRowCount()) ? cellIndex - 1 : cellIndex; if (GridChangeUtil.isRowEmpty(grid, gapRowIndex)) { formLayout.removeRow(gapRowIndex + 1); updateGridConstraintsFromCellConstraints(grid); result++; } } } else { int[][] groupIndices = formLayout.getColumnGroups(); groupIndices = removeDeletedCell(groupIndices, cellIndex + 1); formLayout.setColumnGroups(groupIndices); formLayout.removeColumn(cellIndex + 1); updateGridConstraintsFromCellConstraints(grid); if (formLayout.getColumnCount() > 0 && formLayout.getColumnCount() % 2 == 0) { int gapColumnIndex = (cellIndex >= grid.getGridColumnCount()) ? cellIndex - 1 : cellIndex; if (GridChangeUtil.isColumnEmpty(grid, gapColumnIndex)) { formLayout.removeColumn(gapColumnIndex + 1); updateGridConstraintsFromCellConstraints(grid); result++; } } } return result; }
From source file:com.intellij.uiDesigner.radComponents.RadFormLayoutManager.java
License:Apache License
@Override public void createSnapshotLayout(final SnapshotContext context, final JComponent parent, final RadContainer container, final LayoutManager layout) { ColumnSpec[] colSpecs;//from w w w. ja va 2s .c o m RowSpec[] rowSpecs; int[][] rowGroups; int[][] columnGroups; try { Method method = layout.getClass().getMethod("getRowCount", ArrayUtil.EMPTY_CLASS_ARRAY); int rowCount = ((Integer) method.invoke(layout, ArrayUtil.EMPTY_OBJECT_ARRAY)).intValue(); method = layout.getClass().getMethod("getColumnCount", ArrayUtil.EMPTY_CLASS_ARRAY); int columnCount = ((Integer) method.invoke(layout, ArrayUtil.EMPTY_OBJECT_ARRAY)).intValue(); rowSpecs = new RowSpec[rowCount]; colSpecs = new ColumnSpec[columnCount]; method = layout.getClass().getMethod("getRowSpec", int.class); for (int i = 0; i < rowCount; i++) { rowSpecs[i] = (RowSpec) createSerializedCopy(method.invoke(layout, i + 1)); } method = layout.getClass().getMethod("getColumnSpec", int.class); for (int i = 0; i < columnCount; i++) { colSpecs[i] = (ColumnSpec) createSerializedCopy(method.invoke(layout, i + 1)); } method = layout.getClass().getMethod("getRowGroups", ArrayUtil.EMPTY_CLASS_ARRAY); rowGroups = (int[][]) method.invoke(layout); method = layout.getClass().getMethod("getColumnGroups", ArrayUtil.EMPTY_CLASS_ARRAY); columnGroups = (int[][]) method.invoke(layout); } catch (Exception ex) { throw new RuntimeException(ex); } final FormLayout formLayout = new FormLayout(colSpecs, rowSpecs); formLayout.setRowGroups(rowGroups); formLayout.setColumnGroups(columnGroups); container.setLayout(formLayout); }
From source file:com.isencia.passerelle.hmi.specific.HMITest.java
License:Open Source License
private JPanel getButtonPanel() { addScanLineButton = new JButton("Add scan line"); final AddRowCommand addRowCommand = new AddRowCommand(myTableModel); addScanLineButton.addActionListener(addRowCommand); ///* w ww . ja v a 2 s . c om*/ deleteScanLineButton = new JButton("Delete scan line"); final DeleteRowCommand deleteRowCommand = new DeleteRowCommand(table, myTableModel); deleteScanLineButton.addActionListener(deleteRowCommand); // goButton = new JButton("GO"); // loadScanButton = new JButton("Load sequence"); // LoadSequenceCommand loadSequenceCommand = new // LoadSequenceCommand(contextData); // loadScanButton.addActionListener(loadSequenceCommand); // saveScanButton = new JButton("Save sequence"); // // //SaveRockingCommand saveRockingCommand = new SaveRockingCommand(); // saveScanButton.addActionListener(new ModelSaver()); saveScanButton.setAction(new SaveAction(this)); // saveScanAsButton = new JButton("Save sequence as"); // SaveSequenceCommand saveSequenceCommand = new // SaveSequenceCommand(contextData); // saveScanAsButton.addActionListener(saveSequenceCommand); // // saveFileTextField = new JTextField(getCurrentModel().getName()); // final FormLayout layout = new FormLayout("p, 3dlu, p, 3dlu, p", // cols "pref, 3dlu, p, 9dlu, p, 3dlu, p, 3dlu, p"); // rows // Specify that columns 1 & 5 as well as 3 & 7 have equal widths. layout.setColumnGroups(new int[][] { { 1, 3, 5 } }); // // // Create a builder that assists in adding components to the // container. // // Wrap the panel with a standardized border. final PanelBuilder builder = new PanelBuilder(layout); builder.setDefaultDialogBorder(); // Obtain a reusable constraints object to place components in the grid. final CellConstraints cc = new CellConstraints(); // Fill the grid with components; the builder offers to create // frequently used components, e.g. separators and labels. // Add a titled separator to cell (1, 1) that spans 7 columns. builder.addSeparator("Commands", cc.xyw(1, 1, 5)); builder.add(addScanLineButton, cc.xyw(1, 3, 1)); builder.add(deleteScanLineButton, cc.xyw(3, 3, 1)); builder.add(goButton, cc.xyw(5, 3, 1)); builder.addSeparator("File", cc.xyw(1, 5, 5)); builder.add(loadScanButton, cc.xyw(1, 7, 1)); builder.add(saveScanButton, cc.xyw(3, 7, 1)); builder.add(saveScanAsButton, cc.xyw(5, 7, 1)); builder.add(saveFileTextField, cc.xyw(1, 9, 5)); return builder.getPanel(); }