Browse Source

Merge branch 'release/10.0' of https://code.fineres.com/scm/~qinghui.liu/design into release/10.0

feature/big-screen
Qinghui.Liu 5 years ago
parent
commit
325488f036
  1. 17
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java
  2. 15
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBar.java
  3. 4
      designer-form/src/main/java/com/fr/design/designer/beans/events/CreatorEventListenerTable.java
  4. 14
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  5. 8
      designer-form/src/test/java/com/fr/design/designer/beans/models/SelectionModelTest.java
  6. 9
      designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java

17
designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java

@ -11,6 +11,7 @@ import com.fr.design.gui.ibutton.UIButtonUI;
import com.fr.design.gui.icontainer.UIEastResizableContainer; import com.fr.design.gui.icontainer.UIEastResizableContainer;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
@ -150,12 +151,18 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
public void on(PluginEvent event) { public void on(PluginEvent event) {
PluginContext context = event.getContext(); PluginContext context = event.getContext();
PluginRuntime runtime = context.getRuntime(); PluginRuntime runtime = context.getRuntime();
Set<PropertyItemPaneProvider> providers = runtime.get(PropertyItemPaneProvider.XML_TAG); final Set<PropertyItemPaneProvider> providers = runtime.get(PropertyItemPaneProvider.XML_TAG);
// UI相关的逻辑 用UI线程执行 不走FinePluginController线程 走FinePluginController线程有几率出问题
// 容易导致FinePluginController持有Swing内部的java.awt.Component$AWTTreeLock 这个锁不能被UI线程之外的线程持有 否则容易造成UI线程被Blocked住
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
for (PropertyItemPaneProvider provider : providers) { for (PropertyItemPaneProvider provider : providers) {
addPropertyItem(provider); addPropertyItem(provider);
} }
updateAllPropertyPane(); updateAllPropertyPane();
} }
}); }
}, filter); }, filter);
PluginListenerRegistration.getInstance().listen( PluginListenerRegistration.getInstance().listen(
PluginEventType.BeforeStop, PluginEventType.BeforeStop,
@ -164,13 +171,17 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
public void on(PluginEvent event) { public void on(PluginEvent event) {
PluginContext context = event.getContext(); PluginContext context = event.getContext();
PluginRuntime runtime = context.getRuntime(); PluginRuntime runtime = context.getRuntime();
Set<PropertyItemPaneProvider> providers = runtime.get(PropertyItemPaneProvider.XML_TAG); final Set<PropertyItemPaneProvider> providers = runtime.get(PropertyItemPaneProvider.XML_TAG);
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
for (PropertyItemPaneProvider provider : providers) { for (PropertyItemPaneProvider provider : providers) {
removePropertyItem(provider); removePropertyItem(provider);
} }
updateAllPropertyPane(); updateAllPropertyPane();
} }
});
}
}, filter); }, filter);
} }

15
designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBar.java

@ -15,6 +15,11 @@ import static com.fr.design.i18n.Toolkit.i18nText;
public class LogHandlerBar extends JPanel implements ItemSelectable { public class LogHandlerBar extends JPanel implements ItemSelectable {
// 可以作为常量 提前初始化 不用每次都去实时频繁的读取
private static final String NORMAL_MARK = i18nText("Fine-Design_Basic_NNormal");
private static final String ALERT_MARK = i18nText("Fine-Design_Basic_Alert");
private static final String SERIOUSLY_MARK = i18nText("Fine-Design_Basic_Seriously");
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private ItemListener listeners; private ItemListener listeners;
private UIButton clear; private UIButton clear;
@ -75,9 +80,13 @@ public class LogHandlerBar extends JPanel implements ItemSelectable {
UIUtil.invokeLaterIfNeeded(new Runnable() { UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override @Override
public void run() { public void run() {
normalLabel.setText(i18nText("Fine-Design_Basic_NNormal") + '(' + getInfo() + ')'); // 这块逻辑执行地很频繁
alertLabel.setText(i18nText("Fine-Design_Basic_Alert") + '(' + getError() + ')'); // 容易造成 AWT 与 FinePluginController 发生死锁
seriouslyLabel.setText(i18nText("Fine-Design_Basic_Seriously") + '(' + getServer() + ')'); // in18Text每次读取 资源的时候 都会走下插件引擎逻辑去读取下插件的资源
// 应该避免每次都去读取 可以作为常量提前初始化好 避免与FinePluginController的竞争
normalLabel.setText(NORMAL_MARK + '(' + getInfo() + ')');
alertLabel.setText(ALERT_MARK + '(' + getError() + ')');
seriouslyLabel.setText(SERIOUSLY_MARK + '(' + getServer() + ')');
} }
}); });
} }

4
designer-form/src/main/java/com/fr/design/designer/beans/events/CreatorEventListenerTable.java

