Fixed some progress indication thingies

This commit is contained in:
Frederik Petersen committed 2014-02-19 17:17:52 +01:00
1 parent ce71baa411
commit d2dda24af1
6 files changed
+26 -8

No files matched your search

@@ -960,4 +960,5 @@ public interface StringMessages extends Messages {
String hasSplitFleetContiguousScoring();
String eventOverview();
String start();
String overallProgress();
}
@@ -947,5 +947,6 @@ use=Use
groupingProvider=Grouping Provider
releaseNotes=News and Release History
hasSplitFleetContiguousScoring=Split fleets scored contiguously
overallProgress=Overall Progress
eventOverview=Event Overview
start=Start
@@ -943,5 +943,6 @@ use=Verwende
groupingProvider=Gruppierungs-Versorger
releaseNotes=Neuigkeiten und Änderungshistorie
hasSplitFleetContiguousScoring=Gruppen durchgängig bepunkten
overallProgress=Gesamtfortschritt
eventOverview=Veranstaltungsübersicht
start=Start
@@ -8,6 +8,7 @@ import java.util.Set;
import java.util.UUID;
import com.github.gwtbootstrap.client.ui.ProgressBar;
import com.github.gwtbootstrap.client.ui.base.ProgressBarBase.Style;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyCodes;
@@ -113,11 +114,13 @@ public class MasterDataImportPanel extends VerticalPanel {
protected void importLeaderboardGroups() {
String[] groupNames = createLeaderBoardGroupNamesFromListBox();
final ProgressBar overallProgressBar = new ProgressBar();
final Label overallName = new Label(stringMessages.overallProgress() + ":");
this.add(overallName);
final ProgressBar overallProgressBar = new ProgressBar(Style.ANIMATED);
this.add(overallProgressBar);
final Label subProgressName = new Label();
this.add(subProgressName);
final ProgressBar subProgressBar = new ProgressBar();
final ProgressBar subProgressBar = new ProgressBar(Style.ANIMATED);
this.add(subProgressBar);
if (groupNames.length >= 1) {
disableAllButtons();
@@ -150,18 +153,22 @@ public class MasterDataImportPanel extends VerticalPanel {
showErrorAlert(stringMessages.importServerError());
} else {
if (result.failed()) {
showErrorAlert(result.getErrorMessage());
// Got error, cancel timer
cancel();
deleteProgressIndication(overallName, overallProgressBar,
subProgressName, subProgressBar);
showErrorAlert(result.getErrorMessage());
changeButtonStateAccordingToApplicationState();
} else {
MasterDataImportObjectCreationCount creationCount = result
.getResult();
if (creationCount != null) {
// Got result, cancel timer
cancel();
deleteProgressIndication(overallName, overallProgressBar,
subProgressName, subProgressBar);
showCreationMessage(creationCount);
MasterDataImportPanel.this.remove(overallProgressBar);
MasterDataImportPanel.this.remove(subProgressBar);
MasterDataImportPanel.this.remove(subProgressName);
} else {
overallProgressBar.setPercent((int) (result
.getOverallProgressPct() * 100));
@@ -371,4 +378,12 @@ public class MasterDataImportPanel extends VerticalPanel {
changeButtonStateAccordingToApplicationState();
}
private void deleteProgressIndication(final Label overallName, final ProgressBar overallProgressBar,
final Label subProgressName, final ProgressBar subProgressBar) {
this.remove(overallProgressBar);
this.remove(subProgressBar);
this.remove(subProgressName);
this.remove(overallName);
}
}
@@ -3498,8 +3498,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
objectInputStream = getService().getBaseDomainFactory()
.createObjectInputStreamResolvingAgainstThisFactory(inputStream);
getService().createOrUpdateDataImportProgressWithReplication(importOperationId, 0.03,
"Reading Data",
50.0);
"Reading Data", 0.5);
TopLevelMasterData topLevelMasterData = (TopLevelMasterData) objectInputStream.readObject();
getService().createOrUpdateDataImportProgressWithReplication(importOperationId, 0.3,
@@ -76,6 +76,7 @@ public class ImportMasterDataOperation extends
@Override
public MasterDataImportObjectCreationCountImpl internalApplyTo(RacingEventService toState) throws Exception {
progress.setNameOfCurrentSubProgress("Waiting for other data import operations to finish");
toState.getDataImportLock().lock(importOperationId);
this.progress = toState.getDataImportLock().getProgress(importOperationId);
try {