From 47409dd6900278633202c201fa89e67061dd2d3d Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 10 Dec 2021 15:16:48 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-64079=20=E3=80=90=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E8=BE=B9=E6=A1=86=E3=80=91=E6=82=AC=E6=B5=AE=E5=85=83=E7=B4=A0?= =?UTF-8?q?=E7=9A=84=E6=A0=B7=E5=BC=8F=E6=95=88=E6=9E=9C=E8=B7=9F=E4=BA=A4?= =?UTF-8?q?=E4=BA=92=E7=A8=BF=E4=B8=8D=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 悬浮元素本身不支持内边框,所以重新确定了下悬浮元素主题 单元格样式预览效果实现 【改动思路】 同上 --- .../cell/CellRectangleStylePreviewPane.java | 30 ++++++++------- .../theme/ThemedCellStyleListPane.java | 38 ++----------------- .../theme/edit/cell/CellStyleEditPane.java | 2 +- .../settingpane/style/NameStyleListPane.java | 7 +--- .../com/fr/design/report/ReportStylePane.java | 2 +- 5 files changed, 25 insertions(+), 54 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/cell/CellRectangleStylePreviewPane.java b/designer-base/src/main/java/com/fr/design/cell/CellRectangleStylePreviewPane.java index da80b6c6e2..2ca96616fb 100644 --- a/designer-base/src/main/java/com/fr/design/cell/CellRectangleStylePreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/cell/CellRectangleStylePreviewPane.java @@ -23,27 +23,31 @@ public class CellRectangleStylePreviewPane extends JPanel { private final int[][] borderSourceFlags = new int[ROW_COUNT][COLUMN_COUNT]; private final CellStylePreviewPane[][] cellStylePreviewPaneGrid = new CellStylePreviewPane[ROW_COUNT][COLUMN_COUNT]; - public CellRectangleStylePreviewPane() { + public CellRectangleStylePreviewPane(boolean supportInnerBorder) { setLayout(new GridLayout(2, 2)); for (int r = 0; r < ROW_COUNT; r++) { for (int c = 0; c < COLUMN_COUNT; c++) { CellStylePreviewPane pane = new CellStylePreviewPane(); TemplateCellElement cellElement = DefaultThemedTemplateCellElementCase.createInstance(c, r); - int flags = CellBorderSourceFlag.ALL_BORDER_SOURCE_OUTER; - if (r != 0) { - flags |= CellBorderSourceFlag.TOP_BORDER_SOURCE_INNER; - } - if (r != ROW_COUNT - 1) { - flags |= CellBorderSourceFlag.BOTTOM_BORDER_SOURCE_INNER; - } - if (c != 0) { - flags |= CellBorderSourceFlag.LEFT_BORDER_SOURCE_INNER; - } - if (c != COLUMN_COUNT - 1) { - flags |= CellBorderSourceFlag.RIGHT_BORDER_SOURCE_INNER; + int flags = CellBorderSourceFlag.INVALID_BORDER_SOURCE; + if (supportInnerBorder) { + flags = CellBorderSourceFlag.ALL_BORDER_SOURCE_OUTER; + if (r != 0) { + flags |= CellBorderSourceFlag.TOP_BORDER_SOURCE_INNER; + } + if (r != ROW_COUNT - 1) { + flags |= CellBorderSourceFlag.BOTTOM_BORDER_SOURCE_INNER; + } + if (c != 0) { + flags |= CellBorderSourceFlag.LEFT_BORDER_SOURCE_INNER; + } + if (c != COLUMN_COUNT - 1) { + flags |= CellBorderSourceFlag.RIGHT_BORDER_SOURCE_INNER; + } } + pane.setStyle(cellElement.getStyle()); add(pane); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/ThemedCellStyleListPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/ThemedCellStyleListPane.java index 53838d1c7f..bcb160e1f2 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/ThemedCellStyleListPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/ThemedCellStyleListPane.java @@ -4,7 +4,6 @@ import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.settings.ThemedCellStyle; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.cell.CellRectangleStylePreviewPane; -import com.fr.design.cell.CellStylePreviewPane; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.i18n.Toolkit; @@ -36,14 +35,10 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane styleList; private ChangeListener changeListener; - public ThemedCellStyleListPane() { - this(false); - } - - public ThemedCellStyleListPane(boolean supportCellRange) { + public ThemedCellStyleListPane(boolean supportInnerBorder) { defaultListModel = new DefaultListModel<>(); styleList = new JList<>(defaultListModel); - styleList.setCellRenderer(supportCellRange ? new RadioButtonListCellRangeRenderer() : new RadioButtonListCellRenderer()); + styleList.setCellRenderer(new RadioButtonListCellRangeRenderer(supportInnerBorder)); styleList.setOpaque(false); styleList.setBackground(null); styleList.addListSelectionListener(new ListSelectionListener() { @@ -115,44 +110,19 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane, Serializable { - - private final UIRadioButton button; - private final CellStylePreviewPane previewArea; - - public RadioButtonListCellRenderer() { - super(); - setLayout(new BorderLayout(20, 0)); - setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); - setPreferredSize(new Dimension(getPreferredSize().width, 40)); - button = new UIRadioButton(); - previewArea = new CellStylePreviewPane(); - add(button, BorderLayout.WEST); - add(previewArea, BorderLayout.CENTER); - } - - @Override - public Component getListCellRendererComponent(JList list, ThemedCellStyle value, int index, boolean isSelected, boolean cellHasFocus) { - button.setSelected(isSelected); - previewArea.setPaintText(value.getName()); - previewArea.setStyle(value.getStyle()); - return this; - } - } - private static class RadioButtonListCellRangeRenderer extends JPanel implements ListCellRenderer, Serializable { private final UIRadioButton button; private final CellRectangleStylePreviewPane previewArea; - public RadioButtonListCellRangeRenderer() { + public RadioButtonListCellRangeRenderer(boolean supportInnerBorder) { super(); setLayout(new BorderLayout(5, 0)); setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); setPreferredSize(new Dimension(getPreferredSize().width, 80)); button = new UIRadioButton(); button.setBorder(BorderFactory.createEmptyBorder()); - previewArea = new CellRectangleStylePreviewPane(); + previewArea = new CellRectangleStylePreviewPane(supportInnerBorder); add(button, BorderLayout.WEST); add(previewArea, BorderLayout.CENTER); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/cell/CellStyleEditPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/cell/CellStyleEditPane.java index 39e4394b8d..c3ba368a31 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/cell/CellStyleEditPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/cell/CellStyleEditPane.java @@ -116,7 +116,7 @@ public class CellStyleEditPane extends MultiTabPane { jPanel.setLayout(new BorderLayout(0, 4)); JPanel previewPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - previewArea = new CellRectangleStylePreviewPane(); + previewArea = new CellRectangleStylePreviewPane(true); previewArea.setPreferredSize(new Dimension(223, 60)); previewPane.setBorder(BorderUtils.createTitleBorder(i18nText("Fine-Design_Basic_Preview"))); previewPane.add(previewArea, BorderLayout.CENTER); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/NameStyleListPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/NameStyleListPane.java index 3e4b3ac716..0863927994 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/NameStyleListPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/NameStyleListPane.java @@ -16,11 +16,8 @@ import com.fr.design.mainframe.theme.ThemedCellStyleListPane; */ public class NameStyleListPane extends ThemedCellStyleListPane { - public NameStyleListPane() { - } - - public NameStyleListPane(boolean supportCellRange) { - super(supportCellRange); + public NameStyleListPane(boolean supportInnerBorder) { + super(supportInnerBorder); } public void populateNameStyle(NameStyle style) { diff --git a/designer-realize/src/main/java/com/fr/design/report/ReportStylePane.java b/designer-realize/src/main/java/com/fr/design/report/ReportStylePane.java index a8ebc1c080..ec0f06339b 100644 --- a/designer-realize/src/main/java/com/fr/design/report/ReportStylePane.java +++ b/designer-realize/src/main/java/com/fr/design/report/ReportStylePane.java @@ -541,7 +541,7 @@ public class ReportStylePane extends BasicPane { UITabbedPane mainTabbedPane = new UITabbedPane(); setLayout(FRGUIPaneFactory.createBorderLayout()); - nameStyleListPane = new NameStyleListPane(); + nameStyleListPane = new NameStyleListPane(false); nameStyleListPane.setBorder(BorderFactory.createEmptyBorder()); UIScrollPane scrollPane = new UIScrollPane(nameStyleListPane); scrollPane.setBorder(BorderFactory.createEmptyBorder(10, 5, 5, 0));