Browse Source

REPORT-62533【主题预览图】单元格样式只设置下边框线时,左侧预览图中看不到效果

feature/x
kerry 3 years ago
parent
commit
ed44b067cc
  1. 17
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/cell/AbstractPreviewCell.java

17
designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/cell/AbstractPreviewCell.java

@ -1,12 +1,15 @@
package com.fr.design.mainframe.theme.preview.ecpreview.cell; package com.fr.design.mainframe.theme.preview.ecpreview.cell;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.stable.Constants;
import javax.swing.JComponent; import javax.swing.JComponent;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
public abstract class AbstractPreviewCell extends JComponent { public abstract class AbstractPreviewCell extends JComponent {
private static final double BORDER_INSET = 0.5D;
protected Style style = Style.DEFAULT_STYLE; protected Style style = Style.DEFAULT_STYLE;
private static final int NO_SCALE_RESOLUTION = 100; private static final int NO_SCALE_RESOLUTION = 100;
@ -19,7 +22,19 @@ public abstract class AbstractPreviewCell extends JComponent {
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
Style.paintBackground(g2d, style, getWidth(), getHeight()); Style.paintBackground(g2d, style, getWidth(), getHeight());
paintContent(g2d, NO_SCALE_RESOLUTION); paintContent(g2d, NO_SCALE_RESOLUTION);
Style.paintBorder(g2d, style, getWidth(), getHeight()); paintBorder(g2d);
}
private void paintBorder(Graphics2D g2d) {
double width = getWidth();
double height = getHeight();
if (style.getBorderLeft() == Constants.LINE_SLIM || style.getBorderRight() == Constants.LINE_SLIM) {
width -= BORDER_INSET;
}
if (style.getBorderBottom() == Constants.LINE_SLIM || style.getBorderTop() == Constants.LINE_SLIM) {
height -= BORDER_INSET;
}
Style.paintBorder(g2d, style, width, height);
} }
protected abstract void paintContent(Graphics2D g2d, int resolution); protected abstract void paintContent(Graphics2D g2d, int resolution);

Loading…
Cancel
Save