From a1a07dddbce66e01be414ee8a882ab353f00a4e4 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 14 Sep 2021 14:42:08 +0800 Subject: [PATCH 1/4] =?UTF-8?q?REPORT-59440=20=E3=80=90=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E3=80=91=E5=90=88=E5=B9=B6=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=A0=BC=E4=BB=A5=E5=90=8E=EF=BC=8C=E5=8D=95=E5=85=83=E6=A0=BC?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E9=83=BD=E5=8F=98=E6=88=90=E4=BA=86=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 合并时新建单元格需要在设计器模块中处理,已获取当前正在编辑模版的主题数据来设置样式 【改动思路】 同标题 --- .../com/fr/grid/selection/CellSelection.java | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java b/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java index 23dbc77f5..7a23a1396 100644 --- a/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java +++ b/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java @@ -383,8 +383,27 @@ public class CellSelection extends Selection { return false; } } - - ec.merge(row, row + rowSpan - 1, column, column + columnSpan - 1); + int rowStartIndex = row; + int rowEndIndex = row + rowSpan - 1; + int columnStartIndex = column; + int columnEndIndex = column + columnSpan - 1; + + // 合并已有单元格,还是新建单元格 + boolean hasCellElement = false; + for (int ri = rowStartIndex; ri <= rowEndIndex; ri++) { + for (int ci = columnStartIndex; ci <= columnEndIndex; ci++) { + CellElement ce = ec.getCellElement(ci, ri); + if (ce != null) { + hasCellElement = true; + break; + } + } + } + if (hasCellElement) { + ec.merge(row, row + rowSpan - 1, column, column + columnSpan - 1); + } else { + ec.addCellElement(DefaultThemedTemplateCellElementCase.createInstance(column, row, columnSpan, rowSpan, null), true); + } return true; } From 1fbece9f3e544e0e4af619ccc65aaeb62bb7bc1b Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 14 Sep 2021 15:41:24 +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 【问题原因】 重命名组件样式预览效果的相关方法 【改动思路】 同标题 --- .../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 395647db3..8ed5395e0 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 b1859cd90..ee166d27e 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); @@ -344,7 +344,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 220fddff5..b561151e8 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) @@ -336,7 +336,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 50c5967c5..f1d4c4f6d 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 @@ -75,7 +75,7 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme @Override public void propertyChange() { - initStyle(); + refreshStylePreviewEffect(); } }), new CRPropertyDescriptor("margin", this.data.getClass()).setEditorClass(PaddingMarginEditor.class) @@ -118,7 +118,7 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme @Override protected void initXCreatorProperties() { super.initXCreatorProperties(); - initBorderAndBackgroundStyle(); + refreshBorderAndBackgroundStylePreviewEffect(); this.initLayoutManager(); this.convert(); } @@ -547,7 +547,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 aa5612c09..b00f6710b 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 3b64cd491..e222b4486 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 1628b6cdd..b2ef84edc 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 1d564ec6c..b784187e7 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 2f7200acf..0db348a39 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 @@ -417,7 +417,7 @@ public class XWCardMainBorderLayout extends XWBorderLayout { public void firePropertyChange(){ XWCardLayout cardLayout = this.getCardPart(); if (cardLayout != null && cardLayout.toData() != null) { - cardLayout.initStyle(); + cardLayout.refreshStylePreviewEffect(); } } From 82f46bd22c4386e06db28b2c5bb6bdd78f936004 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 14 Sep 2021 16:16:01 +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 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 8ed5395e0..df8410946 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 e5b4bea87fae8f4fb145bb9a221ab03bfd86d989 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 14 Sep 2021 16:16:58 +0800 Subject: [PATCH 4/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 442d872eb..bc8dc9be0 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 306b62246..24cf56b18 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