From 05c1b3e29ec3047a455c68ffc0507d0cb78b5ede Mon Sep 17 00:00:00 2001 From: lemon Date: Tue, 6 Aug 2024 13:30:35 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-127437=20fix:=E9=9A=90=E8=97=8F=20jtable?= =?UTF-8?q?=20=E6=BB=9A=E5=8A=A8=E6=9D=A1=EF=BC=8C=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E4=B8=80=E4=BA=9B=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/component/CustomSortPane.java | 4 --- .../itableeditorpane/UITableEditorPane.java | 33 ++++++++++++------- .../main/java/com/fr/env/RemoteEnvPane.java | 4 +-- .../fr/design/report/ReportColumnsPane.java | 2 +- 4 files changed, 25 insertions(+), 18 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/CustomSortPane.java b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/CustomSortPane.java index fe8f2cf836..418cee96dd 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/CustomSortPane.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/CustomSortPane.java @@ -78,10 +78,6 @@ public class CustomSortPane extends JPanel { bottom = new UIButton(new LazyIcon("to_bottom")); up = new UIButton(new LazyIcon("move_up")); down = new UIButton(new LazyIcon("move_down")); - top.setDisabledIcon(new LazyIcon("to_top").disabled()); - bottom.setDisabledIcon(new LazyIcon("to_bottom").disabled()); - up.setDisabledIcon(new LazyIcon("move_up").disabled()); - down.setDisabledIcon(new LazyIcon("move_down").disabled()); top.addActionListener(e -> { SwingUtilities.invokeLater(() -> { sortItemPane.setComponentZOrder(selectedLabel, 0); 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 704cbcc303..0293386aa1 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 @@ -28,6 +28,8 @@ 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; @@ -50,6 +52,8 @@ public class UITableEditorPane extends BasicPane { protected UITableModelAdapter tableModel; private String leftLabelName; private JPanel buttonPane; + protected JScrollPane scrollPane; + protected JPanel verticalScrollBar; public UITableEditorPane(UITableModelAdapter model) { this.tableModel = model; @@ -99,18 +103,25 @@ public class UITableEditorPane extends BasicPane { * @param scrollPane * @return */ - protected Component buildScrollTablePane(JScrollPane scrollPane) { - return row( - cell(scrollPane).weight(1), - column( - cell(new UILabel()).with(it -> { - it.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 1, UIManager.getColor("defaultBorderColor"))); - it.setPreferredSize(FineUIScale.scale(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"))); - })) + 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() { diff --git a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java index 67d3e19690..865c5d71d7 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -79,7 +79,7 @@ public class RemoteEnvPane extends BasicBeanPane { private UIButton okButton = new UIButton(Toolkit.i18nText("Fine-Design_Report_OK")); private UIButton cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Cancel")); private UILabel uiLabel = new UILabel(); - private final int FIRST_COL_WIDTH = 72; + private final int FIRST_COL_WIDTH = 80; private final int SECOND_COL_WIDTH = 68; @@ -490,7 +490,7 @@ public class RemoteEnvPane extends BasicBeanPane { UILabel passwordLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Remote_Env_Account_Password")); passwordLabel.setHorizontalAlignment(SwingConstants.LEFT); - UILabel accountLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Remotex_Env_Platform_Account")); + UILabel accountLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Remote_Env_Platform_Account")); accountLabel.setHorizontalAlignment(SwingConstants.LEFT); //输入密码的时候检测下大写锁定 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 db7aa5db20..9723d494af 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 @@ -121,7 +121,7 @@ public class ReportColumnsPane extends BasicPane{ uiLabel.setHorizontalAlignment(SwingConstants.CENTER); int uiLabelWidth = GraphHelper.getWidth(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportColumns_Columns"), uiLableFont); - uiLabel.setPreferredSize(FineUIScale.scale(new Dimension(uiLabelWidth, 20))); + uiLabel.setPreferredSize(new Dimension(uiLabelWidth, FineUIScale.scale(20))); north.add(uiLabel,BorderLayout.WEST); JPanel buttonGroupPane = new JPanel(new FlowLayout(FlowLayout.CENTER, 23,11)); buttonGroupPane.add(onOffButtonGroup);