Browse Source

Pull request #7388: REPORT-65170【主题边框】悬浮元素的预览图,右下的边框线看不到

Merge in DESIGN/design from ~STARRYI/design:release/11.0 to release/11.0

* commit '906eddd5710e6ab6df32fecacd9a345b222346dc':
  REPORT-65170【主题边框】悬浮元素的预览图,右下的边框线看不到
bugfix/11.0
starryi 3 years ago
parent
commit
801d2a1fe1
  1. 8
      designer-base/src/main/java/com/fr/design/cell/CellRectangleStylePreviewPane.java
  2. 39
      designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java
  3. 2
      designer-realize/src/main/java/com/fr/design/report/ReportStylePane.java

8
designer-base/src/main/java/com/fr/design/cell/CellRectangleStylePreviewPane.java

@ -15,6 +15,7 @@ import java.awt.Dimension;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.GridLayout; import java.awt.GridLayout;
import java.awt.Rectangle;
import java.awt.RenderingHints; import java.awt.RenderingHints;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
@ -46,7 +47,7 @@ public class CellRectangleStylePreviewPane extends JPanel {
for (int r = 0; r < ROW_COUNT; r++) { for (int r = 0; r < ROW_COUNT; r++) {
for (int c = 0; c < COLUMN_COUNT; c++) { for (int c = 0; c < COLUMN_COUNT; c++) {
CellStylePreviewPane pane = new CellStylePreviewPane(false, false); CellStylePreviewPane pane = new CellStylePreviewPane(c, r, COLUMN_COUNT, ROW_COUNT, false, false);
TemplateCellElement cellElement = DefaultThemedTemplateCellElementCase.createInstance(c, r); TemplateCellElement cellElement = DefaultThemedTemplateCellElementCase.createInstance(c, r);
int flags = CellBorderSourceFlag.INVALID_BORDER_SOURCE; int flags = CellBorderSourceFlag.INVALID_BORDER_SOURCE;
if (supportInnerBorder) { if (supportInnerBorder) {
@ -136,6 +137,11 @@ public class CellRectangleStylePreviewPane extends JPanel {
super.paint(g); super.paint(g);
} }
@Override
public Rectangle getBounds() {
return super.getBounds();
}
private void paintTransparentBackground(Graphics2D g2d, Style style) { private void paintTransparentBackground(Graphics2D g2d, Style style) {
float alpha = computeTransparentBackgroundAlpha(style); float alpha = computeTransparentBackgroundAlpha(style);

39
designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java

@ -18,7 +18,9 @@ import java.awt.Font;
import java.awt.FontMetrics; import java.awt.FontMetrics;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.RenderingHints; import java.awt.RenderingHints;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.util.List; import java.util.List;
@ -36,10 +38,19 @@ public class CellStylePreviewPane extends JPanel {
private String paintText = "Report"; private String paintText = "Report";
private Style style = Style.DEFAULT_STYLE; private Style style = Style.DEFAULT_STYLE;
private final int column;
private final int row;
private final int columnSpan;
private final int rowSpan;
private final boolean autoClearCanvas; private final boolean autoClearCanvas;
private final boolean paintingMosaic; private final boolean paintingMosaic;
public CellStylePreviewPane(boolean autoClearCanvas, boolean paintingMosaic) { public CellStylePreviewPane(int column, int row, int columnSpan, int rowSpan, boolean autoClearCanvas, boolean paintingMosaic) {
this.column = column;
this.row = row;
this.columnSpan = columnSpan;
this.rowSpan = rowSpan;
this.autoClearCanvas = autoClearCanvas; this.autoClearCanvas = autoClearCanvas;
this.paintingMosaic = paintingMosaic; this.paintingMosaic = paintingMosaic;
transparentBackgroundWidth = transparentBackgroundImage.getWidth(null); transparentBackgroundWidth = transparentBackgroundImage.getWidth(null);
@ -133,8 +144,30 @@ public class CellStylePreviewPane extends JPanel {
Style.paintContent(g2d, paintText, style, width, height, resolution); Style.paintContent(g2d, paintText, style, width, height, resolution);
g2d.setClip(null); paintCellBorder(g2d, style);
Style.paintBorder(g2d, style, width, height); }
protected void paintCellBorder(Graphics2D g2d, Style style) {
float adjustLeft = 0;
float adjustTop = 0;
float adjustRight = 0;
float adjustBottom = 0;
if (column == 0) {
adjustLeft = GraphHelper.getLineStyleSize(style.getBorderLeft()) / 2.0F;
}
if (row == 0) {
adjustTop = GraphHelper.getLineStyleSize(style.getBorderTop()) / 2.0F;
}
if (column == columnSpan - 1) {
adjustRight = -GraphHelper.getLineStyleSize(style.getBorderRight()) / 2.0F;
}
if (row == rowSpan - 1) {
adjustBottom = -GraphHelper.getLineStyleSize(style.getBorderBottom()) / 2.0F;
}
g2d.translate(adjustLeft, adjustTop);
Style.paintBorder(g2d, style, getWidth() - adjustLeft + adjustRight, getHeight() - adjustTop + adjustBottom);
g2d.translate(-adjustLeft, -adjustTop);
} }
@Override @Override

2
designer-realize/src/main/java/com/fr/design/report/ReportStylePane.java

@ -79,7 +79,7 @@ public class ReportStylePane extends BasicPane {
setLayout(FRGUIPaneFactory.createBorderLayout()); setLayout(FRGUIPaneFactory.createBorderLayout());
setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10)); setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10));
previewArea = new CellStylePreviewPane(true, true); previewArea = new CellStylePreviewPane(0, 0, 1,1, true, true);
followingThemeButtonGroup = new UIButtonGroup<>(FOLLOWING_THEME_STRING_ARRAYS); followingThemeButtonGroup = new UIButtonGroup<>(FOLLOWING_THEME_STRING_ARRAYS);
followingThemeButtonGroup.setAutoFireStateChanged(false); followingThemeButtonGroup.setAutoFireStateChanged(false);
customStylePane = new CustomFloatStyleSettingPane(); customStylePane = new CustomFloatStyleSettingPane();

Loading…
Cancel
Save