use of com.evolveum.midpoint.web.page.self.component.DashboardSearchPanel in project midpoint by Evolveum.
the class PageSelfDashboard method initLayout.
private void initLayout() {
DashboardSearchPanel dashboardSearchPanel = new DashboardSearchPanel(ID_SEARCH_PANEL, null);
List<String> searchPanelActions = Arrays.asList(AuthorizationConstants.AUTZ_UI_USERS_ALL_URL, AuthorizationConstants.AUTZ_UI_USERS_URL, AuthorizationConstants.AUTZ_UI_RESOURCES_ALL_URL, AuthorizationConstants.AUTZ_UI_RESOURCES_URL, AuthorizationConstants.AUTZ_UI_TASKS_ALL_URL, AuthorizationConstants.AUTZ_UI_TASKS_URL);
dashboardSearchPanel.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
UserInterfaceElementVisibilityType visibilityType = getComponentVisibility(PredefinedDashboardWidgetId.SEARCH);
return WebComponentUtil.getElementVisibility(visibilityType, searchPanelActions);
}
});
add(dashboardSearchPanel);
LinksPanel linksPanel = new LinksPanel(ID_LINKS_PANEL, Model.ofList(loadLinksList()));
linksPanel.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
UserInterfaceElementVisibilityType visibilityType = getComponentVisibility(PredefinedDashboardWidgetId.SHORTCUTS);
return WebComponentUtil.getElementVisibility(visibilityType);
}
});
add(linksPanel);
// TODO is this correct? [med]
application = getApplication();
final Session session = Session.get();
AsyncDashboardPanel<Object, List<WorkItemDto>> workItemsPanel = new AsyncDashboardPanel<Object, List<WorkItemDto>>(ID_WORK_ITEMS_PANEL, createStringResource("PageSelfDashboard.workItems"), GuiStyleConstants.CLASS_OBJECT_WORK_ITEM_ICON, GuiStyleConstants.CLASS_OBJECT_WORK_ITEM_BOX_CSS_CLASSES, true) {
private static final long serialVersionUID = 1L;
@Override
protected SecurityContextAwareCallable<CallableResult<List<WorkItemDto>>> createCallable(Authentication auth, IModel callableParameterModel) {
return new SecurityContextAwareCallable<CallableResult<List<WorkItemDto>>>(getSecurityEnforcer(), auth) {
private static final long serialVersionUID = 1L;
@Override
public CallableResult<List<WorkItemDto>> callWithContextPrepared() throws Exception {
// TODO is this correct? [med]
setupContext(application, session);
return loadWorkItems();
}
};
}
@Override
protected Component getMainComponent(String markupId) {
ISortableDataProvider provider = new ListDataProvider(this, new PropertyModel<List<WorkItemDto>>(getModel(), CallableResult.F_VALUE));
return new WorkItemsPanel(markupId, provider, null, 10, WorkItemsPanel.View.DASHBOARD);
}
};
workItemsPanel.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
UserInterfaceElementVisibilityType visibilityType = getComponentVisibility(PredefinedDashboardWidgetId.MY_WORKITEMS);
return getWorkflowManager().isEnabled() && WebComponentUtil.getElementVisibility(visibilityType);
}
});
add(workItemsPanel);
AsyncDashboardPanel<Object, List<ProcessInstanceDto>> myRequestsPanel = new AsyncDashboardPanel<Object, List<ProcessInstanceDto>>(ID_REQUESTS_PANEL, createStringResource("PageSelfDashboard.myRequests"), GuiStyleConstants.CLASS_SHADOW_ICON_REQUEST, GuiStyleConstants.CLASS_OBJECT_SERVICE_BOX_CSS_CLASSES, true) {
private static final long serialVersionUID = 1L;
@Override
protected SecurityContextAwareCallable<CallableResult<List<ProcessInstanceDto>>> createCallable(Authentication auth, IModel callableParameterModel) {
return new SecurityContextAwareCallable<CallableResult<List<ProcessInstanceDto>>>(getSecurityEnforcer(), auth) {
private static final long serialVersionUID = 1L;
@Override
public CallableResult<List<ProcessInstanceDto>> callWithContextPrepared() throws Exception {
setupContext(application, session);
return loadMyRequests();
}
};
}
@Override
protected Component getMainComponent(String markupId) {
ISortableDataProvider provider = new ListDataProvider(this, new PropertyModel<List<ProcessInstanceDto>>(getModel(), CallableResult.F_VALUE));
return new ProcessInstancesPanel(markupId, provider, null, 10, ProcessInstancesPanel.View.DASHBOARD, null);
}
};
myRequestsPanel.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
UserInterfaceElementVisibilityType visibilityType = getComponentVisibility(PredefinedDashboardWidgetId.MY_REQUESTS);
return getWorkflowManager().isEnabled() && WebComponentUtil.getElementVisibility(visibilityType);
}
});
add(myRequestsPanel);
initMyAccounts();
initAssignments();
}
Aggregations