Search in sources :

Example 1 with PartnerDTO

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));
}
Also used : PartnerDTO(org.activityinfo.legacy.shared.model.PartnerDTO)

Example 2 with PartnerDTO

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;
        }
    });
// }
}
Also used : PartnerDTO(org.activityinfo.legacy.shared.model.PartnerDTO) Filter(org.activityinfo.legacy.shared.command.Filter) ArrayList(java.util.ArrayList) List(java.util.List) PartnerResult(org.activityinfo.legacy.shared.command.result.PartnerResult) GetPartnersDimension(org.activityinfo.legacy.shared.command.GetPartnersDimension)

Example 3 with PartnerDTO

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);
}
Also used : PartnerDTO(org.activityinfo.legacy.shared.model.PartnerDTO) Filter(org.activityinfo.legacy.shared.command.Filter)

Example 4 with PartnerDTO

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);
                }
            }
        }
    });
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) PartnerDTO(org.activityinfo.legacy.shared.model.PartnerDTO) Filter(org.activityinfo.legacy.shared.command.Filter) PartnerResult(org.activityinfo.legacy.shared.command.result.PartnerResult) GetPartnersDimension(org.activityinfo.legacy.shared.command.GetPartnersDimension)

Example 5 with PartnerDTO

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;
}
Also used : PartnerDTO(org.activityinfo.legacy.shared.model.PartnerDTO)

Aggregations

PartnerDTO (org.activityinfo.legacy.shared.model.PartnerDTO)23 Test (org.junit.Test)6 UpdatePartner (org.activityinfo.legacy.shared.command.UpdatePartner)5 CreateResult (org.activityinfo.legacy.shared.command.result.CreateResult)5 UserResult (org.activityinfo.legacy.shared.command.result.UserResult)4 ProjectDTO (org.activityinfo.legacy.shared.model.ProjectDTO)4 UserPermissionDTO (org.activityinfo.legacy.shared.model.UserPermissionDTO)4 OnDataSet (org.activityinfo.server.database.OnDataSet)4 ArrayList (java.util.ArrayList)3 Filter (org.activityinfo.legacy.shared.command.Filter)3 GetPartnersDimension (org.activityinfo.legacy.shared.command.GetPartnersDimension)3 GetUsers (org.activityinfo.legacy.shared.command.GetUsers)3 UpdateUserPermissions (org.activityinfo.legacy.shared.command.UpdateUserPermissions)3 DuplicateCreateResult (org.activityinfo.legacy.shared.command.result.DuplicateCreateResult)3 PartnerResult (org.activityinfo.legacy.shared.command.result.PartnerResult)3 AsyncCallback (com.google.gwt.user.client.rpc.AsyncCallback)2 GetSchema (org.activityinfo.legacy.shared.command.GetSchema)2 SchemaDTO (org.activityinfo.legacy.shared.model.SchemaDTO)2 SiteDTO (org.activityinfo.legacy.shared.model.SiteDTO)2 FormDialogCallback (org.activityinfo.ui.client.page.common.dialog.FormDialogCallback)2