ASF Bugzilla – Attachment 27848 Details for
Bug 52085
Allow multiple selection in arguments panel
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed enhancement as a patch to Revision 1188664 of ArgumentsPaneljava
Enh52085_MultipleSelectionArgumentsPanel.patch (text/plain), 4.40 KB, created by
Roman Bargezi
on 2011-10-26 06:12:37 UTC
(
hide
)
Description:
Proposed enhancement as a patch to Revision 1188664 of ArgumentsPaneljava
Filename:
MIME Type:
Creator:
Roman Bargezi
Created:
2011-10-26 06:12:37 UTC
Size:
4.40 KB
patch
obsolete
>Index: ArgumentsPanel.java >=================================================================== >--- ArgumentsPanel.java (revision 1188913) >+++ ArgumentsPanel.java (working copy) >@@ -334,10 +334,16 @@ > private void moveDown() { > cancelEditing(); > >- int rowSelected = table.getSelectedRow(); >- if (rowSelected >=0 && rowSelected < table.getRowCount()-1) { >- tableModel.moveRow(rowSelected, rowSelected+1, rowSelected+1); >- table.setRowSelectionInterval(rowSelected+1, rowSelected+1); >+ int[] rowsSelected = table.getSelectedRows(); >+ if (rowsSelected.length > 0 && rowsSelected[rowsSelected.length - 1] < table.getRowCount() - 1) { >+ table.clearSelection(); >+ for (int i = rowsSelected.length - 1; i >= 0; i--) { >+ int rowSelected = rowsSelected[i]; >+ tableModel.moveRow(rowSelected, rowSelected + 1, rowSelected + 1); >+ } >+ for (int rowSelected : rowsSelected) { >+ table.addRowSelectionInterval(rowSelected + 1, rowSelected + 1); >+ } > } > } > >@@ -347,11 +353,16 @@ > private void moveUp() { > cancelEditing(); > >- int rowSelected = table.getSelectedRow(); >- if (rowSelected > 0) { >- tableModel.moveRow(rowSelected, rowSelected+1, rowSelected-1); >- table.setRowSelectionInterval(rowSelected-1, rowSelected-1); >- } >+ int[] rowsSelected = table.getSelectedRows(); >+ if (rowsSelected.length > 0 && rowsSelected[0] > 0) { >+ table.clearSelection(); >+ for (int rowSelected : rowsSelected) { >+ tableModel.moveRow(rowSelected, rowSelected + 1, rowSelected - 1); >+ } >+ for (int rowSelected : rowsSelected) { >+ table.addRowSelectionInterval(rowSelected - 1, rowSelected - 1); >+ } >+ } > } > > /** >@@ -360,32 +371,31 @@ > protected void deleteArgument() { > cancelEditing(); > >- int rowSelected = table.getSelectedRow(); >- if (rowSelected >= 0) { >- tableModel.removeRow(rowSelected); >- tableModel.fireTableDataChanged(); >+ int[] rowsSelected = table.getSelectedRows(); >+ int anchorSelection = table.getSelectionModel().getAnchorSelectionIndex(); >+ table.clearSelection(); >+ if (rowsSelected.length > 0) { >+ for (int i = rowsSelected.length - 1; i >= 0; i--) { >+ tableModel.removeRow(rowsSelected[i]); >+ } > > // Disable DELETE if there are no rows in the table to delete. > if (tableModel.getRowCount() == 0) { > delete.setEnabled(false); > } >+ // Table still contains one or more rows, so highlight (select) >+ // the appropriate one. >+ else if (tableModel.getRowCount() > 0) { >+ if (anchorSelection >= tableModel.getRowCount()) { >+ anchorSelection = tableModel.getRowCount() - 1; >+ } >+ table.setRowSelectionInterval(anchorSelection, anchorSelection); >+ } > > if(enableUpDown && tableModel.getRowCount()>1) { > up.setEnabled(true); > down.setEnabled(true); > } >- >- // Table still contains one or more rows, so highlight (select) >- // the appropriate one. >- else { >- int rowToSelect = rowSelected; >- >- if (rowSelected >= tableModel.getRowCount()) { >- rowToSelect = rowSelected - 1; >- } >- >- table.setRowSelectionInterval(rowToSelect, rowToSelect); >- } > } > } > >@@ -456,8 +466,8 @@ > new Functor("setName"), // $NON-NLS-1$ > new Functor("setValue") }, // $NON-NLS-1$ > new Class[] { String.class, String.class }); >- } > } >+ } > > public static boolean testFunctors(){ > ArgumentsPanel instance = new ArgumentsPanel(); >@@ -483,7 +493,7 @@ > initializeTableModel(); > table = new JTable(tableModel); > table.getTableHeader().setDefaultRenderer(new HeaderAsPropertyRenderer()); >- table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); >+ table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); > if (this.background != null) { > table.setBackground(this.background); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 52085
:
27845
| 27848