use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.
the class ObjectSelectionPanel method createObjectQuery.
private ObjectQuery createObjectQuery() {
ObjectSearchDto dto = searchModel.getObject();
ObjectQuery query = null;
if (StringUtils.isEmpty(dto.getText())) {
if (context.getDataProviderQuery() != null) {
return context.getDataProviderQuery();
} else {
return query;
}
}
try {
PageBase pageBase = WebComponentUtil.getPageBase(this);
PrismContext prismContext = pageBase.getPrismContext();
PolyStringNormalizer normalizer = prismContext.getDefaultPolyStringNormalizer();
String normalized = normalizer.normalize(dto.getText());
ObjectFilter filter = QueryBuilder.queryFor(objectType, prismContext).item(context.getSearchProperty()).contains(normalized).matchingNorm().buildFilter();
if (context.getDataProviderQuery() != null) {
AndFilter and = AndFilter.createAnd(context.getDataProviderQuery().getFilter(), filter);
query = ObjectQuery.createObjectQuery(and);
} else {
query = ObjectQuery.createObjectQuery(filter);
}
} catch (Exception e) {
error(getString("chooseTypeDialog.message.queryError") + " " + e.getMessage());
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't create query filter.", e);
}
return query;
}
use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.
the class MainMenuPanel method menuItemPerformed.
private void menuItemPerformed(MenuItem menu) {
LOGGER.trace("menuItemPerformed: {}", menu);
IPageFactory pFactory = Session.get().getPageFactory();
WebPage page = pFactory.newPage(menu.getPageClass(), menu.getParams());
if (!(page instanceof PageBase)) {
setResponsePage(page);
return;
}
PageBase pageBase = (PageBase) page;
// IMPORTANT: we need to re-bundle the name to a new models
// that will not be connected to the old page reference
// otherwise the old page will somehow remain in the memory
// I have no idea how it could do that and especially how
// several old pages can remain in memory. But if the model
// is not re-bundled here then the page size grows and never
// falls.
MainMenuItem mainMenuItem = getModelObject();
String name = mainMenuItem.getNameModel().getObject();
Breadcrumb bc = new Breadcrumb(new Model<>(name));
bc.setIcon(new Model<>(mainMenuItem.getIconClass()));
pageBase.addBreadcrumb(bc);
List<MenuItem> items = mainMenuItem.getItems();
if (!items.isEmpty() && mainMenuItem.isInsertDefaultBackBreadcrumb()) {
MenuItem first = items.get(0);
IModel<String> nameModel = first.getNameModel();
BreadcrumbPageClass invisibleBc = new BreadcrumbPageClass(new Model<>(nameModel.getObject()), first.getPageClass(), first.getParams());
invisibleBc.setVisible(false);
pageBase.addBreadcrumb(invisibleBc);
}
setResponsePage(page);
}
use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.
the class PageTasks method createTaskNameColumn.
// used in SubtasksPanel as well
public static IColumn createTaskNameColumn(final Component component, String label) {
LinkColumn<TaskDto> column = new LinkColumn<TaskDto>(createStringResourceStatic(component, label), TaskDto.F_NAME, TaskDto.F_NAME) {
@Override
public void onClick(AjaxRequestTarget target, IModel<TaskDto> rowModel) {
TaskDto task = rowModel.getObject();
taskDetailsPerformed(target, task.getOid());
}
private void taskDetailsPerformed(AjaxRequestTarget target, String oid) {
PageParameters parameters = new PageParameters();
parameters.add(OnePageParameterEncoder.PARAMETER, oid);
PageBase page = (PageBase) component.getPage();
page.navigateToNext(PageTaskEdit.class, parameters);
}
@Override
public boolean isEnabled(IModel<TaskDto> rowModel) {
return super.isEnabled(rowModel) && rowModel.getObject().getOid() != null;
}
};
return column;
}
use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.
the class ResourceContentPanel method deleteResourceObjectPerformed.
// TODO: as a task?
protected void deleteResourceObjectPerformed(ShadowType selected, AjaxRequestTarget target) {
final List<ShadowType> selectedShadow = getSelectedShadowsList(selected);
final OperationResult result = new OperationResult(OPERATION_DELETE_OBJECT);
if (selectedShadow == null || selectedShadow.isEmpty()) {
result.recordWarning("Nothing selected to delete");
getPageBase().showResult(result);
target.add(getPageBase().getFeedbackPanel());
return;
}
ConfirmationPanel dialog = new ConfirmationPanel(((PageBase) getPage()).getMainPopupBodyId(), createDeleteConfirmString(selected, "pageContentAccounts.message.deleteConfirmation", "pageContentAccounts.message.deleteConfirmationSingle")) {
@Override
public void yesPerformed(AjaxRequestTarget target) {
((PageBase) getPage()).hideMainPopup(target);
deleteAccountConfirmedPerformed(target, result, selectedShadow);
}
};
((PageBase) getPage()).showMainPopup(dialog, target);
}
use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.
the class ResourceDetailsTabPanel method taskDetailsPerformed.
private void taskDetailsPerformed(AjaxRequestTarget target, String taskOid) {
PageParameters parameters = new PageParameters();
parameters.add(OnePageParameterEncoder.PARAMETER, taskOid);
((PageBase) getPage()).navigateToNext(PageTaskEdit.class, parameters);
}
Aggregations