use of org.activityinfo.shared.dto.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);
if (baseFilter == null || !baseFilter.equals(filter)) {
service.execute(new GetPartnersDimension(filter), new AsyncCallback<PartnerResult>() {
@Override
public void onFailure(Throwable 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.shared.dto.PartnerDTO in project activityinfo by bedatadriven.
the class DbTargetEditor method onEdit.
@Override
protected void onEdit(final TargetDTO dto) {
this.view.showAddDialog(dto, db, new FormDialogCallback() {
@Override
public void onValidated(final FormDialogTether dlg) {
final Record record = store.getRecord(dto);
service.execute(new UpdateEntity(dto, getChangedProperties(record)), dlg, new AsyncCallback<VoidResult>() {
@Override
public void onFailure(Throwable caught) {
}
@Override
public void onSuccess(VoidResult result) {
PartnerDTO partner = db.getPartnerById((Integer) record.get("partnerId"));
dto.setPartner(partner);
ProjectDTO project = db.getProjectById((Integer) record.get("projectId"));
dto.setProject(project);
store.commitChanges();
eventBus.fireEvent(AppEvents.SCHEMA_CHANGED);
dlg.hide();
}
});
}
});
}
use of org.activityinfo.shared.dto.PartnerDTO in project activityinfo by bedatadriven.
the class DbTargetEditor method onAdd.
@Override
protected void onAdd() {
final TargetDTO newTarget = new TargetDTO();
this.view.showAddDialog(newTarget, db, new FormDialogCallback() {
@Override
public void onValidated(final FormDialogTether dlg) {
service.execute(new AddTarget(db.getId(), newTarget), dlg, new AsyncCallback<CreateResult>() {
@Override
public void onFailure(Throwable caught) {
MessageBox.alert(I18N.CONSTANTS.error(), I18N.CONSTANTS.errorOnServer(), null);
}
@Override
public void onSuccess(CreateResult result) {
newTarget.setId(result.getNewId());
PartnerDTO partner = db.getPartnerById((Integer) newTarget.get("partnerId"));
newTarget.setPartner(partner);
ProjectDTO project = db.getProjectById((Integer) newTarget.get("projectId"));
newTarget.setProject(project);
store.add(newTarget);
store.commitChanges();
eventBus.fireEvent(AppEvents.SCHEMA_CHANGED);
dlg.hide();
}
});
}
});
}
use of org.activityinfo.shared.dto.PartnerDTO in project activityinfo by bedatadriven.
the class DbUserEditor method onSelectionChanged.
private void onSelectionChanged(UserPermissionDTO selectedItem) {
if (selectedItem != null) {
PartnerDTO selectedPartner = selectedItem.getPartner();
toolBar.setActionEnabled(UIActions.DELETE, db.isManageAllUsersAllowed() || (db.isManageUsersAllowed() && db.getMyPartnerId() == selectedPartner.getId()));
}
toolBar.setActionEnabled(UIActions.DELETE, selectedItem != null);
}
use of org.activityinfo.shared.dto.PartnerDTO in project activityinfo by bedatadriven.
the class PartnerFilterDialog method show.
public void show(Filter baseFilter, final Filter currentFilter, SelectionCallback<Set<Integer>> callback) {
show();
this.callback = callback;
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);
}
}
}
});
}
Aggregations