@ -1,8 +1,8 @@
package com.fr.design.designer.beans.events; package com.fr.design.designer.beans.events;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.designer.creator.XComponent; import com.fr.design.designer.creator.XComponent;
import com.fr.design.fun.DesignerEditListenerProvider; import com.fr.design.fun.DesignerEditListenerProvider;
import com.fr.form.main.ExtraFormClassManager;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.injectable.PluginModule;
@ -44,7 +44,7 @@ public class CreatorEventListenerTable {
} }
//触发插件的事件 //触发插件的事件
ExtraFormClassManager manager = PluginModule.getAgent(PluginModule.ExtraForm); ExtraDesignClassManager manager = PluginModule.getAgent(PluginModule.ExtraDesign);
Set<DesignerEditListenerProvider> providers = manager.getArray(DesignerEditListenerProvider.XML_TAG); Set<DesignerEditListenerProvider> providers = manager.getArray(DesignerEditListenerProvider.XML_TAG);
for (DesignerEditListenerProvider provider : providers) { for (DesignerEditListenerProvider provider : providers) {
provider.fireCreatorModified(evt); provider.fireCreatorModified(evt);

14
designer-form/src/main/java/com/fr/design/mainframe/JForm.java

@ -128,6 +128,8 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
//FORM_TAB代表是否点击编辑,用于点击编辑前后菜单的显示 //FORM_TAB代表是否点击编辑,用于点击编辑前后菜单的显示
protected int index = FORM_TAB; protected int index = FORM_TAB;
private PluginEventListener pluginListener;
public JForm() { public JForm() {
super(new Form(new WBorderLayout("form")), "Form"); super(new Form(new WBorderLayout("form")), "Form");
@ -151,8 +153,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
return context.contain(PropertyItemPaneProvider.XML_TAG); return context.contain(PropertyItemPaneProvider.XML_TAG);
} }
}; };
PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, this.pluginListener = new PluginEventListener(PropertyItemPaneProvider.LAST) {
new PluginEventListener(PropertyItemPaneProvider.LAST) {
@Override @Override
public void on(PluginEvent event) { public void on(PluginEvent event) {
PluginContext context = event.getContext(); PluginContext context = event.getContext();
@ -162,7 +163,8 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
addPane(provider); addPane(provider);
} }
} }
}, filter); };
PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, this.pluginListener, filter);
} }
private void initPluginPane() { private void initPluginPane() {
@ -1038,4 +1040,10 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
// richer:form文件 daniel 改成三个字 // richer:form文件 daniel 改成三个字
fileChooser.addChooseFILEFilter(new ChooseFileFilter(FileExtension.FRM, appName + Toolkit.i18nText("Fine-Design_Report_Template_File"))); fileChooser.addChooseFILEFilter(new ChooseFileFilter(FileExtension.FRM, appName + Toolkit.i18nText("Fine-Design_Report_Template_File")));
} }
@Override
public void whenClose() {
// stop的时候 pluginListener 和 PluginFilter 都会移除
PluginListenerRegistration.getInstance().stopListen(this.pluginListener);
}
} }

8
designer-form/src/test/java/com/fr/design/designer/beans/models/SelectionModelTest.java

@ -6,7 +6,6 @@ import com.fr.design.designer.creator.XCreator;
import com.fr.design.fun.ClipboardHandlerProvider; import com.fr.design.fun.ClipboardHandlerProvider;
import com.fr.design.fun.impl.AbstractClipboardHandlerProvider; import com.fr.design.fun.impl.AbstractClipboardHandlerProvider;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.form.main.ExtraFormClassManager;
import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.injectable.PluginModule;
import com.fr.stable.fun.mark.Mutable; import com.fr.stable.fun.mark.Mutable;
import org.easymock.EasyMock; import org.easymock.EasyMock;
@ -59,18 +58,15 @@ public class SelectionModelTest {
EasyMock.expect(designManager.getArray(ClipboardHandlerProvider.XML_TAG)) EasyMock.expect(designManager.getArray(ClipboardHandlerProvider.XML_TAG))
.andReturn(providers) .andReturn(providers)
.anyTimes(); .anyTimes();
ExtraFormClassManager formManager = EasyMock.mock(ExtraFormClassManager.class); EasyMock.expect(designManager.getArray("DesignerEditListenerProvider"))
EasyMock.expect(formManager.getArray("DesignerEditListenerProvider"))
.andReturn(new HashSet<Mutable>()) .andReturn(new HashSet<Mutable>())
.anyTimes(); .anyTimes();
EasyMock.replay(designManager, formManager); EasyMock.replay(designManager);
PowerMock.mockStatic(PluginModule.class); PowerMock.mockStatic(PluginModule.class);
EasyMock.expect(PluginModule.getAgent(PluginModule.ExtraDesign)) EasyMock.expect(PluginModule.getAgent(PluginModule.ExtraDesign))
.andReturn(designManager) .andReturn(designManager)
.anyTimes(); .anyTimes();
EasyMock.expect(PluginModule.getAgent(PluginModule.ExtraForm))
.andReturn(formManager).anyTimes();
PowerMock.replayAll(); PowerMock.replayAll();
} }

9
designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java

@ -31,6 +31,7 @@ import com.fr.form.ui.Widget;
import com.fr.form.ui.WidgetInfoConfig; import com.fr.form.ui.WidgetInfoConfig;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.log.FineLoggerFactory;
import com.fr.report.web.button.Email; import com.fr.report.web.button.Email;
import com.fr.report.web.button.Export; import com.fr.report.web.button.Export;
import com.fr.report.web.button.write.AppendColumnRow; import com.fr.report.web.button.write.AppendColumnRow;
@ -223,8 +224,12 @@ public class EditToolBar extends BasicPane {
if (widget instanceof Button) { if (widget instanceof Button) {
String iconname = ((Button) widget).getIconName(); String iconname = ((Button) widget).getIconName();
if (StringUtils.isNotBlank(iconname)) { if (StringUtils.isNotBlank(iconname)) {
Image iimage = WidgetInfoConfig.getInstance().getIconManager().getIconImage(iconname); Image iconImage = WidgetInfoConfig.getInstance().getIconManager().getIconImage(iconname);
toolBarButton.setIcon(new ImageIcon(iimage)); if (iconImage != null) {
toolBarButton.setIcon(new ImageIcon(iconImage));
} else {
FineLoggerFactory.getLogger().warn(iconname + " can not find in finedb!");
}
} }
} }
} }

Loading…
Cancel
Save