Skip to content

Commit

Permalink
Fix bug: Enable delete button of database connection.
Browse files Browse the repository at this point in the history
  • Loading branch information
tabergma committed Sep 25, 2014
1 parent 9220ecd commit 1a2bd7f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ public void onClick(ClickEvent event) {
});

this.connectionInputList.setWidget(row, 0, new HTML(input.getUrl()));
this.connectionInputList.setText(row, 1, input.getUsername());
this.connectionInputList.setText(row, 2, input.getSystem().name());
this.connectionInputList.setWidget(row, 1, new HTML(input.getUsername()));
this.connectionInputList.setWidget(row, 2, new HTML(input.getSystem().name()));
this.connectionInputList.setText(row, 3, input.getComment());
this.connectionInputList.setWidget(row, 4, runButton);
this.connectionInputList.setWidget(row, 5, deleteButton);
Expand Down Expand Up @@ -200,7 +200,7 @@ public void updateDataSourcesOnRunConfiguration() {
protected void setEnableOfDeleteButton(DatabaseConnection connection, boolean enabled) {
int row = findRow(connection);

Button deleteButton = (Button) this.connectionInputList.getWidget(row, 4);
Button deleteButton = (Button) this.connectionInputList.getWidget(row, 5);
deleteButton.setEnabled(enabled);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,11 @@ public void testSetEnableDeleteButton() throws EntityStorageException, InputVali
page.connectionInputList.setWidget(0, 0, new HTML("url"));
page.connectionInputList.setWidget(0, 1, new HTML("user"));
page.connectionInputList.setWidget(0, 2, new HTML("DB2"));
page.connectionInputList.setWidget(0, 3, new Button("Run"));
page.connectionInputList.setWidget(0, 4, new Button("Delete"));
page.connectionInputList.setWidget(0, 3, new HTML("Comment"));
page.connectionInputList.setWidget(0, 4, new Button("Run"));
page.connectionInputList.setWidget(0, 5, new Button("Delete"));

Button actualButton = (Button) page.connectionInputList.getWidget(0, 4);
Button actualButton = (Button) page.connectionInputList.getWidget(0, 5);

assertTrue(actualButton.isEnabled());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@ public void testDeleteCallback() throws EntityStorageException, InputValidationE
page.databaseConnectionTab.connectionInputList.setWidget(0, 0, new HTML("url1"));
page.databaseConnectionTab.connectionInputList.setWidget(0, 1, new HTML("user1"));
page.databaseConnectionTab.connectionInputList.setWidget(0, 2, new HTML("DB2"));
page.databaseConnectionTab.connectionInputList.setWidget(0, 4, deleteButton1);
page.databaseConnectionTab.connectionInputList.setWidget(0, 5, deleteButton1);

page.databaseConnectionTab.connectionInputList.setWidget(1, 0, new HTML("url2"));
page.databaseConnectionTab.connectionInputList.setWidget(1, 1, new HTML("user2"));
page.databaseConnectionTab.connectionInputList.setWidget(1, 2, new HTML("DB2"));
page.databaseConnectionTab.connectionInputList.setWidget(1, 4, deleteButton2);
page.databaseConnectionTab.connectionInputList.setWidget(1, 5, deleteButton2);

tableInputTab.tableInputList.setWidget(0, 0, new HTML("DB2; url1; user1"));
tableInputTab.tableInputList.setWidget(0, 1, new HTML("table1"));
Expand All @@ -160,7 +160,7 @@ public void testDeleteCallback() throws EntityStorageException, InputValidationE
// Check
assertEquals(rowCount - 1, tableInputTab.tableInputList.getRowCount());
assertEquals("table3", ((HTML) tableInputTab.tableInputList.getWidget(1, 1)).getText());
assertTrue(((Button) page.databaseConnectionTab.connectionInputList.getWidget(1, 4)).isEnabled());
assertTrue(((Button) page.databaseConnectionTab.connectionInputList.getWidget(1, 5)).isEnabled());

// Execute (delete Table Input 1)
callback = tableInputTab.getDeleteCallback(tableInput1);
Expand All @@ -169,7 +169,7 @@ public void testDeleteCallback() throws EntityStorageException, InputValidationE
// Check
assertEquals(rowCount - 2, tableInputTab.tableInputList.getRowCount());
assertEquals("table3", ((HTML) tableInputTab.tableInputList.getWidget(0, 1)).getText());
assertTrue(((Button) page.databaseConnectionTab.connectionInputList.getWidget(0, 4)).isEnabled());
assertTrue(((Button) page.databaseConnectionTab.connectionInputList.getWidget(0, 5)).isEnabled());

// Cleanup
TestHelper.resetDatabaseSync();
Expand Down

0 comments on commit 1a2bd7f

Please sign in to comment.