use of com.evolveum.midpoint.web.component.wizard.resource.dto.WizardIssuesDto in project midpoint by Evolveum.
the class WizardIssuesPanel method initLayout.
private void initLayout() {
WebMarkupContainer panel = new WebMarkupContainer(ID_PANEL);
panel.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return getModelObject().hasIssues();
}
});
panel.add(AttributeAppender.append("class", new IModel<String>() {
@Override
public String getObject() {
WizardIssuesDto issuesDto = WizardIssuesPanel.this.getModelObject();
WizardIssuesDto.Severity severity = issuesDto.getSeverity();
return severity != null ? "box-" + severity.getColorStyle() : null;
}
}));
add(panel);
Label title = new Label(ID_TITLE, new IModel<String>() {
@Override
public String getObject() {
WizardIssuesDto issuesDto = WizardIssuesPanel.this.getModelObject();
WizardIssuesDto.Severity severity = issuesDto.getSeverity();
if (severity == null) {
return "";
} else if (severity == WizardIssuesDto.Severity.INFO) {
return getString("Wizard.Notes");
} else {
return getString("Wizard.Issues");
}
}
});
panel.add(title);
WebMarkupContainer table = new WebMarkupContainer(ID_TABLE);
panel.add(table);
ListView<WizardIssuesDto.Issue> issues = new ListView<WizardIssuesDto.Issue>(ID_ROW, new PropertyModel<>(getModel(), WizardIssuesDto.F_ISSUES)) {
@Override
protected void populateItem(ListItem<WizardIssuesDto.Issue> item) {
WizardIssuesDto.Issue issue = item.getModelObject();
Label severityLabel = new Label(ID_SEVERITY, "");
severityLabel.add(AttributeAppender.replace("class", issue.getSeverityClass()));
item.add(severityLabel);
item.add(new Label(ID_TEXT, issue.getText()));
}
};
table.add(issues);
}
use of com.evolveum.midpoint.web.component.wizard.resource.dto.WizardIssuesDto in project midpoint by Evolveum.
the class ResourceWizardIssuesModel method load.
@NotNull
@Override
protected WizardIssuesDto load() {
final WizardIssuesDto issuesDto = new WizardIssuesDto();
if (!resourceModel.isLoaded()) {
// e.g. in first two wizard steps (IT PROBABLY DOES NOT WORK AS EXPECTED)
return issuesDto;
}
ResourceValidator validator = wizardPage.getResourceValidator();
ValidationResult validationResult = validator.validate(resourceModel.getObject(), Scope.QUICK, WebComponentUtil.getCurrentLocale(), wizardPage.createSimpleTask("validate"), new OperationResult("validate"));
issuesDto.fillFrom(validationResult);
issuesDto.sortIssues();
return issuesDto;
}
Aggregations