Browse Source

REPORT-51992 设计器性能提升-缩略图占内存优化

feature/10.0
Henry.Wang 4 years ago
parent
commit
a7cd43294e
  1. 2
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java
  2. 22
      designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java
  3. 2
      designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java
  4. 3
      designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java
  5. 24
      designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java

2
designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java

@ -298,7 +298,7 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter {
WAbsoluteLayout wabs = (WAbsoluteLayout)container.toData();
fix(creator,creator.getX(),creator.getY());
wabs.setBounds(creator.toData(),creator.getBounds());
XElementCase.updateECImage(creator);
//XElementCase.updateECImage2(creator);
XWAbsoluteLayout layout = (XWAbsoluteLayout) container;
layout.updateBoundsWidget(creator);
}

22
designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java

@ -279,22 +279,14 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
setEditorIcon(toData().getECImage() == null ? DEFAULT_BACKGROUND : toData().getECImage());
}
public static void updateECImage(XCreator creator) {
if (creator instanceof XWTitleLayout) {
XWTitleLayout xwTitleLayout = (XWTitleLayout) creator;
for (int i = 0; i < xwTitleLayout.getComponentCount(); i++) {
Component component = xwTitleLayout.getComponent(i);
if (component instanceof XElementCase) {
XElementCase xElementCase = (XElementCase) component;
xElementCase.toData().getElementCaseImage().updateImage(() -> {
xElementCase.setEditorIcon(xElementCase.toData().getECImage() == null ? DEFAULT_BACKGROUND : xElementCase.toData().getECImage());
if (xElementCase.designer != null) {
xElementCase.designer.repaint();
}
});
}
public void updateECImage() {
XElementCase self = this;
self.toData().getElementCaseImage().updateImage(() -> {
self.setEditorIcon(self.toData().getECImage() == null ? DEFAULT_BACKGROUND : self.toData().getECImage());
if (self.designer != null) {
self.designer.repaint();
}
}
});
}

2
designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java

@ -21,7 +21,6 @@ import com.fr.design.mainframe.FormArea;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.form.ui.Connector;
import com.fr.form.ui.ElementCaseImage;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
@ -336,7 +335,6 @@ public class XWAbsoluteLayout extends XLayoutContainer {
for (int i = 0, count = abs.getWidgetCount(); i < count; i++) {
BoundsWidget bw = (BoundsWidget) abs.getWidget(i);
if (bw != null) {
ElementCaseImage.adjustImageSize(bw);
Rectangle bounds = bw.getBounds();
XWidgetCreator comp = (XWidgetCreator) XCreatorUtils.createXCreator(bw.getWidget());
if (!comp.acceptType(XWParameterLayout.class)) {

3
designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java

@ -12,7 +12,6 @@ import com.fr.design.mainframe.FormArea;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.ElementCaseImage;
import com.fr.form.ui.PaddingMargin;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
@ -684,7 +683,6 @@ public class XWFitLayout extends XLayoutContainer {
for (int i=0, num=layout.getWidgetCount(); i<num ; i++) {
BoundsWidget bw = (BoundsWidget)layout.getWidget(i);
if (bw != null) {
ElementCaseImage.adjustImageSize(bw);
Rectangle bounds = bw.getBounds();
bw.setBackupBounds(bounds);
XWidgetCreator comp = (XWidgetCreator) XCreatorUtils.createXCreator(bw.getWidget());
@ -768,7 +766,6 @@ public class XWFitLayout extends XLayoutContainer {
Rectangle rec = recalculateWidgetBounds(wgtBound, hors, veris);
wgt.setBounds(rec);
creator.toData().updateChildBounds(rec);
XElementCase.updateECImage(creator);
if (rec.x == 0) {
containerHeight += rec.height;
}

24
designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java

@ -6,10 +6,12 @@ import com.fr.design.designer.beans.location.Direction;
import com.fr.design.designer.creator.XComponent;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XElementCase;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.designer.creator.XWTitleLayout;
import com.fr.design.designer.creator.cardlayout.XWCardTagLayout;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.file.HistoryTemplateListCache;
@ -18,6 +20,7 @@ import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.Widget;
import com.fr.log.FineLoggerFactory;
import java.awt.Component;
import java.awt.LayoutManager;
import java.awt.Rectangle;
import java.util.ArrayList;
@ -278,11 +281,32 @@ public class FormSelection {
creator.setBackupBound(backupBounds);
}
layoutAdapter.fix(creator);
resetElementCaseImage(creator);
}
i++;
}
}
/**
* @Description 重置报表块缩略图
* @param: creator
* @return void
* @Author Henry.Wang
* @Date 2021/5/21 14:59
**/
public void resetElementCaseImage(XCreator creator) {
if (creator instanceof XWTitleLayout) {
XWTitleLayout xwTitleLayout = (XWTitleLayout) creator;
for (int i = 0; i < xwTitleLayout.getComponentCount(); i++) {
Component component = xwTitleLayout.getComponent(i);
if (component instanceof XElementCase) {
XElementCase xElementCase = (XElementCase) component;
xElementCase.updateECImage();
}
}
}
}
/**
* 检查下有没有参数面板如果存在处理下参数面板造成的偏移量
* @param rectangle

Loading…
Cancel
Save