Browse Source

Merge branch 'release/10.0' of ssh://cloud.finedevelop.com:7999/~lanlan/design into release/10.0

feature/big-screen
Lanlan 4 years ago
parent
commit
81be155253
  1. 11
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  2. 38
      designer-base/src/main/java/com/fr/design/PluginClassRefreshManager.java
  3. 39
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  4. 15
      designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java
  5. 14
      designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java
  6. 16
      designer-form/src/main/java/com/fr/design/mainframe/widget/ui/WidgetBasicPropertyPaneFactory.java

11
designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java

@ -310,8 +310,15 @@ public class EnvChangeEntrance {
String content = PluginErrorRemindHandler.pluginErrorContent();
if (StringUtils.isNotEmpty(content)) {
PluginErrorRemindDialog dialog = new PluginErrorRemindDialog(DesignerContext.getDesignerFrame(), content);
dialog.setVisible(true);
// 该操作需要在当前awt操作之后执行,使用SwingUtilities.invokeLater将其置于awt操作对列末尾
// 若使用UIUtil.invokeLaterIfNeeded,会立即执行,影响其他UI操作
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
PluginErrorRemindDialog dialog = new PluginErrorRemindDialog(DesignerContext.getDesignerFrame(), content);
dialog.setVisible(true);
}
});
}
}

38
designer-base/src/main/java/com/fr/design/PluginClassRefreshManager.java

@ -39,6 +39,23 @@ public class PluginClassRefreshManager {
}
};
private final PluginEventListener beforeAllPluginActive = new PluginEventListener() {
@Override
public void on(PluginEvent event) {
PluginListenerRegistration.getInstance().stopListen(pluginAfterRunEventListener);
}
};
private final PluginEventListener afterAllPluginsActive = new PluginEventListener() {
@Override
public void on(PluginEvent event) {
PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, pluginAfterRunEventListener);
if (DesignerLaunchStatus.getStatus() != DesignerLaunchStatus.WORKSPACE_INIT_COMPLETE) {
HistoryTemplateListCache.getInstance().reloadAllEditingTemplate();
}
}
};
public static PluginClassRefreshManager getInstance() {
return INSTANCE;
@ -50,29 +67,20 @@ public class PluginClassRefreshManager {
}
private PluginClassRefreshManager() {
PluginListenerRegistration.getInstance().listen(PluginEventType.BeforeAllActive, new PluginEventListener() {
@Override
public void on(PluginEvent event) {
removePluginListener();
}
});
PluginListenerRegistration.getInstance().listen(PluginEventType.AfterAllActive, new PluginEventListener() {
@Override
public void on(PluginEvent event) {
addPluginListener();
if (DesignerLaunchStatus.getStatus() != DesignerLaunchStatus.WORKSPACE_INIT_COMPLETE) {
HistoryTemplateListCache.getInstance().reloadAllEditingTemplate();
}
}
});
PluginListenerRegistration.getInstance().listen(PluginEventType.BeforeAllActive, beforeAllPluginActive);
PluginListenerRegistration.getInstance().listen(PluginEventType.AfterAllActive, afterAllPluginsActive);
}
public void removePluginListener() {
PluginListenerRegistration.getInstance().stopListen(this.pluginAfterRunEventListener);
PluginListenerRegistration.getInstance().stopListen(this.beforeAllPluginActive);
PluginListenerRegistration.getInstance().stopListen(this.afterAllPluginsActive);
}
public void addPluginListener() {
PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, this.pluginAfterRunEventListener);
PluginListenerRegistration.getInstance().listen(PluginEventType.BeforeAllActive, beforeAllPluginActive);
PluginListenerRegistration.getInstance().listen(PluginEventType.AfterAllActive, afterAllPluginsActive);
}
}

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

