Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Jul 4, 2016
2 parents b459027 + ea4a86b commit 0bdb40f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 62 deletions.
Expand Up @@ -306,7 +306,7 @@ private String createCountString(IPageable pageable) {
from = table.getCurrentPage() * table.getItemsPerPage() + 1;
to = from + table.getItemsPerPage() - 1;
long itemCount = table.getItemCount();
if (to > itemCount) {
if (to > itemCount) {
to = itemCount;
}
count = itemCount;
Expand All @@ -320,10 +320,6 @@ private String createCountString(IPageable pageable) {

return PageBase.createStringResourceStatic(PagingFooter.this, "CountToolbar.label",
new Object[] { from, to, count }).getString();

// new StringResourceModel("CountToolbar.label",
// PagingFooter.this, null,
// new Object[]{from, to, count}).getString();
}

return PageBase
Expand Down
Expand Up @@ -192,7 +192,12 @@ public SelectableBean<O> createDataObjectWrapper(O obj) {
protected int internalSize() {
LOGGER.trace("begin::internalSize()");
if (!isUseObjectCounting()) {
return Integer.MAX_VALUE;
//try to find out the actual size of provider and return it as a size
if (getAvailableData().size() > 0){
return getAvailableData().size();
} else {
return Integer.MAX_VALUE;
}
}
int count = 0;
OperationResult result = new OperationResult(OPERATION_COUNT_OBJECTS);
Expand Down
Expand Up @@ -35,55 +35,6 @@ protected Item<T> newRowItem(String id, int index, final IModel<T> model) {
final Item<T> rowItem = new SelectableRowItem<T>(id, index, model);

rowItem.setOutputMarkupId(true);

// rowItem.add(new AttributeAppender("class", new AbstractReadOnlyModel<String>() {
//
// @Override
// public String getObject() {
// T object = rowItem.getModel().getObject();
// if (!(object instanceof Selectable)) {
// return "";
// }
//
// Selectable selectable = (Selectable) object;
// return selectable.isSelected() ? "selectedRow" : "";
// }
// }));
//
// rowItem.add(new AjaxEventBehavior("click") {
//
// @Override
// protected void onEvent(AjaxRequestTarget target) {
// T object = rowItem.getModel().getObject();
// if (!(object instanceof Selectable)) {
// return;
// }
//
// Selectable selectable = (Selectable) object;
// selectable.setSelected(!selectable.isSelected());
//
// //update table row
// target.add(rowItem);
// //update checkbox header column, if we found some
// CheckBoxPanel headerCheck = CheckBoxHeaderColumn.findCheckBoxColumnHeader(SelectableDataTable.this);
// if (headerCheck == null) {
// return;
// }
//
// headerCheck.getPanelComponent().setModelObject(
// CheckBoxHeaderColumn.shoulBeHeaderSelected(SelectableDataTable.this));
// target.add(headerCheck);
// }
//
// @Override
// protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
// super.updateAjaxAttributes(attributes);
//
// attributes.getAjaxCallListeners().add(
// new AjaxCallListener().onPrecondition("return !dropClickEvent(attrs);"));
// }
// });

return rowItem;
}

Expand Down
Expand Up @@ -15,15 +15,13 @@
*/
package com.evolveum.midpoint.web.page.admin.resources;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.*;

import javax.xml.namespace.QName;

import com.evolveum.midpoint.web.component.dialog.ConfirmationPanel;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import org.apache.commons.collections.IteratorUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
Expand Down Expand Up @@ -467,9 +465,13 @@ private void createSearchOptions(SelectableBeanObjectDataProvider<ShadowType> pr
if (addAdditionalOptions() != null) {
opts.add(addAdditionalOptions());
}
provider.setUseObjectCounting(isUseObjectCounting());
boolean useObjectCounting = isUseObjectCounting();
provider.setUseObjectCounting(useObjectCounting);
provider.setOptions(opts);
}
if (!useObjectCounting) {
provider.iterator(0, provider.size());
}
}

private StringResourceModel createStringResource(String key) {
return pageBase.createStringResource(key);
Expand Down
Expand Up @@ -21,6 +21,7 @@

import javax.xml.namespace.QName;

import com.evolveum.midpoint.schema.util.ResourceTypeUtil;
import org.apache.wicket.model.IModel;

import com.evolveum.midpoint.common.refinery.RefinedObjectClassDefinition;
Expand Down Expand Up @@ -57,7 +58,8 @@ protected SelectorOptions<GetOperationOptions> addAdditionalOptions() {

@Override
protected boolean isUseObjectCounting() {
return false;
boolean useObjectCounting = ResourceTypeUtil.isCountObjectsCapabilityEnabled(getResourceModel().getObject().asObjectable());
return useObjectCounting;
}

@Override
Expand Down

0 comments on commit 0bdb40f

Please sign in to comment.