Browse Source

Merge pull request #6339 in DESIGN/design from feature/10.0 to feature/x

* commit 'fae1d888f5d3c726263545b6f9a3d700f6224382':
  REPORT-61356  fix 统一api使用入口
  REPORT-60253 安装大数据集导出插件后,模板从本地切换到远程,再切换到本地,触发保存模板会弹窗 保存失败,有npe报错
  REPORT-61356 设计器启动加载完成后,停留的空白时间变长
feature/x
superman 3 years ago
parent
commit
ca6f96d86c
  1. 4
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  2. 5
      designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java
  3. 78
      designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java

4
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -440,7 +440,9 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
*/ */
@Deprecated @Deprecated
public void refreshResource() { public void refreshResource() {
refreshResource(this.editingFILE); if (JTemplateFactory.isAvailable()) {
refreshResource(this.editingFILE);
}
} }
public void refreshResource(FILE file) { public void refreshResource(FILE file) {

5
designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java

@ -93,4 +93,7 @@ public final class JTemplateFactory {
ALL_APP.remove(app); ALL_APP.remove(app);
} }
} }
}
public static boolean isAvailable() {
return !ALL_APP.isEmpty();
}}

78
designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java

@ -17,6 +17,7 @@ import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener; import com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.observer.PluginEventType;
import com.fr.stable.os.support.OSBasedAction; import com.fr.stable.os.support.OSBasedAction;
import com.fr.stable.os.support.OSSupportCenter; import com.fr.stable.os.support.OSSupportCenter;
@ -38,6 +39,17 @@ public class NorthRegionContainerPane extends JPanel {
private JMenuBar menuBar; private JMenuBar menuBar;
private PluginFilter pluginFilter = new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraDesign);
}
};
private volatile boolean existDesignExtraPlugin;
public static NorthRegionContainerPane getInstance() { public static NorthRegionContainerPane getInstance() {
if (THIS == null) { if (THIS == null) {
synchronized (NorthRegionContainerPane.class) { synchronized (NorthRegionContainerPane.class) {
@ -66,34 +78,64 @@ public class NorthRegionContainerPane extends JPanel {
//hugh: private修改为protected方便oem的时候修改右上的组件构成 //hugh: private修改为protected方便oem的时候修改右上的组件构成
//顶部日志+登陆按钮 //顶部日志+登陆按钮
final JPanel northEastPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); final JPanel northEastPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
initPluginListener(northEastPane, ad);
refreshNorthEastPane(northEastPane, ad);
return northEastPane;
}
private void initPluginListener(JPanel northEastPane, ToolBarMenuDock ad) {
//优先级为-1,保证最后全面刷新一次 //优先级为-1,保证最后全面刷新一次
GeneralContext.listenPluginRunningChanged(new PluginEventListener(-1) { PluginEventListener pluginOnRunOrStopListener = new PluginEventListener(-1) {
@Override @Override
public void on(PluginEvent event) { public void on(PluginEvent event) {
refreshAll(northEastPane, ad);
refreshNorthEastPane(northEastPane, ad);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (DesignerContext.getDesignerFrame() == null) {
return;
}
DesignerContext.getDesignerFrame().refresh();
DesignerContext.getDesignerFrame().repaint();
}
});
} }
}, new PluginFilter() { };
// 在设计器启动时仅在最后一个插件启用时候进行刷新一次 如果插件启用过程中存在实现了设计器接口的插件
PluginEventListener afterAllPluginsActiveListener = new PluginEventListener() {
@Override
public void on(PluginEvent event) {
//优先级为-1,保证最后全面刷新一次
GeneralContext.listenPluginRunningChanged(pluginOnRunOrStopListener, pluginFilter);
// 在设计器启动时仅在最后一个插件启用时候进行刷新一次 如果插件启用过程中存在实现了设计器接口的插件
boolean needRefresh = DesignerContext.getDesignerFrame() != null && DesignerContext.getDesignerFrame().isVisible() && existDesignExtraPlugin;
if (needRefresh) {
refreshAll(northEastPane, ad);
}
}
};
PluginEventListener beforeAllPluginStopListener = new PluginEventListener() {
@Override
public void on(PluginEvent event) {
GeneralContext.stopListenPlugin(pluginOnRunOrStopListener);
}
};
PluginEventListener pluginEventListener = new PluginEventListener() {
@Override @Override
public boolean accept(PluginContext context) { public void on(PluginEvent event) {
existDesignExtraPlugin = true;
}
};
GeneralContext.listenPluginRunningChanged(pluginEventListener, pluginFilter);
GeneralContext.listenPlugin(PluginEventType.AfterAllActive, afterAllPluginsActiveListener);
GeneralContext.listenPlugin(PluginEventType.BeforeAllStop, beforeAllPluginStopListener);
return context.contain(PluginModule.ExtraDesign); }
private void refreshAll(JPanel northEastPane, ToolBarMenuDock ad) {
refreshNorthEastPane(northEastPane, ad);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (DesignerContext.getDesignerFrame() == null) {
return;
}
DesignerContext.getDesignerFrame().refresh();
DesignerContext.getDesignerFrame().repaint();
} }
}); });
refreshNorthEastPane(northEastPane, ad);
return northEastPane;
} }
private void refreshNorthEastPane(final JPanel northEastPane, final ToolBarMenuDock ad) { private void refreshNorthEastPane(final JPanel northEastPane, final ToolBarMenuDock ad) {

Loading…
Cancel
Save