diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/experiment/ProjectSelectionTreeGridContainer.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/experiment/ProjectSelectionTreeGridContainer.java index 3e3d745052c8b727c0d56b5d2a4b47bebd31687e..0e0b1051738a32539725913d39b4158ceac0efbd 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/experiment/ProjectSelectionTreeGridContainer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/experiment/ProjectSelectionTreeGridContainer.java @@ -430,6 +430,29 @@ public final class ProjectSelectionTreeGridContainer extends LayoutContainer imp return project.getCode() + " (" + project.getGroup().getCode() + ")"; } + // equals is needed because of weird TreeGrid implementation in GXT + // to be able to selection of previously selected project after refresh of the tree + // #selectByIdentifierIfPossible() + @Override + public boolean equals(Object obj) + { + if (obj == this) + { + return true; + } + if (obj instanceof ProjectItemModel == false) + { + return false; + } + final ProjectItemModel that = (ProjectItemModel) obj; + return this.getIdentifier().equals(that.getIdentifier()); + } + + private String getIdentifier() + { + return get(ModelDataPropertyNames.PROJECT_IDENTIFIER); + } + } private static class GroupItemModel extends BaseModelDataWithCode