use of org.apache.wicket.markup.html.list.ListView 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 AbstractReadOnlyModel<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 AbstractReadOnlyModel<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<List<WizardIssuesDto.Issue>>(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 org.apache.wicket.markup.html.list.ListView in project midpoint by Evolveum.
the class ActionsExecutedInformationPanel method initLayout.
protected void initLayout() {
WebMarkupContainer tableLinesContainer = new WebMarkupContainer(ID_OBJECTS_TABLE_LINES_CONTAINER);
ListView tableLines = new ListView<ActionsExecutedObjectsTableLineDto>(ID_OBJECTS_TABLE_LINES, new AbstractReadOnlyModel<List<ActionsExecutedObjectsTableLineDto>>() {
@Override
public List<ActionsExecutedObjectsTableLineDto> getObject() {
final ActionsExecutedInformationDto modelObject = getModelObject();
if (modelObject == null) {
return new ArrayList<>();
}
if (showResultingActionsOnly) {
return modelObject.getUniqueObjectsTableLines();
} else {
return modelObject.getObjectsTableLines();
}
}
}) {
protected void populateItem(final ListItem<ActionsExecutedObjectsTableLineDto> item) {
item.add(new Label(ID_OBJECT_TYPE, new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
String key = item.getModelObject().getObjectTypeLocalizationKey();
if (key != null) {
return createStringResource(key).getString();
} else {
return item.getModelObject().getObjectType().getLocalPart();
}
}
}));
item.add(new Label(ID_OPERATION, new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return createStringResource(item.getModelObject().getOperation()).getString();
}
}));
item.add(new Label(ID_CHANNEL, new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
String channel = item.getModelObject().getChannel();
if (channel != null && !channel.isEmpty()) {
String key = "Channel." + channel;
return createStringResource(key).getString();
} else {
return "";
}
}
}));
item.add(new Label(ID_SUCCESS_COUNT, new PropertyModel<String>(item.getModel(), ActionsExecutedObjectsTableLineDto.F_SUCCESS_COUNT)));
item.add(new Label(ID_LAST_SUCCESS_OBJECT, new PropertyModel<String>(item.getModel(), ActionsExecutedObjectsTableLineDto.F_LAST_SUCCESS_OBJECT)));
item.add(new Label(ID_LAST_SUCCESS_TIMESTAMP, new PropertyModel<String>(item.getModel(), ActionsExecutedObjectsTableLineDto.F_LAST_SUCCESS_TIMESTAMP)));
item.add(new Label(ID_FAILURE_COUNT, new PropertyModel<String>(item.getModel(), ActionsExecutedObjectsTableLineDto.F_FAILURE_COUNT)));
}
};
tableLinesContainer.add(tableLines);
tableLinesContainer.setOutputMarkupId(true);
add(tableLinesContainer);
final Label showResultingActionsOnlyLabel = new Label(ID_SHOW_RESULTING_ACTIONS_ONLY_LABEL, new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return showResultingActionsOnly ? createStringResource("ActionsExecutedInformationPanel.showingResultingActionsOnly").getString() : createStringResource("ActionsExecutedInformationPanel.showingAllActions").getString();
}
});
showResultingActionsOnlyLabel.setOutputMarkupId(true);
add(showResultingActionsOnlyLabel);
add(new AjaxFallbackLink<String>(ID_SHOW_RESULTING_ACTIONS_ONLY_LINK) {
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
showResultingActionsOnly = !showResultingActionsOnly;
ajaxRequestTarget.add(ActionsExecutedInformationPanel.this);
}
});
add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return getModelObject() != null;
}
});
}
use of org.apache.wicket.markup.html.list.ListView in project midpoint by Evolveum.
the class TaskBasicTabPanel method initLayoutBasic.
private void initLayoutBasic() {
// Name
WebMarkupContainer nameContainer = new WebMarkupContainer(ID_NAME_CONTAINER);
RequiredTextField<String> name = new RequiredTextField<>(ID_NAME, new PropertyModel<String>(taskDtoModel, TaskDto.F_NAME));
name.add(parentPage.createEnabledIfEdit(new ItemPath(TaskType.F_NAME)));
name.add(new AttributeModifier("style", "width: 100%"));
name.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
nameContainer.add(name);
nameContainer.add(parentPage.createVisibleIfAccessible(new ItemPath(TaskType.F_NAME)));
add(nameContainer);
// Description
WebMarkupContainer descriptionContainer = new WebMarkupContainer(ID_DESCRIPTION_CONTAINER);
TextArea<String> description = new TextArea<>(ID_DESCRIPTION, new PropertyModel<String>(taskDtoModel, TaskDto.F_DESCRIPTION));
description.add(parentPage.createEnabledIfEdit(new ItemPath(TaskType.F_DESCRIPTION)));
// description.add(new AttributeModifier("style", "width: 100%"));
// description.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
descriptionContainer.add(description);
descriptionContainer.add(parentPage.createVisibleIfAccessible(new ItemPath(TaskType.F_DESCRIPTION)));
add(descriptionContainer);
// OID
Label oid = new Label(ID_OID, new PropertyModel(getObjectWrapperModel(), ID_OID));
add(oid);
// Identifier
WebMarkupContainer identifierContainer = new WebMarkupContainer(ID_IDENTIFIER_CONTAINER);
identifierContainer.add(new Label(ID_IDENTIFIER, new PropertyModel(taskDtoModel, TaskDto.F_IDENTIFIER)));
identifierContainer.add(parentPage.createVisibleIfAccessible(new ItemPath(TaskType.F_TASK_IDENTIFIER)));
add(identifierContainer);
// Category
WebMarkupContainer categoryContainer = new WebMarkupContainer(ID_CATEGORY_CONTAINER);
categoryContainer.add(new Label(ID_CATEGORY, WebComponentUtil.createCategoryNameModel(this, new PropertyModel(taskDtoModel, TaskDto.F_CATEGORY))));
categoryContainer.add(parentPage.createVisibleIfAccessible(new ItemPath(TaskType.F_CATEGORY)));
add(categoryContainer);
// Parent
WebMarkupContainer parentContainer = new WebMarkupContainer(ID_PARENT_CONTAINER);
final LinkPanel parent = new LinkPanel(ID_PARENT, new PropertyModel<String>(taskDtoModel, TaskDto.F_PARENT_TASK_NAME)) {
@Override
public void onClick(AjaxRequestTarget target) {
String oid = taskDtoModel.getObject().getParentTaskOid();
if (oid != null) {
PageParameters parameters = new PageParameters();
parameters.add(OnePageParameterEncoder.PARAMETER, oid);
getPageBase().navigateToNext(PageTaskEdit.class, parameters);
}
}
};
parentContainer.add(parent);
parentContainer.add(parentPage.createVisibleIfAccessible(new ItemPath(TaskType.F_PARENT)));
add(parentContainer);
// Owner
WebMarkupContainer ownerContainer = new WebMarkupContainer(ID_OWNER_CONTAINER);
final LinkPanel owner = new LinkPanel(ID_OWNER, new PropertyModel<String>(taskDtoModel, TaskDto.F_OWNER_NAME)) {
@Override
public void onClick(AjaxRequestTarget target) {
String oid = taskDtoModel.getObject().getOwnerOid();
if (oid != null) {
PageParameters parameters = new PageParameters();
parameters.add(OnePageParameterEncoder.PARAMETER, oid);
getPageBase().navigateToNext(PageUser.class, parameters);
}
}
};
ownerContainer.add(owner);
ownerContainer.add(parentPage.createVisibleIfAccessible(new ItemPath(TaskType.F_OWNER_REF)));
add(ownerContainer);
// Handler URI
ListView<String> handlerUriContainer = new ListView<String>(ID_HANDLER_URI_CONTAINER, new PropertyModel(taskDtoModel, TaskDto.F_HANDLER_URI_LIST)) {
@Override
protected void populateItem(ListItem<String> item) {
item.add(new Label(ID_HANDLER_URI, item.getModelObject()));
}
};
handlerUriContainer.add(parentPage.createVisibleIfAccessible(new ItemPath(TaskType.F_HANDLER_URI), new ItemPath(TaskType.F_OTHER_HANDLERS_URI_STACK)));
add(handlerUriContainer);
// Execution
WebMarkupContainer executionContainer = new WebMarkupContainer(ID_EXECUTION_CONTAINER);
Label execution = new Label(ID_EXECUTION, new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
TaskDtoExecutionStatus executionStatus = taskDtoModel.getObject().getExecution();
if (executionStatus != TaskDtoExecutionStatus.CLOSED) {
return getString(TaskDtoExecutionStatus.class.getSimpleName() + "." + executionStatus.name());
} else {
return getString(TaskDtoExecutionStatus.class.getSimpleName() + "." + executionStatus.name() + ".withTimestamp", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
if (taskDtoModel.getObject().getCompletionTimestamp() != null) {
// todo correct formatting
return new Date(taskDtoModel.getObject().getCompletionTimestamp()).toLocaleString();
} else {
return "?";
}
}
});
}
}
});
executionContainer.add(execution);
Label node = new Label(ID_NODE, new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
TaskDto dto = taskDtoModel.getObject();
if (!TaskDtoExecutionStatus.RUNNING.equals(dto.getExecution())) {
return null;
}
return parentPage.getString("pageTaskEdit.message.node", dto.getExecutingAt());
}
});
executionContainer.add(node);
executionContainer.add(parentPage.createVisibleIfAccessible(new ItemPath(TaskType.F_EXECUTION_STATUS), new ItemPath(TaskType.F_NODE_AS_OBSERVED)));
add(executionContainer);
}
use of org.apache.wicket.markup.html.list.ListView in project midpoint by Evolveum.
the class AssignmentEditorPanel method initAttributesLayout.
private void initAttributesLayout(WebMarkupContainer constructionContainer) {
WebMarkupContainer attributes = new WebMarkupContainer(ID_ATTRIBUTES);
attributes.setOutputMarkupId(true);
attributes.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
AssignmentEditorDto dto = getModel().getObject();
return AssignmentEditorDtoType.CONSTRUCTION.equals(dto.getType());
}
});
attributes.setEnabled(getModel().getObject().isEditable());
constructionContainer.add(attributes);
ListView<ACAttributeDto> attribute = new ListView<ACAttributeDto>(ID_ATTRIBUTE, attributesModel) {
@Override
protected void populateItem(ListItem<ACAttributeDto> listItem) {
final IModel<ACAttributeDto> attrModel = listItem.getModel();
ACAttributePanel acAttribute = new ACAttributePanel(ID_AC_ATTRIBUTE, attrModel, ignoreMandatoryAttributes());
acAttribute.setRenderBodyOnly(true);
listItem.add(acAttribute);
listItem.setOutputMarkupId(true);
listItem.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
AssignmentEditorDto editorDto = AssignmentEditorPanel.this.getModel().getObject();
if (editorDto.isShowEmpty()) {
return true;
}
ACAttributeDto dto = attrModel.getObject();
return !dto.isEmpty();
}
});
}
};
attributes.add(attribute);
// todo extension
}
use of org.apache.wicket.markup.html.list.ListView in project midpoint by Evolveum.
the class PageAccounts method initLayout.
private void initLayout() {
Form form = new Form(ID_MAIN_FORM);
form.setOutputMarkupId(true);
add(form);
Form accForm = new Form(ID_FORM_ACCOUNT);
accForm.setOutputMarkupId(true);
add(accForm);
Form searchForm = new Form(ID_SEARCH_FORM);
initSearchForm(searchForm);
searchForm.setOutputMarkupPlaceholderTag(true);
searchForm.setOutputMarkupId(true);
searchForm.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return resourceModel.getObject() != null;
}
});
add(searchForm);
DropDownChoice<ResourceItemDto> resources = new DropDownChoice<>(ID_RESOURCES, resourceModel, resourcesModel, new ChoiceableChoiceRenderer<ResourceItemDto>());
form.add(resources);
initLinks(form, accForm);
initTotals(form);
final AjaxDownloadBehaviorFromFile ajaxDownloadBehavior = new AjaxDownloadBehaviorFromFile(true) {
@Override
protected File initFile() {
return downloadFile;
}
};
ajaxDownloadBehavior.setRemoveFile(false);
form.add(ajaxDownloadBehavior);
WebMarkupContainer filesContainer = new WebMarkupContainer(ID_FILES_CONTAINER);
filesContainer.setOutputMarkupId(true);
accForm.add(filesContainer);
ModalWindow resultPopup = createModalWindow(ID_RESULT_DIALOG, createStringResource("PageAccounts.result.popoup"), 1100, 560);
resultPopup.setContent(new AceEditorDialog(resultPopup.getContentId()));
add(resultPopup);
filesModel = createFilesModel();
ListView<String> files = new ListView<String>(ID_FILES, filesModel) {
@Override
protected void populateItem(final ListItem<String> item) {
AjaxLink file = new AjaxLink(ID_FILE) {
@Override
public void onClick(AjaxRequestTarget target) {
downloadPerformed(target, item.getModelObject(), ajaxDownloadBehavior);
}
};
file.add(new Label(ID_FILE_NAME, item.getModelObject()));
item.add(file);
}
};
files.setRenderBodyOnly(true);
filesContainer.add(files);
WebMarkupContainer accountsContainer = new WebMarkupContainer(ID_ACCOUNTS_CONTAINER);
accountsContainer.setOutputMarkupId(true);
accForm.add(accountsContainer);
ObjectDataProvider provider = new ObjectDataProvider(this, ShadowType.class);
provider.setOptions(SelectorOptions.createCollection(GetOperationOptions.createRaw()));
provider.setQuery(ObjectQuery.createObjectQuery(createResourceQueryFilter()));
TablePanel accounts = new TablePanel(ID_ACCOUNTS, provider, createAccountsColumns(), UserProfileStorage.TableId.CONF_PAGE_ACCOUNTS, getItemsPerPage(UserProfileStorage.TableId.CONF_PAGE_ACCOUNTS));
accounts.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return resourceModel.getObject() != null;
}
});
accounts.setItemsPerPage(50);
accountsContainer.add(accounts);
}
Aggregations