Browse Source

Merge pull request #4659 in DESIGN/design from feature/10.0 to research/10.0

* commit '8863345a0778d44e7d601c37d59dc51bfe818f8a':
  KERNEL-8038 设计器存在一些静态方法导致最近关闭的模板对象不释放内存
  KERNEL-8038 设计器存在一些静态方法导致最近关闭的模板对象不释放内存
  KERNEL-8038 设计器存在一些静态方法导致最近关闭的模板对象不释放内存
  KERNEL-8038 设计器存在一些静态方法导致最近关闭的模板对象不释放内存
  fix
  REPORT-53875 新增组件库弹框
  KERNEL-8038 设计器存在一些静态方法导致最近关闭的模板对象不释放内存
research/10.0
superman 3 years ago
parent
commit
290311e4b0
  1. 5
      designer-base/src/main/java/com/fr/design/file/Releasable.java
  2. 35
      designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java
  3. 10
      designer-base/src/main/java/com/fr/design/login/message/DesignerModuleClickType.java
  4. 12
      designer-form/src/main/java/com/fr/design/gui/controlpane/EventPropertyPane.java
  5. 12
      designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java
  6. 8
      designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java
  7. 19
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  8. 28
      designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java
  9. 16
      designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java

5
designer-base/src/main/java/com/fr/design/file/Releasable.java

@ -0,0 +1,5 @@
package com.fr.design.file;
public interface Releasable {
void releaseResources();
}

35
designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java

