use of com.evolveum.midpoint.web.component.data.ObjectDataProvider in project midpoint by Evolveum.
the class ObjectSelectionPanel method searchPerformed.
private void searchPerformed(AjaxRequestTarget target) {
ObjectQuery query = createObjectQuery();
TablePanel panel = getTablePanel();
DataTable table = panel.getDataTable();
ObjectDataProvider provider = (ObjectDataProvider) table.getDataProvider();
provider.setQuery(query);
target.add(panel);
}
use of com.evolveum.midpoint.web.component.data.ObjectDataProvider in project midpoint by Evolveum.
the class ObjectSelectionPanel method clearSearchPerformed.
private void clearSearchPerformed(AjaxRequestTarget target) {
searchModel.setObject(new ObjectSearchDto());
TablePanel panel = getTablePanel();
DataTable table = panel.getDataTable();
ObjectDataProvider provider = (ObjectDataProvider) table.getDataProvider();
if (context.getDataProviderQuery() != null) {
provider.setQuery(context.getDataProviderQuery());
} else {
provider.setQuery(null);
}
target.add(panel, getSearchForm());
}
use of com.evolveum.midpoint.web.component.data.ObjectDataProvider in project midpoint by Evolveum.
the class ObjectSelectionPanel method initLayout.
public void initLayout(PageBase pageBase) {
Form searchForm = new Form(ID_SEARCH_FORM);
searchForm.setOutputMarkupId(true);
add(searchForm);
searchForm.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return context.isSearchEnabled();
}
});
BasicSearchPanel<ObjectSearchDto> basicSearch = new BasicSearchPanel<ObjectSearchDto>(ID_BASIC_SEARCH) {
@Override
protected IModel<String> createSearchTextModel() {
return new PropertyModel<>(searchModel, ObjectSearchDto.F_SEARCH_TEXT);
}
@Override
protected void searchPerformed(AjaxRequestTarget target) {
ObjectSelectionPanel.this.searchPerformed(target);
}
@Override
protected void clearSearchPerformed(AjaxRequestTarget target) {
ObjectSelectionPanel.this.clearSearchPerformed(target);
}
};
searchForm.add(basicSearch);
add(context.createExtraContentContainer(ID_EXTRA_CONTENT_CONTAINER, this));
List<IColumn<SelectableBean<ObjectType>, String>> columns = initColumns();
ObjectDataProvider provider = new ObjectDataProvider(pageBase, this.objectType);
provider.setQuery(context.getDataProviderQuery());
provider.setOptions(context.getDataProviderOptions());
TablePanel table = new TablePanel<>(ID_TABLE, provider, columns);
table.setOutputMarkupId(true);
addOrReplace(table);
AjaxButton cancelButton = new AjaxButton(ID_BUTTON_CANCEL, createStringResource("chooseTypeDialog.button.cancel")) {
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
modalWindow.close(ajaxRequestTarget);
}
};
add(cancelButton);
}
use of com.evolveum.midpoint.web.component.data.ObjectDataProvider in project midpoint by Evolveum.
the class AbstractShoppingCartTabPanel method getTabPanelProvider.
private ObjectDataProvider<AssignmentEditorDto, AbstractRoleType> getTabPanelProvider() {
IModel<Search<AbstractRoleType>> searchModel = new IModel<Search<AbstractRoleType>>() {
@Override
public Search<AbstractRoleType> getObject() {
return getRoleCatalogStorage().getSearch();
}
};
ObjectDataProvider provider = new ObjectDataProvider<AssignmentEditorDto, AbstractRoleType>(AbstractShoppingCartTabPanel.this, searchModel) {
private static final long serialVersionUID = 1L;
@Override
public AssignmentEditorDto createDataObjectWrapper(PrismObject<AbstractRoleType> obj) {
AssignmentEditorDto dto = AssignmentEditorDto.createDtoFromObject(obj.asObjectable(), UserDtoStatus.ADD, getPageBase());
if (!getRoleCatalogStorage().isMultiUserRequest()) {
dto.setAlreadyAssigned(isAlreadyAssigned(obj, dto));
dto.setDefaultAssignmentConstraints(roleManagementConfig == null ? null : roleManagementConfig.getDefaultAssignmentConstraints());
}
dto.setSimpleView(true);
return dto;
}
@Override
protected ObjectQuery getCustomizeContentQuery() {
return createContentQuery();
}
};
// searchModel.getObject().setTypeClass(getQueryClass());
return provider;
}
use of com.evolveum.midpoint.web.component.data.ObjectDataProvider in project midpoint by Evolveum.
the class AbstractShoppingCartTabPanel method initButtonsPanel.
private void initButtonsPanel(WebMarkupContainer parametersPanel) {
AjaxButton addAllButton = new AjaxButton(ID_ADD_ALL_BUTTON, createStringResource("AbstractShoppingCartTabPanel.addAllButton")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
AbstractShoppingCartTabPanel.this.addAllAssignmentsPerformed(ajaxRequestTarget);
}
};
addAllButton.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
ObjectDataProvider provider = getGridViewComponent().getProvider();
return provider != null && provider.size() > 0;
}
@Override
public boolean isEnabled() {
int assignmentsLimit = AssignmentsUtil.loadAssignmentsLimit(new OperationResult(OPERATION_LOAD_ASSIGNMENTS_LIMIT), AbstractShoppingCartTabPanel.this.getPageBase());
return !AssignmentsUtil.isShoppingCartAssignmentsLimitReached(assignmentsLimit, AbstractShoppingCartTabPanel.this.getPageBase());
}
});
addAllButton.add(AttributeAppender.append("title", AssignmentsUtil.getShoppingCartAssignmentsLimitReachedTitleModel(getPageBase())));
parametersPanel.add(addAllButton);
AjaxButton goToShoppingCartButton = new AjaxButton(ID_GO_TO_SHOPPING_CART_BUTTON, createStringResource("AbstractShoppingCartTabPanel.goToShoppingCartButton")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
AbstractShoppingCartTabPanel.this.getPageBase().navigateToNext(new PageAssignmentsList(true));
}
};
goToShoppingCartButton.setOutputMarkupId(true);
goToShoppingCartButton.add(new VisibleBehaviour(() -> {
boolean isShoppingCartEmpty = AbstractShoppingCartTabPanel.this.getRoleCatalogStorage().getAssignmentShoppingCart().size() == 0;
return !isShoppingCartEmpty;
}));
parametersPanel.add(goToShoppingCartButton);
}
Aggregations