Thanks Milamber,
Will fix it this evening.
Regards
Philippe
On Wed, Oct 12, 2011 at 12:21 AM, Milamber wrote:
> Hello,
>
> This commit adds a Up/Down button on Function Helper Dialog window.
> This is not good, because moving the ordering parameters make some
> errors in function helper results (tested with the new ramdom string
> function).
>
> Milamber
>
> Le 07/10/2011 20:30, pmoua...@apache.org a ecrit :
> > Author: pmouawad
> > Date: Fri Oct 7 20:30:33 2011
> > New Revision: 1180205
> >
> > URL: http://svn.apache.org/viewvc?rev=1180205&view=rev
> > Log:
> > Bug 51817 - Moving variables up and down in User Defined Variables
> control.
> >
> > Fixed a ConcurrentModificationException in ObjectTableModel#moveRow I had
> to use.
> >
> > Modified:
> >
> jakarta/jmeter/trunk/src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java
> >
> jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
> >
> jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/gui/ObjectTableModel.java
> >
> > Modified:
> jakarta/jmeter/trunk/src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java
> > URL:
> http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java?rev=1180205&r1=1180204&r2=1180205&view=diff
> >
> ==
> > ---
> jakarta/jmeter/trunk/src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java
> (original)
> > +++
> jakarta/jmeter/trunk/src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java
> Fri Oct 7 20:30:33 2011
> > @@ -81,12 +81,24 @@ public class ArgumentsPanel extends Abst
> > */
> > private boolean standalone = true;
> >
> > +/** Button to move a argument up*/
> > +private JButton up;
> > +
> > +/** Button to move a argument down*/
> > +private JButton down;
> > +
> > /** Command for adding a row to the table. */
> > private static final String ADD = "add"; // $NON-NLS-1$
> >
> > /** Command for removing a row from the table. */
> > private static final String DELETE = "delete"; // $NON-NLS-1$
> >
> > +/** Command for moving a row up in the table. */
> > +private static final String UP = "up"; // $NON-NLS-1$
> > +
> > +/** Command for moving a row down in the table. */
> > +private static final String DOWN = "down"; // $NON-NLS-1$
> > +
> > public static final String COLUMN_RESOURCE_NAMES_0 = "name"; //
> $NON-NLS-1$
> >
> > public static final String COLUMN_RESOURCE_NAMES_1 = "value"; //
> $NON-NLS-1$
> > @@ -239,6 +251,11 @@ public class ArgumentsPanel extends Abst
> > } else {
> > delete.setEnabled(true);
> > }
> > +
> > +if(tableModel.getRowCount()>1) {
> > +up.setEnabled(true);
> > +down.setEnabled(true);
> > +}
> > }
> >
> > @Override
> > @@ -268,19 +285,56 @@ public class ArgumentsPanel extends Abst
> > deleteArgument();
> > } else if (action.equals(ADD)) {
> > addArgument();
> > +} else if (action.equals(UP)) {
> > +moveUp();
> > +} else if (action.equals(DOWN)) {
> > +moveDown();
> > }
> > }
> >
> > /**
> > - * Remove the currently selected argument from the table.
> > + * Cancel cell editing if it is being edited
> > */
> > -protected void deleteArgument() {
> > +private void cancelEditing() {
> > // If a table cell is being edited, we must cancel the editing
> before
> > // deleting the row
> > if (table.isEditing()) {
> > TableCellEditor cellEditor =
> table.getCellEditor(table.getEditingRow(), table.getEditingColumn());
> > cellEditor.cancelCellEditing();
> > }
> > +}
> > +
> > +/**
> > + * Move a row down
> > + */
> > +private void moveDown() {
> > +cancelEditing();
> > +
> > +int rowSelected = table.getSelectedRow();
> > +if (rowSelected < table.getRowCount()-1) {
> > +tableModel.moveRow(rowSelected, rowSelected+1,
> rowSelected+1);
> > +table.setRowSelectionInterval(rowSelected+1, rowSelected+1);
> > +}
> > +}
> > +
> > +/**
> > + * Move a row down
> > + */
> > +private void moveUp() {
> > +cancelEditing();
> > +
> > +int rowSelected = table.getSelectedRow();
> > +if (rowSelected > 0) {
> > +tableModel.moveRow(rowSelected, rowSelected+1,
> rowSelected-1);
> > +table.setRowSelectionInterval(rowSelected-1, rowSelected-1);
> > +}
> > +}
> > +
> > +/**
> > + * Remove the currently selected argument from the table.
> > + */
> > +protected void deleteArgument() {
> > +cancelEditing();
> >
> > int rowSelected = table.getSelectedRow();
> > if (rowSelected >= 0) {
> > @@ -291,6 +345,11 @@ public class ArgumentsPanel extends Abst
> >