use of org.activityinfo.legacy.shared.model.PartnerDTO in project activityinfo by bedatadriven.
the class PartnerFilterPanel method applyInternalValue.
private void applyInternalValue() {
for (PartnerDTO model : listView.getStore().getModels()) {
listView.setChecked(model, value.getRestrictions(DimensionType.Partner).contains(model.getId()));
}
filterToolBar.setApplyFilterEnabled(false);
filterToolBar.setRemoveFilterEnabled(value.isRestricted(DimensionType.Partner));
}
use of org.activityinfo.legacy.shared.model.PartnerDTO in project activityinfo by bedatadriven.
the class PartnerFilterPanel method applyBaseFilter.
@Override
public void applyBaseFilter(Filter rawFilter) {
// we need to remove any partner filter from this base filter
// so the user has the full selection
final Filter filter = new Filter(rawFilter);
filter.clearRestrictions(DimensionType.Partner);
// force to refresh on site crud
// if (baseFilter == null || !baseFilter.equals(filter)) {
service.execute(new GetPartnersDimension(filter), new AsyncCallback<PartnerResult>() {
@Override
public void onFailure(Throwable caught) {
Log.error(caught.getMessage(), caught);
}
@Override
public void onSuccess(PartnerResult result) {
List<Integer> ids = getSelectedIds();
store.removeAll();
store.add(result.getData());
applyInternalValue();
for (PartnerDTO partner : store.getModels()) {
if (ids.contains(partner.getId())) {
listView.setChecked(partner, true);
}
}
baseFilter = filter;
}
});
// }
}
use of org.activityinfo.legacy.shared.model.PartnerDTO in project activityinfo by bedatadriven.
the class PartnerFilterPanel method clearFilter.
protected void clearFilter() {
for (PartnerDTO partner : listView.getStore().getModels()) {
listView.setChecked(partner, false);
}
value = new Filter();
filterToolBar.setApplyFilterEnabled(false);
filterToolBar.setRemoveFilterEnabled(false);
}
use of org.activityinfo.legacy.shared.model.PartnerDTO in project activityinfo by bedatadriven.
the class PartnerFilterDialog method show.
public void show(Filter rawFilter, final Filter currentFilter, SelectionCallback<Set<Integer>> callback) {
show();
this.callback = callback;
Filter baseFilter = new Filter(rawFilter);
baseFilter.clearRestrictions(DimensionType.Partner);
service.execute(new GetPartnersDimension(baseFilter), new AsyncCallback<PartnerResult>() {
@Override
public void onFailure(Throwable caught) {
}
@Override
public void onSuccess(PartnerResult result) {
Set<Integer> ids = currentFilter.getRestrictions(DimensionType.Partner);
store.removeAll();
store.add(result.getData());
for (PartnerDTO partner : store.getModels()) {
if (ids.contains(partner.getId())) {
listView.setChecked(partner, true);
}
}
}
});
}
use of org.activityinfo.legacy.shared.model.PartnerDTO in project activityinfo by bedatadriven.
the class DbPartnerEditor method otherPartnerNames.
private Set<String> otherPartnerNames(PartnerDTO editingPartner) {
List<PartnerDTO> models = grid.getStore().getModels();
Set<String> names = Sets.newHashSet();
for (PartnerDTO partner : models) {
names.add(partner.getName() != null ? partner.getName().trim() : "");
}
if (editingPartner.getName() != null) {
names.remove(editingPartner.getName());
}
return names;
}
Aggregations