Browse Source

REPORT-64079 【主题边框】悬浮元素的样式效果跟交互稿不一致

【问题原因】
悬浮元素本身不支持内边框,所以重新确定了下悬浮元素主题
单元格样式预览效果实现

【改动思路】
同上
feature/x
Starryi 3 years ago
parent
commit
47409dd690
  1. 30
      designer-base/src/main/java/com/fr/design/cell/CellRectangleStylePreviewPane.java
  2. 38
      designer-base/src/main/java/com/fr/design/mainframe/theme/ThemedCellStyleListPane.java
  3. 2
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/cell/CellStyleEditPane.java
  4. 7
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/NameStyleListPane.java
  5. 2
      designer-realize/src/main/java/com/fr/design/report/ReportStylePane.java

30
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 int[][] borderSourceFlags = new int[ROW_COUNT][COLUMN_COUNT];
private final CellStylePreviewPane[][] cellStylePreviewPaneGrid = new CellStylePreviewPane[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)); setLayout(new GridLayout(2, 2));
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(); CellStylePreviewPane pane = new CellStylePreviewPane();
TemplateCellElement cellElement = DefaultThemedTemplateCellElementCase.createInstance(c, r); TemplateCellElement cellElement = DefaultThemedTemplateCellElementCase.createInstance(c, r);
int flags = CellBorderSourceFlag.ALL_BORDER_SOURCE_OUTER; int flags = CellBorderSourceFlag.INVALID_BORDER_SOURCE;
if (r != 0) { if (supportInnerBorder) {
flags |= CellBorderSourceFlag.TOP_BORDER_SOURCE_INNER; flags = CellBorderSourceFlag.ALL_BORDER_SOURCE_OUTER;
} if (r != 0) {
if (r != ROW_COUNT - 1) { flags |= CellBorderSourceFlag.TOP_BORDER_SOURCE_INNER;
flags |= CellBorderSourceFlag.BOTTOM_BORDER_SOURCE_INNER; }
} if (r != ROW_COUNT - 1) {
if (c != 0) { flags |= CellBorderSourceFlag.BOTTOM_BORDER_SOURCE_INNER;
flags |= CellBorderSourceFlag.LEFT_BORDER_SOURCE_INNER; }
} if (c != 0) {
if (c != COLUMN_COUNT - 1) { flags |= CellBorderSourceFlag.LEFT_BORDER_SOURCE_INNER;
flags |= CellBorderSourceFlag.RIGHT_BORDER_SOURCE_INNER; }
if (c != COLUMN_COUNT - 1) {
flags |= CellBorderSourceFlag.RIGHT_BORDER_SOURCE_INNER;
}
} }
pane.setStyle(cellElement.getStyle()); pane.setStyle(cellElement.getStyle());
add(pane); add(pane);

