org.ikasan.dashboard.ui.scheduler.component.JobPlanWarningsDialog Maven / Gradle / Ivy
package org.ikasan.dashboard.ui.scheduler.component;
import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.UI;
import com.vaadin.flow.component.grid.Grid;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.data.renderer.TemplateRenderer;
import org.ikasan.dashboard.ui.general.component.AbstractCloseableResizableDialog;
import org.ikasan.job.orchestration.context.validation.ContextError;
import java.util.List;
public class JobPlanWarningsDialog extends AbstractCloseableResizableDialog {
private List contextWarnings;
public JobPlanWarningsDialog(List contextWarnings) {
this.contextWarnings = contextWarnings;
this.setWidth("70vw");
this.setHeight("70vh");
super.content.add(this.initialiseErrorWidget());
super.title.setText(getTranslation("dialog-title.job-plan-warnings", UI.getCurrent().getLocale()));
}
private Component initialiseErrorWidget() {
Grid errorGrid = new Grid<>();
errorGrid.addColumn(TemplateRenderer.of(
"[[item.error]]")
.withProperty("error", contextError -> contextError.getErrorMessage()))
.setHeader(getTranslation("label.warning-message", UI.getCurrent().getLocale()))
.setKey("warningMessage");
errorGrid.setWidth("100%");
errorGrid.setItems(this.contextWarnings);
return errorGrid;
}
}