Skip to content

Commit

Permalink
etl fetch db / tables button fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
salihkardan committed Apr 9, 2015
1 parent c2f459a commit fba0358
Showing 1 changed file with 10 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,9 @@ public void buttonClick( final Button.ClickEvent clickEvent )
return;
}

class WorkThread extends Thread {

progressIconDB.setVisible(true);
fetchDB.setEnabled(false);
executorService.execute(new Runnable() {
@Override
public void run() {
databases.removeAllItems();
Expand All @@ -294,32 +295,25 @@ public void run() {

Notification.show( "Cannot fetch any database. Check your connection details !!!" );
progressIconDB.setVisible( false );
fetchDB.setEnabled(true);
return;
}
Notification.show( "Fetched " + dbItems.size() + " databases." );

Notification.show("Fetched " + dbItems.size() + " databases.");

for ( String dbItem : dbItems )
{
databases.addItem( dbItem );
}

UI.getCurrent().access( new Runnable() {
@Override
public void run() {
progressIconDB.setVisible(false);

// Stop polling
UI.getCurrent().setPollInterval(-1);
fetchDB.setEnabled(true);
progressIconDB.setVisible( false );
}
});
}
}
progressIconDB.setVisible(true);
fetchDB.setEnabled(false);
final WorkThread thread = new WorkThread();
thread.start();
UI.getCurrent().setPollInterval(500);
});
}
} );

Expand Down Expand Up @@ -357,8 +351,7 @@ public void buttonClick( final Button.ClickEvent clickEvent )
progressIconTable.setVisible( true );
fetchTables.setEnabled(false);

class WorkThread extends Thread {

executorService.execute(new Runnable() {
@Override
public void run() {
tables.removeAllItems();
Expand All @@ -380,19 +373,11 @@ public void run() {
@Override
public void run() {
progressIconTable.setVisible(false);

// Stop polling
UI.getCurrent().setPollInterval(-1);
fetchTables.setEnabled(true);
}
});
}
}
progressIconTable.setVisible(true);
fetchTables.setEnabled(false);
final WorkThread thread = new WorkThread();
thread.start();
UI.getCurrent().setPollInterval(500);
});
}
} );

Expand Down

0 comments on commit fba0358

Please sign in to comment.