Fix problem in bandbox search filters deleting session values
There was an issue that was causing bandbox search filter in company view to be cleared, and deleting the corresponding session variable, the second time that perspective was accesed without changing the filter. FEA: ItEr77S15FilteringEnhancements
This commit is contained in:
parent
5d07599594
commit
fb243cc5d5
7 changed files with 53 additions and 26 deletions
|
|
@ -72,8 +72,8 @@ public class FilterUtils {
|
|||
writeProjectsParameters(parameters);
|
||||
}
|
||||
|
||||
public static void writeProjectFilterChanged(boolean b) {
|
||||
Sessions.getCurrent().setAttribute("companyFilterChanged", true);
|
||||
public static void writeProjectFilterChanged(boolean changed) {
|
||||
Sessions.getCurrent().setAttribute("companyFilterChanged", changed);
|
||||
}
|
||||
|
||||
public static boolean hasProjectFilterChanged() {
|
||||
|
|
@ -82,6 +82,18 @@ public class FilterUtils {
|
|||
"companyFilterChanged"));
|
||||
}
|
||||
|
||||
public static void writeProjectPlanningFilterChanged(boolean changed) {
|
||||
Sessions.getCurrent().setAttribute("companyFilterPlanningChanged",
|
||||
changed);
|
||||
}
|
||||
|
||||
public static boolean hasProjectPlanningFilterChanged() {
|
||||
return (Sessions.getCurrent().getAttribute(
|
||||
"companyFilterPlanningChanged") != null)
|
||||
&& ((Boolean) Sessions.getCurrent().getAttribute(
|
||||
"companyFilterPlanningChanged"));
|
||||
}
|
||||
|
||||
// Resources load filter
|
||||
|
||||
public static LocalDate readResourceLoadsStartDate() {
|
||||
|
|
|
|||
|
|
@ -389,4 +389,13 @@ public class BandboxMultipleSearch extends HtmlMacroComponent {
|
|||
return heightBbox;
|
||||
}
|
||||
|
||||
public void addSelectedElements(List<FilterPair> sessionFilterPairs) {
|
||||
selectedFilters.clear();
|
||||
for (FilterPair filterPair : sessionFilterPairs) {
|
||||
addFilter(filterPair);
|
||||
}
|
||||
updateselectedFiltersText();
|
||||
updateBandboxValue();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -280,7 +280,8 @@ public class OrderCRUDController extends GenericForwardComposer {
|
|||
private void loadLabels() {
|
||||
List<FilterPair> sessionFilterPairs = FilterUtils
|
||||
.readProjectsParameters();
|
||||
if (sessionFilterPairs != null && !sessionFilterPairs.isEmpty()) {
|
||||
// Allow labels when list is empty
|
||||
if (sessionFilterPairs != null) {
|
||||
for (FilterPair filterPair : sessionFilterPairs) {
|
||||
|
||||
FilterPair toadd;
|
||||
|
|
@ -1496,6 +1497,7 @@ public class OrderCRUDController extends GenericForwardComposer {
|
|||
public void onApplyFilter() {
|
||||
OrderPredicate predicate = createPredicate();
|
||||
storeSessionVariables();
|
||||
FilterUtils.writeProjectFilterChanged(true);
|
||||
if (predicate != null && checkIncludeOrderElements.isChecked()) {
|
||||
// Force reload conversation state in oderModel
|
||||
getOrders();
|
||||
|
|
@ -1509,7 +1511,6 @@ public class OrderCRUDController extends GenericForwardComposer {
|
|||
FilterUtils.writeProjectsFilter(filterStartDate.getValue(),
|
||||
filterFinishDate.getValue(),
|
||||
getSelectedBandboxAsTaskGroupFilters());
|
||||
FilterUtils.writeProjectFilterChanged(true);
|
||||
}
|
||||
|
||||
private List<FilterPair> getSelectedBandboxAsTaskGroupFilters() {
|
||||
|
|
@ -1872,6 +1873,7 @@ public class OrderCRUDController extends GenericForwardComposer {
|
|||
public void readSessionFilterDates() {
|
||||
filterStartDate.setValue(FilterUtils.readProjectsStartDate());
|
||||
filterFinishDate.setValue(FilterUtils.readProjectsEndDate());
|
||||
loadLabels();
|
||||
}
|
||||
|
||||
private Popup jirasyncPopup;
|
||||
|
|
|
|||
|
|
@ -152,11 +152,8 @@ public class CompanyPlanningController implements Composer {
|
|||
private void loadPredefinedBandboxFilter() {
|
||||
List<FilterPair> sessionFilterPairs = FilterUtils
|
||||
.readProjectsParameters();
|
||||
if (sessionFilterPairs != null && !sessionFilterPairs.isEmpty()) {
|
||||
bdFilters.clear();
|
||||
for (FilterPair filterPair : sessionFilterPairs) {
|
||||
bdFilters.addSelectedElement(filterPair);
|
||||
}
|
||||
if (sessionFilterPairs != null) {
|
||||
bdFilters.addSelectedElements(sessionFilterPairs);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -323,7 +320,7 @@ public class CompanyPlanningController implements Composer {
|
|||
};
|
||||
}
|
||||
|
||||
public void readSessionVariables() {
|
||||
public void readSessionVariablesIntoComponents() {
|
||||
filterStartDate.setValue(FilterUtils.readProjectsStartDate());
|
||||
filterFinishDate.setValue(FilterUtils.readProjectsEndDate());
|
||||
loadPredefinedBandboxFilter();
|
||||
|
|
@ -332,10 +329,14 @@ public class CompanyPlanningController implements Composer {
|
|||
public void onApplyFilter() {
|
||||
FilterUtils.writeProjectsFilter(filterStartDate.getValue(),
|
||||
filterFinishDate.getValue(), bdFilters.getSelectedElements());
|
||||
FilterUtils.writeProjectFilterChanged(true);
|
||||
FilterUtils.writeProjectPlanningFilterChanged(true);
|
||||
filterByPredicate(createPredicate());
|
||||
}
|
||||
|
||||
public void loadSessionFiltersIntoBandbox() {
|
||||
bdFilters.addSelectedElements(FilterUtils.readProjectsParameters());
|
||||
}
|
||||
|
||||
private TaskGroupPredicate createPredicate() {
|
||||
List<FilterPair> listFilters = (List<FilterPair>) bdFilters
|
||||
.getSelectedElements();
|
||||
|
|
@ -368,6 +369,11 @@ public class CompanyPlanningController implements Composer {
|
|||
planner.invalidate();
|
||||
}
|
||||
|
||||
public void setPredicate() {
|
||||
model.setConfigurationToPlanner(planner, additional,
|
||||
doubleClickCommand, createPredicate());
|
||||
}
|
||||
|
||||
public void setTabsController(MultipleTabsPlannerController tabsController) {
|
||||
this.tabsController = tabsController;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -236,10 +236,12 @@ public class OrderPlanningController implements Composer {
|
|||
.readOrderStartDate(order));
|
||||
filterFinishDateOrderElement.setValue(FilterUtils
|
||||
.readOrderEndDate(order));
|
||||
if (FilterUtils.readOrderParameters(order) != null) {
|
||||
bdFiltersOrderElement.clear();
|
||||
for (Object each : FilterUtils.readOrderParameters(order)) {
|
||||
bdFiltersOrderElement.addSelectedElement(each);
|
||||
List<FilterPair> sessionFilterPairs = FilterUtils
|
||||
.readOrderParameters(order);
|
||||
if (sessionFilterPairs != null
|
||||
&& bdFiltersOrderElement.getSelectedElements().isEmpty()) {
|
||||
for (Object each : sessionFilterPairs) {
|
||||
bdFiltersOrderElement.addSelectedElement(each);
|
||||
}
|
||||
}
|
||||
if (FilterUtils.readOrderInheritance(order) != null) {
|
||||
|
|
|
|||
|
|
@ -115,24 +115,21 @@ public class OrdersTabCreator {
|
|||
|
||||
private boolean checkFiltersChanged() {
|
||||
return (FilterUtils.sessionExists() && FilterUtils
|
||||
.hasProjectFilterChanged());
|
||||
.hasProjectPlanningFilterChanged());
|
||||
}
|
||||
|
||||
private void setFiltersUnchanged() {
|
||||
FilterUtils.writeProjectFilterChanged(false);
|
||||
// Sessions.getCurrent()
|
||||
// .getAttribute("companyFilterChanged", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void afterShowAction() {
|
||||
|
||||
orderCRUDController.goToList();
|
||||
if (checkFiltersChanged()) {
|
||||
orderCRUDController.readSessionFilterDates();
|
||||
orderCRUDController.onApplyFilter();
|
||||
setFiltersUnchanged();
|
||||
}
|
||||
setFiltersUnchanged();
|
||||
orderCRUDController.goToList();
|
||||
|
||||
if (breadcrumbs.getChildren() != null) {
|
||||
breadcrumbs.getChildren().clear();
|
||||
|
|
|
|||
|
|
@ -213,17 +213,16 @@ public class PlanningTabCreator {
|
|||
}
|
||||
|
||||
private void setFiltersUnchanged() {
|
||||
// True??
|
||||
FilterUtils.writeProjectFilterChanged(false);
|
||||
FilterUtils.writeProjectPlanningFilterChanged(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void afterShowAction() {
|
||||
if (checkFiltersChanged()) {
|
||||
companyPlanningController.readSessionVariables();
|
||||
companyPlanningController.onApplyFilter();
|
||||
companyPlanningController
|
||||
.readSessionVariablesIntoComponents();
|
||||
setFiltersUnchanged();
|
||||
}
|
||||
setFiltersUnchanged();
|
||||
|
||||
companyPlanningController.setConfigurationForPlanner();
|
||||
breadcrumbs.getChildren().clear();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue