Fixed KeyFilter restore
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/admin/accounting-manager@144518 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
06010410c0
commit
be132b8355
|
@ -773,13 +773,34 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
comboTopFilterKey.setValue(accountingFilterTop.getFilterKey());
|
||||
topNumber.setValue(accountingFilterTop.getTopNumber());
|
||||
|
||||
// /////////
|
||||
if (accountingFilterTop.getFilters() != null) {
|
||||
List<AccountingFilter> filters = accountingFilterTop
|
||||
.getFilters();
|
||||
storeFilter.clear();
|
||||
storeFilter.addAll(filters);
|
||||
seq = 0;
|
||||
for (AccountingFilter filter : filters) {
|
||||
if (filter.getId() > seq) {
|
||||
seq = filter.getId();
|
||||
}
|
||||
}
|
||||
storeFilter.commitChanges();
|
||||
} else {
|
||||
storeFilter.clear();
|
||||
storeFilter.commitChanges();
|
||||
seq = 0;
|
||||
}
|
||||
|
||||
} else {
|
||||
comboTopFilterKey.reset();
|
||||
showOthersToggle.reset();
|
||||
showOthersNo.setValue(true);
|
||||
topNumber.reset();
|
||||
topNumber.setValue(TOP_NUMBER_DEFAULT);
|
||||
|
||||
storeFilter.clear();
|
||||
storeFilter.commitChanges();
|
||||
seq = 0;
|
||||
}
|
||||
} else {
|
||||
comboTopFilterKey.reset();
|
||||
|
@ -787,12 +808,12 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
showOthersNo.setValue(true);
|
||||
topNumber.reset();
|
||||
topNumber.setValue(TOP_NUMBER_DEFAULT);
|
||||
storeFilter.clear();
|
||||
storeFilter.commitChanges();
|
||||
seq = 0;
|
||||
|
||||
}
|
||||
|
||||
storeFilter.clear();
|
||||
storeFilter.commitChanges();
|
||||
seq = 0;
|
||||
comboChartType.setValue(ChartType.Top);
|
||||
gridContext.setVisible(false);
|
||||
comboTopFilterKeyLabel.setVisible(true);
|
||||
|
@ -834,15 +855,31 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
storeContext.commitChanges();
|
||||
|
||||
smContext.deselectAll();
|
||||
for (String c : accountingFilterContext.getContext()
|
||||
.getContexts()) {
|
||||
for (ContextData contextData : storeContext.getAll()) {
|
||||
if (c.compareTo(contextData.getContextData()) == 0) {
|
||||
smContext.select(contextData, false);
|
||||
break;
|
||||
|
||||
if (accountingFilterContext.getContext().getContexts() == null
|
||||
|| accountingFilterContext.getContext()
|
||||
.getContexts().isEmpty()) {
|
||||
} else {
|
||||
ArrayList<ContextData> selected = new ArrayList<>();
|
||||
for (String c : accountingFilterContext.getContext()
|
||||
.getContexts()) {
|
||||
for (ContextData contextData : storeContext
|
||||
.getAll()) {
|
||||
if (c.compareTo(contextData.getContextData()) == 0) {
|
||||
selected.add(contextData);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!selected.isEmpty()) {
|
||||
if (selected.size() == storeContext.getAll().size()) {
|
||||
smContext.selectAll();
|
||||
} else {
|
||||
smContext.select(selected, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
smContext.refresh();
|
||||
|
||||
} else {
|
||||
|
@ -960,8 +997,8 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
} else {
|
||||
noContextValue = false;
|
||||
}
|
||||
Log.debug("noContextValue: "+noContextValue);
|
||||
|
||||
Log.debug("noContextValue: " + noContextValue);
|
||||
|
||||
if (storeFilter == null || storeFilter.size() <= 0) {
|
||||
return new AccountingFilterBasic(noContextValue);
|
||||
} else {
|
||||
|
@ -974,8 +1011,6 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (filtersReady.size() > 0) {
|
||||
return new AccountingFilterBasic(filtersReady, noContextValue);
|
||||
} else {
|
||||
|
@ -990,7 +1025,7 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
Integer topN = topNumber.getCurrentValue();
|
||||
FilterKey filterKey = comboTopFilterKey.getCurrentValue();
|
||||
if (filterKey == null) {
|
||||
return new AccountingFilterTop(showOthersValue,topN);
|
||||
return new AccountingFilterTop(showOthersValue, topN);
|
||||
} else {
|
||||
if (storeFilter == null || storeFilter.size() <= 0) {
|
||||
return new AccountingFilterTop(filterKey, null,
|
||||
|
@ -1125,8 +1160,7 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
event.getAccountingPeriod());
|
||||
|
||||
AccountingManagerServiceAsync.INSTANCE.getFilterValues(
|
||||
requestFilterValue,
|
||||
new AsyncCallback<FilterValuesResponse>() {
|
||||
requestFilterValue, new AsyncCallback<FilterValuesResponse>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
|
Loading…
Reference in New Issue