@ -172,7 +172,7 @@ public class UIEastResizableContainer extends JPanel {
leftPane.setBounds(0, topToolPaneHeight, leftPaneWidth, getHeight() - topToolPaneHeight);
// parameterPane.setBounds(20, 0, 230, getParameterPaneHeight());//10,0,230,462
rightPane.setBounds(leftPaneWidth, 0, containerWidth-leftPaneWidth, getHeight());//20,0,230,0
rightPane.setBounds(leftPaneWidth, 0, containerWidth - leftPaneWidth, getHeight());//20,0,230,0
}
@Override
@ -242,7 +242,27 @@ public class UIEastResizableContainer extends JPanel {
* 伸缩右子面板时触发此方法
*/
public void onResize() {
// do nothing here
refreshContainer();
if (DesignModeContext.isAuthorityEditing()) {
DesignerContext.getDesignerFrame().doResize();
}
}
public void showContainer() {
if (containerWidth != leftPaneWidth) {
return;
}
containerWidth = preferredWidth;
onResize();
}
public void hideContainer() {
if (containerWidth == leftPaneWidth) {
return;
}
setPreferredWidth(containerWidth);
containerWidth = leftPaneWidth;
onResize();
}
private class TopToolPane extends JPanel {
@ -281,15 +301,9 @@ public class UIEastResizableContainer extends JPanel {
public void mouseClicked(MouseEvent e) {
if (e.getX() <= ARROW_RANGE) {
if (containerWidth == leftPaneWidth) {
containerWidth = preferredWidth;
showContainer();
} else {
setPreferredWidth(containerWidth);
containerWidth = leftPaneWidth;
}
onResize();
refreshContainer();
if (DesignModeContext.isAuthorityEditing()) {
DesignerContext.getDesignerFrame().doResize();
hideContainer();
}
}
}
@ -316,5 +330,4 @@ public class UIEastResizableContainer extends JPanel {
g.drawImage(button, 18, 7, 5, 10, null);
}
}
}

10
designer-base/src/main/java/com/fr/design/login/message/DesignerModuleClickType.java

@ -3,11 +3,16 @@ package com.fr.design.login.message;
import com.fr.config.ServerPreferenceConfig;
import com.fr.design.dialog.NotificationDialogAction;
import com.fr.design.extra.WebViewDlgHelper;
import com.fr.design.mainframe.BaseJForm;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.upm.UpmFinder;
import com.fr.design.utils.DesignUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.stable.bridge.StableFactory;
import com.fr.stable.os.Arch;
import com.fr.stable.os.OperatingSystem;
@ -39,7 +44,10 @@ public enum DesignerModuleClickType {
@Override
public void doClick() {
try {
// TODO
BaseJForm jform = StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG, BaseJForm.class);
DesignerContext.getDesignerFrame().addAndActivateJTemplate((JTemplate<?, ?>) jform);
EastRegionContainerPane.getInstance().showContainer();
EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_LIB);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}

12
designer-form/src/main/java/com/fr/design/gui/controlpane/EventPropertyPane.java

@ -2,6 +2,7 @@ package com.fr.design.gui.controlpane;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.properties.EventPropertyTable;
import com.fr.design.file.Releasable;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.widget.EventCreator;
@ -13,7 +14,7 @@ import com.fr.stable.Nameable;
/**
* Created by kerry on 5/17/21
*/
public class EventPropertyPane extends UIListGroupControlPane {
public class EventPropertyPane extends UIListGroupControlPane implements Releasable {
private XCreator creator;
private FormDesigner designer;
@ -24,6 +25,12 @@ public class EventPropertyPane extends UIListGroupControlPane {
this.designer = designer;
}
@Override
public void releaseResources() {
creator = null;
designer = null;
this.removeAll();
}
/**
* 刷新
@ -44,7 +51,6 @@ public class EventPropertyPane extends UIListGroupControlPane {
}
public void populateNameObjects() {
Widget widget = creator.toData();
populateNameObjects(widget);
@ -93,7 +99,7 @@ public class EventPropertyPane extends UIListGroupControlPane {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Add_Event");
}
protected String getWrapperLabelText(){
protected String getWrapperLabelText() {
return Toolkit.i18nText("Fine-Design_Report_Event");
}

12
designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java

@ -7,6 +7,7 @@ import com.fr.design.constants.UIConstants;
import com.fr.design.designer.beans.events.DesignerEditListener;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.file.Releasable;
import com.fr.design.fun.FormWidgetOptionProvider;
import com.fr.design.gui.core.FormWidgetOption;
import com.fr.design.gui.core.UserDefinedWidgetOption;
@ -56,7 +57,7 @@ import java.awt.event.MouseEvent;
/**
* @author null
*/
public class FormParaWidgetPane extends JPanel {
public class FormParaWidgetPane extends JPanel implements Releasable {
private static FormParaWidgetPane THIS;
private final static int BORDER = 5;
private final static int WIDGET_WIDTHGAP = 4;
@ -119,6 +120,15 @@ public class FormParaWidgetPane extends JPanel {
return THIS;
}
public static FormParaWidgetPane getInstance(){
return THIS;
}
@Override
public void releaseResources() {
designer = null;
}
public FormParaWidgetPane() {
setLayout(new FlowLayout(FlowLayout.LEFT));
DesignerContext.getDesignerFrame().getCenterTemplateCardPane().addComponentListener(new ComponentAdapter() {

8
designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java

@ -2,6 +2,7 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.design.dialog.BasicPane;
import com.fr.design.file.Releasable;
import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo;
@ -23,7 +24,7 @@ import java.util.List;
* Date: 14-7-8
* Time: 下午8:18
*/
public class FormWidgetDetailPane extends FormDockView{
public class FormWidgetDetailPane extends FormDockView implements Releasable {
private static final int ONLINE_TAB = 1;
private JPanel centerPane;
@ -52,6 +53,11 @@ public class FormWidgetDetailPane extends FormDockView{
private static FormWidgetDetailPane singleton = new FormWidgetDetailPane();
}
@Override
public void releaseResources() {
setEditingFormDesigner(null);
}
public String getViewTitle() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Tree_And_Table");
}

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

@ -116,7 +116,8 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
private static final String[] CARDNAME = new String[]{FORM_CARD, ELEMENTCASE_CARD};
private static final int TOOLBARPANEDIMHEIGHT_FORM = 60;
//当前使用的表单设计器
private static FormDesigner currentFormDesign;
//表单设计器
private FormDesigner formDesign;
//格子设计器
@ -858,6 +859,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
EastRegionContainerPane.getInstance().addParameterPane(parameterPropertyPane);
refreshWidgetLibPane();
currentFormDesign = formDesign;
}
private void refreshWidgetLibPane() {
@ -1090,4 +1092,19 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
}
}
}
@Override
public void whenClose() {
super.whenClose();
releaseResources();
}
private void releaseResources() {
if (ComparatorUtils.equals(currentFormDesign, formDesign)) {
FormParaWidgetPane.getInstance().releaseResources();
FormWidgetDetailPane.getInstance().releaseResources();
WidgetPropertyPane.getInstance().releaseResources();
currentFormDesign = null;
}
}
}

28
designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java

@ -9,6 +9,7 @@ import com.fr.design.designer.creator.*;
import com.fr.design.designer.creator.cardlayout.XWCardTagLayout;
import com.fr.design.designer.properties.mobile.MobileBookMarkPropertyUI;
import com.fr.design.designer.properties.mobile.MobileStylePropertyUI;
import com.fr.design.file.Releasable;
import com.fr.design.form.util.FormDesignerUtils;
import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.gui.controlpane.EventPropertyPane;
@ -32,7 +33,7 @@ import java.util.Set;
* 控件属性表绘制
* Modified by fanglei
*/
public class WidgetPropertyPane extends FormDockView implements BaseWidgetPropertyPane {
public class WidgetPropertyPane extends FormDockView implements BaseWidgetPropertyPane, Releasable {
private static final int PADDING = 10;
private static final int PADDING_M = 12;
@ -68,6 +69,31 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
setLayout(FRGUIPaneFactory.createBorderLayout());
}
@Override
public void releaseResources() {
setEditingFormDesigner(null);
if (eventTable != null) {
eventTable.releaseResources();
}
if (formWidgetCardPane != null) {
formWidgetCardPane.releaseResources();
}
if (wsp != null) {
wsp.removeAll();
}
designer.getSelectionModel().reset();
formWidgetCardPane = null;
eventTable = null;
widgetPropertyTables = null;
mobileExtraPropertyPanes = null;
designer = null;
psp = null;
wsp = null;
tabsHeaderIconPane = null;
lastAffectedCreator = null;
this.removeAll();
}
@Override
protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Control_Setting");

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

@ -14,6 +14,7 @@ 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.Releasable;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
@ -48,7 +49,7 @@ import java.awt.BorderLayout;
/**
* Created by ibm on 2017/7/25.
*/
public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
public class FormWidgetCardPane extends AbstractAttrNoScrollPane implements Releasable {
private AttributeChangeListener listener;
private FormDesigner designer;
//当前的编辑器属性定义面板
@ -86,7 +87,7 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
return null;
} else if (xLayoutContainer.acceptType(XWAbsoluteLayout.class)) {
return new WidgetAbsoluteBoundPane(xCreator);
} else if(xCreator.acceptType(XWCardTagLayout.class)){
} else if (xCreator.acceptType(XWCardTagLayout.class)) {
return new WidgetCardTagBoundPane(xCreator);
}
return new WidgetBoundPane(xCreator);
@ -281,4 +282,15 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED);
}
@Override
public void releaseResources() {
listener = null;
designer = null;
currentEditorDefinePane = null;
widgetPropertyPane = null;
attriCardPane = null;
xCreator = null;
widgetBoundPane = null;
this.removeAll();
}
}

Loading…
Cancel
Save