use of org.apache.wicket.request.mapper.parameter.PageParameters in project midpoint by Evolveum.
the class PageBase method createConfigurationItems.
private MainMenuItem createConfigurationItems() {
MainMenuItem item = new MainMenuItem("fa fa-cog", createStringResource("PageAdmin.menu.top.configuration"), null);
item.setInsertDefaultBackBreadcrumb(false);
List<MenuItem> submenu = item.getItems();
MenuItem menu = new MenuItem(createStringResource("PageAdmin.menu.top.configuration.bulkActions"), PageBulkAction.class);
submenu.add(menu);
menu = new MenuItem(createStringResource("PageAdmin.menu.top.configuration.importObject"), PageImportObject.class, null, null);
submenu.add(menu);
menu = new MenuItem(createStringResource("PageAdmin.menu.top.configuration.repositoryObjects"), PageDebugList.class);
submenu.add(menu);
menu = new MenuItem(createStringResource("PageAdmin.menu.top.configuration.repositoryObjectView"), PageDebugView.class, null, createVisibleDisabledBehaviorForEditMenu(PageDebugView.class));
submenu.add(menu);
PageParameters params = new PageParameters();
params.add(PageSystemConfiguration.SELECTED_TAB_INDEX, PageSystemConfiguration.CONFIGURATION_TAB_BASIC);
menu = new MenuItem(createStringResource("PageAdmin.menu.top.configuration.basic"), PageSystemConfiguration.class, params, null) {
@Override
public boolean isMenuActive(WebPage page) {
if (!PageSystemConfiguration.class.equals(page.getClass())) {
return false;
}
int index = getSelectedTabForConfiguration(page);
return PageSystemConfiguration.CONFIGURATION_TAB_BASIC == index ? true : false;
}
};
submenu.add(menu);
params = new PageParameters();
params.add(PageSystemConfiguration.SELECTED_TAB_INDEX, PageSystemConfiguration.CONFIGURATION_TAB_NOTIFICATION);
menu = new MenuItem(createStringResource("PageAdmin.menu.top.configuration.notifications"), PageSystemConfiguration.class, params, null) {
@Override
public boolean isMenuActive(WebPage page) {
if (!PageSystemConfiguration.class.equals(page.getClass())) {
return false;
}
int index = getSelectedTabForConfiguration(page);
return PageSystemConfiguration.CONFIGURATION_TAB_NOTIFICATION == index ? true : false;
}
};
submenu.add(menu);
params = new PageParameters();
params.add(PageSystemConfiguration.SELECTED_TAB_INDEX, PageSystemConfiguration.CONFIGURATION_TAB_LOGGING);
menu = new MenuItem(createStringResource("PageAdmin.menu.top.configuration.logging"), PageSystemConfiguration.class, params, null) {
@Override
public boolean isMenuActive(WebPage page) {
if (!PageSystemConfiguration.class.equals(page.getClass())) {
return false;
}
int index = getSelectedTabForConfiguration(page);
return PageSystemConfiguration.CONFIGURATION_TAB_LOGGING == index ? true : false;
}
};
submenu.add(menu);
params = new PageParameters();
params.add(PageSystemConfiguration.SELECTED_TAB_INDEX, PageSystemConfiguration.CONFIGURATION_TAB_PROFILING);
menu = new MenuItem(createStringResource("PageAdmin.menu.top.configuration.profiling"), PageSystemConfiguration.class, params, null) {
@Override
public boolean isMenuActive(WebPage page) {
if (!PageSystemConfiguration.class.equals(page.getClass())) {
return false;
}
int index = getSelectedTabForConfiguration(page);
return PageSystemConfiguration.CONFIGURATION_TAB_PROFILING == index ? true : false;
}
};
submenu.add(menu);
params = new PageParameters();
params.add(PageSystemConfiguration.SELECTED_TAB_INDEX, PageSystemConfiguration.CONFIGURATION_TAB_ADMIN_GUI);
menu = new MenuItem(createStringResource("PageAdmin.menu.top.configuration.adminGui"), PageSystemConfiguration.class, params, null) {
@Override
public boolean isMenuActive(WebPage page) {
if (!PageSystemConfiguration.class.equals(page.getClass())) {
return false;
}
int index = getSelectedTabForConfiguration(page);
return PageSystemConfiguration.CONFIGURATION_TAB_ADMIN_GUI == index ? true : false;
}
};
submenu.add(menu);
menu = new MenuItem(createStringResource("PageAdmin.menu.top.configuration.shadowsDetails"), PageAccounts.class);
submenu.add(menu);
menu = new MenuItem(createStringResource("PageAdmin.menu.top.configuration.internals"), PageInternals.class);
submenu.add(menu);
menu = new MenuItem(createStringResource("PageAdmin.menu.top.configuration.repoQuery"), PageRepositoryQuery.class);
submenu.add(menu);
if (SystemConfigurationHolder.isExperimentalCodeEnabled()) {
menu = new MenuItem(createStringResource("PageAdmin.menu.top.configuration.evaluateMapping"), PageEvaluateMapping.class);
submenu.add(menu);
}
menu = new MenuItem(createStringResource("PageAdmin.menu.top.configuration.about"), PageAbout.class);
submenu.add(menu);
return item;
}
use of org.apache.wicket.request.mapper.parameter.PageParameters in project midpoint by Evolveum.
the class PageBase method createCertificationItems.
private MainMenuItem createCertificationItems() {
MainMenuItem item = new MainMenuItem("fa fa-certificate", createStringResource("PageAdmin.menu.top.certification"), null) {
private static final long serialVersionUID = 1L;
@Override
public String getBubbleLabel() {
Integer certWorkItemCount = certWorkItemCountModel.getObject();
if (certWorkItemCount == null || certWorkItemCount == 0) {
return null;
} else {
return certWorkItemCount.toString();
}
}
};
List<MenuItem> submenu = item.getItems();
MenuItem menu = new MenuItem(createStringResource("PageAdmin.menu.top.certification.definitions"), PageCertDefinitions.class);
submenu.add(menu);
menu = new MenuItem(createStringResource("PageAdmin.menu.top.certification.newDefinition"), PageCertDefinition.class);
submenu.add(menu);
menu = new MenuItem(createStringResource("PageAdmin.menu.top.certification.campaigns"), PageCertCampaigns.class);
submenu.add(menu);
PageParameters params = new PageParameters();
params.add(PageTasks.SELECTED_CATEGORY, TaskCategory.ACCESS_CERTIFICATION);
menu = new MenuItem(createStringResource("PageAdmin.menu.top.certification.scheduling"), PageTasksCertScheduling.class, params, null);
submenu.add(menu);
menu = new MenuItem(createStringResource("PageAdmin.menu.top.certification.decisions"), PageCertDecisions.class);
submenu.add(menu);
return item;
}
use of org.apache.wicket.request.mapper.parameter.PageParameters in project midpoint by Evolveum.
the class PageBase method getSelectedTabForConfiguration.
private int getSelectedTabForConfiguration(WebPage page) {
PageParameters params = page.getPageParameters();
StringValue val = params.get(PageSystemConfiguration.SELECTED_TAB_INDEX);
String value = null;
if (val != null && !val.isNull()) {
value = val.toString();
}
return StringUtils.isNumeric(value) ? Integer.parseInt(value) : PageSystemConfiguration.CONFIGURATION_TAB_BASIC;
}
use of org.apache.wicket.request.mapper.parameter.PageParameters 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)));
}
use of org.apache.wicket.request.mapper.parameter.PageParameters in project midpoint by Evolveum.
the class ResourceTasksPanel method initLayout.
private void initLayout(final ListModel<TaskType> tasks) {
final MainObjectListPanel<TaskType> tasksPanel = new MainObjectListPanel<TaskType>(ID_TASKS_TABLE, TaskType.class, TableId.PAGE_RESOURCE_TASKS_PANEL, null, pageBase) {
private static final long serialVersionUID = 1L;
@Override
protected BaseSortableDataProvider<SelectableBean<TaskType>> initProvider() {
return new ListDataProvider2(pageBase, tasks);
}
@Override
protected List<InlineMenuItem> createInlineMenu() {
// TODO Auto-generated method stub
return null;
}
@Override
public void objectDetailsPerformed(AjaxRequestTarget target, TaskType task) {
// TODO Auto-generated method stub
// super.objectDetailsPerformed(target, task);
PageParameters parameters = new PageParameters();
parameters.add(OnePageParameterEncoder.PARAMETER, task.getOid());
getPageBase().navigateToNext(PageTaskEdit.class, parameters);
}
@Override
protected void newObjectPerformed(AjaxRequestTarget target) {
getPageBase().navigateToNext(PageTaskAdd.class);
}
@Override
protected List<IColumn<SelectableBean<TaskType>, String>> createColumns() {
return ColumnUtils.getDefaultTaskColumns();
}
};
// final ObjectListPanel<TaskType> tasksPanel = new ObjectListPanel<TaskType>(ID_TASKS_TABLE, TaskType.class, pageBase){
//
// @Override
// protected BaseSortableDataProvider<SelectableBean<TaskType>> getProvider() {
// return new ListDataProvider2(pageBase, tasks);
// }
//
// @Override
// public boolean isEditable() {
// return ResourceTasksPanel.this.editable;
// }
//
// @Override
// public void objectDetailsPerformed(AjaxRequestTarget target, TaskType task) {
// // TODO Auto-generated method stub
// super.objectDetailsPerformed(target, task);
// PageParameters parameters = new PageParameters();
// parameters.add(OnePageParameterEncoder.PARAMETER, task.getOid());
// setResponsePage(new PageTaskEdit(parameters));
// }
// };
// tasksPanel.setEditable(false);
tasksPanel.setAdditionalBoxCssClasses(GuiStyleConstants.CLASS_OBJECT_TASK_BOX_CSS_CLASSES);
add(tasksPanel);
AjaxButton runNow = new AjaxButton(ID_RUN_NOW, pageBase.createStringResource("pageTaskEdit.button.runNow")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
List<String> oids = createOidList(getTaskListPanel().getSelectedObjects());
if (!oids.isEmpty()) {
OperationResult result = TaskOperationUtils.runNowPerformed(pageBase.getTaskService(), oids);
pageBase.showResult(result);
} else {
noTasksSelected();
}
target.add(pageBase.getFeedbackPanel());
}
};
add(runNow);
AjaxButton resume = new AjaxButton(ID_RESUME, pageBase.createStringResource("pageTaskEdit.button.resume")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
List<String> oids = createOidList(getTaskListPanel().getSelectedObjects());
if (!oids.isEmpty()) {
OperationResult result = TaskOperationUtils.resumePerformed(pageBase.getTaskService(), oids);
pageBase.showResult(result);
} else {
noTasksSelected();
}
target.add(pageBase.getFeedbackPanel());
}
};
add(resume);
AjaxButton suspend = new AjaxButton(ID_SUSPEND, pageBase.createStringResource("pageTaskEdit.button.suspend")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
List<String> oids = createOidList(getTaskListPanel().getSelectedObjects());
if (!oids.isEmpty()) {
OperationResult result = TaskOperationUtils.suspendPerformed(pageBase.getTaskService(), oids);
pageBase.showResult(result);
} else {
noTasksSelected();
}
target.add(pageBase.getFeedbackPanel());
}
};
add(suspend);
}
Aggregations