Browse Source

REPORT-13895 release设计器启动时异步加载模板后,目录内容不断刷新

bugfix/10.0
Hades 6 years ago
parent
commit
b35dfc96e3
  1. 48
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  2. 30
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java

48
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java

@ -38,7 +38,6 @@ import com.fr.design.mainframe.toolbar.ToolBarMenuDock;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.menu.MenuManager; import com.fr.design.menu.MenuManager;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.exception.DecryptTemplateException; import com.fr.exception.DecryptTemplateException;
import com.fr.file.FILE; import com.fr.file.FILE;
@ -69,6 +68,7 @@ import javax.swing.JLayeredPane;
import javax.swing.JMenuBar; import javax.swing.JMenuBar;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.UIManager; import javax.swing.UIManager;
import javax.swing.WindowConstants; import javax.swing.WindowConstants;
import javax.swing.border.MatteBorder; import javax.swing.border.MatteBorder;
@ -102,8 +102,6 @@ import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class DesignerFrame extends JFrame implements JTemplateActionListener, TargetModifiedListener { public class DesignerFrame extends JFrame implements JTemplateActionListener, TargetModifiedListener {
@ -243,9 +241,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
private ProgressDialog progressDialog; private ProgressDialog progressDialog;
private ExecutorService fixedThreadPool = Executors.newFixedThreadPool(1);
public DesignerFrame(ToolBarMenuDock ad) { public DesignerFrame(ToolBarMenuDock ad) {
setName(DESIGNER_FRAME_NAME); setName(DESIGNER_FRAME_NAME);
@ -418,7 +413,16 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
public void on(PluginEvent event) { public void on(PluginEvent event) {
refreshNorthEastPane(northEastPane, ad); refreshNorthEastPane(northEastPane, ad);
DesignUtils.refreshDesignerFrame(); SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (DesignerContext.getDesignerFrame() == null) {
return;
}
DesignerContext.getDesignerFrame().refresh();
DesignerContext.getDesignerFrame().repaint();
}
});
} }
}, new PluginFilter() { }, new PluginFilter() {
@ -820,21 +824,23 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* 报表运行环境改变时,需要刷新某些面板 * 报表运行环境改变时,需要刷新某些面板
*/ */
public void refreshEnv() { public void refreshEnv() {
refresh();
DesignerFrameFileDealerPane.getInstance().refreshDockingView();
TemplateTreePane.getInstance().refreshDockingView();
}
/**
* 安装设计器相关插件时的刷新
*/
public void refresh() {
this.setTitle(); this.setTitle();
fixedThreadPool.execute(new Runnable() { TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter());
@Override DesignTableDataManager.clearGlobalDs();
public void run() { EastRegionContainerPane.getInstance().refreshDownPane();
DesignerFrameFileDealerPane.getInstance().refreshDockingView(); JTemplate template = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); if (template != null) {
TemplateTreePane.getInstance().refreshDockingView(); template.refreshToolArea();
DesignTableDataManager.clearGlobalDs(); }
EastRegionContainerPane.getInstance().refreshDownPane();
JTemplate template = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (template != null) {
template.refreshToolArea();
}
}
});
} }
/** /**

30
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java

@ -30,11 +30,18 @@ import com.fr.design.menu.KeySetUtils;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.file.FileNodeFILE; import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.third.org.apache.commons.io.FilenameUtils; import com.fr.third.org.apache.commons.io.FilenameUtils;
@ -68,6 +75,22 @@ import static javax.swing.JOptionPane.WARNING_MESSAGE;
public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarStateChangeListener, ResponseDataSourceChange { public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarStateChangeListener, ResponseDataSourceChange {
static {
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {
DesignUtils.refreshDesignerFrame();
}
}, new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraDesign, ShortCut.TEMPLATE_TREE);
}
});
}
private static final String FILE = "file"; private static final String FILE = "file";
private static volatile DesignerFrameFileDealerPane THIS; private static volatile DesignerFrameFileDealerPane THIS;
@ -163,7 +186,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
* 刷新菜单 * 刷新菜单
*/ */
public void refreshDockingView() { public void refreshDockingView() {
long start = System.currentTimeMillis();
ToolBarDef toolbarDef = new ToolBarDef(); ToolBarDef toolbarDef = new ToolBarDef();
toolbarDef.addShortCut(newFolderAction, refreshTreeAction); toolbarDef.addShortCut(newFolderAction, refreshTreeAction);
if (WorkContext.getCurrent().isLocal()) { if (WorkContext.getCurrent().isLocal()) {
@ -176,7 +199,12 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
} }
toolbarDef.updateToolBar(toolBar); toolbarDef.updateToolBar(toolBar);
resetActionStatus(); resetActionStatus();
long end = System.currentTimeMillis();
System.out.println("----------------------->refreshDockingView 菜单: " + (end - start));
long start1 = System.currentTimeMillis();
refresh(); refresh();
long end1 = System.currentTimeMillis();
System.out.println("-------------------------->菜单 refresh: " + (end1 - start1));
} }

Loading…
Cancel
Save