diff -r 58d0915fb74d form/src/org/netbeans/modules/form/editors/Bundle.properties --- a/form/src/org/netbeans/modules/form/editors/Bundle.properties Wed Mar 17 20:08:17 2010 +0100 +++ b/form/src/org/netbeans/modules/form/editors/Bundle.properties Fri Mar 19 20:18:20 2010 +0000 @@ -250,6 +250,7 @@ LBL_TableCustomizer_Column_Renderer=&Renderer\: LBL_TableCustomizer_Column_Renderer_ACSD=N/A LBL_TableCustomizer_Column_Expression=Ex&pression\: +LBL_TableCustomizer_Column_Warning_MaxExceeded=Maximum columns (100) exceeded - re-setting to previous column count LBL_TableCustomizer_SelectionModel=&Selection Model\: LBL_TableCustomizer_SelectionModel_ACSD=N/A LBL_TableCustomizer_ReorderingAllowed=&Allow to reorder columns by drag and drop @@ -290,9 +291,12 @@ LBL_TableCustomizer_Rows_MoveDown_ACSD=N/A LBL_TableCustomizer_Rows_Table=Rows LBL_TableCustomizer_Rows_Table_ACSD=N/A +LBL_TableCustomizer_Row_Warning_MaxExceeded=Maximum rows (100) exceeded - re-setting to previous row count LBL_TableCustomizer_Title=Title LBL_TableCustomizer_Expression=Expression LBL_TableCustomizer_Type=Type LBL_TableCustomizer_ResizableH=Resizable LBL_TableCustomizer_EditableH=Editable MSG_TableCustomizer_ModelPropertyError=Unable to set the model of the table! +TableCustomizer.columnErrorLabel.text= +TableCustomizer.rowErrorLabel.text= diff -r 58d0915fb74d form/src/org/netbeans/modules/form/editors/TableCustomizer.form --- a/form/src/org/netbeans/modules/form/editors/TableCustomizer.form Wed Mar 17 20:08:17 2010 +0100 +++ b/form/src/org/netbeans/modules/form/editors/TableCustomizer.form Fri Mar 19 20:18:20 2010 +0000 @@ -1,4 +1,4 @@ - +
@@ -28,6 +28,7 @@ + @@ -44,7 +45,7 @@ - + @@ -110,7 +111,7 @@ - + @@ -180,7 +181,7 @@ - + @@ -224,7 +225,7 @@ - + @@ -268,7 +269,7 @@ - + @@ -294,12 +295,13 @@ - - - - + + + + + - + @@ -432,7 +434,8 @@ - + + @@ -655,7 +658,7 @@ - + @@ -691,7 +694,7 @@ - + @@ -714,7 +717,7 @@ - + @@ -920,6 +923,16 @@ + + + + + + + + + + @@ -936,20 +949,25 @@ - + - - - - - + + + + - + + + + + + + + + + + - - - - @@ -977,6 +995,7 @@ + @@ -1106,6 +1125,16 @@ + + + + + + + + + + diff -r 58d0915fb74d form/src/org/netbeans/modules/form/editors/TableCustomizer.java --- a/form/src/org/netbeans/modules/form/editors/TableCustomizer.java Wed Mar 17 20:08:17 2010 +0100 +++ b/form/src/org/netbeans/modules/form/editors/TableCustomizer.java Fri Mar 19 20:18:20 2010 +0000 @@ -73,6 +73,9 @@ */ public class TableCustomizer extends JPanel implements Customizer, FormAwareEditor { private JTable table; + + private static final int ROW_MAX = 100; + private static final int COLUMN_MAX = 100; /** Property editor for model from component section. */ private RADConnectionPropertyEditor modelFromComponentEd; @@ -237,6 +240,7 @@ placeHolder1.setVisible(false); placeHolder2 = new javax.swing.JLabel(); placeHolder2.setVisible(false); + columnErrorLabel = new javax.swing.JLabel(); rowsTab = new javax.swing.JPanel(); rowsScrollPane = new javax.swing.JScrollPane(); rowsTable = new javax.swing.JTable(); @@ -246,6 +250,7 @@ deleteRowButton = new javax.swing.JButton(); moveUpRowButton = new javax.swing.JButton(); moveDownRowButton = new javax.swing.JButton(); + rowErrorLabel = new javax.swing.JLabel(); FormListener formListener = new FormListener(); @@ -270,7 +275,7 @@ modelBoundPanel.setLayout(modelBoundPanelLayout); modelBoundPanelLayout.setHorizontalGroup( modelBoundPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(0, 535, Short.MAX_VALUE) + .add(0, 585, Short.MAX_VALUE) ); modelBoundPanelLayout.setVerticalGroup( modelBoundPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) @@ -287,7 +292,7 @@ modelFromComponentPanel.setLayout(modelFromComponentPanelLayout); modelFromComponentPanelLayout.setHorizontalGroup( modelFromComponentPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(0, 535, Short.MAX_VALUE) + .add(0, 585, Short.MAX_VALUE) ); modelFromComponentPanelLayout.setVerticalGroup( modelFromComponentPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) @@ -304,7 +309,7 @@ modelCustomPanel.setLayout(modelCustomPanelLayout); modelCustomPanelLayout.setHorizontalGroup( modelCustomPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(0, 535, Short.MAX_VALUE) + .add(0, 585, Short.MAX_VALUE) ); modelCustomPanelLayout.setVerticalGroup( modelCustomPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) @@ -344,7 +349,7 @@ .add(modelCustomChoice) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(modelCustomPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .addContainerGap(58, Short.MAX_VALUE)) + .addContainerGap(63, Short.MAX_VALUE)) ); modelHardcodedChoice.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TableCustomizer.class, "LBL_TableCustomizer_Model_Hardcoded_ACSD")); // NOI18N @@ -401,7 +406,7 @@ ); columnTitlePanelLayout.setVerticalGroup( columnTitlePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(0, 24, Short.MAX_VALUE) + .add(0, 22, Short.MAX_VALUE) ); columnTypeCombo.setEnabled(false); @@ -417,7 +422,7 @@ ); columnEditorPanelLayout.setVerticalGroup( columnEditorPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(0, 24, Short.MAX_VALUE) + .add(0, 22, Short.MAX_VALUE) ); columnRendererPanel.setEnabled(false); @@ -430,7 +435,7 @@ ); columnRendererPanelLayout.setVerticalGroup( columnRendererPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(0, 24, Short.MAX_VALUE) + .add(0, 22, Short.MAX_VALUE) ); selectionModelLabel.setLabelFor(selectionModelCombo); @@ -470,16 +475,20 @@ widthMaxCombo.setEditable(true); widthMaxCombo.setEnabled(false); + columnErrorLabel.setForeground(new java.awt.Color(204, 0, 0)); + columnErrorLabel.setText(org.openide.util.NbBundle.getMessage(TableCustomizer.class, "TableCustomizer.columnErrorLabel.text")); // NOI18N + org.jdesktop.layout.GroupLayout columnsTabLayout = new org.jdesktop.layout.GroupLayout(columnsTab); columnsTab.setLayout(columnsTabLayout); columnsTabLayout.setHorizontalGroup( columnsTabLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(columnsTabLayout.createSequentialGroup() + .add(org.jdesktop.layout.GroupLayout.TRAILING, columnsTabLayout.createSequentialGroup() .addContainerGap() - .add(columnsTabLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(separator, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 535, Short.MAX_VALUE) - .add(org.jdesktop.layout.GroupLayout.TRAILING, columnsTabLayout.createSequentialGroup() - .add(columnsScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 438, Short.MAX_VALUE) + .add(columnsTabLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) + .add(org.jdesktop.layout.GroupLayout.LEADING, columnErrorLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 585, Short.MAX_VALUE) + .add(org.jdesktop.layout.GroupLayout.LEADING, separator, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 585, Short.MAX_VALUE) + .add(columnsTabLayout.createSequentialGroup() + .add(columnsScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 465, Short.MAX_VALUE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(columnsTabLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false) .add(insertColumnButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) @@ -490,12 +499,12 @@ .add(deleteColumnButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(moveUpColumnButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(moveDownColumnButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) - .add(columnsTabLayout.createSequentialGroup() + .add(org.jdesktop.layout.GroupLayout.LEADING, columnsTabLayout.createSequentialGroup() .add(selectionModelLabel) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(selectionModelCombo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) - .add(reorderingAllowedChoice) - .add(columnsTabLayout.createSequentialGroup() + .add(org.jdesktop.layout.GroupLayout.LEADING, reorderingAllowedChoice) + .add(org.jdesktop.layout.GroupLayout.LEADING, columnsTabLayout.createSequentialGroup() .add(columnsTabLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(columnTypeLabel) .add(columnEditorLabel) @@ -585,7 +594,8 @@ .add(selectionModelCombo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(reorderingAllowedChoice) - .addContainerGap(25, Short.MAX_VALUE)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) + .add(columnErrorLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 13, Short.MAX_VALUE)) ); columnCountLabel.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TableCustomizer.class, "LBL_TableCustomizer_Columns_Count_ACSD")); // NOI18N @@ -641,23 +651,29 @@ moveDownRowButton.setEnabled(false); moveDownRowButton.addActionListener(formListener); + rowErrorLabel.setForeground(new java.awt.Color(204, 0, 0)); + rowErrorLabel.setText(org.openide.util.NbBundle.getMessage(TableCustomizer.class, "TableCustomizer.rowErrorLabel.text")); // NOI18N + org.jdesktop.layout.GroupLayout rowsTabLayout = new org.jdesktop.layout.GroupLayout(rowsTab); rowsTab.setLayout(rowsTabLayout); rowsTabLayout.setHorizontalGroup( rowsTabLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(rowsTabLayout.createSequentialGroup() + .add(org.jdesktop.layout.GroupLayout.TRAILING, rowsTabLayout.createSequentialGroup() .addContainerGap() - .add(rowsScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 437, Short.MAX_VALUE) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(rowsTabLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(rowsTabLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) + .add(org.jdesktop.layout.GroupLayout.LEADING, rowErrorLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 585, Short.MAX_VALUE) .add(rowsTabLayout.createSequentialGroup() - .add(rowCountLabel) + .add(rowsScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 451, Short.MAX_VALUE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(rowCountSpinner, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 55, Short.MAX_VALUE)) - .add(insertRowButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 92, Short.MAX_VALUE) - .add(deleteRowButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 92, Short.MAX_VALUE) - .add(moveUpRowButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 92, Short.MAX_VALUE) - .add(moveDownRowButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 92, Short.MAX_VALUE)) + .add(rowsTabLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(rowsTabLayout.createSequentialGroup() + .add(rowCountLabel) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(rowCountSpinner, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 69, Short.MAX_VALUE)) + .add(insertRowButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 122, Short.MAX_VALUE) + .add(deleteRowButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 122, Short.MAX_VALUE) + .add(moveUpRowButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 122, Short.MAX_VALUE) + .add(moveDownRowButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 122, Short.MAX_VALUE)))) .addContainerGap()) ); rowsTabLayout.setVerticalGroup( @@ -678,7 +694,8 @@ .add(moveUpRowButton) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(moveDownRowButton))) - .addContainerGap()) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(rowErrorLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 18, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) ); rowCountLabel.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(TableCustomizer.class, "LBL_TableCustomizer_Rows_Count_ACSD")); // NOI18N @@ -698,7 +715,7 @@ ); layout.setVerticalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(tabbedPane) + .add(tabbedPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 508, Short.MAX_VALUE) ); tabbedPane.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(TableCustomizer.class, "LBL_TableCustomizer_ACSN")); // NOI18N @@ -824,6 +841,12 @@ private void rowCountSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_rowCountSpinnerStateChanged stopCellEditing(rowsTable); int rowNo = ((Integer)rowCountSpinner.getValue()).intValue(); + if (rowNo>ROW_MAX) { + rowErrorLabel.setText(NbBundle.getMessage(TableCustomizer.class, "LBL_TableCustomizer_Row_Warning_MaxExceeded")); // NOI18N + rowCountSpinner.setValue(rowsTable.getRowCount()); + } else if (rowsTable.getRowCount()!=rowNo) { + rowErrorLabel.setText(""); // NOI18N + } ensureRowCount(rowNo); }//GEN-LAST:event_rowCountSpinnerStateChanged @@ -836,6 +859,12 @@ private void columnCountSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_columnCountSpinnerStateChanged stopCellEditing(columnsTable); int columnNo = ((Integer)columnCountSpinner.getValue()).intValue(); + if (columnNo>COLUMN_MAX) { + columnErrorLabel.setText(NbBundle.getMessage(TableCustomizer.class, "LBL_TableCustomizer_Column_Warning_MaxExceeded")); // NOI18N + columnCountSpinner.setValue(columnsTable.getRowCount()); + } else if (columnsTable.getRowCount()!=columnNo) { + columnErrorLabel.setText(""); // NOI18N + } ensureColumnCount(columnNo); }//GEN-LAST:event_columnCountSpinnerStateChanged @@ -1046,6 +1075,7 @@ private javax.swing.JSpinner columnCountSpinner; private javax.swing.JLabel columnEditorLabel; private org.openide.explorer.propertysheet.PropertyPanel columnEditorPanel; + private javax.swing.JLabel columnErrorLabel; private javax.swing.JLabel columnExpressionLabel; private javax.swing.JLabel columnRendererLabel; private org.openide.explorer.propertysheet.PropertyPanel columnRendererPanel; @@ -1080,6 +1110,7 @@ private javax.swing.JCheckBox resizableColumnChoice; private javax.swing.JLabel rowCountLabel; private javax.swing.JSpinner rowCountSpinner; + private javax.swing.JLabel rowErrorLabel; private javax.swing.JScrollPane rowsScrollPane; private javax.swing.JPanel rowsTab; private javax.swing.JTable rowsTable; @@ -1567,34 +1598,38 @@ * @param columnCount number of columns. */ private void ensureColumnCount(int columnCount) { - boolean hardcoded = modelHardcodedChoice.isSelected(); - for (int i=columns.size(); i=columnCount; i--) { + if (lastSelectedColumn == i) { + lastSelectedColumn = -1; + } + columns.remove(i); + if (hardcoded) { + rowTableModel.removeColumn(i); + } + } + columnTableModel.fireTableDataChanged(); } - for (int i=columns.size()-1; i>=columnCount; i--) { - if (lastSelectedColumn == i) { - lastSelectedColumn = -1; - } - columns.remove(i); - if (hardcoded) { - rowTableModel.removeColumn(i); - } - } - columnTableModel.fireTableDataChanged(); } /** * Ensures that there is correct number of rows in row info table. */ private void ensureRowCount(int rowCount) { - for (int i=rowTableModel.getRowCount(); i=rowCount; i--) { - rowTableModel.removeRow(i); + if (rowCount<=ROW_MAX) { + for (int i=rowTableModel.getRowCount(); i=rowCount; i--) { + rowTableModel.removeRow(i); + } } }