38
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.base.theme.settings.ThemedCellStyle;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.cell.CellRectangleStylePreviewPane; import com.fr.design.cell.CellRectangleStylePreviewPane;
import com.fr.design.cell.CellStylePreviewPane;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
@ -36,14 +35,10 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane<ThemedCellStyl
private final JList<ThemedCellStyle> styleList; private final JList<ThemedCellStyle> styleList;
private ChangeListener changeListener; private ChangeListener changeListener;
public ThemedCellStyleListPane() { public ThemedCellStyleListPane(boolean supportInnerBorder) {
this(false);
}
public ThemedCellStyleListPane(boolean supportCellRange) {
defaultListModel = new DefaultListModel<>(); defaultListModel = new DefaultListModel<>();
styleList = new JList<>(defaultListModel); styleList = new JList<>(defaultListModel);
styleList.setCellRenderer(supportCellRange ? new RadioButtonListCellRangeRenderer() : new RadioButtonListCellRenderer()); styleList.setCellRenderer(new RadioButtonListCellRangeRenderer(supportInnerBorder));
styleList.setOpaque(false); styleList.setOpaque(false);
styleList.setBackground(null); styleList.setBackground(null);
styleList.addListSelectionListener(new ListSelectionListener() { styleList.addListSelectionListener(new ListSelectionListener() {
@ -115,44 +110,19 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane<ThemedCellStyl
styleList.setModel(defaultListModel); styleList.setModel(defaultListModel);
} }
private static class RadioButtonListCellRenderer extends JPanel implements ListCellRenderer<ThemedCellStyle>, 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<? extends ThemedCellStyle> 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<ThemedCellStyle>, Serializable { private static class RadioButtonListCellRangeRenderer extends JPanel implements ListCellRenderer<ThemedCellStyle>, Serializable {
private final UIRadioButton button; private final UIRadioButton button;
private final CellRectangleStylePreviewPane previewArea; private final CellRectangleStylePreviewPane previewArea;
public RadioButtonListCellRangeRenderer() { public RadioButtonListCellRangeRenderer(boolean supportInnerBorder) {
super(); super();
setLayout(new BorderLayout(5, 0)); setLayout(new BorderLayout(5, 0));
setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
setPreferredSize(new Dimension(getPreferredSize().width, 80)); setPreferredSize(new Dimension(getPreferredSize().width, 80));
button = new UIRadioButton(); button = new UIRadioButton();
button.setBorder(BorderFactory.createEmptyBorder()); button.setBorder(BorderFactory.createEmptyBorder());
previewArea = new CellRectangleStylePreviewPane(); previewArea = new CellRectangleStylePreviewPane(supportInnerBorder);
add(button, BorderLayout.WEST); add(button, BorderLayout.WEST);
add(previewArea, BorderLayout.CENTER); add(previewArea, BorderLayout.CENTER);
} }

2
designer-base/src/main/java/com/fr/design/mainframe/theme/edit/cell/CellStyleEditPane.java

@ -116,7 +116,7 @@ public class CellStyleEditPane extends MultiTabPane<ThemedCellStyle> {
jPanel.setLayout(new BorderLayout(0, 4)); jPanel.setLayout(new BorderLayout(0, 4));
JPanel previewPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel previewPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
previewArea = new CellRectangleStylePreviewPane(); previewArea = new CellRectangleStylePreviewPane(true);
previewArea.setPreferredSize(new Dimension(223, 60)); previewArea.setPreferredSize(new Dimension(223, 60));
previewPane.setBorder(BorderUtils.createTitleBorder(i18nText("Fine-Design_Basic_Preview"))); previewPane.setBorder(BorderUtils.createTitleBorder(i18nText("Fine-Design_Basic_Preview")));
previewPane.add(previewArea, BorderLayout.CENTER); previewPane.add(previewArea, BorderLayout.CENTER);

7
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 class NameStyleListPane extends ThemedCellStyleListPane {
public NameStyleListPane() { public NameStyleListPane(boolean supportInnerBorder) {
} super(supportInnerBorder);
public NameStyleListPane(boolean supportCellRange) {
super(supportCellRange);
} }
public void populateNameStyle(NameStyle style) { public void populateNameStyle(NameStyle style) {

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

@ -541,7 +541,7 @@ public class ReportStylePane extends BasicPane {
UITabbedPane mainTabbedPane = new UITabbedPane(); UITabbedPane mainTabbedPane = new UITabbedPane();
setLayout(FRGUIPaneFactory.createBorderLayout()); setLayout(FRGUIPaneFactory.createBorderLayout());
nameStyleListPane = new NameStyleListPane(); nameStyleListPane = new NameStyleListPane(false);
nameStyleListPane.setBorder(BorderFactory.createEmptyBorder()); nameStyleListPane.setBorder(BorderFactory.createEmptyBorder());
UIScrollPane scrollPane = new UIScrollPane(nameStyleListPane); UIScrollPane scrollPane = new UIScrollPane(nameStyleListPane);
scrollPane.setBorder(BorderFactory.createEmptyBorder(10, 5, 5, 0)); scrollPane.setBorder(BorderFactory.createEmptyBorder(10, 5, 5, 0));

Loading…
Cancel
Save