@ -47,7 +47,6 @@ import com.fr.design.menu.MenuDef;
import com.fr.design.menu.NameSeparator;
import com.fr.design.menu.ShortCut;
import com.fr.design.preview.PagePreview;
import com.fr.design.ui.util.UIUtil;
import com.fr.design.write.submit.DBManipulationInWidgetEventPane;
import com.fr.design.write.submit.DBManipulationPane;
import com.fr.event.EventDispatcher;
@ -80,6 +79,7 @@ import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JOptionPane;
import javax.swing.SwingWorker;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.undo.UndoManager;
import java.util.ArrayList;
@ -340,17 +340,34 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
public void refreshResource(FILE file) {
try {
this.template = JTemplateFactory.asIOFile(file, this.suffix());
setTarget(this.template);
// 先移除旧的。
removeCenterPane();
// 加入新的
addCenterPane();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception {
setTargetByFile(file);
return null;
}
@Override
public void done() {
try {
get();
// 先移除旧的。
removeCenterPane();
// 加入新的
addCenterPane();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}.execute();
}
private void setTargetByFile(FILE file) {
this.template = JTemplateFactory.asIOFile(file, this.suffix());
setTarget(this.template);
}
private void addCenterPane() {

15
designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java

@ -116,31 +116,22 @@ public class EnvChangeEntranceTest {
Workspace workspace = EasyMock.mock(Workspace.class);
EasyMock.expect(workspace.isLocal()).andReturn(false).once();
EasyMock.expect(workspace.isLocal()).andReturn(true).times(2);
EasyMock.expect(workspace.isLocal()).andReturn(true).once();
PowerMock.mockStatic(WorkContext.class);
EasyMock.expect(WorkContext.getCurrent()).andReturn(workspace).anyTimes();
PowerMock.mockStatic(PluginErrorRemindHandler.class);
EasyMock.expect(PluginErrorRemindHandler.pluginErrorContent()).andReturn("").once();
EasyMock.expect(PluginErrorRemindHandler.pluginErrorContent()).andReturn("111").once();
PluginErrorRemindDialog dialog = EasyMock.mock(PluginErrorRemindDialog.class);
PowerMock.expectNew(PluginErrorRemindDialog.class, EasyMock.anyObject(Frame.class), EasyMock.anyString()).andReturn(dialog).once();
dialog.setVisible(true);
EasyMock.expectLastCall();
EasyMock.replay(workspace, dialog);
EasyMock.replay(workspace);
PowerMock.replayAll();
EnvChangeEntrance entrance = EnvChangeEntrance.getInstance();
entrance.pluginErrorRemind();
entrance.pluginErrorRemind();
entrance.pluginErrorRemind();
EasyMock.verify(workspace, dialog);
EasyMock.verify(workspace);
PowerMock.verifyAll();
} catch (Exception e) {
Assert.fail();

14
designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java

@ -14,13 +14,16 @@ import com.fr.design.designer.creator.XWTitleLayout;
import com.fr.design.designer.creator.cardlayout.XWCardTagLayout;
import com.fr.design.dialog.AttrScrollPane;
import com.fr.design.dialog.BasicScrollPane;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.JForm;
import com.fr.design.widget.DataModify;
import com.fr.design.widget.FormWidgetDefinePaneFactoryBase;
import com.fr.design.widget.Operator;
@ -147,6 +150,7 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
}
};
freshPropertyMode(innerCreator);
if (isExtraWidget) {
return;
}
@ -159,6 +163,16 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
}
private static void freshPropertyMode(XCreator xCreator) {
if (!(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate() instanceof JForm)) {
if (xCreator instanceof XWParameterLayout) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_PARA);
} else {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_PARA_WIDGET);
}
}
}
private void initDefinePane() {
currentEditorDefinePane = null;
XCreator creator = getXCreatorDedicated();

16
designer-form/src/main/java/com/fr/design/mainframe/widget/ui/WidgetBasicPropertyPaneFactory.java

@ -1,10 +1,6 @@
package com.fr.design.mainframe.widget.ui;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.mainframe.JForm;
/**
* Created by kerry on 2017/9/30.
@ -12,7 +8,6 @@ import com.fr.design.mainframe.JForm;
public class WidgetBasicPropertyPaneFactory {
public static FormBasicPropertyPane createBasicPropertyPane(XCreator xCreator) {
freshPropertyMode(xCreator);
if (xCreator.supportSetVisible() && xCreator.supportSetEnable()) {
return new FormBasicWidgetPropertyPane();
}
@ -23,15 +18,4 @@ public class WidgetBasicPropertyPaneFactory {
}
}
private static void freshPropertyMode(XCreator xCreator) {
if (!(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate() instanceof JForm)) {
if (xCreator instanceof XWParameterLayout) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_PARA);
} else {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_PARA_WIDGET);
}
}
}
}

Loading…
Cancel
Save