Browse Source

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

feature/10.0
Henry.Wang 4 years ago
parent
commit
c69fefe8e7
  1. 2
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java
  2. 23
      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

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(); WAbsoluteLayout wabs = (WAbsoluteLayout)container.toData();
fix(creator,creator.getX(),creator.getY()); fix(creator,creator.getX(),creator.getY());
wabs.setBounds(creator.toData(),creator.getBounds()); wabs.setBounds(creator.toData(),creator.getBounds());
XElementCase.updateECImage(creator);
XWAbsoluteLayout layout = (XWAbsoluteLayout) container; XWAbsoluteLayout layout = (XWAbsoluteLayout) container;
layout.updateBoundsWidget(creator); layout.updateBoundsWidget(creator);
} }

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

@ -275,10 +275,29 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
} }
public void setBackground(BufferedImage image) { public void setBackground(BufferedImage image) {
toData().setECImage(image); toData().getElementCaseImage().adjustImageBytes(image);
setEditorIcon(image); 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();
}
});
}
}
}
}
private void setEditorIcon(BufferedImage image) { private void setEditorIcon(BufferedImage image) {
setLabelBackground(image, imageLable); setLabelBackground(image, imageLable);
} }

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

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

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

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

Loading…
Cancel
Save