Model widthModel;
public ImportProgressPage(String importerKey) {
this.importerId = importerKey;
FeatureTypeImporter importer = getImporter();
// construction
add(new Label("project", importer.getProject()));
add(info = new WebMarkupContainer("info"));
info.setOutputMarkupId(true);
info.add(bar = new Label("bar", "0"));
widthModel = new Model("width: 0%;");
bar.add(new AttributeModifier("style", widthModel));
info.add(percentage = new Label("percentage", "0"));
info.add(currentFile = new Label("currentFile", ""));
info.add(new AjaxLink("cancel") {
@Override
public void onClick(AjaxRequestTarget target) {
FeatureTypeImporter importer = getImporter();
importer.cancel();
setResponsePage(new ImportSummaryPage(importer.getSummary()));
}
});
// comment this out if you need to hack on the HTML of a live page
info.add(new AbstractAjaxTimerBehavior(Duration.milliseconds(500)) {
@Override
protected void onTimer(AjaxRequestTarget target) {
FeatureTypeImporter importer = getImporter();
ImportSummary summary = importer.getSummary();
if(summary != null) {
if(summary.isCompleted()) {
setResponsePage(new ImportSummaryPage(summary));
}