From 18a2dcf5fca755e5da036e70dcca6af17b685aeb Mon Sep 17 00:00:00 2001 From: lemon Date: Sun, 11 Aug 2024 13:44:25 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-127437=20fix:=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=20jtable=20=E6=BB=9A=E5=8A=A8=E6=9D=A1/UI=E5=B8=83=E5=B1=80/?= =?UTF-8?q?=E8=A1=A8=E8=BA=AB=E7=BB=84=E4=BB=B6=20=E7=9A=84=E4=B8=80?= =?UTF-8?q?=E4=BA=9B=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../theme/light/ui/FineTableHeaderUI.java | 107 +++++++++++++++++ .../light/ui/FineTableScrollBarPaneUI.java | 53 +++++++++ .../com/fine/theme/utils/FineUIStyle.java | 2 + .../data/datapane/preview/CopyableJTable.java | 3 - .../datapane/preview/PreviewTablePane.java | 12 +- .../view/PreviewTableDesensitizationPane.java | 14 ++- .../TableDataDesensitizationTableModel.java | 50 ++++---- .../gui/icombocheckbox/UIComboCheckBox.java | 35 ++++-- .../fr/design/gui/itable/SortableJTable.java | 3 + .../com/fr/design/gui/itable/TableSorter.java | 4 +- .../itableeditorpane/ParameterTableModel.java | 14 +-- .../itableeditorpane/UITableEditorPane.java | 105 ++--------------- .../com/fr/design/mainframe/DottedLine.java | 2 +- .../ui/AbstractSupportSelectTablePane.java | 1 + .../vcs/ui/ToolTipTableCellRenderer.java | 4 +- .../design/mainframe/vcs/ui/VcsNewPane.java | 1 + .../write/submit/DBManipulationPane.java | 44 +++++-- .../light/ui/laf/FineLightLaf.properties | 12 +- .../storybook/components/TableStoryBoard.java | 111 ++++++++++++++++++ .../replace/ui/ITReplaceSouthPanel.java | 1 - .../actions/replace/ui/ITTableButton.java | 13 -- .../actions/replace/ui/ITTableEditor.java | 1 - .../actions/replace/ui/ITTableEditorPane.java | 30 +++-- .../cell/smartaction/SmartJTablePane.java | 5 +- .../submit/SmartInsertDBManipulationPane.java | 8 +- 25 files changed, 431 insertions(+), 204 deletions(-) create mode 100644 designer-base/src/main/java/com/fine/theme/light/ui/FineTableHeaderUI.java create mode 100644 designer-base/src/main/java/com/fine/theme/light/ui/FineTableScrollBarPaneUI.java create mode 100644 designer-base/src/test/java/com/fr/design/gui/storybook/components/TableStoryBoard.java diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/FineTableHeaderUI.java b/designer-base/src/main/java/com/fine/theme/light/ui/FineTableHeaderUI.java new file mode 100644 index 0000000000..35a5f48c1d --- /dev/null +++ b/designer-base/src/main/java/com/fine/theme/light/ui/FineTableHeaderUI.java @@ -0,0 +1,107 @@ +package com.fine.theme.light.ui; + +import com.fine.theme.utils.FineUIScale; +import com.fine.theme.utils.FineUIStyle; +import com.formdev.flatlaf.ui.FlatTableHeaderUI; +import com.fr.stable.StringUtils; +import sun.swing.DefaultLookup; + +import javax.swing.BorderFactory; +import javax.swing.JComponent; +import javax.swing.JTable; +import javax.swing.SwingConstants; +import javax.swing.UIManager; +import javax.swing.border.Border; +import javax.swing.plaf.ComponentUI; +import javax.swing.plaf.UIResource; +import javax.swing.table.DefaultTableCellRenderer; +import javax.swing.table.JTableHeader; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Graphics; + +/** + * 应用于 JTable 的UI + * + * @author lemon + * @since + * Created on + */ +public class FineTableHeaderUI extends FlatTableHeaderUI { + + @Override + public void installUI(JComponent c) { + super.installUI(c); + JTableHeader header = (JTableHeader) c; + header.setDefaultRenderer(new TableHeaderRenderer()); + JTable table = header.getTable(); + + FineUIStyle.setStyle(table, FineUIStyle.DEFAULT_TABLE); + table.getTableHeader().getTable().setDefaultRenderer(Object.class, new TableRenderer()); + } + + + @Override + public void paint(Graphics g, JComponent c) { + super.paint(g, c); + } + + /** + * 表头 render + */ + public static class TableHeaderRenderer extends DefaultTableCellRenderer implements UIResource { + public TableHeaderRenderer() { + setPreferredSize(new Dimension(this.getWidth(), FineUIScale.scale(24))); + } + + @Override + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { + Border var13 = null; + if (hasFocus) { + var13 = DefaultLookup.getBorder(this, this.ui, "TableHeader.focusCellBorder"); + } + + if (var13 == null) { + var13 = DefaultLookup.getBorder(this, this.ui, "TableHeader.cellBorder"); + } + + this.setText(value == null ? "" : value.toString()); + this.setHorizontalAlignment(SwingConstants.LEFT); + this.setBorder(var13); + return this; + } + } + + + /** + * UI + * @param c + * @return + */ + public static ComponentUI createUI(JComponent c) { + return new FineTableHeaderUI(); + } + + /** + * 表身 render + */ + public static class TableRenderer extends DefaultTableCellRenderer { + public TableRenderer() { + setHorizontalAlignment(SwingConstants.LEFT); + } + + @Override + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { + if (column == table.getColumnCount() - 1) { + this.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIManager.getColor("defaultBorderColor")), + UIManager.getBorder("Table.cellNoFocusBorder"))); + } else { + this.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(0, 0, 1, 1, UIManager.getColor("defaultBorderColor")), + UIManager.getBorder("Table.cellNoFocusBorder"))); + } + setBackground(UIManager.getColor("Table.background")); + setText(value == null ? StringUtils.BLANK : String.valueOf(value)); + return this; + } + } +} diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/FineTableScrollBarPaneUI.java b/designer-base/src/main/java/com/fine/theme/light/ui/FineTableScrollBarPaneUI.java new file mode 100644 index 0000000000..354a0240a0 --- /dev/null +++ b/designer-base/src/main/java/com/fine/theme/light/ui/FineTableScrollBarPaneUI.java @@ -0,0 +1,53 @@ +package com.fine.theme.light.ui; + +import com.formdev.flatlaf.ui.FlatScrollBarUI; + +import javax.swing.JComponent; +import javax.swing.JTable; +import javax.swing.UIManager; +import java.awt.BasicStroke; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Rectangle; + +/** + * 应用于 JTable 的垂直滚动条UI + * + * @author lemon + * @since + * Created on 2024/08/11 + */ +public class FineTableScrollBarPaneUI extends FlatScrollBarUI { + + private final JTable table; + + public FineTableScrollBarPaneUI(JTable table) { + this.table = table; + } + + @Override + protected void paintTrack(Graphics g, JComponent c, Rectangle trackBounds) { + super.paintTrack(g, c, trackBounds); + // 获取表头的高度 + int gridLineThickness = 1; + Rectangle headerRect = table.getTableHeader().getBounds(); + int headerBottomY = headerRect.y + headerRect.height - gridLineThickness; + + // 在滚动条上限(表头的下边框位置)绘制一条线 + Graphics2D g2d = (Graphics2D) g; + g2d.setColor(UIManager.getColor("defaultBorderColor")); // 设置线条颜色 + g2d.setStroke(new BasicStroke(1)); // 设置线条宽度 + g2d.drawLine(trackBounds.x, headerBottomY, trackBounds.x + trackBounds.width, headerBottomY); + } + + @Override + protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds) { + // 确保滚动条滑块不会超过表头区域 + Rectangle headerRect = table.getTableHeader().getBounds(); + int headerHeight = headerRect.height; + thumbBounds.y = Math.max(thumbBounds.y, headerHeight); + + super.paintThumb(g, c, thumbBounds); + } + +} diff --git a/designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java b/designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java index 5e15fffb0b..dbddf1d261 100644 --- a/designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java +++ b/designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java @@ -42,6 +42,8 @@ public interface FineUIStyle { String PURE_TREE = "pureTree"; String PASTEL_BUTTON = "pastelButton"; + String DEFAULT_TABLE = "defaultTable"; + /** * 添加组件的样式类,类似css,该方法会接在原样式后方 diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/CopyableJTable.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/CopyableJTable.java index 65e4123b5c..6071fa3daa 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/CopyableJTable.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/CopyableJTable.java @@ -7,7 +7,6 @@ import com.fr.log.FineLoggerFactory; import com.fr.stable.os.OperatingSystem; import javax.swing.*; -import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.JTableHeader; import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumnModel; @@ -211,8 +210,6 @@ public class CopyableJTable extends SortableJTable { Component comp = super.prepareRenderer(renderer, row, column); if (isChoose(row, column)) { comp.setBackground(selectBackGround); - } else { - comp.setBackground(this.getBackground()); } return comp; } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java index ef7a81fb93..707befa4f8 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java @@ -4,6 +4,8 @@ package com.fr.design.data.datapane.preview; import com.fine.theme.icon.LazyIcon; +import com.fine.theme.light.ui.FineTableHeaderUI; +import com.fine.theme.light.ui.FineTableScrollBarPaneUI; import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIUtils; import com.fr.base.TableData; @@ -308,8 +310,10 @@ public class PreviewTablePane extends BasicPane { private JComponent initCenterPane() { preveiwTable = new CopyableJTable(new TableSorter()); preveiwTable.setRowSelectionAllowed(false); - preveiwTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); - return new JScrollPane(preveiwTable); + preveiwTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); + JScrollPane scrollPane = new JScrollPane(preveiwTable); + scrollPane.getVerticalScrollBar().setUI(new FineTableScrollBarPaneUI(preveiwTable)); + return scrollPane; } private void initDialog() { @@ -403,7 +407,7 @@ public class PreviewTablePane extends BasicPane { public static void resetPreviewTable() { getInstance().preveiwTable = new SortableJTable(new TableSorter()); getInstance().preveiwTable.setRowSelectionAllowed(false); - getInstance().preveiwTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + getInstance().preveiwTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); PreviewTablePane.progressBar.close(); getInstance().repaint(); } @@ -511,7 +515,7 @@ public class PreviewTablePane extends BasicPane { * @return */ private DefaultTableCellRenderer getDefaultTableCellRenderer() { - return new DefaultTableCellRenderer() { + return new FineTableHeaderUI.TableRenderer() { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { JComponent comp = (JComponent) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/PreviewTableDesensitizationPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/PreviewTableDesensitizationPane.java index 8cfdebd201..f96438bee5 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/PreviewTableDesensitizationPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/PreviewTableDesensitizationPane.java @@ -1,18 +1,19 @@ package com.fr.design.data.datapane.preview.desensitization.view; import com.fine.theme.icon.LazyIcon; +import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.design.constants.UIConstants; import com.fr.design.data.datapane.preview.PreviewTablePane; -import com.fr.design.gui.ibutton.UIToggleButton; +import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.i18n.Toolkit; import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.ToolBarDef; -import javax.swing.Icon; import javax.swing.JPanel; import java.awt.BorderLayout; +import java.awt.Color; import java.awt.Component; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; @@ -47,7 +48,7 @@ public class PreviewTableDesensitizationPane extends JPanel { /** * 脱敏效果预览按钮 */ - private UIToggleButton previewToggle; + private UIButton previewToggle; public PreviewTableDesensitizationPane(PreviewTablePane previewTablePane) { @@ -100,10 +101,13 @@ public class PreviewTableDesensitizationPane extends JPanel { * * @return */ - private UIToggleButton initPreviewButton() { - previewToggle = new UIToggleButton(new Icon[]{new LazyIcon("preview"), new LazyIcon("preview")}, true); + private UIButton initPreviewButton() { + previewToggle = new UIButton(); + previewToggle.setIcon(new LazyIcon("preview")); previewToggle.setToolTipText(Toolkit.i18nText("Fine-Design_Report_Desensitization_Preview")); previewToggle.setSelected(false); + previewToggle.setBackground(FlatUIUtils.getUIColor("default.background", new Color(246, 248, 250, 255))); + previewToggle.setBorder(null); previewToggle.addActionListener(e -> { // 切换TableModel的脱敏状态 previewTablePane.togglePreviewTableModelDesensitizeStatus(); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTableModel.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTableModel.java index 5ee8127b7a..5605f2d911 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTableModel.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTableModel.java @@ -1,6 +1,8 @@ package com.fr.design.data.datapane.preview.desensitization.view.setting; import com.fine.theme.icon.LazyIcon; +import com.fine.theme.light.ui.FineRoundBorder; +import com.fine.theme.utils.FineUIStyle; import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.data.desensitize.base.DesensitizationTableData; import com.fr.data.desensitize.base.TableDataDesensitizationItem; @@ -346,26 +348,10 @@ public class TableDataDesensitizationTableModel extends UITableModelAdapter } - private class ParameterValueRenderer extends DefaultTableCellRenderer { + private class ParameterValueRenderer extends FineTableHeaderUI.TableRenderer { private static final long serialVersionUID = 1L; private ValueEditorPane editor; private UILabel disableLable; - public ParameterValueRenderer(int paraUseType) { this(ValueEditorPaneFactory.createVallueEditorPaneWithUseType(paraUseType)); } @@ -243,15 +241,13 @@ public class ParameterTableModel extends UITableModelAdapter public ParameterValueRenderer(ValueEditorPane valueEditorPane) { disableLable = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Paramete_Name")); FineUIStyle.setStyle(disableLable, FineUIStyle.LABEL_WARNING_TIP); - disableLable.setHorizontalAlignment(SwingConstants.LEFT); disableLable.setOpaque(true); - disableLable.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); - disableLable.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIManager.getColor("defaultBorderColor"))); - + disableLable.setHorizontalAlignment(SwingConstants.LEFT); editor = valueEditorPane; } public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { + JComponent component = ((JComponent) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column)); if (table.isCellEditable(row, column)) { if (value == null) { editor.populate(""); @@ -260,6 +256,8 @@ public class ParameterTableModel extends UITableModelAdapter } return editor; } else { + disableLable.setBorder(component.getBorder()); + disableLable.setBackground(component.getBackground()); return disableLable; } } diff --git a/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableEditorPane.java b/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableEditorPane.java index 0293386aa1..a3923f6554 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableEditorPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableEditorPane.java @@ -1,40 +1,26 @@ package com.fr.design.gui.itableeditorpane; import com.fine.theme.light.ui.FineRoundBorder; +import com.fine.theme.light.ui.FineTableHeaderUI; +import com.fine.theme.light.ui.FineTableScrollBarPaneUI; import com.fine.theme.utils.FineUIScale; -import com.formdev.flatlaf.ui.FlatUIUtils; -import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.general.GeneralUtils; -import com.fr.stable.StringUtils; -import javax.swing.BorderFactory; -import javax.swing.JComponent; -import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; -import javax.swing.SwingConstants; -import javax.swing.UIManager; import javax.swing.event.TableModelListener; -import javax.swing.table.DefaultTableCellRenderer; import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.Dimension; import java.awt.GridLayout; import java.awt.Insets; -import java.awt.event.AdjustmentEvent; -import java.awt.event.AdjustmentListener; import java.util.List; import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.column; -import static com.fine.swing.ui.layout.Layouts.row; /** * 表格编辑面板,一般是两列.键-值 用泛型实现,用的时候请定义T.model里面的T要一样 @@ -47,7 +33,7 @@ public class UITableEditorPane extends BasicPane { * */ private static final long serialVersionUID = 6855793816972735815L; - protected static JTable editTable; + protected JTable editTable; // 放置action 的按钮. protected UITableModelAdapter tableModel; private String leftLabelName; @@ -91,39 +77,12 @@ public class UITableEditorPane extends BasicPane { controlPane.add(buttonPane, BorderLayout.EAST); controlPane.add(content == null ? l : content, BorderLayout.WEST); - pane.add(column(cell(controlPane), cell(buildScrollTablePane(scrollPane)).weight(1)).getComponent()); - - this.editTable.getTableHeader().setDefaultRenderer(new TableHeaderRenderer()); - this.editTable.setDefaultRenderer(Object.class, new TableRenderer()); + scrollPane.getVerticalScrollBar().setUI(new FineTableScrollBarPaneUI(editTable)); + pane.add(column(10, cell(controlPane), cell(scrollPane).weight(1)).getComponent()); + this.editTable.getTableHeader().setUI(new FineTableHeaderUI()); this.editTable.setRowHeight(FineUIScale.scale(24)); } - /** - * 组合 jtable 和垂直滚动条 - * @param scrollPane - * @return - */ - protected JPanel buildScrollTablePane(JScrollPane scrollPane) { - verticalScrollBar = column( - cell(new UILabel()).with(it -> { - it.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 1, UIManager.getColor("defaultBorderColor"))); - it.setPreferredSize(new Dimension(scrollPane.getVerticalScrollBar().getWidth(), (int) editTable.getTableHeader().getPreferredSize().getHeight())); - }), - cell(scrollPane.getVerticalScrollBar()).weight(1).with(it -> { - it.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 1, UIManager.getColor("defaultBorderColor"))); - }) - ).getComponent(); - scrollPane.getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener() { - @Override - public void adjustmentValueChanged(AdjustmentEvent e) { - verticalScrollBar.setVisible(editTable.getHeight() > scrollPane.getViewport().getHeight()); - verticalScrollBar.repaint(); - } - }); - - return row(cell(scrollPane).weight(1), cell(verticalScrollBar)).getComponent(); - } - public UITableModelAdapter getTableModel() { return tableModel; } @@ -211,7 +170,7 @@ public class UITableEditorPane extends BasicPane { /** * @return jTable */ - public static JTable getEditTable() { + public JTable getEditTable() { return editTable; } @@ -234,54 +193,4 @@ public class UITableEditorPane extends BasicPane { editTable.getTableHeader().setResizingAllowed(resizingAllowed); } - /** - * 设置 TableHeader 文字左对齐 - */ - public static class TableHeaderRenderer extends DefaultTableCellRenderer { - public TableHeaderRenderer() { - setHorizontalAlignment(SwingConstants.LEFT); - setPreferredSize(new Dimension(this.getWidth(), FineUIScale.scale(24))); - } - - @Override - public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { - Component component = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); - if (column == table.getColumnCount() - 1) { - ((JComponent) component).setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIManager.getColor("defaultBorderColor"))); - } else { - ((JComponent) component).setBorder(BorderFactory.createMatteBorder(0, 0, 1, 1, UIManager.getColor("defaultBorderColor"))); - } - return component; - } - } - - /** - * 设置 Table 表身格式 - */ - public static class TableRenderer extends DefaultTableCellRenderer { - public TableRenderer() { - } - - @Override - public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { - Component component = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); - if(component instanceof JLabel) { - String toolTipText = GeneralUtils.objectToString(value); - if (StringUtils.isNotEmpty(toolTipText)) { - ((JLabel) component).setToolTipText(toolTipText); - } - } - if (column == table.getColumnCount() - 1) { - ((JComponent) component).setBorder(BorderFactory.createCompoundBorder( - BorderFactory.createMatteBorder(0, 0, 1, 0, UIManager.getColor("defaultBorderColor")), - new ScaledEmptyBorder(0,4,0,0))); - } else { - ((JComponent) component).setBorder(BorderFactory.createCompoundBorder( - BorderFactory.createMatteBorder(0, 0, 1, 1, UIManager.getColor("defaultBorderColor")), - new ScaledEmptyBorder(0,4,0,0))); - } - component.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); - return component; - } - } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DottedLine.java b/designer-base/src/main/java/com/fr/design/mainframe/DottedLine.java index 9382b03f89..4e37a87830 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DottedLine.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DottedLine.java @@ -1 +1 @@ -package com.fr.design.mainframe; import com.fr.design.constants.UIConstants; import com.fr.design.gui.iscrollbar.UIScrollBar; import javax.swing.*; import java.awt.*; import java.awt.geom.GeneralPath; import java.awt.geom.Path2D; /** * Author : daisy * Date: 13-9-11 * Time: 上午10:14 */ public class DottedLine extends JPanel { public static final int HEIGHT = 3; private static final int BLUE_WIDTH = 12;//蓝色线长度,白色线长度是其半 private int direction = UIScrollBar.HORIZONTAL; public DottedLine(int direction, int width) { //水平方向的虚线框 if (direction == UIScrollBar.HORIZONTAL) { this.setPreferredSize(new Dimension(width, HEIGHT)); } else { this.setPreferredSize(new Dimension(HEIGHT, width)); } this.direction = direction; this.setBackground(new Color(255, 255, 255));//设置白色背景 } public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; //如果是水平方向的 if (direction == UIScrollBar.HORIZONTAL) { paintHorizontal(g2d); } else { paintVertical(g2d); } } private void paintHorizontal(Graphics2D g2d) { int totalWidth = getWidth(); int paintX = 0; while (paintX < totalWidth) { int endX = paintX + BLUE_WIDTH; if (endX > totalWidth) { endX = totalWidth; } int[] x = new int[]{paintX, endX, endX, paintX, paintX}; int[] y = new int[]{0, 0, HEIGHT, HEIGHT, 0}; paintBlueArea(g2d, x, y); paintX += BLUE_WIDTH + BLUE_WIDTH / 2; } } private void paintVertical(Graphics2D g2d) { int totalHeight = getHeight(); int paintY = 0; while (paintY < totalHeight) { int endY = paintY + BLUE_WIDTH; if (endY > totalHeight) { endY = totalHeight; } int[] x = new int[]{0, HEIGHT, HEIGHT, 0, 0}; int[] y = new int[]{paintY, paintY, endY, endY, paintY}; paintBlueArea(g2d, x, y); paintY += BLUE_WIDTH + BLUE_WIDTH / 2; } } private void paintBlueArea(Graphics2D g2d, int[] x, int[] y) { g2d.setPaint(UIConstants.DOTTED_LINE_COLOR); GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, x.length); generalPath.moveTo(x[0], y[0]); for (int index = 1; index < x.length; index++) { generalPath.lineTo(x[index], y[index]); } generalPath.closePath(); g2d.fill(generalPath); } } \ No newline at end of file +package com.fr.design.mainframe; import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.design.constants.UIConstants; import com.fr.design.gui.iscrollbar.UIScrollBar; import javax.swing.*; import java.awt.*; import java.awt.geom.GeneralPath; import java.awt.geom.Path2D; /** * Author : daisy * Date: 13-9-11 * Time: 上午10:14 */ public class DottedLine extends JPanel { public static final int HEIGHT = 3; private static final int BLUE_WIDTH = 12;//蓝色线长度,白色线长度是其半 private int direction = UIScrollBar.HORIZONTAL; public DottedLine(int direction, int width) { //水平方向的虚线框 if (direction == UIScrollBar.HORIZONTAL) { this.setPreferredSize(new Dimension(width, HEIGHT)); } else { this.setPreferredSize(new Dimension(HEIGHT, width)); } this.direction = direction; this.setBackground(new Color(255, 255, 255));//设置白色背景 } public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; //如果是水平方向的 if (direction == UIScrollBar.HORIZONTAL) { paintHorizontal(g2d); } else { paintVertical(g2d); } } private void paintHorizontal(Graphics2D g2d) { int totalWidth = getWidth(); int paintX = 0; while (paintX < totalWidth) { int endX = paintX + BLUE_WIDTH; if (endX > totalWidth) { endX = totalWidth; } int[] x = new int[]{paintX, endX, endX, paintX, paintX}; int[] y = new int[]{0, 0, HEIGHT, HEIGHT, 0}; paintBlueArea(g2d, x, y); paintX += BLUE_WIDTH + BLUE_WIDTH / 2; } } private void paintVertical(Graphics2D g2d) { int totalHeight = getHeight(); int paintY = 0; while (paintY < totalHeight) { int endY = paintY + BLUE_WIDTH; if (endY > totalHeight) { endY = totalHeight; } int[] x = new int[]{0, HEIGHT, HEIGHT, 0, 0}; int[] y = new int[]{paintY, paintY, endY, endY, paintY}; paintBlueArea(g2d, x, y); paintY += BLUE_WIDTH + BLUE_WIDTH / 2; } } private void paintBlueArea(Graphics2D g2d, int[] x, int[] y) { g2d.setPaint(FlatUIUtils.getUIColor("DottedLine.defaultColor", new Color(37,118,239,1))); GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, x.length); generalPath.moveTo(x[0], y[0]); for (int index = 1; index < x.length; index++) { generalPath.lineTo(x[index], y[index]); } generalPath.closePath(); g2d.fill(generalPath); } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/AbstractSupportSelectTablePane.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/AbstractSupportSelectTablePane.java index 5810a02dd5..39c8631a0f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/AbstractSupportSelectTablePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/AbstractSupportSelectTablePane.java @@ -366,6 +366,7 @@ public abstract class AbstractSupportSelectTablePane exte setColumnClass(classes); this.setDefaultEditor(Boolean.class, new BooleanEditor()); this.setDefaultRenderer(Boolean.class, new BooleanRenderer()); + this.setDefaultRenderer(UILabel.class, new ToolTipTableCellRenderer()); this.createTable().getColumnModel().getColumn(0).setCellRenderer(new BooleanRenderer()); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/ToolTipTableCellRenderer.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/ToolTipTableCellRenderer.java index bfb10e2057..7cfb7bd550 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/ToolTipTableCellRenderer.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/ToolTipTableCellRenderer.java @@ -1,11 +1,11 @@ package com.fr.design.mainframe.vcs.ui; +import com.fine.theme.light.ui.FineTableHeaderUI; import com.fr.general.GeneralUtils; import com.fr.stable.StringUtils; import javax.swing.JTable; import javax.swing.JLabel; -import javax.swing.table.DefaultTableCellRenderer; import java.awt.*; @@ -16,7 +16,7 @@ import java.awt.*; * @since 11.0 * Created on 2023/7/21 */ -public class ToolTipTableCellRenderer extends DefaultTableCellRenderer { +public class ToolTipTableCellRenderer extends FineTableHeaderUI.TableRenderer { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java index c58f496a2e..f0615bfa49 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java @@ -127,6 +127,7 @@ public class VcsNewPane extends RecyclePane { this.operatorPane = createOperatorPane(); this.model.setDefaultEditor(VcsOperatorPane.class, new VcsCellEditor(createOperatorPane())); this.model.setDefaultRenderer(VcsOperatorPane.class, new VcsCellRender(createOperatorPane())); + this.model.setDefaultRenderer(UILabel.class, new ToolTipTableCellRenderer()); } diff --git a/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java b/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java index 605d84b40e..cbf69a64d5 100644 --- a/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java +++ b/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java @@ -3,6 +3,7 @@ package com.fr.design.write.submit; import com.fine.swing.ui.layout.Layouts; import com.fine.theme.icon.LazyIcon; import com.fine.swing.ui.layout.Spacer; +import com.fine.theme.light.ui.FineTableHeaderUI; import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIUtils; import com.fr.base.BaseFormula; @@ -54,12 +55,15 @@ import com.fr.write.config.InsertConfig; import com.fr.write.config.IntelliDMLConfig; import com.fr.write.config.UpdateConfig; +import java.awt.*; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.AbstractCellEditor; +import javax.swing.BorderFactory; import javax.swing.DefaultCellEditor; import javax.swing.DefaultComboBoxModel; import javax.swing.Icon; +import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JOptionPane; import javax.swing.JPanel; @@ -69,17 +73,14 @@ import javax.swing.JTree; import javax.swing.ListSelectionModel; import javax.swing.SwingConstants; import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.plaf.UIResource; import javax.swing.table.AbstractTableModel; -import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.TableCellEditor; +import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumn; import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.DefaultTreeModel; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.FocusAdapter; @@ -169,9 +170,7 @@ public class DBManipulationPane extends BasicBeanPane { keyColumnValuesTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); keyColumnValuesTable.setPreferredScrollableViewportSize(FineUIScale.scale(new Dimension(280, 150))); keyColumnValuesTable.setShowHorizontalLines(true); - DefaultTableCellRenderer headerRenderer = new DefaultTableCellRenderer(); - headerRenderer.setHorizontalAlignment(SwingConstants.LEFT); - keyColumnValuesTable.getTableHeader().setDefaultRenderer(headerRenderer); + keyColumnValuesTable.getTableHeader().setUI(new FineTableHeaderUI()); northPane.add(column(10, cell(FineUIUtils.wrapComponentWithTitle(typePane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Write_Submit_Type"))), @@ -697,7 +696,7 @@ public class DBManipulationPane extends BasicBeanPane { private void initJTableColumn() { TableColumn column0 = this.keyColumnValuesTable.getColumnModel().getColumn(0); column0.setMaxWidth(50); - column0.setCellRenderer(new ColumnNameTableCellRenderer()); + column0.setCellRenderer(new BooleanRenderer()); TableColumn column1 = this.keyColumnValuesTable.getColumnModel().getColumn(1); column1.setCellRenderer(new ColumnNameTableCellRenderer()); @@ -1183,7 +1182,7 @@ public class DBManipulationPane extends BasicBeanPane { /* * ColumnNameTableCellRenderer */ - public static class ColumnNameTableCellRenderer extends DefaultTableCellRenderer { + public static class ColumnNameTableCellRenderer extends FineTableHeaderUI.TableRenderer { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); @@ -1199,7 +1198,7 @@ public class DBManipulationPane extends BasicBeanPane { /* * ColumnValueTableCellRenderer */ - private static class ColumnValueTableCellRenderer extends DefaultTableCellRenderer { + private static class ColumnValueTableCellRenderer extends FineTableHeaderUI.TableRenderer { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); @@ -1220,4 +1219,25 @@ public class DBManipulationPane extends BasicBeanPane { return this; } } + + /** + * checkBox 的 cellRender + */ + public static class BooleanRenderer extends UICheckBox implements TableCellRenderer, UIResource { + public BooleanRenderer() { + super(); + setHorizontalAlignment(JLabel.CENTER); + setBorderPainted(true); + } + + @Override + public Component getTableCellRendererComponent(JTable table, Object value, + boolean isSelected, boolean hasFocus, int row, int column) { + setSelected((value != null && ((Boolean) value).booleanValue())); + setUI(getUICheckBoxUI()); + setBorder(BorderFactory.createMatteBorder(0, 0, 1, 1, UIManager.getColor("defaultBorderColor"))); + setBackground(Color.WHITE); + return this; + } + } } diff --git a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties index 5310524e57..b78c2c2806 100644 --- a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties +++ b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties @@ -893,7 +893,7 @@ Table.scrollPaneBorder = com.formdev.flatlaf.ui.FlatBorder Table.ascendingSortIcon = com.formdev.flatlaf.icons.FlatAscendingSortIcon Table.descendingSortIcon = com.formdev.flatlaf.icons.FlatDescendingSortIcon Table.sortIconColor = @icon -Table.cellMargins = 2,3,2,3 +Table.cellMargins = 2,6,2,3 Table.cellFocusColor = @cellFocusColor Table.cellNoFocusBorder = com.formdev.flatlaf.ui.FlatTableCellBorder$Default Table.focusCellHighlightBorder = com.formdev.flatlaf.ui.FlatTableCellBorder$Focused @@ -908,13 +908,14 @@ Table.dropCellForeground = @dropCellForeground Table.dropLineColor = @dropLineColor Table.dropLineShortColor = @dropLineShortColor Table.gridColor = darken($Table.background,8%) +Table.default.background = $default.background #---- TableHeader ---- TableHeader.height = 25 TableHeader.cellBorder = com.formdev.flatlaf.ui.FlatTableHeaderBorder -TableHeader.cellMargins = 2,3,2,3 +TableHeader.cellMargins = 2,6,2,3 TableHeader.focusCellBackground = $TableHeader.background TableHeader.background = @componentBackground TableHeader.showTrailingVerticalLine = false @@ -1143,6 +1144,10 @@ Tree.icon.closedColor = @icon Tree.icon.openColor = @icon Tree.hash = darken($Tree.background,10%) +# ---- DottedLine ---- +DottedLine.defaultColor=@BrandColor + + #---- West ---- West.border = $defaultBorderColor #---- ExpandablePane ---- @@ -1333,3 +1338,6 @@ CellOtherSetPane.height=$Component.defaultHeight [style]Tree.pureTree = \ background: $fill.normal + +[style]Table.defaultTable = \ + background: $Table.default.background \ No newline at end of file diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/components/TableStoryBoard.java b/designer-base/src/test/java/com/fr/design/gui/storybook/components/TableStoryBoard.java new file mode 100644 index 0000000000..e2ff6554f6 --- /dev/null +++ b/designer-base/src/test/java/com/fr/design/gui/storybook/components/TableStoryBoard.java @@ -0,0 +1,111 @@ +package com.fr.design.gui.storybook.components; + +import com.fine.theme.light.ui.FineRoundBorder; +import com.fine.theme.light.ui.FineTableHeaderUI; +import com.fine.theme.light.ui.FineTableScrollBarPaneUI; +import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.storybook.StoryBoard; + +import javax.swing.BorderFactory; +import javax.swing.JCheckBox; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JTable; +import javax.swing.UIManager; +import javax.swing.plaf.UIResource; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableCellRenderer; + +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; + +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; + +public class TableStoryBoard extends StoryBoard { + public TableStoryBoard() { + super("表格"); + + DefaultTableModel model1 = new DefaultTableModel(new Object[][] { + {"1", "Alice", "Female", "Engineering"}, + {"2", "Bob", "Male", "Marketing"}, + {"3", "Carol", "Female", "Design"}, + {"4", "Dave", "Male", "Finance"}, + {"4", "Dave", "Male", "Finance"}, + {"4", "Dave", "Male", "Finance"}, + {"4", "Dave", "Male", "Finance"}, + {"4", "Dave", "Male", "Finance"}, + {"4", "Dave", "Male", "Finance"}, + {"4", "Dave", "Male", "Finance"}, + {"4", "Dave", "Male", "Finance"}, + {"4", "Dave", "Male", "Finance"}, + {"4", "Dave", "Male", "Finance"}, + {"4", "Dave", "Male", "Finance"}, + {"4", "Dave", "Male", "Finance"}, + {"4", "Dave", "Male", "Finance"}, + {"4", "Dave", "Male", "Finance"}, + {"4", "Dave", "Male", "Finance"}, + {"4", "Dave", "Male", "Finance"}, + {"4", "Dave", "Male", "Finance"}, + {"4", "Dave", "Male", "Finance"}, + {"4", "Dave", "Male", "Finance"} + }, new String[] {"ID", "Name", "Gender", "Department"}); + JTable table1 = new JTable(model1); + table1.getTableHeader().setUI(new FineTableHeaderUI()); + + DefaultTableModel model2 = new DefaultTableModel(new Object[][] { + {"1", "Alice", "Female", "Engineering"}, + {"2", "Bob", "Male", "Marketing"}, + {"3", "Carol", "Female", "Design"}, + {"4", "Dave", "Male", "Finance"} + }, new String[] {"ID", "Name", "Gender", "Department"}); + JTable table2 = new JTable(model2); + table2.getTableHeader().setUI(new FineTableHeaderUI()); + + DefaultTableModel model3 = new DefaultTableModel(new Object[][] { + {false, "1", "Alice", "Female", "Engineering"}, + {false, "2", "Bob", "Male", "Marketing"}, + {false, "3", "Carol", "Female", "Design"}, + {false, "4", "Dave", "Male", "Finance"} + }, new String[] {"选中", "ID", "Name", "Gender", "Department"}) { + private static final long serialVersionUID = 1L; + Class[] types = new Class[]{Boolean.class, UILabel.class, UILabel.class, UILabel.class, UILabel.class}; + + public Class getColumnClass(int columnIndex) { + return types[columnIndex]; + } + }; + JTable table3 = new JTable(model3); + table3.getTableHeader().setUI(new FineTableHeaderUI()); + table3.getTableHeader().getColumnModel().getColumn(0).setCellRenderer(new BooleanRenderer()); + + add(column(20, cell(new UIScrollPane(table1)).with(this::setFixSize).with(it -> it.getVerticalScrollBar().setUI(new FineTableScrollBarPaneUI(table1))), + cell(new UIScrollPane(table2)).with(this::setFixSize), + cell(new UIScrollPane(table3)).with(this::setFixSize)).getComponent()); + } + + + private void setFixSize(JComponent component) { + component.setPreferredSize(new Dimension(component.getWidth(), 150)); + component.setBorder(new FineRoundBorder()); + } + + public static class BooleanRenderer extends JCheckBox implements TableCellRenderer, UIResource { + public BooleanRenderer() { + super(); + setHorizontalAlignment(JLabel.CENTER); + setOpaque(false); + } + + @Override + public Component getTableCellRendererComponent(JTable table, Object value, + boolean isSelected, boolean hasFocus, int row, int column) { + setSelected((value != null && ((Boolean) value).booleanValue())); + setBorder(BorderFactory.createMatteBorder(0, 0, 1, 1, UIManager.getColor("defaultBorderColor"))); + setBackground(Color.WHITE); + return this; + } + } +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceSouthPanel.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceSouthPanel.java index a549c0fa5e..ef1c13e9c7 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceSouthPanel.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceSouthPanel.java @@ -3,7 +3,6 @@ package com.fr.design.actions.replace.ui; import javax.swing.BorderFactory; import javax.swing.RowSorter; import javax.swing.table.TableRowSorter; -import java.awt.Color; /** * 下面板 diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableButton.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableButton.java index a84faf432c..87210a62d9 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableButton.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableButton.java @@ -1,17 +1,8 @@ package com.fr.design.actions.replace.ui; import com.fine.theme.icon.LazyIcon; -import com.fr.base.TRL; import com.fr.design.actions.replace.info.base.ITContent; -import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.i18n.Toolkit; -import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.JTemplate; -import com.fr.file.FILE; -import com.fr.file.FILEFactory; -import com.fr.general.GeneralUtils; -import com.fr.stable.StringUtils; import javax.swing.AbstractCellEditor; @@ -21,10 +12,6 @@ import javax.swing.UIManager; import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellRenderer; import java.awt.Component; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -import static com.fr.design.actions.replace.ui.ITTableEditorPane.getEditTable; /** * 放进表格中的定位按钮 diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditor.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditor.java index 527a74b1ed..ce571d193f 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditor.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditor.java @@ -60,7 +60,6 @@ public class ITTableEditor extends UITableModelAdapter { }); - this.setDefaultRenderer(UILabel.class, new UITableEditorPane.TableRenderer()); this.setDefaultEditor(ITTableButton.class, new ITTableButton()); this.setDefaultRenderer(ITTableButton.class, new ITTableButton()); this.setDefaultEditor(Boolean.class, new ITBooleanEditor()); diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java index bb36379e02..132f1cd85c 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java @@ -1,21 +1,25 @@ package com.fr.design.actions.replace.ui; import com.fine.theme.icon.LazyIcon; +import com.fine.theme.light.ui.FineTableHeaderUI; +import com.fine.theme.light.ui.FineTableScrollBarPaneUI; +import com.fine.theme.utils.FineUIStyle; import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.base.TRL; import com.fr.design.actions.replace.info.base.ITContent; +import com.fr.design.dialog.BasicPane; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.itableeditorpane.UITableEditAction; -import com.fr.design.gui.itableeditorpane.UITableEditorPane; import com.fr.design.gui.itableeditorpane.UITableModelAdapter; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.share.ui.base.MouseClickListener; import com.fr.general.GeneralUtils; import com.fr.stable.StringUtils; +import sun.swing.DefaultLookup; import javax.swing.BorderFactory; @@ -28,10 +32,8 @@ import javax.swing.SwingConstants; import javax.swing.UIManager; import javax.swing.table.JTableHeader; import javax.swing.table.TableCellRenderer; -import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; -import java.awt.Dimension; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.List; @@ -47,13 +49,15 @@ import static com.fine.swing.ui.layout.Layouts.cell; * @since * Created On */ -public class ITTableEditorPane extends UITableEditorPane { +public class ITTableEditorPane extends BasicPane { + public static JTable editTable; + private UITableModelAdapter tableModel; private String leftLabelName; private JPanel buttonPane; public ITTableEditorPane(UITableModelAdapter model) { - super(model); - + this.tableModel = model; + this.initComponent(model.createAction()); } @@ -65,6 +69,7 @@ public class ITTableEditorPane extends UITableEditorPane { public void initComponent(UITableEditAction[] action) { this.setLayout(FRGUIPaneFactory.createBorderLayout()); editTable = tableModel.createTable(); + FineUIStyle.setStyle(editTable, FineUIStyle.DEFAULT_TABLE); editTable.addMouseListener(new MouseClickListener() { @Override public void mouseClicked(MouseEvent e) { @@ -88,9 +93,10 @@ public class ITTableEditorPane extends UITableEditorPane { } }); - UIScrollPane scrollPane = new UIScrollPane(editTable); - add(cell(buildScrollTablePane(scrollPane)).weight(1).getComponent()); + UIScrollPane scrollPane = new UIScrollPane(editTable); + scrollPane.getVerticalScrollBar().setUI(new FineTableScrollBarPaneUI(editTable)); + add(cell(scrollPane).weight(1).getComponent()); } /** @@ -136,7 +142,7 @@ public class ITTableEditorPane extends UITableEditorPane { /** * 表头渲染 */ - public static class ITHeaderRenderer implements TableCellRenderer { + public static class ITHeaderRenderer extends FineTableHeaderUI.TableHeaderRenderer { JTableHeader tableHeader; final UICheckBox selectBox; private boolean ascSort = true; @@ -221,8 +227,8 @@ public class ITTableEditorPane extends UITableEditorPane { component.setForeground(tableHeader.getForeground()); component.setBackground(tableHeader.getBackground()); component.setFont(tableHeader.getFont()); - if (column == table.getColumnCount() - 1) { - component.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIManager.getColor("defaultBorderColor"))); + if (column != ITReplaceSouthPanel.CHECKBOX_INDEX) { + component.setBorder(DefaultLookup.getBorder(this, this.ui, "TableHeader.cellBorder")); } else { component.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 1, UIManager.getColor("defaultBorderColor"))); } @@ -239,7 +245,7 @@ public class ITTableEditorPane extends UITableEditorPane { * @param table */ public static void makeFace(JTable table) { - table.getTableHeader().setBackground(FlatUIUtils.getUIColor("TableHeader.background", Color.WHITE)); + table.getTableHeader().setUI(new FineTableHeaderUI()); table.getTableHeader().setDefaultRenderer(new ITHeaderRenderer(table)); } diff --git a/designer-realize/src/main/java/com/fr/design/cell/smartaction/SmartJTablePane.java b/designer-realize/src/main/java/com/fr/design/cell/smartaction/SmartJTablePane.java index c55f9a6974..51c23b615a 100644 --- a/designer-realize/src/main/java/com/fr/design/cell/smartaction/SmartJTablePane.java +++ b/designer-realize/src/main/java/com/fr/design/cell/smartaction/SmartJTablePane.java @@ -3,6 +3,7 @@ package com.fr.design.cell.smartaction; import java.awt.BorderLayout; import java.awt.Window; +import com.fine.theme.light.ui.FineTableHeaderUI; import com.fr.design.gui.ilable.UILabel; import javax.swing.JScrollPane; @@ -73,9 +74,7 @@ public abstract class SmartJTablePane extends BasicPane { } } }); - DefaultTableCellRenderer headerRenderer = new DefaultTableCellRenderer(); - headerRenderer.setHorizontalAlignment(SwingConstants.LEFT); - table.getTableHeader().setDefaultRenderer(headerRenderer); + table.getTableHeader().setUI(new FineTableHeaderUI()); setCellRenderer(); actionReportPane.addSelectionChangeListener(gridSelectionChangeL); diff --git a/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java b/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java index 38b4546c43..7ced9bf8e9 100644 --- a/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java +++ b/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java @@ -1,6 +1,7 @@ package com.fr.design.write.submit; import com.fine.theme.icon.LazyIcon; +import com.fine.theme.light.ui.FineTableHeaderUI; import com.fr.cache.list.IntList; import com.fr.data.ClassSubmitJob; import com.fr.design.actions.UpdateAction; @@ -40,7 +41,6 @@ import javax.swing.JTable; import javax.swing.SwingConstants; import javax.swing.SwingUtilities; import javax.swing.SwingWorker; -import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.TableColumn; import java.awt.BorderLayout; import java.awt.Component; @@ -355,7 +355,7 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane { column0.setMaxWidth(LEFT_COLUMN_MAX_WIDTH); ColumnNameTableCellRenderer cellRenderer = new ColumnNameTableCellRenderer(); cellRenderer.setHorizontalAlignment(SwingConstants.LEFT); - column0.setCellRenderer(cellRenderer); + column0.setCellRenderer(new BooleanRenderer()); /* * 设置Column 1的Renderer */ @@ -554,7 +554,7 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane { /* * ColumnValueTableCellRenderer */ - private class SelectedColumnValueTableCellRenderer extends DefaultTableCellRenderer { + private class SelectedColumnValueTableCellRenderer extends FineTableHeaderUI.TableRenderer { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); @@ -577,7 +577,7 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane { } } - private class ColumnRowGroupCellRenderer2 extends DefaultTableCellRenderer { + private class ColumnRowGroupCellRenderer2 extends FineTableHeaderUI.TableRenderer { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); From ed8d3bc5361c3b03c5480470cdef793c43542027 Mon Sep 17 00:00:00 2001 From: lemon Date: Mon, 12 Aug 2024 19:47:35 +0800 Subject: [PATCH 2/2] =?UTF-8?q?REPORT-127437=20fix:=E5=B8=83=E5=B1=80?= =?UTF-8?q?=EF=BC=8C=E8=83=8C=E6=99=AF=E9=A2=9C=E8=89=B2=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../theme/light/ui/FineTableHeaderUI.java | 25 ++++------- .../light/ui/FineTableScrollBarPaneUI.java | 15 +------ .../com/fine/theme/utils/FineUIStyle.java | 2 + .../connect/ConnectionTableProcedurePane.java | 21 ++++------ .../datapane/preview/PreviewTablePane.java | 16 +++---- .../view/PreviewTableDesensitizationPane.java | 6 +-- .../tabledatapane/DBTableDataPane.java | 23 ++++++---- .../tabledatapane/MaxMemRowCountPanel.java | 4 ++ .../tabledatapane/ProcedureDataPane.java | 9 ++-- .../java/com/fr/design/dialog/BasicPane.java | 5 ++- .../gui/icombobox/UIComboBoxRenderer.java | 25 +++-------- .../fr/design/gui/ilist/TableViewList.java | 7 ++++ .../itableeditorpane/UITableEditorPane.java | 12 +++--- .../fr/design/layout/FRGUIPaneFactory.java | 22 ++++++++++ .../mainframe/CenterRegionContainerPane.java | 2 +- .../ui/AbstractSupportSelectTablePane.java | 6 ++- .../design/mainframe/vcs/ui/RecyclePane.java | 3 +- .../mainframe/vcs/ui/VcsOperatorPane.java | 2 +- .../fr/design/style/AbstractSelectBox.java | 1 + .../java/com/fr/design/style/FormatPane.java | 19 +++++---- .../background/impl/ImageBackgroundPane.java | 3 +- .../style/color/DetailColorSelectPane.java | 3 +- .../light/ui/laf/FineLightLaf.properties | 19 ++++++--- .../replace/ui/ITReplaceNorthPanel.java | 2 +- .../cell/smartaction/SmartJTablePane.java | 2 + .../fr/design/condition/ForeGroundPane.java | 3 ++ .../com/fr/design/condition/PaddingPane.java | 3 ++ .../com/fr/design/condition/PagePane.java | 3 ++ .../headerfooter/HeaderFooterEditPane.java | 25 +++++------ .../design/headerfooter/HeaderFooterPane.java | 11 ++--- .../report/NewReportBackgroundPane.java | 23 ++++------ .../fr/design/report/ReportColumnsPane.java | 23 +++++----- .../freeze/RepeatAndFreezeSettingPane.java | 42 ++++++++----------- 33 files changed, 192 insertions(+), 195 deletions(-) diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/FineTableHeaderUI.java b/designer-base/src/main/java/com/fine/theme/light/ui/FineTableHeaderUI.java index 35a5f48c1d..2dc2b53392 100644 --- a/designer-base/src/main/java/com/fine/theme/light/ui/FineTableHeaderUI.java +++ b/designer-base/src/main/java/com/fine/theme/light/ui/FineTableHeaderUI.java @@ -1,6 +1,5 @@ package com.fine.theme.light.ui; -import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIStyle; import com.formdev.flatlaf.ui.FlatTableHeaderUI; import com.fr.stable.StringUtils; @@ -17,7 +16,6 @@ import javax.swing.plaf.UIResource; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.JTableHeader; import java.awt.Component; -import java.awt.Dimension; import java.awt.Graphics; /** @@ -51,23 +49,14 @@ public class FineTableHeaderUI extends FlatTableHeaderUI { */ public static class TableHeaderRenderer extends DefaultTableCellRenderer implements UIResource { public TableHeaderRenderer() { - setPreferredSize(new Dimension(this.getWidth(), FineUIScale.scale(24))); } @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { - Border var13 = null; - if (hasFocus) { - var13 = DefaultLookup.getBorder(this, this.ui, "TableHeader.focusCellBorder"); - } - - if (var13 == null) { - var13 = DefaultLookup.getBorder(this, this.ui, "TableHeader.cellBorder"); - } - + Border border = DefaultLookup.getBorder(this, this.ui, "TableHeader.cellBorder"); this.setText(value == null ? "" : value.toString()); this.setHorizontalAlignment(SwingConstants.LEFT); - this.setBorder(var13); + this.setBorder(border); return this; } } @@ -92,15 +81,17 @@ public class FineTableHeaderUI extends FlatTableHeaderUI { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { + Border border; if (column == table.getColumnCount() - 1) { - this.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIManager.getColor("defaultBorderColor")), - UIManager.getBorder("Table.cellNoFocusBorder"))); + border = BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIManager.getColor("defaultBorderColor")), + UIManager.getBorder("Table.cellNoFocusBorder")); } else { - this.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(0, 0, 1, 1, UIManager.getColor("defaultBorderColor")), - UIManager.getBorder("Table.cellNoFocusBorder"))); + border = BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(0, 0, 1, 1, UIManager.getColor("defaultBorderColor")), + UIManager.getBorder("Table.cellNoFocusBorder")); } setBackground(UIManager.getColor("Table.background")); setText(value == null ? StringUtils.BLANK : String.valueOf(value)); + setBorder(border); return this; } } diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/FineTableScrollBarPaneUI.java b/designer-base/src/main/java/com/fine/theme/light/ui/FineTableScrollBarPaneUI.java index 354a0240a0..9e18e17b45 100644 --- a/designer-base/src/main/java/com/fine/theme/light/ui/FineTableScrollBarPaneUI.java +++ b/designer-base/src/main/java/com/fine/theme/light/ui/FineTableScrollBarPaneUI.java @@ -4,10 +4,7 @@ import com.formdev.flatlaf.ui.FlatScrollBarUI; import javax.swing.JComponent; import javax.swing.JTable; -import javax.swing.UIManager; -import java.awt.BasicStroke; import java.awt.Graphics; -import java.awt.Graphics2D; import java.awt.Rectangle; /** @@ -27,17 +24,7 @@ public class FineTableScrollBarPaneUI extends FlatScrollBarUI { @Override protected void paintTrack(Graphics g, JComponent c, Rectangle trackBounds) { - super.paintTrack(g, c, trackBounds); - // 获取表头的高度 - int gridLineThickness = 1; - Rectangle headerRect = table.getTableHeader().getBounds(); - int headerBottomY = headerRect.y + headerRect.height - gridLineThickness; - - // 在滚动条上限(表头的下边框位置)绘制一条线 - Graphics2D g2d = (Graphics2D) g; - g2d.setColor(UIManager.getColor("defaultBorderColor")); // 设置线条颜色 - g2d.setStroke(new BasicStroke(1)); // 设置线条宽度 - g2d.drawLine(trackBounds.x, headerBottomY, trackBounds.x + trackBounds.width, headerBottomY); + super.paintTrack(g, c, trackBounds); } @Override diff --git a/designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java b/designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java index 9e6c0c998e..3a1bb6c6c4 100644 --- a/designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java +++ b/designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java @@ -44,6 +44,8 @@ public interface FineUIStyle { String PASTEL_BUTTON = "pastelButton"; String DEFAULT_TABLE = "defaultTable"; + String WHITE_BUTTON = "whiteButton"; + String ORIGINAL_BUTTON = "originalButton"; /** diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java index 2cb5813ccd..4d8540fe95 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java @@ -5,8 +5,6 @@ import com.fine.theme.light.ui.FineRoundBorder; import com.fine.theme.utils.FineUIScale; import com.formdev.flatlaf.ui.FlatUIUtils; import com.formdev.flatlaf.util.ScaledEmptyBorder; -import com.fr.base.BaseUtils; -import com.fr.base.svg.IconUtils; import com.fr.data.core.db.TableProcedure; import com.fr.data.impl.AbstractDatabaseConnection; import com.fr.data.impl.Connection; @@ -72,7 +70,7 @@ public class ConnectionTableProcedurePane extends BasicPane { } private void init(SwitchableTableDataPane parent) { - this.setLayout(new BorderLayout(4, 10)); + this.setLayout(FRGUIPaneFactory.createScaledBorderLayout(4, 10)); // 初始化数据连接下拉框 initConnectionComboBox(parent); // 初始化中间的面板 @@ -84,8 +82,7 @@ public class ConnectionTableProcedurePane extends BasicPane { } private JPanel initCenterPane() { - JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - centerPane.setLayout(new BorderLayout(0, 5)); + JPanel centerPane = FRGUIPaneFactory.createScaledBorderLayout_S_Pane(0, 6); // 搜索面板 centerPane.add(createSearchPane(), BorderLayout.NORTH); // 数据库表视图面板 @@ -156,8 +153,7 @@ public class ConnectionTableProcedurePane extends BasicPane { }); UIScrollPane tableViewListPane = new UIScrollPane(tableViewList); tableViewListPane.setBorder(new UIRoundedBorder(UIManager.getColor("defaultBorderColor"), 1, UIConstants.ARC)); - JPanel tableViewBorderPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - tableViewBorderPane.setLayout(new BorderLayout(0, 5)); + JPanel tableViewBorderPane = FRGUIPaneFactory.createScaledBorderLayout_S_Pane(0, 10); tableViewBorderPane.add(tableViewListPane, BorderLayout.CENTER); JPanel checkBoxgroupPane = createCheckBoxgroupPane(); if (checkBoxgroupPane != null) { @@ -193,19 +189,18 @@ public class ConnectionTableProcedurePane extends BasicPane { } protected JPanel createCheckBoxgroupPane() { - JPanel checkBoxgroupPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(2); - checkBoxgroupPane.setLayout(new BorderLayout(20, 0)); - JPanel first = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + JPanel checkBoxgroupPane = FRGUIPaneFactory.createScaledBorderLayout_S_Pane(30, 2); + JPanel first = FRGUIPaneFactory.createScaledBorderLayout_S_Pane(2, 0); tableCheckBox = new UICheckBox(); tableCheckBox.setSelected(true); tableCheckBox.addActionListener(filter); - first.add(tableCheckBox); + first.add(tableCheckBox, BorderLayout.WEST); - JPanel second = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + JPanel second = FRGUIPaneFactory.createScaledBorderLayout_S_Pane(4, 0); viewCheckBox = new UICheckBox(); viewCheckBox.setSelected(true); viewCheckBox.addActionListener(filter); - second.add(viewCheckBox); + second.add(viewCheckBox, BorderLayout.WEST); // 根据环境是否为中文设置不同的显示 if (GeneralContext.isChineseEnv()) { diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java index 707befa4f8..70f821dcdf 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java @@ -7,6 +7,7 @@ import com.fine.theme.icon.LazyIcon; import com.fine.theme.light.ui.FineTableHeaderUI; import com.fine.theme.light.ui.FineTableScrollBarPaneUI; import com.fine.theme.utils.FineUIScale; +import com.fine.theme.utils.FineUIStyle; import com.fine.theme.utils.FineUIUtils; import com.fr.base.TableData; import com.fr.data.TableDataSource; @@ -27,6 +28,7 @@ import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.gui.frpane.UITabbedPane; +import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.iprogressbar.AutoProgressBar; import com.fr.design.gui.itable.SortableJTable; @@ -90,7 +92,7 @@ public class PreviewTablePane extends BasicPane { private BasicDialog dialog; private SwingWorker worker; - private UILabel refreshLabel; + private UIButton refreshLabel; private static PreviewTablePane THIS; private EmbeddedTableData previewTableData; @@ -106,31 +108,22 @@ public class PreviewTablePane extends BasicPane { @Override public void mouseEntered(MouseEvent e) { // 当鼠标进入时候调用. mouseEntered = true; - if (!buttonPressed) { - refreshLabel.setBackground(java.awt.Color.WHITE); - refreshLabel.setOpaque(true); - refreshLabel.setBorder(BorderFactory.createLineBorder(java.awt.Color.GRAY)); - } } @Override public void mouseExited(MouseEvent e) { mouseEntered = false; - refreshLabel.setOpaque(false); - refreshLabel.setBorder(BorderFactory.createEmptyBorder()); } @Override public void mousePressed(MouseEvent e) { buttonPressed = true; - refreshLabel.setBackground(java.awt.Color.lightGray); } @Override public void mouseReleased(MouseEvent e) { buttonPressed = false; if (mouseEntered) { - refreshLabel.setBackground(java.awt.Color.WHITE); try { populate(tableData); if (dataModel != null) { @@ -210,7 +203,8 @@ public class PreviewTablePane extends BasicPane { private void initRefreshLabel() { Icon refreshImage = new LazyIcon("refresh"); - refreshLabel = new UILabel(refreshImage); + refreshLabel = new UIButton(refreshImage); + FineUIStyle.setStyle(refreshLabel, FineUIStyle.ORIGINAL_BUTTON); refreshLabel.addMouseListener(refreshLabelMouseAdapter); } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/PreviewTableDesensitizationPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/PreviewTableDesensitizationPane.java index f96438bee5..a351028194 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/PreviewTableDesensitizationPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/PreviewTableDesensitizationPane.java @@ -1,7 +1,7 @@ package com.fr.design.data.datapane.preview.desensitization.view; import com.fine.theme.icon.LazyIcon; -import com.formdev.flatlaf.ui.FlatUIUtils; +import com.fine.theme.utils.FineUIStyle; import com.fr.design.constants.UIConstants; import com.fr.design.data.datapane.preview.PreviewTablePane; import com.fr.design.gui.ibutton.UIButton; @@ -13,7 +13,6 @@ import com.fr.design.menu.ToolBarDef; import javax.swing.JPanel; import java.awt.BorderLayout; -import java.awt.Color; import java.awt.Component; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; @@ -106,8 +105,7 @@ public class PreviewTableDesensitizationPane extends JPanel { previewToggle.setIcon(new LazyIcon("preview")); previewToggle.setToolTipText(Toolkit.i18nText("Fine-Design_Report_Desensitization_Preview")); previewToggle.setSelected(false); - previewToggle.setBackground(FlatUIUtils.getUIColor("default.background", new Color(246, 248, 250, 255))); - previewToggle.setBorder(null); + FineUIStyle.setStyle(previewToggle, FineUIStyle.ORIGINAL_BUTTON); previewToggle.addActionListener(e -> { // 切换TableModel的脱敏状态 previewTablePane.togglePreviewTableModelDesensitizeStatus(); diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java index d587c2cafe..32dc440a3d 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java @@ -2,6 +2,7 @@ package com.fr.design.data.tabledata.tabledatapane; import com.fine.theme.icon.LazyIcon; import com.fine.theme.utils.FineUIScale; +import com.fine.theme.utils.FineUIStyle; import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.Parameter; import com.fr.base.ParameterHelper; @@ -100,7 +101,7 @@ import static com.fine.theme.utils.FineClientProperties.ADAPTIVE_COMBO_BOX; */ public class DBTableDataPane extends AbstractTableDataPane implements SwitchableTableDataPane { - private static final int BOTTOM = 9; + private static final int BOTTOM = 10; private static final String PREVIEW_BUTTON = Toolkit.i18nText("Fine-Design_Basic_Preview"); private static final String REFRESH_BUTTON = Toolkit.i18nText("Fine-Design_Basic_Refresh"); private ConnectionTableProcedurePane connectionTableProcedurePane; @@ -156,7 +157,7 @@ public class DBTableDataPane extends AbstractTableDataPane implemen } private void init() { - contentPane.setLayout(new BorderLayout(4, 4)); + contentPane.setLayout(FRGUIPaneFactory.createScaledBorderLayout(4, 4)); this.sqlTextPane = new SQLEditPane(); this.sqlTextPane.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_SQL); @@ -243,11 +244,11 @@ public class DBTableDataPane extends AbstractTableDataPane implemen private void initMainSplitPane() { Box box = new Box(BoxLayout.Y_AXIS); - JPanel northPane = new JPanel(new BorderLayout(4, 4)); + JPanel northPane = new JPanel(FRGUIPaneFactory.createScaledBorderLayout(4, 4)); JToolBar editToolBar = createToolBar(); editToolBar.setBorder(null); northPane.add(editToolBar, BorderLayout.CENTER); - northPane.setBorder(BorderFactory.createEmptyBorder(0, 0, BOTTOM, 0)); + northPane.setBorder(new ScaledEmptyBorder(0, 0, BOTTOM, 0)); RTextScrollPane sqlTextScrollPane = new RTextScrollPane(this.sqlTextPane); sqlTextScrollPane.setLineNumbersEnabled(true); @@ -255,8 +256,9 @@ public class DBTableDataPane extends AbstractTableDataPane implemen sqlTextScrollPane.setPreferredSize(FineUIScale.scale(new Dimension(680, 600))); JPanel paraMeanPane = new JPanel(new BorderLayout()); - paraMeanPane.setPreferredSize(FineUIScale.scale(new Dimension(680, 90))); + paraMeanPane.setBorder(new ScaledEmptyBorder(10, 0, BOTTOM, 0)); UILabel paraMean = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Datasource_Param_DES")); + FineUIStyle.setStyle(paraMean, FineUIStyle.LABEL_TIP); paraMeanPane.add(paraMean, BorderLayout.CENTER); @@ -265,7 +267,7 @@ public class DBTableDataPane extends AbstractTableDataPane implemen box.add(paraMeanPane); box.add(this.editorPane); - JPanel sqlSplitPane = new JPanel(new BorderLayout(4, 4)); + JPanel sqlSplitPane = new JPanel(FRGUIPaneFactory.createScaledBorderLayout(4, 4)); sqlSplitPane.add(box, BorderLayout.CENTER); @@ -275,7 +277,6 @@ public class DBTableDataPane extends AbstractTableDataPane implemen this.connectionTableProcedurePane.setMaximumSize(FineUIScale.scale(new Dimension(500, 400))); JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, this.connectionTableProcedurePane, sqlSplitPane); - mainSplitPane.setBorder(new ScaledEmptyBorder(10, 10, 10, 10)); mainSplitPane.setOneTouchExpandable(true); contentPane.add(mainSplitPane, BorderLayout.CENTER); } @@ -339,15 +340,19 @@ public class DBTableDataPane extends AbstractTableDataPane implemen private void createToolbarEsdComponents(final UIToolbar editToolBar) { this.esdSettingsLabel = new UILabel(Toolkit.i18nText("Fine-Design_ESD_Cache_Settings")); + esdSettingsLabel.setBorder(new ScaledEmptyBorder(0, 6, 0,6)); this.esdConfigOption = new UIComboBox(StrategyConfigFrom.values()); this.esdConfigOption.putClientProperty(COMBO_BOX_TYPE, ADAPTIVE_COMBO_BOX); this.esdEnabled = new UICheckBox(Toolkit.i18nText("Fine-Design_ESD_Enable_Cache")); + esdEnabled.setBorder(new ScaledEmptyBorder(0, 6, 0,6)); this.barErrorTips = new UILabel(); - this.barErrorTips.setForeground(Color.RED); + barErrorTips.setBorder(new ScaledEmptyBorder(0, 6, 0,6)); + FineUIStyle.setStyle(barErrorTips, FineUIStyle.LABEL_WARNING_TIP); this.barErrorTips.setVisible(false); esdSettingsBtn = new UIButton(Toolkit.i18nText("Fine-Design_ESD_Strategy_Config")); - esdSettingsBtn.setPreferredSize(FineUIScale.scale(new Dimension(72, 24))); + esdSettingsBtn.setPreferredSize(new Dimension((int) esdSettingsBtn.getPreferredSize().getWidth(), FineUIScale.scale(24))); + FineUIStyle.setStyle(esdSettingsBtn, FineUIStyle.WHITE_BUTTON); esdSettingsBtn.addActionListener(new ActionListener() { @Override diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MaxMemRowCountPanel.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MaxMemRowCountPanel.java index af2b71a7c6..d3e43724a9 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MaxMemRowCountPanel.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MaxMemRowCountPanel.java @@ -15,6 +15,9 @@ import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.i18n.Toolkit; import com.fr.stable.StringUtils; +import static com.fine.theme.utils.FineClientProperties.ADAPTIVE_COMBO_BOX; +import static com.fine.theme.utils.FineClientProperties.COMBO_BOX_TYPE; + public class MaxMemRowCountPanel extends UIToolbar { private static final int ALL_IN_MEMORY = 0; @@ -71,6 +74,7 @@ public class MaxMemRowCountPanel extends UIToolbar { this.setRollover(true); this.setBackground(UIConstants.NORMAL_BACKGROUND); switchCache = new UIComboBox(CACHE_LIST); + switchCache.putClientProperty(COMBO_BOX_TYPE, ADAPTIVE_COMBO_BOX); switchCache.addActionListener(switchStateL); numberSpinner = new UISpinner(0, Integer.MAX_VALUE, 1); numberSpinner.setNumberFieldColumns(3); diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java index 293c096ae3..8e46cc9721 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java @@ -92,11 +92,11 @@ public class ProcedureDataPane extends AbstractTableDataPane imp super(); queryText = new UILabel(StringUtils.EMPTY); Box box = new Box(BoxLayout.Y_AXIS); - JPanel northpane = new JPanel(new BorderLayout(4, 4)); + JPanel northpane = new JPanel(FRGUIPaneFactory.createScaledBorderLayout(4, 0)); JToolBar editToolBar = creatToolBar(); editToolBar.setBorder(null); northpane.add(editToolBar, BorderLayout.NORTH); - northpane.setBorder(BorderFactory.createEmptyBorder(0, 0, 6, 0)); + northpane.setBorder(new ScaledEmptyBorder(0, 0, 10, 0)); storeProcedureContext = new SQLEditPane(SQLEditPane.UNREQUEST_DROPTARGET); storeProcedureContext.setEditable(false); @@ -107,6 +107,7 @@ public class ProcedureDataPane extends AbstractTableDataPane imp JPanel namePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); namePane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Datasource_Stored_Procedure") + ":")); namePane.add(queryText); + namePane.setBorder(new ScaledEmptyBorder(10, 0, 0, 0)); inAutoeditorPane = new UITableEditorPane(new StoreProcedureTableModel()); autoEditorPane = new UITableEditorPane(new AutoStoreProcedureTableModel()); autoEditorPane.getbuttonPane().setVisible(false); @@ -127,13 +128,12 @@ public class ProcedureDataPane extends AbstractTableDataPane imp // 左边的Panel,上面是选择DatabaseConnection的ComboBox,下面DatabaseConnection对应的Table initconnectionTableProcedurePane(); - this.setLayout(new BorderLayout(4, 4)); + this.setLayout(FRGUIPaneFactory.createScaledBorderLayout(4, 4)); this.connectionTableProcedurePane.setMinimumSize(FineUIScale.scale(new Dimension(230, 400))); this.connectionTableProcedurePane.setMaximumSize(FineUIScale.scale(new Dimension(500, 400))); box.setMinimumSize(FineUIScale.scale(new Dimension(300, 400))); // 使用SplitPane JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, connectionTableProcedurePane, sqlSplitPane); - mainSplitPane.setBorder(new ScaledEmptyBorder(10, 10, 10, 10)); mainSplitPane.setOneTouchExpandable(true); this.add(mainSplitPane, BorderLayout.CENTER); } @@ -172,6 +172,7 @@ public class ProcedureDataPane extends AbstractTableDataPane imp toolBarDef.addShortCut(new RefreshAction()); toolBarDef.addShortCut(SeparatorDef.DEFAULT); isShareCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Is_Share_DBTableData")); + isShareCheckBox.setBorder(new ScaledEmptyBorder(0, 6, 0,6)); maxPanel = new MaxMemRowCountPanel(); maxPanel.setBorder(null); maxPanel.setBackground(null); diff --git a/designer-base/src/main/java/com/fr/design/dialog/BasicPane.java b/designer-base/src/main/java/com/fr/design/dialog/BasicPane.java index 1555b01d42..1da3e34e0c 100644 --- a/designer-base/src/main/java/com/fr/design/dialog/BasicPane.java +++ b/designer-base/src/main/java/com/fr/design/dialog/BasicPane.java @@ -1,6 +1,7 @@ package com.fr.design.dialog; import com.fine.theme.utils.FineUIScale; +import com.fine.theme.utils.FineUIStyle; import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.common.annotations.Open; import com.fr.design.constants.LayoutConstants; @@ -315,14 +316,14 @@ public abstract class BasicPane extends JPanel { nameTextField = new UITextField(); Name = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Name")); JPanel northPane = new JPanel(new BorderLayout()); - northPane.setBorder(new ScaledEmptyBorder(0,10,0,10)); + northPane.setBorder(new ScaledEmptyBorder(0,0,10,0)); northPane.add(row( LayoutConstants.HGAP_LARGE, cell(Name).weight(titleRatio), cell(nameTextField).weight(0.7 - titleRatio), cell(showfield = new UILabel(" ")).weight(0.3) ).getComponent()); - showfield.setForeground(new Color(204, 0, 1)); + FineUIStyle.setStyle(showfield, FineUIStyle.LABEL_WARNING_TIP); showfield.setPreferredSize(new Dimension(FineUIScale.scale(220), showfield.getPreferredSize().height)); this.add(northPane, BorderLayout.NORTH); this.centerPane = bPane; diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxRenderer.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxRenderer.java index 07cb941293..f0bf7b1a4e 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxRenderer.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxRenderer.java @@ -1,14 +1,10 @@ package com.fr.design.gui.icombobox; -import java.awt.Color; -import java.awt.Component; +import java.awt.Dimension; import javax.swing.DefaultListCellRenderer; -import com.fr.design.constants.UIConstants; - -import javax.swing.JList; -import javax.swing.JLabel; +import com.fine.theme.utils.FineUIScale; /** * @@ -23,19 +19,8 @@ public class UIComboBoxRenderer extends DefaultListCellRenderer { super(); } - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - cellHasFocus = cellHasFocus && !this.isEnabled(); - JLabel renderer =(JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - renderer.setOpaque(true); - list.setSelectionBackground(UIConstants.NORMAL_BLUE); - list.setSelectionForeground(Color.WHITE); - if (isSelected) { - renderer.setForeground(list.getSelectionForeground()); - renderer.setBackground(list.getSelectionBackground()); - } else { - renderer.setForeground(list.getForeground()); - renderer.setBackground(list.getBackground()); - } - return renderer; + @Override + public Dimension getPreferredSize() { + return new Dimension(super.getPreferredSize().width, FineUIScale.scale(24)); } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java b/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java index 5d50b7ff2c..cf1eb6796c 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java +++ b/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java @@ -1,6 +1,7 @@ package com.fr.design.gui.ilist; import com.fine.theme.icon.LazyIcon; +import com.fine.theme.utils.FineUIScale; import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.base.BaseUtils; import com.fr.data.core.DataCoreUtils; @@ -26,6 +27,7 @@ import javax.swing.ListSelectionModel; import javax.swing.SwingWorker; import java.awt.Color; import java.awt.Component; +import java.awt.Dimension; import java.awt.dnd.DnDConstants; import java.awt.dnd.DragGestureEvent; import java.awt.dnd.DragGestureListener; @@ -261,6 +263,11 @@ public class TableViewList extends UIList { return this; } + + @Override + public Dimension getPreferredSize() { + return new Dimension(super.getPreferredSize().width, FineUIScale.scale(24)); + } } /** diff --git a/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableEditorPane.java b/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableEditorPane.java index a3923f6554..18979b677b 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableEditorPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableEditorPane.java @@ -1,5 +1,7 @@ package com.fr.design.gui.itableeditorpane; +import com.fine.swing.ui.layout.Layouts; +import com.fine.swing.ui.layout.Row; import com.fine.theme.light.ui.FineRoundBorder; import com.fine.theme.light.ui.FineTableHeaderUI; import com.fine.theme.light.ui.FineTableScrollBarPaneUI; @@ -15,13 +17,11 @@ import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.event.TableModelListener; import java.awt.BorderLayout; +import java.awt.Dimension; import java.awt.GridLayout; import java.awt.Insets; import java.util.List; -import static com.fine.swing.ui.layout.Layouts.cell; -import static com.fine.swing.ui.layout.Layouts.column; - /** * 表格编辑面板,一般是两列.键-值 用泛型实现,用的时候请定义T.model里面的T要一样 * @@ -78,7 +78,7 @@ public class UITableEditorPane extends BasicPane { controlPane.add(content == null ? l : content, BorderLayout.WEST); scrollPane.getVerticalScrollBar().setUI(new FineTableScrollBarPaneUI(editTable)); - pane.add(column(10, cell(controlPane), cell(scrollPane).weight(1)).getComponent()); + pane.add(Layouts.column(10, Layouts.cell(controlPane), Layouts.cell(scrollPane).weight(1)).getComponent()); this.editTable.getTableHeader().setUI(new FineTableHeaderUI()); this.editTable.setRowHeight(FineUIScale.scale(24)); } @@ -91,7 +91,7 @@ public class UITableEditorPane extends BasicPane { buttonPane = new JPanel(); if (action != null) { - buttonPane.setLayout(new GridLayout(1, action.length, 3, 3)); + buttonPane.setLayout(new GridLayout(1, action.length, FineUIScale.scale(2), 0)); for (int i = 0; i < action.length; i++) { final UIButton newButton = new UIButton(action[i]); newButton.set4ToolbarButton(); @@ -99,9 +99,9 @@ public class UITableEditorPane extends BasicPane { newButton.setText(""); newButton.setName(action[i].getName()); newButton.setToolTipText(action[i].getName()); - newButton.setBorder(null); newButton.setMargin(null); newButton.setOpaque(false); + newButton.setPreferredSize(FineUIScale.scale(new Dimension(24, 24))); buttonPane.add(newButton); } } diff --git a/designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java b/designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java index b3b53c3351..2fb1a7d4fd 100644 --- a/designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java +++ b/designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java @@ -1,5 +1,6 @@ package com.fr.design.layout; +import com.fine.theme.utils.FineUIScale; import com.fr.design.border.UITitledBorder; import com.fr.design.gui.ilable.UILabel; import com.fr.stable.AssistUtils; @@ -114,6 +115,16 @@ public class FRGUIPaneFactory { return new BorderLayout(); } + /** + * 创建一个适应 DPI 缩放的边框布局 + * @param hgap 水平间距 + * @param vgap 竖直间距 + * @return JPanel对象 + */ + public static LayoutManager createScaledBorderLayout(int hgap, int vgap) { + return new BorderLayout(FineUIScale.scale(hgap), FineUIScale.scale(vgap)); + } + /** * 创建一个边框布局,间距4,4 * @@ -660,6 +671,17 @@ public class FRGUIPaneFactory { return jp; } + /** + * 创建包含水平垂直间距的边框面板S + * + * @return JPanel对象 + */ + public static JPanel createScaledBorderLayout_S_Pane(int hgap, int vgap) { + JPanel jp = new JPanel(); + jp.setLayout(FRGUIPaneFactory.createScaledBorderLayout(hgap, vgap)); + return jp; + } + public static JPanel createBorderLayout_NO_Opaque_Pane() { JPanel jp = new JPanel(); jp.setOpaque(false); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java index db9bb5ce4d..f7b0dbe028 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java @@ -72,7 +72,7 @@ public class CenterRegionContainerPane extends JPanel { public CenterRegionContainerPane() { toolbarPane = new JPanel(); - toolbarPane.setBorder(new ScaledEmptyBorder(6, 0, 0, 0)); + toolbarPane.setBorder(new ScaledEmptyBorder(10, 0, 0, 0)); toolbarPane.setLayout(FRGUIPaneFactory.createBorderLayout()); eastPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); largeToolbar = getToolBarMenuDock().createLargeToolbar(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/AbstractSupportSelectTablePane.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/AbstractSupportSelectTablePane.java index 39c8631a0f..b6b0215729 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/AbstractSupportSelectTablePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/AbstractSupportSelectTablePane.java @@ -334,7 +334,11 @@ public abstract class AbstractSupportSelectTablePane exte component.setForeground(tableHeader.getForeground()); component.setBackground(tableHeader.getBackground()); component.setFont(tableHeader.getFont()); - component.setBorder(UIManager.getBorder("TableHeader.cellBorder")); + if (column != 0) { + component.setBorder(UIManager.getBorder("TableHeader.cellBorder")); + } else { + component.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 1, UIManager.getColor("defaultBorderColor"))); + } return component; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/RecyclePane.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/RecyclePane.java index 76030638b2..2c5ad62eb8 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/RecyclePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/RecyclePane.java @@ -123,7 +123,7 @@ public class RecyclePane extends AbstractSupportSelectTablePane searchTextField.setPlaceholder(Toolkit.i18nText("Fine-Design_Vcs_Start_Search")); searchTextField.setColumns(COLUMNS_COUNT); UILabel searchLabel = new UILabel(ICON_SEARCH); - searchLabel.setBorder(new ScaledEmptyBorder(0, 3, 0, 3)); + searchLabel.setBorder(new ScaledEmptyBorder(0, 4, 0, 4)); searchTextField.setBorder(null); leftPane = row(cell(searchLabel), cell(searchTextField).weight(1)).with(it -> { it.setBorder(new FineRoundBorder()); @@ -148,7 +148,6 @@ public class RecyclePane extends AbstractSupportSelectTablePane } tableTopPane.add(leftPane, BorderLayout.EAST); tableTopPane.add(rightPane, BorderLayout.WEST); - tableTopPane.setBorder(new ScaledEmptyBorder(0, 0, 10, 0)); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsOperatorPane.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsOperatorPane.java index 15230e9ab5..c42c96e84c 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsOperatorPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsOperatorPane.java @@ -46,7 +46,7 @@ public class VcsOperatorPane extends JPanel { panel.add(value); } panel.setOpaque(false); - add(column(flex(), row(fix(4), cell(panel)), flex()) + add(column(flex(), row(fix(6), cell(panel)), flex()) .with(it -> { it.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 1, UIManager.getColor("defaultBorderColor"))); it.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); diff --git a/designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java b/designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java index 08b4bd178e..2c00655201 100644 --- a/designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java +++ b/designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java @@ -45,6 +45,7 @@ public abstract class AbstractSelectBox extends AbstractPopBox implements Mou // 初始化组件布局 JPanel displayPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); displayPane.setBorder(null); + displayPane.setOpaque(false); displayPane.add(displayComponent, BorderLayout.CENTER); displayComponent.setSize(new Dimension(preWidth, displayPane.getPreferredSize().height)); // 添加事件监听 diff --git a/designer-base/src/main/java/com/fr/design/style/FormatPane.java b/designer-base/src/main/java/com/fr/design/style/FormatPane.java index 69744c3b8a..dad1087361 100644 --- a/designer-base/src/main/java/com/fr/design/style/FormatPane.java +++ b/designer-base/src/main/java/com/fr/design/style/FormatPane.java @@ -22,10 +22,10 @@ import com.fr.general.ComparatorUtils; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; -import javax.swing.BorderFactory; import javax.swing.ButtonGroup; import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListModel; +import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; @@ -139,21 +139,24 @@ public class FormatPane extends BasicPane { patternList.setCellRenderer(new DefaultListCellRenderer(){ public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - setOpaque(false); - return this; + JLabel renderer = (JLabel)super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + list.setSelectionBackground(UIManager.getColor("List.selectBackgroundColor")); + setOpaque(true); + if (isSelected) { + renderer.setBackground(list.getSelectionBackground()); + } else { + renderer.setBackground(list.getBackground()); + } + return renderer; } }); + patternList.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); patternList.addListSelectionListener(patternListSelectionListener); } private JScrollPane initPatternScrollPanel() { JScrollPane scrollPane = new JScrollPane(patternList); - patternList.setOpaque(false); - scrollPane.getViewport().setOpaque(false); - scrollPane.getVerticalScrollBar().setOpaque(false); scrollPane.setBorder(new FineRoundBorder()); - scrollPane.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); return scrollPane; } diff --git a/designer-base/src/main/java/com/fr/design/style/background/impl/ImageBackgroundPane.java b/designer-base/src/main/java/com/fr/design/style/background/impl/ImageBackgroundPane.java index 6a9ed7bee9..52bb9b3a7f 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/impl/ImageBackgroundPane.java +++ b/designer-base/src/main/java/com/fr/design/style/background/impl/ImageBackgroundPane.java @@ -1,6 +1,7 @@ package com.fr.design.style.background.impl; import com.fine.theme.light.ui.FineRoundBorder; +import com.fine.theme.utils.FineUIStyle; import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.base.Style; import com.fr.base.background.ImageBackground; @@ -66,7 +67,7 @@ public class ImageBackgroundPane extends BackgroundDetailPane { this.add(column( 5, - cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"))), + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"))).with(it -> FineUIStyle.setStyle(it, FineUIStyle.LABEL_TIP)), row( 10, cell(new JScrollPane(previewPane)).with(it -> { diff --git a/designer-base/src/main/java/com/fr/design/style/color/DetailColorSelectPane.java b/designer-base/src/main/java/com/fr/design/style/color/DetailColorSelectPane.java index 3d68c8469f..f11f8a8e35 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/DetailColorSelectPane.java +++ b/designer-base/src/main/java/com/fr/design/style/color/DetailColorSelectPane.java @@ -12,6 +12,7 @@ import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; import com.fine.theme.light.ui.FineRoundBorder; +import com.fine.theme.utils.FineUIStyle; import com.fine.theme.utils.FineUIUtils; import com.fr.design.gui.ilable.UILabel; @@ -79,7 +80,7 @@ public class DetailColorSelectPane extends BasicPane { row( 20, cell(colorSelectPane.transparentButton).weight(0.3), - cell(new UILabel("" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview") + "")).weight(0.53) + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"))).weight(0.53).with(it -> FineUIStyle.setStyle(it, FineUIStyle.LABEL_TIP)) ), row( 20, diff --git a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties index a37bb65096..67c1f6782d 100644 --- a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties +++ b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties @@ -427,9 +427,10 @@ HelpButton.innerFocusWidth = $?Button.innerFocusWidth List.border = 0,0,0,0 List.cellMargins = 1,12,1,12 -List.selectionInsets = 0,0,0,0 -List.selectionArc = 0 +List.selectionInsets = 0,4,0,4 +List.selectionArc = 2 List.cellFocusColor = @cellFocusColor +List.selectionBackground = fade(#2576EF,12%) List.cellNoFocusBorder = com.formdev.flatlaf.ui.FlatListCellBorder$Default List.focusCellHighlightBorder = com.formdev.flatlaf.ui.FlatListCellBorder$Focused List.focusSelectedCellHighlightBorder = com.formdev.flatlaf.ui.FlatListCellBorder$Selected @@ -742,8 +743,8 @@ GradientBar.recHeight=30 #---- Spinner ---- Spinner.border = com.formdev.flatlaf.ui.FlatRoundBorder -Spinner.background = @componentBackground -Spinner.buttonBackground = darken($Spinner.background,2%) +Spinner.background = $fill.normal +Spinner.buttonBackground = $fill.normal Spinner.buttonSeparatorColor = $Component.borderColor Spinner.buttonDisabledSeparatorColor = $Component.disabledBorderColor Spinner.buttonArrowColor = @buttonArrowColor @@ -1355,4 +1356,12 @@ CellOtherSetPane.height=$Component.defaultHeight hoverTrackColor : fade(@background, 0%) [style]Table.defaultTable = \ - background: $Table.default.background \ No newline at end of file + background: $Table.default.background + +[style]Button.whiteButton = \ + border: com.fine.theme.light.ui.FineRoundBorder; \ + background: $fill.normal + +[style]Button.originalButton = \ + border: 4,4,4,4; \ + background: null; \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java index 56f1fb4cad..1dd05ae66f 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java @@ -159,7 +159,7 @@ public class ITReplaceNorthPanel { public ITReplaceNorthPanel() { cardLayout = new CardLayout(); cardPanel = new JPanel(cardLayout); - cardPanel.setBorder(new ScaledEmptyBorder(20, 20, 20, 20)); + cardPanel.setBorder(new ScaledEmptyBorder(20, 20, 10, 20)); upContentPanel = new JPanel(null); upSettingPanel = new JPanel(null); diff --git a/designer-realize/src/main/java/com/fr/design/cell/smartaction/SmartJTablePane.java b/designer-realize/src/main/java/com/fr/design/cell/smartaction/SmartJTablePane.java index 51c23b615a..7812fb5352 100644 --- a/designer-realize/src/main/java/com/fr/design/cell/smartaction/SmartJTablePane.java +++ b/designer-realize/src/main/java/com/fr/design/cell/smartaction/SmartJTablePane.java @@ -4,6 +4,7 @@ import java.awt.BorderLayout; import java.awt.Window; import com.fine.theme.light.ui.FineTableHeaderUI; +import com.fine.theme.light.ui.FineTableScrollBarPaneUI; import com.fr.design.gui.ilable.UILabel; import javax.swing.JScrollPane; @@ -61,6 +62,7 @@ public abstract class SmartJTablePane extends BasicPane { // BasicPane的center放JTable table = new JTable(model); this.add(scrollPane = new JScrollPane(table), BorderLayout.CENTER); + scrollPane.getVerticalScrollBar().setUI(new FineTableScrollBarPaneUI(table)); // 鼠标切换选中项时,editingRowIndex也要跟着变 table.getSelectionModel().addListSelectionListener(new ListSelectionListener() { diff --git a/designer-realize/src/main/java/com/fr/design/condition/ForeGroundPane.java b/designer-realize/src/main/java/com/fr/design/condition/ForeGroundPane.java index 1ef2063582..d7270e1dbd 100644 --- a/designer-realize/src/main/java/com/fr/design/condition/ForeGroundPane.java +++ b/designer-realize/src/main/java/com/fr/design/condition/ForeGroundPane.java @@ -13,6 +13,8 @@ import java.awt.*; import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.theme.utils.FineClientProperties.ADAPTIVE_COMBO_BOX; +import static com.fine.theme.utils.FineClientProperties.COMBO_BOX_TYPE; /** * @author richie @@ -34,6 +36,7 @@ public class ForeGroundPane extends ConditionAttrSingleConditionPane com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cell_Write_Page_Before_Row"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cell_Write_Page_After_Column"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cell_Write_Page_Before_Column") }); + this.pageComboBox.putClientProperty(COMBO_BOX_TYPE, ADAPTIVE_COMBO_BOX); this.pageComboBox.setSelectedIndex(0); this.setLayout(new BorderLayout()); diff --git a/designer-realize/src/main/java/com/fr/design/headerfooter/HeaderFooterEditPane.java b/designer-realize/src/main/java/com/fr/design/headerfooter/HeaderFooterEditPane.java index ab1efae885..823e6f71cc 100644 --- a/designer-realize/src/main/java/com/fr/design/headerfooter/HeaderFooterEditPane.java +++ b/designer-realize/src/main/java/com/fr/design/headerfooter/HeaderFooterEditPane.java @@ -5,9 +5,9 @@ package com.fr.design.headerfooter; import com.fine.theme.icon.LazyIcon; import com.fine.theme.light.ui.FineRoundBorder; +import com.fine.theme.utils.FineUIStyle; import com.formdev.flatlaf.ui.FlatUIUtils; import com.formdev.flatlaf.util.ScaledEmptyBorder; -import com.fr.base.BaseUtils; import com.fr.base.GraphHelper; import com.fr.base.PaperSize; import com.fr.base.ScreenResolution; @@ -29,7 +29,6 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.style.background.BackgroundPane; -import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.Background; import com.fr.page.ReportSettingsProvider; import com.fr.report.core.ReportHF; @@ -40,10 +39,8 @@ import com.fr.stable.unit.INCH; import com.fr.stable.unit.MM; import com.fr.stable.unit.UNIT; -import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.JScrollPane; -import javax.swing.JToolBar; import javax.swing.JViewport; import javax.swing.Scrollable; import javax.swing.SwingConstants; @@ -67,6 +64,7 @@ import java.awt.geom.Rectangle2D; import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.fix; import static com.fine.swing.ui.layout.Layouts.row; /** @@ -133,36 +131,33 @@ public class HeaderFooterEditPane extends JPanel { private void addCenterPanel() { JPanel controlContentPane = row( - 2, + 4, cell(createContainerSection(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_HF_Left_Section") + ":", leftHFContainer)).weight(0.1), cell(createContainerSection(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_HF_Center_Section") + ":", centerHFContainer)).weight(0.1), cell(createContainerSection(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_HF_Right_Section") + ":", rightHFContainer)).weight(0.1) ).getComponent(); + initToolbar(); JPanel centerPane = column( 10, - cell(createToolbar()), + cell(iconToolPanel), cell(controlContentPane).weight(0.3), column( 2, - cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"))).weight(0.1), + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"))).weight(0.1).with(it -> FineUIStyle.setStyle(it, FineUIStyle.LABEL_TIP)), cell(scrollPreviewPane).weight(1.2).with(it -> it.setBorder(new FineRoundBorder())) ).weight(0.75) ).with(it -> it.setBorder(new ScaledEmptyBorder(0,10,0,0))).getComponent(); this.add(centerPane, BorderLayout.CENTER); } - private JToolBar createToolbar() { + private void initToolbar() { //toolbar. - JToolBar toolbar = new JToolBar(); - toolbar.setFloatable(false); printBackgroundCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportGUI_Print_Background")); headerUnitFieldPane = new AdjustHeightPane(); footerUnitFieldPane = new AdjustHeightPane(); headFootUnitFieldPane = new AdjustHeightPane(); initIconToolPanel(); - toolbar.add(iconToolPanel); - return toolbar; } private UIButton initCustomBackgroundButton() { @@ -191,7 +186,7 @@ public class HeaderFooterEditPane extends JPanel { private void initIconToolPanel() { iconToolPanel = row( - 6, + 2, cell(this.createHFInsertButton(new TextHFElement())), cell(this.createHFInsertButton(new FormulaHFElement())), cell(this.createHFInsertButton(new PageNumberHFElement())), @@ -201,11 +196,13 @@ public class HeaderFooterEditPane extends JPanel { cell(this.createHFInsertButton(new ImageHFElement())), cell(this.createHFInsertButton(new NewLineHFElement())), cell(initCustomBackgroundButton()), + fix(6), cell(printBackgroundCheckBox), + fix(6), row( cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Height") + ":")), cell(headFootUnitFieldPane) - ).with(it -> it.setBorder(new ScaledEmptyBorder(2,0,2,0))) + ) ).getComponent(); } diff --git a/designer-realize/src/main/java/com/fr/design/headerfooter/HeaderFooterPane.java b/designer-realize/src/main/java/com/fr/design/headerfooter/HeaderFooterPane.java index 6b29170a7b..0bd97b3188 100644 --- a/designer-realize/src/main/java/com/fr/design/headerfooter/HeaderFooterPane.java +++ b/designer-realize/src/main/java/com/fr/design/headerfooter/HeaderFooterPane.java @@ -59,7 +59,7 @@ public abstract class HeaderFooterPane extends BasicPane { reportHFYypeList .addListSelectionListener(reportHFTypeSelectionListener); reportHFYypeList.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); - reportHFYypeList.setBorder(BorderFactory.createCompoundBorder(new FineRoundBorder(), new ScaledEmptyBorder(4, 4, 4, 4))); + reportHFYypeList.setBorder(BorderFactory.createCompoundBorder(new FineRoundBorder(), new ScaledEmptyBorder(6, 2, 6, 2))); JScrollPane hfTypeListScrollPane = new JScrollPane(reportHFYypeList); leftPane.add(hfTypeListScrollPane, BorderLayout.CENTER); @@ -75,10 +75,10 @@ public abstract class HeaderFooterPane extends BasicPane { .addElement(new Integer(ReportConstants.REPORTPAGE_EVEN)); // CenterPane. - JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + JPanel centerPane = FRGUIPaneFactory.createScaledBorderLayout_S_Pane(0, 10); this.add(centerPane, BorderLayout.CENTER); - JPanel definePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + JPanel definePane = new JPanel(new BorderLayout()); centerPane.add(definePane, BorderLayout.NORTH); defineCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_HF_Whether_To_Define_The_Selected_Type"), true); //是否定义选中的类型 @@ -229,11 +229,6 @@ public abstract class HeaderFooterPane extends BasicPane { return this; } - - @Override - public Dimension getPreferredSize() { - return new Dimension(super.getPreferredSize().width, FineUIScale.scale(24)); - } }; diff --git a/designer-realize/src/main/java/com/fr/design/report/NewReportBackgroundPane.java b/designer-realize/src/main/java/com/fr/design/report/NewReportBackgroundPane.java index 0aadbb2d63..a2fe8268d6 100644 --- a/designer-realize/src/main/java/com/fr/design/report/NewReportBackgroundPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/NewReportBackgroundPane.java @@ -3,6 +3,7 @@ package com.fr.design.report; import com.fine.swing.ui.layout.Layouts; import com.fine.theme.light.ui.FineRoundBorder; import com.fine.theme.utils.FineUIScale; +import com.fine.theme.utils.FineUIStyle; import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.theme.ReportTheme; import com.fr.base.theme.TemplateTheme; @@ -34,9 +35,6 @@ import java.awt.Graphics2D; import java.awt.Shape; import java.awt.geom.Rectangle2D; -import static com.fine.swing.ui.layout.Layouts.cell; -import static com.fine.swing.ui.layout.Layouts.column; - public class NewReportBackgroundPane extends BasicPane { private final UICheckBox isPrintBackgroundCheckBox; private final UICheckBox isExportBackgroundCheckBox; @@ -50,16 +48,9 @@ public class NewReportBackgroundPane extends BasicPane { isPrintBackgroundCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Print_Background")); isExportBackgroundCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Export_Background")); - add(column(10, cell(profilePane).weight(1), cell(createBottomPane())).getComponent()); + add(Layouts.column(10, Layouts.cell(profilePane).weight(1), Layouts.row(10, Layouts.cell(isPrintBackgroundCheckBox), Layouts.cell(isExportBackgroundCheckBox))).getComponent()); } - private JPanel createBottomPane() { - JPanel container = new JPanel(); - container.setPreferredSize(new Dimension(container.getPreferredSize().width, FineUIScale.scale(30))); - container.add(isExportBackgroundCheckBox); - container.add(isPrintBackgroundCheckBox); - return container; - } @Override protected String title4PopupWindow() { @@ -143,9 +134,9 @@ public class NewReportBackgroundPane extends BasicPane { } }); - JPanel contentContainer = column( + JPanel contentContainer = Layouts.column( 10, - Layouts.row(10, cell(createLeftPane()).weight(1), cell(createRightPane())).weight(1) + Layouts.row(10, Layouts.cell(createLeftPane()).weight(1), Layouts.cell(createRightPane())).weight(1) ).getComponent(); contentContainer.setPreferredSize(FineUIScale.scale(new Dimension(600, 540))); @@ -169,10 +160,10 @@ public class NewReportBackgroundPane extends BasicPane { JPanel panel = new JPanel(new BorderLayout()); panel.add(previewPane, BorderLayout.CENTER); - return column( + return Layouts.column( 10, - cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Preview"))), - cell(panel).weight(1).with(it -> it.setBorder(new FineRoundBorder())) + Layouts.cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Preview"))).with(it -> FineUIStyle.setStyle(it, FineUIStyle.LABEL_TIP)), + Layouts.cell(panel).weight(1).with(it -> it.setBorder(new FineRoundBorder())) ).getComponent(); } diff --git a/designer-realize/src/main/java/com/fr/design/report/ReportColumnsPane.java b/designer-realize/src/main/java/com/fr/design/report/ReportColumnsPane.java index b1b296e110..94106abd6c 100644 --- a/designer-realize/src/main/java/com/fr/design/report/ReportColumnsPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/ReportColumnsPane.java @@ -1,10 +1,10 @@ package com.fr.design.report; import com.fine.theme.utils.FineUIScale; +import com.fine.theme.utils.FineUIStyle; import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.GraphHelper; import com.fr.design.border.UIRoundedBorder; -import com.fr.design.border.UITitledBorder; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIRadioButton; @@ -25,7 +25,6 @@ import com.fr.stable.Constants; import com.fr.stable.StringUtils; import javax.swing.BorderFactory; -import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.SpinnerNumberModel; import javax.swing.SwingConstants; @@ -36,7 +35,6 @@ import java.awt.Container; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Graphics; -import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -127,7 +125,6 @@ public class ReportColumnsPane extends BasicPane{ buttonGroupPane.add(onOffButtonGroup); north.add(buttonGroupPane, BorderLayout.EAST); - this.setBorder(new ScaledEmptyBorder(10, 10, 10, 10)); JPanel northV2 = column( 20, row( @@ -229,12 +226,12 @@ public class ReportColumnsPane extends BasicPane{ colButton.addActionListener(colChangeListener); return row( row( - 3, + 4, column(cell(rowButton)), cell(new UILabel(IOUtils.readIcon("/com/fr/design/images/reportcolumns/" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Row_Icon_File_Name")))) ).weight(0.2), row( - 3, + 4, column(cell(colButton)), cell(new UILabel(IOUtils.readIcon("/com/fr/design/images/reportcolumns/" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Col_Icon_File_Name")))) ).weight(0.3) @@ -288,14 +285,14 @@ public class ReportColumnsPane extends BasicPane{ toUILabel = new UILabel(COLUMN_ROW_TEXTS[1 - rowOrColumn]); return row( row( - 3, + 4, cell(maxRadioButton), cell(maxNumberSpinner), cell(maxUILabel), cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Report_Columns_Columns_Optional"))) ).weight(0.2), row( - 3, + 4, cell(toXRadioButton), cell(toXSpinner), cell(toUILabel) @@ -334,23 +331,25 @@ public class ReportColumnsPane extends BasicPane{ */ private JPanel createRowPane() { repeatColDataTextField = new UITextField(); - copyLabel = new UILabel(REPORT_COLUMN_RAPEAT[rowOrColumn] + ":"); + copyLabel = new UILabel(REPORT_COLUMN_RAPEAT[rowOrColumn]); copyTitleTextField = new UITextField(); JPanel colPane = column( 10, row( 10, - cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Column_Data") + ":")).weight(0.12), + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Column_Data"))).weight(0.12), cell(repeatColDataTextField).weight(0.33), - cell(new UILabel("" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Format") + ": A2:D5 " + "")).weight(0.2), + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Format") + ": A2:D5 ")).weight(0.2) + .with(it -> FineUIStyle.setStyle(it, FineUIStyle.LABEL_TIP)), flex(0.35) ), row( 10, cell(copyLabel).weight(0.12), cell(copyTitleTextField).weight(0.33), - cell(new UILabel("" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Format") + ": 1,2-3,5,18" + "")).weight(0.2), + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Format") + ": 1,2-3,5,18")).weight(0.2) + .with(it -> FineUIStyle.setStyle(it, FineUIStyle.LABEL_TIP)), flex(0.35) ) ).getComponent(); diff --git a/designer-realize/src/main/java/com/fr/design/report/freeze/RepeatAndFreezeSettingPane.java b/designer-realize/src/main/java/com/fr/design/report/freeze/RepeatAndFreezeSettingPane.java index 971813bff4..936871a8bc 100644 --- a/designer-realize/src/main/java/com/fr/design/report/freeze/RepeatAndFreezeSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/freeze/RepeatAndFreezeSettingPane.java @@ -1,11 +1,11 @@ package com.fr.design.report.freeze; +import com.fine.theme.utils.FineUIStyle; import com.fr.base.FRContext; import com.fr.design.constants.UIConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.extra.WebViewDlgHelper; import com.fr.design.gui.frpane.FineTabbedPane; -import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.ActionLabel; import com.fr.design.gui.ilable.UILabel; @@ -27,7 +27,6 @@ import java.awt.event.ActionListener; import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.column; -import static com.fine.swing.ui.layout.Layouts.fix; import static com.fine.swing.ui.layout.Layouts.flex; import static com.fine.swing.ui.layout.Layouts.row; import static com.fine.theme.utils.FineUIUtils.wrapComponentWithTitle; @@ -94,7 +93,7 @@ public class RepeatAndFreezeSettingPane extends BasicPane { repeatTitleRowPane = new RepeatRowPane(); return row( - 2, + 4, cell(useRepeatTitleRCheckBox), cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Title_Start_Row_Form"))), cell(repeatTitleRowPane), @@ -111,7 +110,7 @@ public class RepeatAndFreezeSettingPane extends BasicPane { repeatTitleColPane = new RepeatColPane(); return row( - 2, + 4, cell(useRepeatTitleCCheckBox), cell(new UILabel(Toolkit.i18nText("Fine-Design_Report_Title_Start_Column_Form"))), cell(repeatTitleColPane), @@ -121,7 +120,7 @@ public class RepeatAndFreezeSettingPane extends BasicPane { private JPanel initPageRepeatPane() { return row( - 10, + 20, column( 10, cell(new UILabel(REPEAT_AND_FROZEN_HEAD)).weight(0.5), @@ -138,7 +137,7 @@ public class RepeatAndFreezeSettingPane extends BasicPane { private JPanel initPageRepeatFootPane() { return row( - 10, + 20, column( 10, cell(new UILabel(REPEAT_AND_FROZEN_FOOT)).weight(0.5), @@ -161,7 +160,7 @@ public class RepeatAndFreezeSettingPane extends BasicPane { repeatFinisRowPane = new RepeatRowPane(); return row( - 2, + 4, cell(useRepeatFinisRCheckBox), cell(new UILabel(Toolkit.i18nText("Fine-Design_Report_Finis_Start_Row_Form"))), cell(repeatFinisRowPane), @@ -178,7 +177,7 @@ public class RepeatAndFreezeSettingPane extends BasicPane { repeatFinisColPane = new RepeatColPane(); return row( - 2, + 4, cell(useRepeatFinisCCheckBox), cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Finis_Start_Column_Form"))), cell(repeatFinisColPane), @@ -208,7 +207,7 @@ public class RepeatAndFreezeSettingPane extends BasicPane { usePageHeadFrozenCCheckBox = new UICheckBox(); return row( - 10, + 20, column( 10, cell(new UILabel(REPEAT_AND_FROZEN_HEAD)).weight(0.5), @@ -217,12 +216,12 @@ public class RepeatAndFreezeSettingPane extends BasicPane { column( 10, row( - 2, + 4, cell(usePageHeadFrozenRCheckBox), cell(freezePageRowPane) ).weight(0.5), row( - 2, + 4, cell(usePageHeadFrozenCCheckBox), cell(freezePageColPane) ).weight(0.5) @@ -239,7 +238,7 @@ public class RepeatAndFreezeSettingPane extends BasicPane { freezeFootColPane = new FreezePagePane(false, true); return row( - 10, + 20, column( 10, cell(new UILabel(REPEAT_AND_FROZEN_FOOT)).weight(0.5), @@ -248,12 +247,12 @@ public class RepeatAndFreezeSettingPane extends BasicPane { column( 10, row( - 2, + 4, cell(usePageFootFrozenRCheckBox), cell(freezeFootRowPane) ).weight(0.5), row( - 2, + 4, cell(usePageFootFrozenCCheckBox), cell(freezeFootColPane) ).weight(0.5) @@ -287,7 +286,7 @@ public class RepeatAndFreezeSettingPane extends BasicPane { freezeWriteColPane = new FreezeWriteColPane(); return row( - 10, + 20, column( 10, cell(new UILabel(Toolkit.i18nText("Fine-Design_Report_Face_Write_Frozen"))).weight(0.5), @@ -296,12 +295,12 @@ public class RepeatAndFreezeSettingPane extends BasicPane { column( 10, row( - 2, + 4, cell(useWriteFrozenRCheckBox), cell(freezeWriteRowPane) ).weight(0.5), row( - 2, + 4, cell(useWriteFrozenCCheckBox), cell(freezeWriteColPane) ).weight(0.5) @@ -325,15 +324,12 @@ public class RepeatAndFreezeSettingPane extends BasicPane { ).getComponent(); JPanel pagePanel = column( - 10, - fix(10), + 20, cell(wrapComponentWithTitle(outrepeatPanel, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Repeat"))), cell(wrapComponentWithTitle(outfreezePanel, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Frozen"))), - cell(new UILabel(""+ Toolkit.i18nText("Fine-Design_Report_Engine_Freeze_Tip") + "")) + cell(new UILabel(Toolkit.i18nText("Fine-Design_Report_Engine_Freeze_Tip"))).with(it -> FineUIStyle.setStyle(it, FineUIStyle.LABEL_TIP)) ).getComponent(); - // 重复打印部分 - // 重复打印标题的起始行 JPanel labelPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); labelPanel.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Select_the_repeated_row_and_column") + ":")); UILabel warning = new UILabel("(" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_FreezeWarning") + ")"); @@ -342,8 +338,6 @@ public class RepeatAndFreezeSettingPane extends BasicPane { JPanel writeOutrepeatPanel = initWriteFrozenPane(); JPanel writePanel = column( - 10, - fix(10), cell(wrapComponentWithTitle(writeOutrepeatPanel, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Frozen"))) ).getComponent(); addWriteFrozen(writePanel, pagePanel);