PL-8946 ConcurrentModificationException on login of any user after adding FoldersPane in main window

This commit is contained in:
Yuriy Artamonov 2017-04-17 16:42:47 +04:00
parent 157cc5368c
commit 17f3c4193a
2 changed files with 26 additions and 14 deletions

View File

@ -23,6 +23,7 @@ import com.haulmont.cuba.core.entity.AppFolder;
import com.haulmont.cuba.core.entity.Entity;
import com.haulmont.cuba.core.entity.Folder;
import com.haulmont.cuba.core.global.*;
import com.haulmont.cuba.gui.ComponentsHelper;
import com.haulmont.cuba.gui.WindowManager;
import com.haulmont.cuba.gui.app.core.file.FileUploadDialog;
import com.haulmont.cuba.gui.components.Action.Status;
@ -106,6 +107,8 @@ public class CubaFoldersPane extends VerticalLayout {
protected BackgroundTaskWrapper<Integer, List<AppFolder>> folderUpdateBackgroundTaskWrapper;
protected Frame frame;
public CubaFoldersPane() {
setSizeFull();
setMargin(false);
@ -236,20 +239,13 @@ public class CubaFoldersPane extends VerticalLayout {
AppUI ui = AppUI.getCurrent();
stopExistingFoldersPaneTimer(ui);
ui.addTimer(timer);
} else {
AttachListener attachListener = new AttachListener() {
@Override
public void attach(AttachEvent event) {
AppUI ui = (AppUI) getUI();
stopExistingFoldersPaneTimer(ui);
ui.addTimer(timer);
// execute once
removeAttachListener(this);
}
};
addAttachListener(attachListener);
} else if (frame != null) {
com.haulmont.cuba.gui.components.Window window = ComponentsHelper.getWindowImplementation(frame);
if (window == null) {
throw new IllegalStateException("Null window for CubaFoldersPane");
}
AbstractComponent topLevelFrame = window.unwrapComposition(AbstractComponent.class);
timer.extend(topLevelFrame);
}
}
@ -621,6 +617,14 @@ public class CubaFoldersPane extends VerticalLayout {
StringUtils.isBlank(((AbstractSearchFolder) folder).getFilterComponentId());
}
public void setFrame(Frame frame) {
this.frame = frame;
}
public Frame getFrame() {
return frame;
}
protected class FolderTreeStyleProvider implements Tree.ItemStyleGenerator {
@Override
public String getStyle(Tree source, Object itemId) {

View File

@ -17,6 +17,7 @@
package com.haulmont.cuba.web.gui.components.mainwindow;
import com.haulmont.cuba.gui.components.Frame;
import com.haulmont.cuba.gui.components.mainwindow.FoldersPane;
import com.haulmont.cuba.web.app.folders.CubaFoldersPane;
import com.haulmont.cuba.web.gui.components.WebAbstractComponent;
@ -46,6 +47,13 @@ public class WebFoldersPane extends WebAbstractComponent<CubaFoldersPane> implem
return StringUtils.normalizeSpace(super.getStyleName().replace(C_FOLDERS_PANE, ""));
}
@Override
public void setFrame(Frame frame) {
super.setFrame(frame);
component.setFrame(frame);
}
@Override
public void loadFolders() {
component.loadFolders();