Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
bz-973574: Button 'Delete selected jar' does not work in Guvnor M2 re…
…pository tab
  • Loading branch information
jervisliu committed Aug 11, 2013
1 parent d3bb4f1 commit b69088b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 23 deletions.
Expand Up @@ -16,7 +16,6 @@

package org.guvnor.m2repo.client.editor;

import java.util.Set;

import com.google.gwt.cell.client.ButtonCell;
import com.google.gwt.cell.client.FieldUpdater;
Expand All @@ -31,7 +30,6 @@
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.view.client.MultiSelectionModel;

import org.guvnor.m2repo.client.resources.i18n.Constants;
import org.guvnor.m2repo.model.JarListPageRow;
Expand Down Expand Up @@ -65,8 +63,6 @@ interface JarListEditorBinder

private static JarListEditorBinder uiBinder = GWT.create( JarListEditorBinder.class );

protected MultiSelectionModel<JarListPageRow> selectionModel;

private Caller<M2RepoService> m2RepoService;

public JarListEditor( Caller<M2RepoService> repoService ) {
Expand Down Expand Up @@ -102,7 +98,7 @@ public void update( int index,

@UiHandler("deleteSelectedJarButton")
void deleteSelectedJar( ClickEvent e ) {
if ( getSelectedJars() == null ) {
if ( pagedJarTable.getSelectedJars() == null ) {
Window.alert( "Please Select A Jar To Delete" );
return;
}
Expand All @@ -115,23 +111,7 @@ public void callback( Void v ) {
Window.alert( "Deleted successfully" );
pagedJarTable.refresh();
}
} ).deleteJar( getSelectedJars() );
}

public String[] getSelectedJars() {
Set<JarListPageRow> selectedRows = selectionModel.getSelectedSet();
// Compatibility with existing API
if ( selectedRows.size() == 0 ) {
return null;
}

// Create the array of paths
String[] paths = new String[ selectedRows.size() ];
int rowCount = 0;
for ( JarListPageRow row : selectedRows ) {
paths[ rowCount++ ] = row.getPath();
}
return paths;
} ).deleteJar( pagedJarTable.getSelectedJars() );
}

@UiHandler("refreshButton")
Expand Down
@@ -1,6 +1,7 @@
package org.guvnor.m2repo.client.editor;

import java.util.Date;
import java.util.Set;

import com.github.gwtbootstrap.client.ui.CellTable;
import com.google.gwt.cell.client.ButtonCell;
Expand Down Expand Up @@ -111,7 +112,23 @@ public void refresh() {
cellTable.setVisibleRangeAndClearData( cellTable.getVisibleRange(),
true );
}


public String[] getSelectedJars() {
Set<JarListPageRow> selectedRows = selectionModel.getSelectedSet();
// Compatibility with existing API
if ( selectedRows.size() == 0 ) {
return null;
}

// Create the array of paths
String[] paths = new String[ selectedRows.size() ];
int rowCount = 0;
for ( JarListPageRow row : selectedRows ) {
paths[ rowCount++ ] = row.getPath();
}
return paths;
}

@Override
protected void addAncillaryColumns( ColumnPicker<JarListPageRow> columnPicker,
SortableHeaderGroup<JarListPageRow> sortableHeaderGroup ) {
Expand Down

0 comments on commit b69088b

Please sign in to comment.