From ca8aa8309431931bf1219b82483480f8ab38c2ba Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 14 Sep 2021 15:41:24 +0800 Subject: [PATCH 1/4] =?UTF-8?q?REPORT-57551=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=EF=BC=8C=E8=87=AA=E9=80=82=E5=BA=94=E5=B8=83?= =?UTF-8?q?=E5=B1=80=E4=B8=8Bbody=E8=83=8C=E6=99=AF=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E4=BB=A5=E5=90=8E=EF=BC=8C=E7=94=BB=E5=B8=83=E4=B8=AD=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E5=AE=9E=E6=97=B6=E6=98=BE=E7=A4=BA=E8=83=8C=E6=99=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 重命名组件样式预览效果的相关方法 【改动思路】 同标题 --- .../designer/creator/XBorderStyleWidgetCreator.java | 8 ++++---- .../com/fr/design/designer/creator/XChartEditor.java | 6 +++--- .../com/fr/design/designer/creator/XElementCase.java | 6 +++--- .../fr/design/designer/creator/XLayoutContainer.java | 6 +++--- .../design/designer/creator/XWAbsoluteBodyLayout.java | 8 ++++---- .../fr/design/designer/creator/XWAbsoluteLayout.java | 2 +- .../com/fr/design/designer/creator/XWTitleLayout.java | 6 +++--- .../designer/creator/cardlayout/XWCardLayout.java | 10 +++++----- .../creator/cardlayout/XWCardMainBorderLayout.java | 2 +- 9 files changed, 27 insertions(+), 27 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java index 395647db3b..8ed5395e04 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java @@ -91,12 +91,12 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{ super.addToWrapper(parentPanel, width, minHeight); // REPORT-53175: 新创建的图表组件默认显示标题 since 10.0.18 // 将当前对象添加到父容器后,初始化默认样式的效果 - initStyle(); + refreshStylePreviewEffect(); } - protected void initStyle() { + public void refreshStylePreviewEffect() { BorderPacker style = toData().getBorderStyle(); - initBorderAndBackgroundStyle(); + refreshBorderAndBackgroundStylePreviewEffect(); if (ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE)) { initTitleStyle(style); } else { @@ -107,7 +107,7 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{ reshuffleBorderAndBackgroundPaintingEffectIfTitleExists(); } - protected void initBorderAndBackgroundStyle() { + public void refreshBorderAndBackgroundStylePreviewEffect() { BorderPacker style = toData().getBorderStyle(); LineBorder DEFAULT_LINE_BORDER = (LineBorder) DEFALUTBORDER; diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java b/designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java index c5f9305c36..020dac0630 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java @@ -122,7 +122,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator { @Override public void propertyChange() { - initStyle(); + refreshStylePreviewEffect(); } }), }; @@ -165,7 +165,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator { @Override protected void initXCreatorProperties() { super.initXCreatorProperties(); - initBorderAndBackgroundStyle(); + refreshBorderAndBackgroundStylePreviewEffect(); BaseChartCollection collection = ((BaseChartEditor) data).getChartCollection(); isRefreshing = true; ((MiddleChartComponent) designerEditor.getEditorTarget()).populate(collection); @@ -345,7 +345,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator { * data属性改变触发其他操作 */ public void firePropertyChange() { - initStyle(); + refreshStylePreviewEffect(); } @Override diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java index aeaae876c1..6094ab49e3 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java @@ -58,7 +58,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme super.initXCreatorProperties(); // 报表块初始化时要加载对应的borderStyle - initBorderAndBackgroundStyle(); + refreshBorderAndBackgroundStylePreviewEffect(); } /** @@ -94,7 +94,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme @Override public void propertyChange() { - initStyle(); + refreshStylePreviewEffect(); } }), new CRPropertyDescriptor("margin", this.data.getClass()).setEditorClass(PaddingMarginEditor.class) @@ -344,7 +344,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme * */ public void firePropertyChange() { - initStyle(); + refreshStylePreviewEffect(); } /** diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java b/designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java index d4bd11bbb2..ebd4956601 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java @@ -77,7 +77,7 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme @Override public void propertyChange() { - initStyle(); + refreshStylePreviewEffect(); } }), new CRPropertyDescriptor("margin", this.data.getClass()).setEditorClass(PaddingMarginEditor.class) @@ -120,7 +120,7 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme @Override protected void initXCreatorProperties() { super.initXCreatorProperties(); - initBorderAndBackgroundStyle(); + refreshBorderAndBackgroundStylePreviewEffect(); this.initLayoutManager(); this.convert(); } @@ -549,7 +549,7 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme * */ public void firePropertyChange(){ - initStyle(); + refreshStylePreviewEffect(); } /** diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java index aa5612c09f..b00f6710bf 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java @@ -78,7 +78,7 @@ public class XWAbsoluteBodyLayout extends XWAbsoluteLayout { @Override public void propertyChange() { - initStyle(); + XWAbsoluteBodyLayout.this.refreshStylePreviewEffect(); } }) }; @@ -105,8 +105,8 @@ public class XWAbsoluteBodyLayout extends XWAbsoluteLayout { } @Override - protected void initStyle() { - initBorderAndBackgroundStyle(); + public void refreshStylePreviewEffect() { + refreshBorderAndBackgroundStylePreviewEffect(); } /** @@ -114,7 +114,7 @@ public class XWAbsoluteBodyLayout extends XWAbsoluteLayout { * */ public void firePropertyChange(){ - initStyle(); + this.refreshStylePreviewEffect(); } @Override diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java index 74c18a910e..f249a651e1 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java @@ -305,7 +305,7 @@ public class XWAbsoluteLayout extends XLayoutContainer { } @Override - protected void initStyle() { + public void refreshStylePreviewEffect() { // do nothing } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java index 1628b6cdd2..b2ef84edc6 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java @@ -63,7 +63,7 @@ public class XWTitleLayout extends DedicateLayoutContainer { } @Override - protected void initBorderAndBackgroundStyle() { + public void refreshBorderAndBackgroundStylePreviewEffect() { setBorder(null); setBorderImage4Painting(null, 0.0); setBackground4Painting(null, 0.0); @@ -76,7 +76,7 @@ public class XWTitleLayout extends DedicateLayoutContainer { // 初始化后(如打开旧模版),需要重新调整组件/标题/边框的显示效果 XCreator xCreator = getBodyCreator(); if (xCreator instanceof XBorderStyleWidgetCreator) { - ((XBorderStyleWidgetCreator) xCreator).initStyle(); + ((XBorderStyleWidgetCreator) xCreator).refreshStylePreviewEffect(); } } @@ -237,7 +237,7 @@ public class XWTitleLayout extends DedicateLayoutContainer { } // 刷新时重置下样式 if (bodyCreator != null) { - bodyCreator.initStyle(); + bodyCreator.refreshStylePreviewEffect(); } isRefreshing = false; } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java index 1d564ec6c1..b784187e77 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java @@ -160,7 +160,7 @@ public class XWCardLayout extends XLayoutContainer { */ @Override protected XLayoutContainer getCreatorWrapper(String widgetName) { - initStyle(); + refreshStylePreviewEffect(); Dimension dimension = new Dimension(); //主结构是一个borderlayout, 标签部分是north, card部分为center WCardMainBorderLayout border = new WCardMainBorderLayout(); @@ -389,7 +389,7 @@ public class XWCardLayout extends XLayoutContainer { @Override public void propertyChange() { - initStyle(); + refreshStylePreviewEffect(); } }) }; @@ -397,10 +397,10 @@ public class XWCardLayout extends XLayoutContainer { //初始化样式 @Override - protected void initStyle() { + public void refreshStylePreviewEffect() { BorderPacker style = toData().getBorderStyle(); initBorderTitleStyle(style); - initBorderAndBackgroundStyle(); + refreshBorderAndBackgroundStylePreviewEffect(); clearOrShowTitleLayout(ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE)); } @@ -479,7 +479,7 @@ public class XWCardLayout extends XLayoutContainer { */ @Override public void firePropertyChange() { - initStyle(); + refreshStylePreviewEffect(); } public void resetTabBackground(TemplateStyle templateStyle) { diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java index bf660cf5ec..fdc01be1e9 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java @@ -405,7 +405,7 @@ public class XWCardMainBorderLayout extends XWBorderLayout { public void firePropertyChange(){ XWCardLayout cardLayout = this.getCardPart(); if (cardLayout != null && cardLayout.toData() != null) { - cardLayout.initStyle(); + cardLayout.refreshStylePreviewEffect(); } } From 489fec327bf76e2b203d078b78feb3a68d753e13 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 14 Sep 2021 16:16:01 +0800 Subject: [PATCH 2/4] =?UTF-8?q?REPORT-57551=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=EF=BC=8C=E8=87=AA=E9=80=82=E5=BA=94=E5=B8=83?= =?UTF-8?q?=E5=B1=80=E4=B8=8Bbody=E8=83=8C=E6=99=AF=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E4=BB=A5=E5=90=8E=EF=BC=8C=E7=94=BB=E5=B8=83=E4=B8=AD=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E5=AE=9E=E6=97=B6=E6=98=BE=E7=A4=BA=E8=83=8C=E6=99=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 Body Creator的swing Background遮挡了样式背景导致. 需要将swing背景的绘制放置到样式背景的下方, 避免遮挡样式背景 【改动思路】 同标题 --- .../creator/XBorderStyleWidgetCreator.java | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java index 8ed5395e04..df84109463 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java @@ -21,6 +21,8 @@ import com.fr.stable.StringUtils; import javax.swing.*; import javax.swing.border.Border; import javax.swing.border.LineBorder; +import javax.swing.plaf.PanelUI; +import javax.swing.plaf.basic.BasicPanelUI; import java.awt.*; import java.awt.geom.Rectangle2D; import java.awt.geom.RoundRectangle2D; @@ -42,6 +44,7 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{ public XBorderStyleWidgetCreator(Widget widget, Dimension initSize) { super(widget, initSize); + setUI(new NoBackgroundPaneUI()); setOpaque(false); setBackupBound(null); @@ -51,6 +54,13 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{ } } + @Override + public void setUI(PanelUI ui) { + if (ui instanceof NoBackgroundPaneUI) { + super.setUI(ui); + } + } + public Background getBackground4Painting() { return this.background4Painting; } @@ -288,6 +298,11 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{ // 设计器预览界面中绘制组件背景效果 public void paintBackground(Graphics2D g2d) { + if (isOpaque()) { + g2d.setColor(getBackground()); + g2d.fillRect(0, 0, getWidth(), getHeight()); + } + Background background4Painting = getBackground4Painting(); if (background4Painting != null) { Composite oldComposite = g2d.getComposite(); @@ -311,12 +326,12 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{ } public void paintForeground(Graphics2D g2d) { - super.paint(g2d); + super.paintComponent(g2d); super.paintBorder(g2d); } @Override - public void paint(Graphics g) { + public void paintComponent(Graphics g) { this.clipByRoundedBorder((Graphics2D) g); this.paintBackground((Graphics2D) g); this.paintBorderImage((Graphics2D) g); @@ -378,4 +393,11 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); } } + + public static class NoBackgroundPaneUI extends BasicPanelUI { + @Override + public void update(Graphics g, JComponent c) { + paint(g, c); + } + } } \ No newline at end of file From 074d3b435a45bbe0a641feb2b770d8006248a103 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 14 Sep 2021 16:16:58 +0800 Subject: [PATCH 3/4] =?UTF-8?q?REPORT-57551=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=EF=BC=8C=E8=87=AA=E9=80=82=E5=BA=94=E5=B8=83?= =?UTF-8?q?=E5=B1=80=E4=B8=8Bbody=E8=83=8C=E6=99=AF=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E4=BB=A5=E5=90=8E=EF=BC=8C=E7=94=BB=E5=B8=83=E4=B8=AD=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E5=AE=9E=E6=97=B6=E6=98=BE=E7=A4=BA=E8=83=8C=E6=99=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 body布局切换时,除了要重新设置body widget样式数据模型,还要 刷新样式预览效果 【改动思路】 同标题 --- .../layout/FRAbsoluteBodyLayoutDefinePane.java | 1 + .../ui/designer/layout/FRFitLayoutDefinePane.java | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java index 442d872ebe..bc8dc9be03 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java @@ -181,6 +181,7 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane { wFitLayout.setBorderStyle(layout.getBorderStyle()); } copyLayoutAttr(layout, xwFitLayout.toData()); + xwFitLayout.refreshStylePreviewEffect(); } } layout.setBorderStyleFollowingTheme(themePane.isFollowingTheme()); diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java index 306b62246a..24cf56b18b 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java @@ -42,6 +42,7 @@ import com.fr.log.FineLoggerFactory; import com.fr.report.core.ReportUtils; import javax.swing.*; +import javax.swing.border.Border; import java.awt.*; /** @@ -243,6 +244,16 @@ public class FRFitLayoutDefinePane extends AbstractFRLayoutDefinePane Date: Tue, 14 Sep 2021 11:10:01 +0800 Subject: [PATCH 4/4] =?UTF-8?q?REPORT-59421=20=E5=86=B3=E7=AD=96=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8-=E5=8F=82=E6=95=B0=E9=9D=A2=E6=9D=BF-=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E9=9D=A2=E6=9D=BF=E8=AE=BE=E7=BD=AE=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=EF=BC=8C=E7=8E=B0=E5=9C=A8=E8=AE=BE=E8=AE=A1=E7=94=BB=E5=B8=83?= =?UTF-8?q?=E9=87=8C=E7=9C=8B=E4=B8=8D=E5=88=B0=E6=A0=B7=E5=BC=8F=E6=95=88?= =?UTF-8?q?=E6=9E=9C=EF=BC=8C=E4=B9=8B=E5=89=8D=E7=BB=84=E4=BB=B6=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E5=88=86=E7=A6=BB=E8=BF=AD=E4=BB=A3=E6=97=B6=E6=9C=89?= =?UTF-8?q?=E5=AF=B9body=E8=BF=9B=E8=A1=8C=E8=AE=BE=E8=AE=A1=E7=94=BB?= =?UTF-8?q?=E5=B8=83=E5=8F=AF=E7=9C=8B=E5=88=B0=E6=A0=B7=E5=BC=8F=E6=95=88?= =?UTF-8?q?=E6=9E=9C=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 添加对参数面板背景设计器画布预览效果的支持 【改动思路】 同标题 --- .../design/designer/creator/XWParameterLayout.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWParameterLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWParameterLayout.java index fc01aefaa9..a41ec46f6f 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWParameterLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWParameterLayout.java @@ -43,6 +43,16 @@ public class XWParameterLayout extends XWAbsoluteLayout { super(widget, initSize); } + @Override + public void refreshBorderAndBackgroundStylePreviewEffect() { + WParameterLayout data = toData(); + if (data != null) { + Background background = data.getBackground(); + setBackground4Painting(background, 1.0); + repaint(); + } + } + /** * 初始化尺寸 * @return 尺寸 @@ -235,7 +245,7 @@ public class XWParameterLayout extends XWAbsoluteLayout { * */ public void firePropertyChange(){ - + refreshBorderAndBackgroundStylePreviewEffect(); } @Override