use of org.apache.wicket.AttributeModifier in project midpoint by Evolveum.
the class AuditLogViewerPanel method createReferenceColumn.
private void createReferenceColumn(ObjectReferenceType ref, Item item, String componentId) {
String name = WebModelServiceUtils.resolveReferenceName(ref, pageBase, pageBase.createSimpleTask(OPERATION_RESOLVE_REFENRENCE_NAME), new OperationResult(OPERATION_RESOLVE_REFENRENCE_NAME));
item.add(new Label(componentId, name));
item.add(new AttributeModifier("style", new Model<String>("width: 10%;")));
}
use of org.apache.wicket.AttributeModifier in project midpoint by Evolveum.
the class ProgressbarPanel method initLayout.
private void initLayout(final IModel<Integer> model) {
WebMarkupContainer progressBar = new WebMarkupContainer(ID_PROGRESS_BAR);
IModel<String> styleAttributeModel = new Model<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
return "width: " + model.getObject() + "%";
}
};
progressBar.add(new AttributeModifier("style", styleAttributeModel));
add(progressBar);
}
use of org.apache.wicket.AttributeModifier in project midpoint by Evolveum.
the class ResourceDependencyEditor method initLayout.
protected void initLayout(final PageResourceWizard parentPage) {
WebMarkupContainer container = new WebMarkupContainer(ID_CONTAINER);
container.setOutputMarkupId(true);
add(container);
ListView repeater = new ListView<ResourceObjectTypeDependencyType>(ID_REPEATER, getModel()) {
@Override
protected void populateItem(final ListItem<ResourceObjectTypeDependencyType> item) {
WebMarkupContainer linkContainer = new WebMarkupContainer(ID_DEPENDENCY_LINK);
linkContainer.setOutputMarkupId(true);
linkContainer.add(new AttributeModifier("href", createCollapseItemId(item, true)));
item.add(linkContainer);
Label linkLabel = new Label(ID_DEPENDENCY_LINK_NAME, createDependencyLabelModel(item));
linkContainer.add(linkLabel);
AjaxLink delete = new AjaxLink(ID_DELETE_BUTTON) {
@Override
public void onClick(AjaxRequestTarget target) {
deleteDependencyPerformed(target, item);
}
};
parentPage.addEditingVisibleBehavior(delete);
linkContainer.add(delete);
WebMarkupContainer dependencyBody = new WebMarkupContainer(ID_DEPENDENCY_BODY);
dependencyBody.setOutputMarkupId(true);
dependencyBody.setMarkupId(createCollapseItemId(item, false).getObject());
if (changeState != ChangeState.SKIP) {
dependencyBody.add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
if (changeState == ChangeState.FIRST && item.getIndex() == 0) {
return "panel-collapse collapse in";
} else if (changeState == ChangeState.LAST && item.getIndex() == (getModelObject().size() - 1)) {
return "panel-collapse collapse in";
} else {
return "panel-collapse collapse";
}
}
}));
}
item.add(dependencyBody);
TextField order = new TextField<>(ID_ORDER, new PropertyModel<Integer>(item.getModelObject(), "order"));
order.add(prepareAjaxOnComponentTagUpdateBehavior());
parentPage.addEditingEnabledBehavior(order);
dependencyBody.add(order);
DropDownChoice strictness = new DropDownChoice<>(ID_STRICTNESS, new PropertyModel<ResourceObjectTypeDependencyStrictnessType>(item.getModelObject(), "strictness"), WebComponentUtil.createReadonlyModelFromEnum(ResourceObjectTypeDependencyStrictnessType.class), new EnumChoiceRenderer<ResourceObjectTypeDependencyStrictnessType>(this));
strictness.add(prepareAjaxOnComponentTagUpdateBehavior());
parentPage.addEditingEnabledBehavior(strictness);
dependencyBody.add(strictness);
DropDownChoice kind = new DropDownChoice<>(ID_KIND, new PropertyModel<ShadowKindType>(item.getModelObject(), "kind"), WebComponentUtil.createReadonlyModelFromEnum(ShadowKindType.class), new EnumChoiceRenderer<ShadowKindType>(this));
kind.add(prepareAjaxOnComponentTagUpdateBehavior());
parentPage.addEditingEnabledBehavior(kind);
dependencyBody.add(kind);
TextField intent = new TextField<>(ID_INTENT, new PropertyModel<String>(item.getModelObject(), "intent"));
intent.add(prepareAjaxOnComponentTagUpdateBehavior());
parentPage.addEditingEnabledBehavior(intent);
dependencyBody.add(intent);
DropDownChoice resource = new DropDownChoice<>(ID_REF, new PropertyModel<ObjectReferenceType>(item.getModelObject(), "resourceRef"), new AbstractReadOnlyModel<List<ObjectReferenceType>>() {
@Override
public List<ObjectReferenceType> getObject() {
return WebModelServiceUtils.createObjectReferenceList(ResourceType.class, getPageBase(), resourceMap);
}
}, new ObjectReferenceChoiceRenderer(resourceMap));
resource.add(prepareAjaxOnComponentTagUpdateBehavior());
parentPage.addEditingEnabledBehavior(resource);
dependencyBody.add(resource);
Label orderTooltip = new Label(ID_T_ORDER);
orderTooltip.add(new InfoTooltipBehavior());
dependencyBody.add(orderTooltip);
Label strictnessTooltip = new Label(ID_T_STRICTNESS);
strictnessTooltip.add(new InfoTooltipBehavior());
dependencyBody.add(strictnessTooltip);
Label kindTooltip = new Label(ID_T_KIND);
kindTooltip.add(new InfoTooltipBehavior());
dependencyBody.add(kindTooltip);
Label intentTooltip = new Label(ID_T_INTENT);
intentTooltip.add(new InfoTooltipBehavior());
dependencyBody.add(intentTooltip);
Label resourceRefTooltip = new Label(ID_T_RESOURCE_REF);
resourceRefTooltip.add(new InfoTooltipBehavior());
dependencyBody.add(resourceRefTooltip);
}
};
repeater.setOutputMarkupId(true);
container.add(repeater);
AjaxLink add = new AjaxLink(ID_ADD_BUTTON) {
@Override
public void onClick(AjaxRequestTarget target) {
addDependencyPerformed(target);
}
};
parentPage.addEditingVisibleBehavior(add);
add(add);
}
use of org.apache.wicket.AttributeModifier in project midpoint by Evolveum.
the class ResourceProtectedEditor method initLayout.
protected void initLayout(final PageResourceWizard parentPage) {
WebMarkupContainer container = new WebMarkupContainer(ID_CONTAINER);
container.setOutputMarkupId(true);
add(container);
ListView repeater = new ListView<ResourceObjectPatternType>(ID_REPEATER, getModel()) {
@Override
protected void populateItem(final ListItem<ResourceObjectPatternType> item) {
WebMarkupContainer linkCont = new WebMarkupContainer(ID_ACCOUNT_LINK);
linkCont.setOutputMarkupId(true);
linkCont.add(new AttributeModifier("href", createCollapseItemId(item, true)));
item.add(linkCont);
Label accountLabel = new Label(ID_ACCOUNT_NAME, new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
StringBuilder sb = new StringBuilder();
ResourceObjectPatternType account = item.getModelObject();
sb.append("#").append(item.getIndex() + 1).append(" - ");
if (account.getUid() != null) {
sb.append(account.getUid()).append(":");
}
if (account.getName() != null) {
sb.append(account.getName());
}
return sb.toString();
}
});
linkCont.add(accountLabel);
AjaxLink delete = new AjaxLink(ID_BUTTON_DELETE) {
@Override
public void onClick(AjaxRequestTarget target) {
deleteProtectedAccountPerformed(target, item);
}
};
parentPage.addEditingVisibleBehavior(delete);
linkCont.add(delete);
WebMarkupContainer accountBody = new WebMarkupContainer(ID_ACCOUNT_BODY);
accountBody.setOutputMarkupId(true);
accountBody.setMarkupId(createCollapseItemId(item, false).getObject());
if (changeState != ChangeState.SKIP) {
accountBody.add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
if (changeState == ChangeState.FIRST && item.getIndex() == 0) {
return "panel-collapse collapse in";
} else if (changeState == ChangeState.LAST && item.getIndex() == (getModelObject().size() - 1)) {
return "panel-collapse collapse in";
} else {
return "panel-collapse collapse";
}
}
}));
}
item.add(accountBody);
//TODO - maybe add some validator and auto-complete functionality?
TextField name = new TextField<>(ID_NAME, new PropertyModel<String>(item.getModel(), "name"));
name.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
parentPage.addEditingEnabledBehavior(name);
accountBody.add(name);
//TODO - maybe add some validator and auto-complete functionality?
TextField uid = new TextField<>(ID_UID, new PropertyModel<String>(item.getModel(), "uid"));
uid.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
parentPage.addEditingEnabledBehavior(uid);
accountBody.add(uid);
SearchFilterPanel searchFilterPanel = new SearchFilterPanel<>(ID_FILTER_EDITOR, new NonEmptyPropertyModel<SearchFilterType>(item.getModel(), "filter"), parentPage.getReadOnlyModel());
accountBody.add(searchFilterPanel);
Label nameTooltip = new Label(ID_T_NAME);
nameTooltip.add(new InfoTooltipBehavior());
accountBody.add(nameTooltip);
Label uidTooltip = new Label(ID_T_UID);
uidTooltip.add(new InfoTooltipBehavior());
accountBody.add(uidTooltip);
Label filterTooltip = new Label(ID_T_FILTER);
filterTooltip.add(new InfoTooltipBehavior());
accountBody.add(filterTooltip);
}
};
repeater.setOutputMarkupId(true);
container.add(repeater);
AjaxLink add = new AjaxLink(ID_BUTTON_ADD) {
@Override
public void onClick(AjaxRequestTarget target) {
addProtectedAccountPerformed(target);
}
};
parentPage.addEditingVisibleBehavior(add);
add(add);
}
use of org.apache.wicket.AttributeModifier in project midpoint by Evolveum.
the class WorkItemPanel method initLayout.
protected void initLayout(Form mainForm, PageBase pageBase) {
WebMarkupContainer additionalInfoColumn = new WebMarkupContainer(ID_ADDITIONAL_INFO_COLUMN);
WebMarkupContainer historyContainer = new WebMarkupContainer(ID_HISTORY_CONTAINER);
historyContainer.add(new ItemApprovalHistoryPanel(ID_HISTORY, new PropertyModel<>(getModel(), WorkItemDto.F_WORKFLOW_CONTEXT), UserProfileStorage.TableId.PAGE_WORK_ITEM_HISTORY_PANEL, (int) pageBase.getItemsPerPage(UserProfileStorage.TableId.PAGE_WORK_ITEM_HISTORY_PANEL)));
final VisibleEnableBehaviour historyContainerVisible = new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return getModelObject().hasHistory();
}
};
historyContainer.add(historyContainerVisible);
historyContainer.add(WebComponentUtil.createHelp(ID_HISTORY_HELP));
additionalInfoColumn.add(historyContainer);
WebMarkupContainer relatedWorkItemsContainer = new WebMarkupContainer(ID_RELATED_WORK_ITEMS_CONTAINER);
final IModel<List<WorkItemDto>> relatedWorkItemsModel = new PropertyModel<>(getModel(), WorkItemDto.F_OTHER_WORK_ITEMS);
final ISortableDataProvider<WorkItemDto, String> relatedWorkItemsProvider = new ListDataProvider<>(this, relatedWorkItemsModel);
relatedWorkItemsContainer.add(new WorkItemsPanel(ID_RELATED_WORK_ITEMS, relatedWorkItemsProvider, null, 10, WorkItemsPanel.View.ITEMS_FOR_PROCESS));
final VisibleEnableBehaviour relatedWorkItemsContainerVisible = new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return !relatedWorkItemsModel.getObject().isEmpty();
}
};
relatedWorkItemsContainer.add(relatedWorkItemsContainerVisible);
relatedWorkItemsContainer.add(WebComponentUtil.createHelp(ID_RELATED_WORK_ITEMS_HELP));
additionalInfoColumn.add(relatedWorkItemsContainer);
final WebMarkupContainer relatedWorkflowRequestsContainer = new WebMarkupContainer(ID_RELATED_REQUESTS_CONTAINER);
final IModel<List<ProcessInstanceDto>> relatedWorkflowRequestsModel = new PropertyModel<>(getModel(), WorkItemDto.F_RELATED_WORKFLOW_REQUESTS);
final ISortableDataProvider<ProcessInstanceDto, String> relatedWorkflowRequestsProvider = new ListDataProvider<>(this, relatedWorkflowRequestsModel);
relatedWorkflowRequestsContainer.add(new ProcessInstancesPanel(ID_RELATED_REQUESTS, relatedWorkflowRequestsProvider, null, 10, ProcessInstancesPanel.View.TASKS_FOR_PROCESS, new PropertyModel<>(getModel(), WorkItemDto.F_PROCESS_INSTANCE_ID)));
final VisibleEnableBehaviour relatedWorkflowRequestsContainerVisible = new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return !relatedWorkflowRequestsModel.getObject().isEmpty();
}
};
relatedWorkflowRequestsContainer.add(relatedWorkflowRequestsContainerVisible);
relatedWorkflowRequestsContainer.add(WebComponentUtil.createHelp(ID_RELATED_REQUESTS_HELP));
additionalInfoColumn.add(relatedWorkflowRequestsContainer);
final VisibleEnableBehaviour additionalInfoColumnVisible = new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return historyContainerVisible.isVisible() || relatedWorkItemsContainerVisible.isVisible() || relatedWorkflowRequestsContainerVisible.isVisible();
}
};
additionalInfoColumn.add(additionalInfoColumnVisible);
add(additionalInfoColumn);
WebMarkupContainer primaryInfoColumn = new WebMarkupContainer(ID_PRIMARY_INFO_COLUMN);
// primaryInfoColumn.add(new Label(ID_REQUESTED_BY, new PropertyModel(getModel(), WorkItemDto.F_REQUESTER_NAME)));
// primaryInfoColumn.add(new Label(ID_REQUESTED_BY_FULL_NAME, new PropertyModel(getModel(), WorkItemDto.F_REQUESTER_FULL_NAME)));
// primaryInfoColumn.add(new Label(ID_REQUESTED_ON, new PropertyModel(getModel(), WorkItemDto.F_STARTED_FORMATTED_FULL)));
primaryInfoColumn.add(new Label(ID_WORK_ITEM_CREATED_ON, new PropertyModel(getModel(), WorkItemDto.F_CREATED_FORMATTED_FULL)));
primaryInfoColumn.add(new Label(ID_WORK_ITEM_DEADLINE, new PropertyModel(getModel(), WorkItemDto.F_DEADLINE_FORMATTED_FULL)));
primaryInfoColumn.add(new Label(ID_ORIGINALLY_ALLOCATED_TO, new PropertyModel(getModel(), WorkItemDto.F_ORIGINAL_ASSIGNEE_FULL)));
primaryInfoColumn.add(new Label(ID_CURRENTLY_ALLOCATED_TO, new PropertyModel(getModel(), WorkItemDto.F_CURRENT_ASSIGNEES_FULL)));
primaryInfoColumn.add(new Label(ID_CANDIDATES, new PropertyModel(getModel(), WorkItemDto.F_CANDIDATES)));
WebMarkupContainer stageInfoContainer = new WebMarkupContainer(ID_STAGE_INFO_CONTAINER);
primaryInfoColumn.add(stageInfoContainer);
stageInfoContainer.add(new Label(ID_STAGE_INFO, new PropertyModel<String>(getModel(), WorkItemDto.F_STAGE_INFO)));
stageInfoContainer.add(new VisibleBehaviour(() -> getModelObject().getStageInfo() != null));
WebMarkupContainer escalationLevelInfoContainer = new WebMarkupContainer(ID_ESCALATION_LEVEL_INFO_CONTAINER);
primaryInfoColumn.add(escalationLevelInfoContainer);
escalationLevelInfoContainer.add(new Label(ID_ESCALATION_LEVEL_INFO, new PropertyModel<String>(getModel(), WorkItemDto.F_ESCALATION_LEVEL_INFO)));
escalationLevelInfoContainer.add(new VisibleBehaviour(() -> getModelObject().getEscalationLevelInfo() != null));
WebMarkupContainer requesterCommentContainer = new WebMarkupContainer(ID_REQUESTER_COMMENT_CONTAINER);
requesterCommentContainer.setOutputMarkupId(true);
primaryInfoColumn.add(requesterCommentContainer);
requesterCommentContainer.add(new Label(ID_REQUESTER_COMMENT_MESSAGE, new PropertyModel<String>(getModel(), WorkItemDto.F_REQUESTER_COMMENT)));
//primaryInfoColumn.add(new ScenePanel(ID_DELTAS_TO_BE_APPROVED, new PropertyModel<SceneDto>(getModel(), WorkItemDto.F_DELTAS)));
primaryInfoColumn.add(new TaskChangesPanel(ID_DELTAS_TO_BE_APPROVED, new PropertyModel<>(getModel(), WorkItemDto.F_CHANGES)));
primaryInfoColumn.add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return additionalInfoColumnVisible.isVisible() ? "col-md-5" : "col-md-12";
}
}));
add(primaryInfoColumn);
add(new AjaxFallbackLink(ID_SHOW_REQUEST) {
public void onClick(AjaxRequestTarget target) {
String oid = WorkItemPanel.this.getModelObject().getTaskOid();
if (oid != null) {
PageParameters parameters = new PageParameters();
parameters.add(OnePageParameterEncoder.PARAMETER, oid);
getPageBase().navigateToNext(PageTaskEdit.class, parameters);
}
}
});
add(WebComponentUtil.createHelp(ID_SHOW_REQUEST_HELP));
WebMarkupContainer additionalInformation = new InformationListPanel(ID_ADDITIONAL_INFORMATION, new PropertyModel<>(getModel(), WorkItemDto.F_ADDITIONAL_INFORMATION));
add(additionalInformation);
WorkItemDto dto = getModelObject();
ApprovalStageDefinitionType level = WfContextUtil.getCurrentStageDefinition(dto.getWorkflowContext());
WebMarkupContainer additionalAttribues = new WebMarkupContainer(ID_ADDITIONAL_ATTRIBUTES);
add(additionalAttribues);
additionalAttribues.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
public boolean isVisible() {
return (level != null && level.getFormRef() != null && level.getFormRef().getOid() != null);
}
;
});
if (level != null && level.getFormRef() != null && level.getFormRef().getOid() != null) {
String formOid = level.getFormRef().getOid();
ObjectType focus = dto.getFocus(pageBase);
if (focus == null) {
// TODO FIXME (this should not occur anyway)
focus = new UserType(pageBase.getPrismContext());
}
Task task = pageBase.createSimpleTask(OPERATION_LOAD_CUSTOM_FORM);
DynamicFormPanel<?> customForm = new DynamicFormPanel<>(ID_CUSTOM_FORM, focus.asPrismObject(), formOid, mainForm, task, pageBase);
additionalAttribues.add(customForm);
} else {
additionalAttribues.add(new Label(ID_CUSTOM_FORM));
}
add(new TextArea<>(ID_APPROVER_COMMENT, new PropertyModel<String>(getModel(), WorkItemDto.F_APPROVER_COMMENT)));
}
Aggregations