From e4ff94f24e021698512ce767ba2736eb6bd3eea7 Mon Sep 17 00:00:00 2001 From: "Richard.Fang" Date: Fri, 20 Sep 2024 15:52:56 +0800 Subject: [PATCH 01/19] =?UTF-8?q?REPORT-135235=20fix:fbp=E5=9B=9E=E5=BD=92?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=9A=E8=B0=83=E6=95=B4=E9=AB=98=E7=BA=A7?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=BC=B9=E7=AA=97=E5=A4=A7=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../javascript/JSContentWithDescriptionPane.java | 7 ++++--- .../com/fr/design/javascript/JavaScriptImplPane.java | 10 +++------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java b/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java index 4116f4f1d0..47f9898def 100644 --- a/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java +++ b/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java @@ -1,5 +1,6 @@ package com.fr.design.javascript; +import com.fine.theme.utils.FineUIScale; import com.fr.base.svg.IconUtils; import com.fr.design.border.UIRoundedBorder; import com.fr.design.constants.UIConstants; @@ -140,7 +141,7 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi //js函数声明面板 JPanel jsParaPane = createJSParaPane(); - jsParaPane.setPreferredSize(new Dimension(650, 80)); + jsParaPane.setPreferredSize(FineUIScale.createScaleDimension(650, 80)); //右上角的搜索提示面板 JPanel tipsPane = createTipsPane(); @@ -153,7 +154,7 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi UIScrollPane contentTextAreaPanel = createContentTextAreaPanel(); initContextAreaListener(); - contentTextAreaPanel.setPreferredSize(new Dimension(850, 250)); + contentTextAreaPanel.setPreferredSize(FineUIScale.createScaleDimension(850, 250)); //js函数结束标签 UILabel endBracketsLabel = new UILabel(); endBracketsLabel.setText("}"); @@ -173,7 +174,7 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi //函数分类和函数说明面板================================== JPanel functionNameAndDescriptionPanel = createInterfaceAndDescriptionPanel(); - functionNameAndDescriptionPanel.setPreferredSize(new Dimension(880, 220)); + functionNameAndDescriptionPanel.setPreferredSize(FineUIScale.createScaleDimension(880, 220)); this.add(functionNameAndDescriptionPanel, BorderLayout.SOUTH); } diff --git a/designer-base/src/main/java/com/fr/design/javascript/JavaScriptImplPane.java b/designer-base/src/main/java/com/fr/design/javascript/JavaScriptImplPane.java index 1efd313940..bb1921689b 100644 --- a/designer-base/src/main/java/com/fr/design/javascript/JavaScriptImplPane.java +++ b/designer-base/src/main/java/com/fr/design/javascript/JavaScriptImplPane.java @@ -13,13 +13,11 @@ import com.fr.design.hyperlink.AbstractHyperLinkPane; import com.fr.design.javascript.jsapi.JSImplPopulateAction; import com.fr.design.javascript.jsapi.JSImplUpdateAction; import com.fr.design.mainframe.DesignerContext; -import com.fr.design.scrollruler.ModLineBorder; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.js.JavaScriptImpl; import com.fr.stable.ParameterProvider; import com.fr.stable.StringUtils; -import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.event.TableModelEvent; import javax.swing.event.TableModelListener; @@ -30,7 +28,6 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; -import static com.fine.swing.ui.layout.Layouts.column; import static com.fine.swing.ui.layout.Layouts.row; import static com.fine.swing.ui.layout.Layouts.cell; @@ -76,12 +73,11 @@ public class JavaScriptImplPane extends AbstractHyperLinkPane { cell(FineUIUtils.wrapComponentWithTitle(importedJsPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportServerP_Import_JavaScript"))).weight(0.5), cell(FineUIUtils.wrapComponentWithTitle(parameterPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameter"))).weight(0.5) ).getComponent()); + topPane.setPreferredSize(new Dimension(super.getPreferredSize().width, 150)); this.setLayout(new BorderLayout()); - this.add(column(10, - cell(topPane).weight(0.5), - cell(FineUIUtils.wrapComponentWithTitle(jsPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JavaScript"))).weight(0.5) - ).getComponent()); + this.add(topPane, BorderLayout.NORTH); + this.add(FineUIUtils.wrapComponentWithTitle(jsPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JavaScript")), BorderLayout.CENTER); this.reLayoutForChart(); } From 7a567512a8d8a411be8ff39240e7f8f0fff2dfb6 Mon Sep 17 00:00:00 2001 From: "Richard.Fang" Date: Fri, 20 Sep 2024 16:51:09 +0800 Subject: [PATCH 02/19] =?UTF-8?q?REPORT-135235=20fix:fbp=E5=9B=9E=E5=BD=92?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=9A=E4=BF=AE=E5=A4=8D=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E6=82=AC=E6=B5=AE=E5=BC=B9=E7=AA=97=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E4=B8=8D=E7=81=B5=E6=95=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/style/TextFormatPane.java | 2 +- .../style/VanChartPlotLegendPane.java | 34 ++++++++++--------- .../designer/style/VanChartTitlePane.java | 32 +++++++++-------- 3 files changed, 36 insertions(+), 32 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java b/designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java index a3a1f3f578..a86bc70e05 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java @@ -132,7 +132,7 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName cell(textField), row( cell(new UILabel(Toolkit.i18nText("Fine-Design_Report_Base_Option"))).weight(LEFT_WEIGHT), - row(cell(roundingBox)).weight(RIGHT_WEIGHT) + cell(roundingBox).weight(RIGHT_WEIGHT) ), cell(previewLabel) ).getComponent()); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java index 57923b1ee8..3321769c9f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java @@ -32,6 +32,7 @@ import com.fr.van.chart.designer.component.border.VanChartBorderWithRadiusPane; import javax.swing.Icon; import javax.swing.JPanel; +import javax.swing.SwingUtilities; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.BorderLayout; @@ -153,7 +154,7 @@ public class VanChartPlotLegendPane extends BasicPane { return FineLayoutBuilder.asBorderLayoutWrapped(column); } - protected VanChartBackgroundPane creatBackgroundPane(){ + protected VanChartBackgroundPane creatBackgroundPane() { return new VanChartBackgroundWithOutImagePane(); } @@ -252,21 +253,22 @@ public class VanChartPlotLegendPane extends BasicPane { customFloatPositionButton.setSelected(true); checkLayoutPaneVisible(); checkDisplayStrategyUse(); - - if (customFloatPositionPane == null) { - customFloatPositionPane = new VanChartFloatPositionPane(); - } - if (uiBubbleFloatPane == null) { - Point comPoint = customFloatPositionButton.getLocationOnScreen(); - Point arrowPoint = new Point(comPoint.x + customFloatPositionButton.getWidth() / 2 - GAP, comPoint.y + customFloatPositionButton.getHeight()); - uiBubbleFloatPane = new UIBubbleFloatPane(Constants.TOP, arrowPoint, customFloatPositionPane, WIDTH, HEIGHT) { - @Override - public void updateContentPane() { - parent.attributeChanged(); - } - }; - } - uiBubbleFloatPane.show(VanChartPlotLegendPane.this, null); + SwingUtilities.invokeLater(() -> { + if (customFloatPositionPane == null) { + customFloatPositionPane = new VanChartFloatPositionPane(); + } + if (uiBubbleFloatPane == null) { + Point comPoint = customFloatPositionButton.getLocationOnScreen(); + Point arrowPoint = new Point(comPoint.x + customFloatPositionButton.getWidth() / 2 - GAP, comPoint.y + customFloatPositionButton.getHeight()); + uiBubbleFloatPane = new UIBubbleFloatPane(Constants.TOP, arrowPoint, customFloatPositionPane, WIDTH, HEIGHT) { + @Override + public void updateContentPane() { + parent.attributeChanged(); + } + }; + } + uiBubbleFloatPane.show(VanChartPlotLegendPane.this, null); + }); } }); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java index 9761c618ba..441e3d36e1 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java @@ -35,6 +35,7 @@ import com.fr.van.chart.designer.component.background.VanChartBackgroundWithOutS import javax.swing.JPanel; import javax.swing.SwingConstants; +import javax.swing.SwingUtilities; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.BorderLayout; @@ -220,21 +221,22 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { alignmentPane.setSelectedIndex(-1); customFloatPositionButton.setSelected(true); checkDisplayStrategyUse(); - - if (customFloatPositionPane == null) { - customFloatPositionPane = new VanChartFloatPositionPane(); - } - if (uiBubbleFloatPane == null) { - Point comPoint = customFloatPositionButton.getLocationOnScreen(); - Point arrowPoint = new Point(comPoint.x + customFloatPositionButton.getWidth() / 2 - GAP, comPoint.y + customFloatPositionButton.getHeight()); - uiBubbleFloatPane = new UIBubbleFloatPane(Constants.TOP, arrowPoint, customFloatPositionPane, WIDTH, HEIGHT) { - @Override - public void updateContentPane() { - parent.attributeChanged(); - } - }; - } - uiBubbleFloatPane.show(VanChartTitlePane.this, null); + SwingUtilities.invokeLater(() -> { + if (customFloatPositionPane == null) { + customFloatPositionPane = new VanChartFloatPositionPane(); + } + if (uiBubbleFloatPane == null) { + Point comPoint = customFloatPositionButton.getLocationOnScreen(); + Point arrowPoint = new Point(comPoint.x + customFloatPositionButton.getWidth() / 2 - GAP, comPoint.y + customFloatPositionButton.getHeight()); + uiBubbleFloatPane = new UIBubbleFloatPane(Constants.TOP, arrowPoint, customFloatPositionPane, WIDTH, HEIGHT) { + @Override + public void updateContentPane() { + parent.attributeChanged(); + } + }; + } + uiBubbleFloatPane.show(VanChartTitlePane.this, null); + }); } }); } From 8d4fb7256fcfc88df9eeb3bf67eccef373f9f17a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Levy=2EXie-=E8=A7=A3=E5=AE=89=E6=A3=AE?= Date: Fri, 20 Sep 2024 17:00:17 +0800 Subject: [PATCH 03/19] =?UTF-8?q?REPORT-133133=20&=20REPORT-134138=20fix:?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E5=BC=82=E5=B8=B8=E6=8A=A5?= =?UTF-8?q?=E9=94=99=E5=9C=BA=E6=99=AF=E5=BC=B9=E7=AA=97=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datapane/connect/ConnectionListPane.java | 76 ++++++++++++++----- 1 file changed, 57 insertions(+), 19 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java index ed96b2697e..9879fd700c 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java @@ -13,6 +13,8 @@ import com.fr.design.ExtraDesignClassManager; import com.fr.design.data.MapCompareUtils; import com.fr.design.data.datapane.preview.ConnectionInfoBeanHelper; import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.editlock.EditLockUtils; import com.fr.design.fun.ConnectionProvider; import com.fr.design.gui.controlpane.JListControlPane; import com.fr.design.gui.controlpane.NameObjectCreator; @@ -25,18 +27,21 @@ import com.fr.general.NameObject; import com.fr.license.database.DBTypes; import com.fr.license.database.DataBaseTypePointManager; import com.fr.license.exception.DataBaseNotSupportedException; +import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; +import com.fr.report.LockItem; import com.fr.stable.ArrayUtils; import com.fr.stable.Nameable; import com.fr.stable.StringUtils; import com.fr.stable.core.PropertyChangeAdapter; import com.fr.workspace.WorkContext; +import com.fr.workspace.engine.exception.DriverUnExistException; import com.fr.workspace.server.database.DataBaseTypeOperator; import com.fr.workspace.server.entity.connection.ConnectionBean; import com.fr.workspace.server.repository.connection.ConnectionRepository; import org.jetbrains.annotations.NotNull; -import javax.swing.SwingWorker; +import javax.swing.*; import java.awt.Window; import java.util.ArrayList; import java.util.Arrays; @@ -345,18 +350,23 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh private void alterConnections(List addConnections, List removedConnNames, List updateConnection) throws Exception { - try { - for (ConnectionInfoBean bean : addConnections) { + // 处理新增 connections + processConnections(addConnections, bean -> { ConnectionRepository.getInstance().add(bean); - } - for (ConnectionInfoBean bean : updateConnection) { + }, "add"); + + // 处理更新 connections + processConnections(updateConnection, bean -> { ConnectionRepository.getInstance().update(bean); - } - for (String name : removedConnNames) { + }, "update"); + + // 处理移除 connections + processConnections(removedConnNames, name -> { ConnectionRepository.getInstance().delete(new ConnectionInfoBean(name)); - } - // hades:远程环境时,由于时直接RPC调用远程修改,因此设计器本地配置需要失效 + }, "delete"); + + // 远程环境处理逻辑 if (!WorkContext.getCurrent().isLocal()) { EventDispatcher.fire(RemoteConfigEvent.EDIT, "ConnectionConfig"); } @@ -366,18 +376,46 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh } } + private void processConnections(List connections, ThrowingConsumer action, String actionType) throws Exception { + for (T item : connections) { + try { + action.accept(item); + } catch (Exception e) { + String errorConnectionName = (item instanceof ConnectionInfoBean) + ? ((ConnectionInfoBean) item).getConnectionName() + : item.toString(); + if (e instanceof DriverUnExistException) { + throw new DriverUnExistException(InterProviderFactory.getProvider().getLocText("Fine-Core_Data_Connection") + errorConnectionName + + InterProviderFactory.getProvider().getLocText("Fine-Core_Driver_Not_Found")); + } + throw e; + } + } + } + + @FunctionalInterface + interface ThrowingConsumer { + void accept(T t) throws Exception; + } public static void showDialog(Window parent) { - final Map connectionMap = ConnectionInfoBeanHelper.createConnectionMap(ConnectionRepository.getInstance().getAll()); - final ConnectionManagerPane connectionManagerPane = new ConnectionManagerPane() { - @Override - public void complete() { - populate(connectionMap); - } - }; - final BasicDialog connectionListDialog = connectionManagerPane.showLargeWindow(parent, null); - connectionListDialog.addDialogActionListener(new ConnectionListDialogActionAdapter(connectionManagerPane, connectionListDialog, connectionMap)); - connectionListDialog.setVisible(true); + try { + final Map connectionMap = ConnectionInfoBeanHelper.createConnectionMap(ConnectionRepository.getInstance().getAll()); + final ConnectionManagerPane connectionManagerPane = new ConnectionManagerPane() { + @Override + public void complete() { + populate(connectionMap); + } + }; + final BasicDialog connectionListDialog = connectionManagerPane.showLargeWindow(parent, null); + connectionListDialog.addDialogActionListener(new ConnectionListDialogActionAdapter(connectionManagerPane, connectionListDialog, connectionMap)); + connectionListDialog.setVisible(true); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Remote_Data_Error"), + Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE); + EditLockUtils.unlock(LockItem.CONNECTION); + } } @Override From ac94ca4d12b90022825d39741dc8cb2820c694b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Levy=2EXie-=E8=A7=A3=E5=AE=89=E6=A3=AE?= Date: Fri, 20 Sep 2024 17:00:46 +0800 Subject: [PATCH 04/19] =?UTF-8?q?REPORT-135142=20fix:NewUI=20=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8=E6=98=BE=E7=A4=BA=E6=AF=94=E4=BE=8B=E8=B0=83=E4=BC=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/van/chart/designer/component/VanChartHtmlLabelPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHtmlLabelPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHtmlLabelPane.java index 90213ea924..373fc412d9 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHtmlLabelPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHtmlLabelPane.java @@ -151,7 +151,7 @@ public class VanChartHtmlLabelPane extends JPanel { new Component[]{isCustomWidth, customWidth}, new Component[]{isCustomHeight, customHeight}, }; - return FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1, 1}); + return FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1.4, 0.6}); } private void checkWidth() { From dea308717c9f5309131a9d79bc84e5031a330e1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Levy=2EXie-=E8=A7=A3=E5=AE=89=E6=A3=AE?= Date: Fri, 20 Sep 2024 17:02:53 +0800 Subject: [PATCH 05/19] =?UTF-8?q?=E6=97=A0jira=20=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/data/datapane/connect/ConnectionListPane.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java index 9879fd700c..eb98dd6b0a 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java @@ -41,7 +41,8 @@ import com.fr.workspace.server.entity.connection.ConnectionBean; import com.fr.workspace.server.repository.connection.ConnectionRepository; import org.jetbrains.annotations.NotNull; -import javax.swing.*; +import javax.swing.JOptionPane; +import javax.swing.SwingWorker; import java.awt.Window; import java.util.ArrayList; import java.util.Arrays; From 2fb49be88fb2a39158ee633edd4e43f71bf16e86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Levy=2EXie-=E8=A7=A3=E5=AE=89=E6=A3=AE?= Date: Fri, 20 Sep 2024 17:10:13 +0800 Subject: [PATCH 06/19] =?UTF-8?q?=E6=97=A0jira=20=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/data/datapane/connect/ConnectionListPane.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java index eb98dd6b0a..52bac8eaff 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java @@ -394,6 +394,9 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh } } + /** + * 抛异常的函数式接口 + */ @FunctionalInterface interface ThrowingConsumer { void accept(T t) throws Exception; From 62e8ea70c16604166cf6488b21f683926c90e048 Mon Sep 17 00:00:00 2001 From: lemon Date: Fri, 20 Sep 2024 18:06:20 +0800 Subject: [PATCH 07/19] =?UTF-8?q?=20REPORT-134742=20&=20REPORT-135139=20fi?= =?UTF-8?q?x:=20=E6=97=A5=E6=9C=9F=E6=8E=A7=E4=BB=B6=E7=BF=BB=E6=96=B0?= =?UTF-8?q?=EF=BC=8C=E5=8A=A8=E6=80=81=20tab=20=E9=A1=B5=E6=A0=87=E9=A2=98?= =?UTF-8?q?=E5=AE=BD=E5=BA=A6=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datapane/preview/PreviewTablePane.java | 12 +- .../design/gui/date/CalendarNumberField.java | 7 +- .../fr/design/gui/date/UICalendarPanel.java | 243 ++++++------------ .../com/fr/design/gui/date/UIDayLabel.java | 2 - .../com/fine/theme/icon/left_arrow.svg | 3 + .../com/fine/theme/icon/right_arrow.svg | 3 + .../fine/theme/light/ui/fine_light.icon.json | 2 + .../light/ui/laf/FineLightLaf.properties | 14 +- 8 files changed, 118 insertions(+), 168 deletions(-) create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/left_arrow.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/right_arrow.svg 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 b7b6a39fe7..6b6d887ef7 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 @@ -706,11 +706,21 @@ public class PreviewTablePane extends BasicPane { }; previewPane.setLayout(FRGUIPaneFactory.createBorderLayout()); if (nameDataModels.length > 0) { - previewPane.add(tabbedPane.withHeadRatio(0.8f).withTabLayout(buildTabLayout(nameDataModels)).build(), BorderLayout.CENTER); + int[] tabLayout = buildTabLayout(nameDataModels); + float headRatio = buildHeadRatio(tabLayout); + previewPane.add(tabbedPane.withHeadRatio(headRatio).withTabLayout(tabLayout).build(), BorderLayout.CENTER); } previewPane.showWindow(new JFrame()).setVisible(true); } + private static float buildHeadRatio(int[] tabLayout) { + float maxLen = 0.8f; + if (tabLayout.length == 1) { + return (float) tabLayout[0] / TAB_MAX_COUNT_WITH_LINE; + } + return maxLen; + } + private static int[] buildTabLayout(NameDataModel[] nameDataModels) { int length = nameDataModels.length; int size = (length + TAB_MAX_COUNT_WITH_LINE - 1) / TAB_MAX_COUNT_WITH_LINE; diff --git a/designer-base/src/main/java/com/fr/design/gui/date/CalendarNumberField.java b/designer-base/src/main/java/com/fr/design/gui/date/CalendarNumberField.java index 1908751c6a..c4a6c24c7a 100644 --- a/designer-base/src/main/java/com/fr/design/gui/date/CalendarNumberField.java +++ b/designer-base/src/main/java/com/fr/design/gui/date/CalendarNumberField.java @@ -12,6 +12,8 @@ import java.awt.Toolkit; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; +import static com.fine.theme.utils.FineUIScale.scale; + /** * Created with IntelliJ IDEA. * User: 小灰灰 @@ -25,6 +27,7 @@ public class CalendarNumberField extends UINumberField { public CalendarNumberField(double maxValue) { super(2, 0, 0, maxValue); + this.setHorizontalAlignment(CENTER); this.setBorderPainted(false); addFocusListener(new FocusAdapter() { @Override @@ -96,7 +99,7 @@ public class CalendarNumberField extends UINumberField { } public Dimension getPreferredSize() { - return new Dimension(24, 11); + return scale(new Dimension(24, 24)); } public boolean shouldResponseChangeListener() { @@ -104,7 +107,7 @@ public class CalendarNumberField extends UINumberField { } public Insets getInsets() { - return new Insets(0, 6, 0, 4); + return new Insets(0, 0, 0, 0); } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java b/designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java index f4b8a5b123..9907c840f4 100644 --- a/designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java +++ b/designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java @@ -1,10 +1,12 @@ package com.fr.design.gui.date; import com.fanruan.product.ProductConstantsBase; +import com.fine.theme.icon.LazyIcon; +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.background.GradientBackground; +import com.fr.design.border.FineBorderFactory; import com.fr.design.carton.MonthlyCartonFile; import com.fr.design.carton.SwitchForSwingChecker; import com.fr.design.constants.UIConstants; @@ -13,13 +15,11 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.DesignUtils; -import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.general.GeneralUtils; import com.fr.stable.Constants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; -import javax.swing.BorderFactory; import javax.swing.Box; import javax.swing.Icon; import javax.swing.JComponent; @@ -34,14 +34,11 @@ import javax.swing.event.EventListenerList; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; -import java.awt.FlowLayout; import java.awt.Font; import java.awt.Graphics; -import java.awt.Graphics2D; import java.awt.GridLayout; import java.awt.Insets; import java.awt.Rectangle; -import java.awt.Shape; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; @@ -55,6 +52,10 @@ import java.util.Date; import java.util.HashSet; import java.util.Set; +import static com.fine.swing.ui.layout.Layouts.cell; +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.FineUIScale.scale; public class UICalendarPanel extends JPanel { @@ -75,6 +76,10 @@ public class UICalendarPanel extends JPanel { protected Color background; protected Color foreground; + protected Color hoverBackground; + protected Color pressedBackground; + protected Color defaultBackground; + private Calendar calendar = null; private UILabel monthLabel = null; private DayPane days = null; @@ -86,6 +91,9 @@ public class UICalendarPanel extends JPanel { private final Color LABEL_FORGE_GROUND = new Color(0x6F6F6); private MouseListener todayListener; private UIDayLabel lbToday; + private int dateButtonArc; + private int dateButtonWidth; + private int dateButtonHeight; /** * 一个int类型用于判断日历是否是专门用于处理卡顿的设计器反馈箱中的日历 * 0表示是 @@ -126,17 +134,23 @@ public class UICalendarPanel extends JPanel { this.isTimePicker = isTimerPicker; calendar = Calendar.getInstance(); - selectedBackground = UIManager.getColor( - "ComboBox.selectionBackground"); + hoverBackground = UIManager.getColor("Calendar.hoverBackground"); + pressedBackground = UIManager.getColor("Calendar.pressedBackground"); + selectedBackground = UIManager.getColor("Calendar.selectedBackground"); + defaultBackground = UIManager.getColor("Calendar.defaultBackground"); + selectedForeground = UIManager.getColor( "ComboBox.selectionForeground"); background = UIManager.getColor("ComboBox.background"); foreground = UIManager.getColor("ComboBox.foreground"); + dateButtonArc = UIManager.getInt("Calendar.dateButton.arc"); + dateButtonWidth = UIManager.getInt("Calendar.dateButton.width"); + dateButtonHeight = UIManager.getInt("Calendar.dateButton.height"); + dayBttListener = createDayBttListener(); //renderer this - setPreferredSize(scale(new Dimension(218, 179))); setBackground(FlatUIUtils.getUIColor("fill.normal", Color.WHITE)); setBorder(new LineBorder(FlatUIUtils.getUIColor("defaultBorderColor", Color.BLACK))); @@ -144,7 +158,6 @@ public class UICalendarPanel extends JPanel { add(BorderLayout.NORTH, createNorthPane()); add(BorderLayout.CENTER, createCenterPane()); if (isTimerPicker) { - setPreferredSize(scale(new Dimension(218, 209))); add(BorderLayout.SOUTH, createSouthPane()); updateHMS(); } @@ -159,21 +172,12 @@ public class UICalendarPanel extends JPanel { private JPanel createNorthPane() { JPanel pNorth = FRGUIPaneFactory.createX_AXISBoxInnerContainer_S_Pane(); pNorth.setBackground(new Color(0xFFFFFF)); - pNorth.setPreferredSize(scale(new Dimension(1, 22))); + pNorth.setPreferredSize(new Dimension(pNorth.getPreferredSize().width, scale(40))); pNorth.add(Box.createHorizontalStrut(5)); - pNorth.add(createSkipButton(Calendar.YEAR, -1, new Icon[]{ - BaseUtils.readIcon("/com/fr/design/images/calender/year_reduce.png"), - BaseUtils.readIcon("/com/fr/design/images/calender/year_reduce_hover.png"), - BaseUtils.readIcon("/com/fr/design/images/calender/year_reduce_click.png") - })); + pNorth.add(createSkipButton(Calendar.YEAR, -1, new LazyIcon("drag_left"))); pNorth.add(Box.createHorizontalStrut(11)); - UILabel monthMinus = createSkipButton(Calendar.MONTH, -1, new Icon[]{ - BaseUtils.readIcon("/com/fr/design/images/calender/month_reduce.png"), - BaseUtils.readIcon("/com/fr/design/images/calender/month_reduce_hover.png"), - BaseUtils.readIcon("/com/fr/design/images/calender/month_reduce_click.png") - }); - monthMinus.setPreferredSize(scale(new Dimension(20, 20))); + UIButton monthMinus = createSkipButton(Calendar.MONTH, -1, new LazyIcon("left_arrow")); pNorth.add(monthMinus); monthLabel = new UILabel("", UILabel.CENTER); monthLabel.setBackground(new Color(0xFFFFFF)); @@ -183,20 +187,11 @@ public class UICalendarPanel extends JPanel { pNorth.add(monthLabel); pNorth.add(Box.createHorizontalGlue()); - UILabel monthPlus = createSkipButton(Calendar.MONTH, 1, new Icon[]{ - BaseUtils.readIcon("/com/fr/design/images/calender/month_add.png"), - BaseUtils.readIcon("/com/fr/design/images/calender/month_add_hover.png"), - BaseUtils.readIcon("/com/fr/design/images/calender/month_add_click.png") - }); - monthPlus.setPreferredSize(scale(new Dimension(20, 20))); + UIButton monthPlus = createSkipButton(Calendar.MONTH, 1, new LazyIcon("right_arrow")); monthPlus.setHorizontalAlignment(SwingConstants.RIGHT); pNorth.add(monthPlus); pNorth.add(Box.createHorizontalStrut(11)); - pNorth.add(createSkipButton(Calendar.YEAR, 1, new Icon[]{ - BaseUtils.readIcon("/com/fr/design/images/calender/year_add.png"), - BaseUtils.readIcon("/com/fr/design/images/calender/year_add_hover.png"), - BaseUtils.readIcon("/com/fr/design/images/calender/year_add_click.png") - })); + pNorth.add(createSkipButton(Calendar.YEAR, 1, new LazyIcon("drag_right"))); pNorth.add(Box.createHorizontalStrut(5)); return pNorth; @@ -205,9 +200,8 @@ public class UICalendarPanel extends JPanel { private JPanel createCenterPane() { //星期日 星期一 星期二 星期三 星期四 星期五 星期六 - JPanel pWeeks = new JPanel(new GridLayout(1, 7, 1, 0)); - pWeeks.setPreferredSize(scale(new Dimension(216, 22))); - pWeeks.setBackground(new Color(0xFFFFFF)); + JPanel pWeeks = new JPanel(new GridLayout(1, 7, 9, 0)); + pWeeks.setBackground(defaultBackground); pWeeks.setOpaque(true); String[] strWeeks = new String[]{StringUtils.EMPTY, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Sun"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Mon"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tue"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Wed"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Thu"), @@ -219,27 +213,30 @@ public class UICalendarPanel extends JPanel { label.setForeground(new Color(0x4D4C4C)); label.setFont(FONT_BLACK); label.setText(strWeeks[i]); + label.setPreferredSize(scale(new Dimension(dateButtonWidth, dateButtonHeight))); pWeeks.add(label); } + pWeeks.setBorder(new ScaledEmptyBorder(3, 9, 3, 9)); //中间放日期的面板 days = new DayPane(); days.setOpaque(true); - days.setPreferredSize(scale(new Dimension(216, 115))); + days.setPreferredSize(scale(new Dimension(pWeeks.getPreferredSize().width, 165))); JPanel pCenter = FRGUIPaneFactory.createBorderLayout_S_Pane(); pCenter.setOpaque(true); pCenter.add(pWeeks, BorderLayout.NORTH); pCenter.add(days, BorderLayout.CENTER); //显示今天的日期,直接单击图标跳到今天 - GradientPane pToday = new GradientPane(new GradientBackground(new Color(0x097BDA), new Color(0x40A3EE), GradientBackground.TOP2BOTTOM), false); - pToday.setPreferredSize(scale(new Dimension(216, 18))); + GradientPane pToday = new GradientPane(new GradientBackground(pressedBackground, pressedBackground, GradientBackground.TOP2BOTTOM), false); + pToday.setPreferredSize(new Dimension(pToday.getPreferredSize().width, scale(30))); pToday.setLayout(new BorderLayout()); lbToday = new UIDayLabel(new Date(), false); lbToday.setForeground(new Color(0x000000)); + pToday.setBorder(FineBorderFactory.createDefaultTopBorder()); todayListener = createTodayListener(pToday, lbToday); lbToday.addMouseListener(todayListener); - pToday.setBackground(new Color(0xF0F0F0)); + pToday.setBackground(defaultBackground); pToday.add(lbToday, BorderLayout.CENTER); pCenter.add(pToday, BorderLayout.SOUTH); return pCenter; @@ -247,23 +244,15 @@ public class UICalendarPanel extends JPanel { private JPanel createSouthPane() { JPanel sPane = new JPanel(); - sPane.setPreferredSize(scale(new Dimension(216, 30))); sPane.setBackground(Color.WHITE); - sPane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 6)); + sPane.setLayout(new BorderLayout()); UILabel timeLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Time") + ":"); - timeLabel.setBorder(new ScaledEmptyBorder(0, 9, 0, 5)); timeLabel.setFont(FONT_UI); - sPane.add(timeLabel); hms = new HMSPane(); - sPane.add(hms); - - UILabel gap = new UILabel(); - gap.setPreferredSize(scale(new Dimension(26, 1))); - sPane.add(gap); UIButton okButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_OK")) { public Dimension getPreferredSize() { - return scale(new Dimension(32, 18)); + return scale(new Dimension(48, 24)); } public Insets getInsets() { @@ -282,8 +271,8 @@ public class UICalendarPanel extends JPanel { } }); - sPane.add(okButton); - + sPane.add(row(12, cell(timeLabel), cell(hms), flex(), cell(okButton)).getComponent()); + sPane.setBorder(new ScaledEmptyBorder(10, 12, 10, 12)); return sPane; } @@ -301,38 +290,22 @@ public class UICalendarPanel extends JPanel { * @param amount int * @return UILabel */ - protected UILabel createSkipButton(final int field, final int amount, final Icon[] icons) { - if (icons.length != 3) { - return new UILabel(); - } - UILabel label = new UILabel(); - label.setIcon(icons[0]); - label.setRequestFocusEnabled(false); - label.addMouseListener(createSkipListener(label, field, amount, icons)); - return label; + protected UIButton createSkipButton(final int field, final int amount, final Icon icon) { + UIButton button = new UIButton(); + FineUIStyle.setStyle(button, FineUIStyle.ORIGINAL_BUTTON); + button.setIcon(icon); + button.setRequestFocusEnabled(false); + button.addMouseListener(createSkipListener(field, amount)); + return button; } - protected MouseListener createSkipListener(final UILabel label, final int field, - final int amount, final Icon[] icons) { + protected MouseListener createSkipListener(final int field, final int amount) { return new MouseAdapter() { public void mouseReleased(MouseEvent e) { - label.setIcon(icons[1]); calendar.add(field, amount); updateDays(); resetHMSPaneSelectedNumberField(); } - - public void mouseEntered(MouseEvent e) { - label.setIcon(icons[1]); - } - - public void mouseExited(MouseEvent e) { - label.setIcon(icons[0]); - } - - public void mousePressed(MouseEvent e) { - label.setIcon(icons[2]); - } }; } @@ -432,20 +405,20 @@ public class UICalendarPanel extends JPanel { } for (int i = 0; i < TOTAL_DAYS_COUNT; i++) { setupCalendar.add(Calendar.DATE, 1); - GradientPane gp = new GradientPane(new GradientBackground(new Color(0xFEFEFE), new Color(0xF3F2F3), GradientBackground.TOP2BOTTOM), true); + GradientPane gp = new GradientPane(new GradientBackground(defaultBackground, defaultBackground, GradientBackground.TOP2BOTTOM), true, true); gp.setIndex(i); gp.setLayout(new BorderLayout()); gp.setBorder(null); UIDayLabel label = new UIDayLabel(setupCalendar.getTime()); - label.setHorizontalAlignment(SwingConstants.RIGHT); - label.setBorder(new ScaledEmptyBorder(0, 0, 0, 9)); + label.setHorizontalAlignment(SwingConstants.CENTER); + label.setPreferredSize(new Dimension(dateButtonWidth, dateButtonHeight)); if ("1".equals(label.getText())) { isCurrentMonth = !isCurrentMonth; } setUIDayLabel(label, isCurrentMonth, setupCalendar, logSet); //当前选择的日期 if (setupCalendar.get(Calendar.DAY_OF_MONTH) == selectedCalendar.get(Calendar.DAY_OF_MONTH) && isCurrentMonth) { - gp.setGradientBackground(new GradientBackground(new Color(0x097BD9), new Color(0x41A3EE), GradientBackground.TOP2BOTTOM)); + gp.setGradientBackground(new GradientBackground(selectedBackground, selectedBackground, GradientBackground.TOP2BOTTOM)); gp.add(label, BorderLayout.CENTER); days.add(gp); days.setSelectedIndex(i); @@ -456,6 +429,7 @@ public class UICalendarPanel extends JPanel { days.add(gp); } } + days.setBorder(new ScaledEmptyBorder(3, 9, 3, 9)); days.validate(); } @@ -470,27 +444,24 @@ public class UICalendarPanel extends JPanel { return new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { - jp.setBorder(BorderFactory.createLineBorder(new Color(0x3868AA))); jp.setPaintGradientBackground(true); jp.repaint(); - label.setForeground(new Color(0xFFFFFF)); + jp.setBackground(pressedBackground); } @Override public void mouseExited(MouseEvent e) { - jp.setBackground(new Color(0xF0F0F0)); + jp.setBackground(defaultBackground); } @Override public void mouseEntered(MouseEvent e) { - jp.setBackground(new Color(0xC8DDEE)); + jp.setBackground(hoverBackground); } @Override public void mouseReleased(MouseEvent e) { - jp.setBackground(new Color(0xF0F0F0)); - label.setForeground(new Color(0x000000)); - jp.setBorder(null); + jp.setBackground(defaultBackground); jp.setPaintGradientBackground(false); jp.repaint(); if (isTimePicker) { @@ -513,9 +484,9 @@ public class UICalendarPanel extends JPanel { UIDayLabel com = (UIDayLabel) e.getComponent(); GradientPane gp = (GradientPane) com.getParent(); if (days.selectedIndex != -1) { - ((GradientPane) days.getComponent(days.selectedIndex)).setGradientBackground(new GradientBackground(new Color(0xFEFEFE), new Color(0xF3F2F3), GradientBackground.TOP2BOTTOM)); + ((GradientPane) days.getComponent(days.selectedIndex)).setGradientBackground(new GradientBackground(new Color(0xFFFFFF), new Color(0xFFFFFF), GradientBackground.TOP2BOTTOM)); } - gp.setGradientBackground(new GradientBackground(new Color(0x097BD9), new Color(0x41A3EE), GradientBackground.TOP2BOTTOM)); + gp.setGradientBackground(new GradientBackground(pressedBackground, pressedBackground, GradientBackground.TOP2BOTTOM)); days.setSelectedIndex(gp.getIndex()); } } @@ -540,7 +511,7 @@ public class UICalendarPanel extends JPanel { if (gp.getIndex() == days.selectedIndex) { return; } - gp.setGradientBackground(new GradientBackground(new Color(0xFFFFFF), new Color(0xEAF4FC), GradientBackground.TOP2BOTTOM)); + gp.setGradientBackground(new GradientBackground(hoverBackground, hoverBackground, GradientBackground.TOP2BOTTOM)); days.setFloatIndex(gp.getIndex()); } @@ -551,7 +522,7 @@ public class UICalendarPanel extends JPanel { JComponent com = (JComponent) e.getComponent(); GradientPane gp = (GradientPane) com.getParent(); if (gp.getIndex() != days.selectedIndex) { - gp.setGradientBackground(new GradientBackground(new Color(0xFEFEFE), new Color(0xF3F2F3), GradientBackground.TOP2BOTTOM)); + gp.setGradientBackground(new GradientBackground(defaultBackground, defaultBackground, GradientBackground.TOP2BOTTOM)); } days.setFloatIndex(-1); days.repaint(); @@ -600,6 +571,7 @@ public class UICalendarPanel extends JPanel { private int index; private boolean isGradientBackground; + private boolean roundPane = false; private GradientBackground gradientBackground; public GradientPane() { @@ -612,7 +584,18 @@ public class UICalendarPanel extends JPanel { this.isGradientBackground = isGradientBackground; } + public GradientPane(GradientBackground gradientBackground, boolean isGradientBackground, boolean roundPane) { + super(); + this.gradientBackground = gradientBackground; + this.isGradientBackground = isGradientBackground; + this.roundPane = roundPane; + } + public void paint(Graphics g) { + if (roundPane) { + RoundRectangle2D rect = new RoundRectangle2D.Double(0, 0, getWidth(), getHeight(), dateButtonArc, dateButtonArc); + g.setClip(rect); + } super.paint(g); if (isGradientBackground && gradientBackground != null) { gradientBackground.paint(g, new Rectangle(this.getWidth(), this.getHeight())); @@ -646,65 +629,30 @@ public class UICalendarPanel extends JPanel { private class DayPane extends JPanel { private Color floatColor = new Color(0xC5E2F9); - private Color selectedColor = new Color(0x41A3EE); private int floateIndex; private int selectedIndex; public DayPane() { floateIndex = -1; selectedIndex = -1; - this.setLayout(new GridLayout(6, 7, 1, 1)); - this.setBackground(new Color(0xFFFFFF)); - this.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 0, new Color(0xDADADA))); + this.setLayout(new GridLayout(6, 7, scale(9), scale(3))); + this.setBackground(defaultBackground); } public void paint(Graphics g) { super.paint(g); - int width = UICalendarPanel.WIDTH; - int height = UICalendarPanel.HEIGHT; Color oldColor = g.getColor(); - g.setColor(new Color(0xDADADA)); - int start_x = UICalendarPanel.START_X; - int start_y = UICalendarPanel.START_Y; - for (int i = 0; i < 6; i++) { - g.drawLine(start_x, 0, start_x, getHeight()); - start_x += width; - } - for (int i = 0; i < 5; i++) { - g.drawLine(0, start_y, getWidth(), start_y); - start_y += height; - } if (floateIndex > -1) { g.setColor(floatColor); - paintChindPane(g, floateIndex); } if (selectedIndex > -1) { - g.setColor(selectedColor); - paintChindPane(g, selectedIndex); + g.setColor(selectedBackground); } g.setColor(oldColor); } - private void paintChindPane(Graphics g, int index) { - if (index % 7 == 0) { - int y1 = index / 7 * UICalendarPanel.HEIGHT; - g.drawLine(0, y1, UICalendarPanel.START_X, y1); - g.drawLine(0, y1 + UICalendarPanel.HEIGHT, UICalendarPanel.START_X, y1 + UICalendarPanel.HEIGHT); - g.drawLine(UICalendarPanel.START_X, y1, UICalendarPanel.START_X, y1 + UICalendarPanel.HEIGHT); - } else if (index % 7 == 6) { - int y1 = index / 7 * UICalendarPanel.HEIGHT; - g.drawLine(scale(185), y1, scale(216), y1); - g.drawLine(scale(185), y1 + UICalendarPanel.HEIGHT, scale(216), y1 + UICalendarPanel.HEIGHT); - g.drawLine(scale(185), y1, scale(185), y1 + UICalendarPanel.HEIGHT); - } else { - int x1 = index % 7 * UICalendarPanel.WIDTH - 1; - int y1 = index / 7 * UICalendarPanel.HEIGHT; - g.drawRect(x1, y1, UICalendarPanel.WIDTH, UICalendarPanel.HEIGHT); - } - } - public void setFloatIndex(int index) { this.floateIndex = index; repaint(); @@ -733,9 +681,8 @@ public class UICalendarPanel extends JPanel { private CalendarNumberField selectedNumberField; public HMSPane() { - this.setPreferredSize(scale(new Dimension(101, 18))); this.setLayout(new BorderLayout(0, 0)); - this.setBackground(null); + this.setOpaque(false); initComponents(); initListener(); @@ -757,22 +704,11 @@ public class UICalendarPanel extends JPanel { } private void initComponents() { - JPanel jp = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 2)); - jp.setBackground(null); - jp.setBorder(null); - hField = new CalendarNumberField(23); mField = new CalendarNumberField(59); sField = new CalendarNumberField(59); selectedNumberField = hField; - jp.add(hField); - jp.add(createGapLabel()); - jp.add(mField); - jp.add(createGapLabel()); - jp.add(sField); - - this.add(jp, BorderLayout.CENTER); preButton = new UIButton(UIConstants.ARROW_UP_ICON) { public boolean shouldResponseChangeListener() { return false; @@ -786,10 +722,11 @@ public class UICalendarPanel extends JPanel { }; nextButton.setRoundBorder(true, Constants.LEFT); JPanel arrowPane = new JPanel(); - arrowPane.setPreferredSize(scale(new Dimension(11, 18))); + arrowPane.setPreferredSize(scale(new Dimension(12, 24))); arrowPane.setLayout(new GridLayout(2, 1)); arrowPane.add(preButton); arrowPane.add(nextButton); + this.add(row(cell(hField), cell(createGapLabel()), cell(mField), cell(createGapLabel()), cell(sField), fix(4)).getComponent(), BorderLayout.CENTER); this.add(arrowPane, BorderLayout.EAST); } @@ -834,13 +771,8 @@ public class UICalendarPanel extends JPanel { }); } - private UILabel createGapLabel() { - UILabel uiLabel = new UILabel(":"); - uiLabel.setHorizontalAlignment(SwingConstants.CENTER); - uiLabel.setBackground(null); - uiLabel.setBorder(null); - uiLabel.setPreferredSize(scale(new Dimension(6, 10))); - return uiLabel; + private JPanel createGapLabel() { + return row(fix(4), cell(new UILabel(":")), fix(4)).getComponent(); } public Insets getInsets() { @@ -849,17 +781,6 @@ public class UICalendarPanel extends JPanel { public void paint(Graphics g) { super.paint(g); - paintBorder(g); - } - - public void paintBorder(Graphics g) { - Graphics2D g2d = (Graphics2D) g; - if (isRolOver) { - Shape shape = new RoundRectangle2D.Double(1, 1, 86, 15, UIConstants.ARC, UIConstants.ARC); - GUIPaintUtils.paintBorderShadow(g2d, 3, shape, UIConstants.HOVER_BLUE, Color.WHITE); - } else { - GUIPaintUtils.drawBorder(g2d, 0, 0, 101, 18, true, 3); - } } public void populate(Calendar calendar) { diff --git a/designer-base/src/main/java/com/fr/design/gui/date/UIDayLabel.java b/designer-base/src/main/java/com/fr/design/gui/date/UIDayLabel.java index f7accce9e9..f9ad0344b2 100644 --- a/designer-base/src/main/java/com/fr/design/gui/date/UIDayLabel.java +++ b/designer-base/src/main/java/com/fr/design/gui/date/UIDayLabel.java @@ -3,7 +3,6 @@ package com.fr.design.gui.date; import com.fr.design.gui.ilable.UILabel; import com.fr.design.utils.DesignUtils; -import java.awt.Dimension; import java.text.SimpleDateFormat; import java.util.Date; @@ -31,7 +30,6 @@ public class UIDayLabel extends UILabel { setHorizontalAlignment(UILabel.CENTER); setFont(DesignUtils.getDefaultGUIFont().applySize(scale(12))); this.date = date; - setPreferredSize(scale(new Dimension(30, 18))); if (isSmallLabel) { setText(dayFormat.format(date)); } else { diff --git a/designer-base/src/main/resources/com/fine/theme/icon/left_arrow.svg b/designer-base/src/main/resources/com/fine/theme/icon/left_arrow.svg new file mode 100644 index 0000000000..ee9347f2e6 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/left_arrow.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/right_arrow.svg b/designer-base/src/main/resources/com/fine/theme/icon/right_arrow.svg new file mode 100644 index 0000000000..64b0c896d9 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/right_arrow.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json b/designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json index 1aac4235da..3d09c571bf 100644 --- a/designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json +++ b/designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json @@ -29,6 +29,8 @@ "drag_right": "drag_right.svg", "down_arrow": "down_arrow.svg", "up_arrow": "up_arrow.svg", + "left_arrow": "left_arrow.svg", + "right_arrow": "right_arrow.svg", "select": "select.svg", "recycle": "recycle.svg", "time": "time.svg", 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 c58cfad65c..b7e0cf9b85 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 @@ -410,6 +410,15 @@ Label.strongHintColor = #FF0000 Label.warningColor = #F1393C Label.secondaryColor = #0A1C38A8 +# ---- Calendar ---- +Calendar.hoverBackground = #E6E9EF +Calendar.pressedBackground = #DADEE7 +Calendar.selectedBackground = #2576EF +Calendar.defaultBackground = $fill.normal +Calendar.dateButton.arc = 6 +Calendar.dateButton.width = 24 +Calendar.dateButton.height = 24 + #---- HelpButton ---- HelpButton.questionMarkColor = @accentCheckmarkColor @@ -1401,8 +1410,9 @@ chart.selectedBorderColor = #2576EF background: $fill.normal [style]Button.originalButton = \ - border: 4,4,4,4; \ - background: null; + borderColor: null; \ + background: null; \ + hoverBorderColor: null; [style]Label.detailLabel = \ foreground: fade(@foreground, 90%); \ From bd0f57dbc5f777b39f50e760526d51fd54a07683 Mon Sep 17 00:00:00 2001 From: lemon Date: Sun, 22 Sep 2024 14:15:01 +0800 Subject: [PATCH 08/19] =?UTF-8?q?REPORT-134742=20fix:=20=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=20southPane=20=E7=BB=84=E4=BB=B6=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2=EF=BC=8Cday=20label=20UI=20=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fine/theme/light/ui/FineDayLabelUI.java | 54 ++++ .../com/fine/theme/utils/FineUIStyle.java | 1 + .../fr/design/gui/date/UICalendarPanel.java | 305 +++++------------- .../com/fr/design/gui/date/UIDatePicker.java | 3 - .../com/fr/design/gui/date/UIDayLabel.java | 28 +- .../theme/light/ui/laf/FineLaf.properties | 1 + .../light/ui/laf/FineLightLaf.properties | 17 +- 7 files changed, 169 insertions(+), 240 deletions(-) create mode 100644 designer-base/src/main/java/com/fine/theme/light/ui/FineDayLabelUI.java diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/FineDayLabelUI.java b/designer-base/src/main/java/com/fine/theme/light/ui/FineDayLabelUI.java new file mode 100644 index 0000000000..45e0149c8b --- /dev/null +++ b/designer-base/src/main/java/com/fine/theme/light/ui/FineDayLabelUI.java @@ -0,0 +1,54 @@ +package com.fine.theme.light.ui; + + +import com.fr.design.gui.date.UIDayLabel; + +import javax.swing.AbstractButton; +import javax.swing.JComponent; +import javax.swing.UIManager; +import javax.swing.plaf.ComponentUI; +import java.awt.Color; + +/** + * {@link UIDayLabel} 的 UI 样式 + * @author lemon + * @since + * Created on + */ +public class FineDayLabelUI extends FineButtonUI { + protected Color selectedBackground; + + /** + * @param shared + * @since 2 + */ + protected FineDayLabelUI(boolean shared) { + super(shared); + } + + /** + * 创建UI + * + * @param c 组件 + * @return ComponentUI + */ + public static ComponentUI createUI(JComponent c) { + return new FineDayLabelUI(false); + } + + @Override + protected void installDefaults(AbstractButton b) { + super.installDefaults(b); + selectedBackground = UIManager.getColor("Calendar.day.selectedBackground"); + } + + + @Override + protected Color getBackground(JComponent c) { + if (c instanceof UIDayLabel) { + return ((UIDayLabel) c).isSelected() ? selectedBackground : super.getBackground(c); + } + return super.getBackground(c); + } + +} 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 0dc3c2df29..03d50ac371 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 @@ -51,6 +51,7 @@ public interface FineUIStyle { String DEFAULT_TABLE = "defaultTable"; String WHITE_BUTTON = "whiteButton"; String ORIGINAL_BUTTON = "originalButton"; + String GRAY_BUTTON = "grayButton"; String DETAIL_LABEL = "detailLabel"; String WIDGET_EVENT_LABEL = "widgetEventLabel"; diff --git a/designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java b/designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java index 9907c840f4..d8a6a627fd 100644 --- a/designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java +++ b/designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java @@ -2,10 +2,11 @@ package com.fr.design.gui.date; import com.fanruan.product.ProductConstantsBase; import com.fine.theme.icon.LazyIcon; +import com.fine.theme.light.ui.FineRoundBorder; import com.fine.theme.utils.FineUIStyle; +import com.fine.theme.utils.FineUIUtils; import com.formdev.flatlaf.ui.FlatUIUtils; import com.formdev.flatlaf.util.ScaledEmptyBorder; -import com.fr.base.background.GradientBackground; import com.fr.design.border.FineBorderFactory; import com.fr.design.carton.MonthlyCartonFile; import com.fr.design.carton.SwitchForSwingChecker; @@ -22,7 +23,6 @@ import com.fr.stable.StringUtils; import javax.swing.Box; import javax.swing.Icon; -import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingConstants; @@ -38,13 +38,11 @@ import java.awt.Font; import java.awt.Graphics; import java.awt.GridLayout; import java.awt.Insets; -import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; -import java.awt.geom.RoundRectangle2D; import java.io.File; import java.text.SimpleDateFormat; import java.util.Calendar; @@ -56,29 +54,21 @@ import static com.fine.swing.ui.layout.Layouts.cell; 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.FineUIScale.createScaleDimension; import static com.fine.theme.utils.FineUIScale.scale; +import static com.fine.theme.utils.FineUIStyle.STYLE_TEXT; +import static com.fine.theme.utils.FineUIStyle.setStyle; public class UICalendarPanel extends JPanel { + private static final Font FONT_UI = DesignUtils.getDefaultGUIFont().applySize(scale(12)); private static final Font FONT_BLACK = new Font(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Black_Font"), Font.PLAIN, scale(12)); private static final int WEEKDAY_COUNT = 7; private static final int TOTAL_DAYS_COUNT = 42; - - private static final int WIDTH = scale(31); - private static final int HEIGHT = scale(19); - private static final int START_X = scale(30); - private static final int START_Y = scale(19); + protected final Insets defaultInsets = new Insets(0, 6, 0, 6); //卡顿日志所在地址 private static final String JOURNAL_FILE_PATH = StableUtils.pathJoin(ProductConstantsBase.getEnvHome(), "journal_log"); - protected Color selectedBackground; - protected Color selectedForeground; - protected Color background; - protected Color foreground; - - protected Color hoverBackground; - protected Color pressedBackground; - protected Color defaultBackground; private Calendar calendar = null; private UILabel monthLabel = null; @@ -88,12 +78,11 @@ public class UICalendarPanel extends JPanel { private boolean isSupportDateChangeListener = false; private java.util.Date selectedDate = null; private boolean isTimePicker; - private final Color LABEL_FORGE_GROUND = new Color(0x6F6F6); private MouseListener todayListener; private UIDayLabel lbToday; - private int dateButtonArc; - private int dateButtonWidth; - private int dateButtonHeight; + private static final int WEEK_LABEL_WIDTH = 24; + private static final int WEEK_LABEL_HEIGHT = 24; + private final int ICON_WIDTH = 12; /** * 一个int类型用于判断日历是否是专门用于处理卡顿的设计器反馈箱中的日历 * 0表示是 @@ -133,21 +122,6 @@ public class UICalendarPanel extends JPanel { this.selectedDate = selectedDate; this.isTimePicker = isTimerPicker; calendar = Calendar.getInstance(); - - hoverBackground = UIManager.getColor("Calendar.hoverBackground"); - pressedBackground = UIManager.getColor("Calendar.pressedBackground"); - selectedBackground = UIManager.getColor("Calendar.selectedBackground"); - defaultBackground = UIManager.getColor("Calendar.defaultBackground"); - - selectedForeground = UIManager.getColor( - "ComboBox.selectionForeground"); - background = UIManager.getColor("ComboBox.background"); - foreground = UIManager.getColor("ComboBox.foreground"); - - dateButtonArc = UIManager.getInt("Calendar.dateButton.arc"); - dateButtonWidth = UIManager.getInt("Calendar.dateButton.width"); - dateButtonHeight = UIManager.getInt("Calendar.dateButton.height"); - dayBttListener = createDayBttListener(); //renderer this @@ -171,17 +145,14 @@ public class UICalendarPanel extends JPanel { // << < yyyy/MM/dd > >> private JPanel createNorthPane() { JPanel pNorth = FRGUIPaneFactory.createX_AXISBoxInnerContainer_S_Pane(); - pNorth.setBackground(new Color(0xFFFFFF)); pNorth.setPreferredSize(new Dimension(pNorth.getPreferredSize().width, scale(40))); - + pNorth.setOpaque(false); pNorth.add(Box.createHorizontalStrut(5)); pNorth.add(createSkipButton(Calendar.YEAR, -1, new LazyIcon("drag_left"))); pNorth.add(Box.createHorizontalStrut(11)); UIButton monthMinus = createSkipButton(Calendar.MONTH, -1, new LazyIcon("left_arrow")); pNorth.add(monthMinus); monthLabel = new UILabel("", UILabel.CENTER); - monthLabel.setBackground(new Color(0xFFFFFF)); - monthLabel.setForeground(new Color(0x000000)); monthLabel.setFont(FONT_UI); pNorth.add(Box.createHorizontalGlue()); pNorth.add(monthLabel); @@ -201,8 +172,7 @@ public class UICalendarPanel extends JPanel { private JPanel createCenterPane() { //星期日 星期一 星期二 星期三 星期四 星期五 星期六 JPanel pWeeks = new JPanel(new GridLayout(1, 7, 9, 0)); - pWeeks.setBackground(defaultBackground); - pWeeks.setOpaque(true); + pWeeks.setOpaque(false); String[] strWeeks = new String[]{StringUtils.EMPTY, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Sun"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Mon"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tue"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Wed"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Thu"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Fri"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Sat") @@ -210,41 +180,35 @@ public class UICalendarPanel extends JPanel { for (int i = 1; i <= WEEKDAY_COUNT; i++) { UILabel label = new UILabel(); label.setHorizontalAlignment(UILabel.CENTER); - label.setForeground(new Color(0x4D4C4C)); label.setFont(FONT_BLACK); label.setText(strWeeks[i]); - label.setPreferredSize(scale(new Dimension(dateButtonWidth, dateButtonHeight))); + label.setPreferredSize(createScaleDimension(WEEK_LABEL_WIDTH, WEEK_LABEL_HEIGHT)); pWeeks.add(label); } pWeeks.setBorder(new ScaledEmptyBorder(3, 9, 3, 9)); //中间放日期的面板 days = new DayPane(); - days.setOpaque(true); - days.setPreferredSize(scale(new Dimension(pWeeks.getPreferredSize().width, 165))); + days.setOpaque(false); + days.setPreferredSize(new Dimension(pWeeks.getPreferredSize().width, scale(165))); JPanel pCenter = FRGUIPaneFactory.createBorderLayout_S_Pane(); - pCenter.setOpaque(true); + pCenter.setOpaque(false); pCenter.add(pWeeks, BorderLayout.NORTH); pCenter.add(days, BorderLayout.CENTER); //显示今天的日期,直接单击图标跳到今天 - GradientPane pToday = new GradientPane(new GradientBackground(pressedBackground, pressedBackground, GradientBackground.TOP2BOTTOM), false); - pToday.setPreferredSize(new Dimension(pToday.getPreferredSize().width, scale(30))); - pToday.setLayout(new BorderLayout()); lbToday = new UIDayLabel(new Date(), false); - lbToday.setForeground(new Color(0x000000)); - pToday.setBorder(FineBorderFactory.createDefaultTopBorder()); - todayListener = createTodayListener(pToday, lbToday); + lbToday.setPreferredSize(new Dimension(lbToday.getPreferredSize().width, scale(30))); + lbToday.setBorder(FineBorderFactory.createDefaultTopBorder()); + todayListener = createTodayListener(lbToday); lbToday.addMouseListener(todayListener); - pToday.setBackground(defaultBackground); - pToday.add(lbToday, BorderLayout.CENTER); - pCenter.add(pToday, BorderLayout.SOUTH); + pCenter.add(lbToday, BorderLayout.SOUTH); return pCenter; } private JPanel createSouthPane() { JPanel sPane = new JPanel(); - sPane.setBackground(Color.WHITE); + sPane.setOpaque(false); sPane.setLayout(new BorderLayout()); UILabel timeLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Time") + ":"); timeLabel.setFont(FONT_UI); @@ -252,7 +216,7 @@ public class UICalendarPanel extends JPanel { UIButton okButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_OK")) { public Dimension getPreferredSize() { - return scale(new Dimension(48, 24)); + return createScaleDimension(48, 24); } public Insets getInsets() { @@ -276,13 +240,6 @@ public class UICalendarPanel extends JPanel { return sPane; } - public void resetHMSPaneSelectedNumberField() { - if (this.hms != null) { - this.hms.selectedNumberField = this.hms.hField; - this.hms.nextButton.requestFocus(); - } - } - /** * 创建上一月,下一月,上一年,下一年"按钮" * @@ -304,7 +261,6 @@ public class UICalendarPanel extends JPanel { public void mouseReleased(MouseEvent e) { calendar.add(field, amount); updateDays(); - resetHMSPaneSelectedNumberField(); } }; } @@ -356,10 +312,9 @@ public class UICalendarPanel extends JPanel { } } else { label.addMouseListener(dayBttListener); - label.setEnabled(isCurrentMonth); } if (!isCurrentMonth) { - label.setForeground(LABEL_FORGE_GROUND); + FineUIStyle.setStyle(label, FineUIStyle.GRAY_BUTTON); } } /** @@ -405,28 +360,19 @@ public class UICalendarPanel extends JPanel { } for (int i = 0; i < TOTAL_DAYS_COUNT; i++) { setupCalendar.add(Calendar.DATE, 1); - GradientPane gp = new GradientPane(new GradientBackground(defaultBackground, defaultBackground, GradientBackground.TOP2BOTTOM), true, true); - gp.setIndex(i); - gp.setLayout(new BorderLayout()); - gp.setBorder(null); UIDayLabel label = new UIDayLabel(setupCalendar.getTime()); - label.setHorizontalAlignment(SwingConstants.CENTER); - label.setPreferredSize(new Dimension(dateButtonWidth, dateButtonHeight)); + label.setIndex(i); if ("1".equals(label.getText())) { isCurrentMonth = !isCurrentMonth; } setUIDayLabel(label, isCurrentMonth, setupCalendar, logSet); + days.add(label); //当前选择的日期 if (setupCalendar.get(Calendar.DAY_OF_MONTH) == selectedCalendar.get(Calendar.DAY_OF_MONTH) && isCurrentMonth) { - gp.setGradientBackground(new GradientBackground(selectedBackground, selectedBackground, GradientBackground.TOP2BOTTOM)); - gp.add(label, BorderLayout.CENTER); - days.add(gp); + label.getModel().setSelected(true); days.setSelectedIndex(i); this.selectedDate = label.getDate(); this.calendar.setTime(this.selectedDate); - } else { - gp.add(label, BorderLayout.CENTER); - days.add(gp); } } days.setBorder(new ScaledEmptyBorder(3, 9, 3, 9)); @@ -440,30 +386,11 @@ public class UICalendarPanel extends JPanel { } } - protected MouseListener createTodayListener(final GradientPane jp, final UIDayLabel label) { + protected MouseListener createTodayListener(final UIDayLabel label) { return new MouseAdapter() { - @Override - public void mousePressed(MouseEvent e) { - jp.setPaintGradientBackground(true); - jp.repaint(); - jp.setBackground(pressedBackground); - } - - @Override - public void mouseExited(MouseEvent e) { - jp.setBackground(defaultBackground); - } - - @Override - public void mouseEntered(MouseEvent e) { - jp.setBackground(hoverBackground); - } @Override public void mouseReleased(MouseEvent e) { - jp.setBackground(defaultBackground); - jp.setPaintGradientBackground(false); - jp.repaint(); if (isTimePicker) { UICalendarPanel.this.setSelectedDate(label.getDate()); updateDays(); @@ -472,7 +399,6 @@ public class UICalendarPanel extends JPanel { UICalendarPanel.this.setSelectedDate(label.getDate()); UICalendarPanel.this.isSupportDateChangeListener = false; } - resetHMSPaneSelectedNumberField(); } }; } @@ -482,12 +408,7 @@ public class UICalendarPanel extends JPanel { public void mousePressed(MouseEvent e) { if (isEnabled()) { UIDayLabel com = (UIDayLabel) e.getComponent(); - GradientPane gp = (GradientPane) com.getParent(); - if (days.selectedIndex != -1) { - ((GradientPane) days.getComponent(days.selectedIndex)).setGradientBackground(new GradientBackground(new Color(0xFFFFFF), new Color(0xFFFFFF), GradientBackground.TOP2BOTTOM)); - } - gp.setGradientBackground(new GradientBackground(pressedBackground, pressedBackground, GradientBackground.TOP2BOTTOM)); - days.setSelectedIndex(gp.getIndex()); + days.setSelectedIndex(com.getIndex()); } } @@ -501,29 +422,21 @@ public class UICalendarPanel extends JPanel { UICalendarPanel.this.setSelectedDate(com.getDate()); UICalendarPanel.this.isSupportDateChangeListener = false; } - resetHMSPaneSelectedNumberField(); } public void mouseEntered(MouseEvent e) { if (isEnabled()) { - JComponent com = (JComponent) e.getComponent(); - GradientPane gp = (GradientPane) com.getParent(); - if (gp.getIndex() == days.selectedIndex) { + UIDayLabel com = (UIDayLabel) e.getComponent(); + if (com.getIndex() == days.selectedIndex) { return; } - gp.setGradientBackground(new GradientBackground(hoverBackground, hoverBackground, GradientBackground.TOP2BOTTOM)); - days.setFloatIndex(gp.getIndex()); + days.setFloatIndex(com.getIndex()); } } public void mouseExited(MouseEvent e) { if (isEnabled()) { - JComponent com = (JComponent) e.getComponent(); - GradientPane gp = (GradientPane) com.getParent(); - if (gp.getIndex() != days.selectedIndex) { - gp.setGradientBackground(new GradientBackground(defaultBackground, defaultBackground, GradientBackground.TOP2BOTTOM)); - } days.setFloatIndex(-1); days.repaint(); } @@ -567,66 +480,6 @@ public class UICalendarPanel extends JPanel { return selectedDate; } - private class GradientPane extends JPanel { - - private int index; - private boolean isGradientBackground; - private boolean roundPane = false; - private GradientBackground gradientBackground; - - public GradientPane() { - - } - - public GradientPane(GradientBackground gradientBackground, boolean isGradientBackground) { - super(); - this.gradientBackground = gradientBackground; - this.isGradientBackground = isGradientBackground; - } - - public GradientPane(GradientBackground gradientBackground, boolean isGradientBackground, boolean roundPane) { - super(); - this.gradientBackground = gradientBackground; - this.isGradientBackground = isGradientBackground; - this.roundPane = roundPane; - } - - public void paint(Graphics g) { - if (roundPane) { - RoundRectangle2D rect = new RoundRectangle2D.Double(0, 0, getWidth(), getHeight(), dateButtonArc, dateButtonArc); - g.setClip(rect); - } - super.paint(g); - if (isGradientBackground && gradientBackground != null) { - gradientBackground.paint(g, new Rectangle(this.getWidth(), this.getHeight())); - } - paintChildren(g); - } - - public void setPaintGradientBackground(boolean flag) { - this.isGradientBackground = flag; - } - - public void setGradientBackground(GradientBackground gradientBackground) { - this.gradientBackground = gradientBackground; - } - - public void setIndex(int i) { - this.index = i; - } - - public int getIndex() { - return this.index; - } - - public void setForeground(Color c) { - super.setForeground(c); - if (getComponentCount() > 0) { - getComponent(0).setForeground(c); - } - } - } - private class DayPane extends JPanel { private Color floatColor = new Color(0xC5E2F9); private int floateIndex; @@ -636,7 +489,6 @@ public class UICalendarPanel extends JPanel { floateIndex = -1; selectedIndex = -1; this.setLayout(new GridLayout(6, 7, scale(9), scale(3))); - this.setBackground(defaultBackground); } @@ -647,9 +499,6 @@ public class UICalendarPanel extends JPanel { if (floateIndex > -1) { g.setColor(floatColor); } - if (selectedIndex > -1) { - g.setColor(selectedBackground); - } g.setColor(oldColor); } @@ -659,12 +508,6 @@ public class UICalendarPanel extends JPanel { } public void setSelectedIndex(int index) { - if (this.selectedIndex != -1 && this.selectedIndex < getComponentCount()) { - this.getComponent(selectedIndex).setForeground(Color.black); - } - if (index != -1 && index < getComponentCount()) { - this.getComponent(index).setForeground(Color.WHITE); - } this.selectedIndex = index; repaint(); } @@ -673,12 +516,9 @@ public class UICalendarPanel extends JPanel { private class HMSPane extends JPanel { private boolean isRolOver; - private UIButton preButton; - private UIButton nextButton; private CalendarNumberField hField; private CalendarNumberField mField; private CalendarNumberField sField; - private CalendarNumberField selectedNumberField; public HMSPane() { this.setLayout(new BorderLayout(0, 0)); @@ -707,36 +547,62 @@ public class UICalendarPanel extends JPanel { hField = new CalendarNumberField(23); mField = new CalendarNumberField(59); sField = new CalendarNumberField(59); - selectedNumberField = hField; + this.add(row(cell(combineFieldArrowPane(hField)), cell(createGapLabel()), cell(combineFieldArrowPane(mField)), + cell(createGapLabel()), cell(combineFieldArrowPane(sField)), fix(4)).getComponent(), BorderLayout.CENTER); + } + + private JPanel combineFieldArrowPane(CalendarNumberField field) { + JPanel panel = new JPanel(new BorderLayout()); + panel.setOpaque(false); + Insets insets = FineUIUtils.getUIInsets("InputTextField.borderInsets", defaultInsets); + field.setBorder(new ScaledEmptyBorder(insets.top, insets.left, insets.bottom, insets.right)); + + UIButton preButton = createArrowButton(new LazyIcon("up_arrow", ICON_WIDTH)); + UIButton nextButton = createArrowButton(new LazyIcon("down_arrow", ICON_WIDTH)); + JPanel arrowPane = new JPanel(); + arrowPane.setPreferredSize(createScaleDimension(12, 24)); + arrowPane.setLayout(new GridLayout(2, 1)); + arrowPane.add(preButton); + arrowPane.add(nextButton); + arrowPane.setOpaque(false); + + panel.add(field, BorderLayout.CENTER); + panel.add(arrowPane, BorderLayout.EAST); + panel.setBorder(new FineRoundBorder()); + + nextButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + field.setValue(field.getIntValue() - 1); + field.requestFocus(); + field.selectAll(); - preButton = new UIButton(UIConstants.ARROW_UP_ICON) { - public boolean shouldResponseChangeListener() { - return false; } - }; - preButton.setRoundBorder(true, Constants.LEFT); - nextButton = new UIButton(UIConstants.ARROW_DOWN_ICON) { + }); + preButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + field.setValue(field.getIntValue() + 1); + field.requestFocus(); + field.selectAll(); + } + }); + return panel; + } + + private UIButton createArrowButton(Icon icon) { + UIButton arrowButton = new UIButton(icon) { public boolean shouldResponseChangeListener() { return false; } }; - nextButton.setRoundBorder(true, Constants.LEFT); - JPanel arrowPane = new JPanel(); - arrowPane.setPreferredSize(scale(new Dimension(12, 24))); - arrowPane.setLayout(new GridLayout(2, 1)); - arrowPane.add(preButton); - arrowPane.add(nextButton); - this.add(row(cell(hField), cell(createGapLabel()), cell(mField), cell(createGapLabel()), cell(sField), fix(4)).getComponent(), BorderLayout.CENTER); - this.add(arrowPane, BorderLayout.EAST); + setStyle(arrowButton, STYLE_TEXT); + return arrowButton; } + private void initListener() { MouseAdapter backgroundAdapter = new MouseAdapter() { - @Override - public void mousePressed(MouseEvent e) { - HMSPane.this.selectedNumberField = (CalendarNumberField) e.getComponent(); - } - @Override public void mouseExited(MouseEvent e) { isRolOver = false; @@ -752,23 +618,6 @@ public class UICalendarPanel extends JPanel { hField.addMouseListener(backgroundAdapter); mField.addMouseListener(backgroundAdapter); sField.addMouseListener(backgroundAdapter); - nextButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - HMSPane.this.selectedNumberField.setValue(HMSPane.this.selectedNumberField.getIntValue() - 1); - HMSPane.this.selectedNumberField.requestFocus(); - HMSPane.this.selectedNumberField.selectAll(); - - } - }); - preButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - HMSPane.this.selectedNumberField.setValue(HMSPane.this.selectedNumberField.getIntValue() + 1); - HMSPane.this.selectedNumberField.requestFocus(); - HMSPane.this.selectedNumberField.selectAll(); - } - }); } private JPanel createGapLabel() { diff --git a/designer-base/src/main/java/com/fr/design/gui/date/UIDatePicker.java b/designer-base/src/main/java/com/fr/design/gui/date/UIDatePicker.java index c37f5e88cd..eddf8945b2 100644 --- a/designer-base/src/main/java/com/fr/design/gui/date/UIDatePicker.java +++ b/designer-base/src/main/java/com/fr/design/gui/date/UIDatePicker.java @@ -235,9 +235,6 @@ public class UIDatePicker extends UIComboBox implements Serializable { if (willHide || UIDatePicker.this.isEnabled() == false) { return; } - if (calendarPanel != null) { - calendarPanel.resetHMSPaneSelectedNumberField(); - } super.show(); } diff --git a/designer-base/src/main/java/com/fr/design/gui/date/UIDayLabel.java b/designer-base/src/main/java/com/fr/design/gui/date/UIDayLabel.java index f9ad0344b2..f1195ea4c7 100644 --- a/designer-base/src/main/java/com/fr/design/gui/date/UIDayLabel.java +++ b/designer-base/src/main/java/com/fr/design/gui/date/UIDayLabel.java @@ -1,17 +1,28 @@ package com.fr.design.gui.date; +import com.fine.theme.utils.FineUIStyle; +import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.utils.DesignUtils; +import java.awt.Insets; import java.text.SimpleDateFormat; import java.util.Date; import static com.fine.theme.utils.FineUIScale.scale; -public class UIDayLabel extends UILabel { +/** + * 日期控件,day label + * @author lemon + * @since + * Created on + */ +public class UIDayLabel extends UIButton { + private static final String UI_CLASS_ID = "DayLabelUI"; private Date date = null; + private int index; /** * 日期格式(TODAY/TIP用) @@ -27,8 +38,10 @@ public class UIDayLabel extends UILabel { } public UIDayLabel(Date date, boolean isSmallLabel) { + FineUIStyle.setStyle(this, FineUIStyle.ORIGINAL_BUTTON); setHorizontalAlignment(UILabel.CENTER); setFont(DesignUtils.getDefaultGUIFont().applySize(scale(12))); + setMargin(new Insets(0, 0, 0, 0)); this.date = date; if (isSmallLabel) { setText(dayFormat.format(date)); @@ -46,4 +59,17 @@ public class UIDayLabel extends UILabel { this.date = date; } + public void setIndex(int i) { + this.index = i; + } + + public int getIndex() { + return this.index; + } + + @Override + public String getUIClassID() { + return UI_CLASS_ID; + } + } \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLaf.properties b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLaf.properties index 165701c244..d2d7133f02 100644 --- a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLaf.properties +++ b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLaf.properties @@ -7,6 +7,7 @@ ColorChooserUI=com.formdev.flatlaf.ui.FlatColorChooserUI ComboBoxUI=com.fine.theme.light.ui.FineComboBoxUI DesktopIconUI=com.formdev.flatlaf.ui.FlatDesktopIconUI DesktopPaneUI=com.formdev.flatlaf.ui.FlatDesktopPaneUI +DayLabelUI=com.fine.theme.light.ui.FineDayLabelUI EditorPaneUI=com.formdev.flatlaf.ui.FlatEditorPaneUI FileChooserUI=com.formdev.flatlaf.ui.FlatFileChooserUI FormattedTextFieldUI=com.formdev.flatlaf.ui.FlatFormattedTextFieldUI 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 b7e0cf9b85..130ae78374 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 @@ -411,13 +411,7 @@ Label.warningColor = #F1393C Label.secondaryColor = #0A1C38A8 # ---- Calendar ---- -Calendar.hoverBackground = #E6E9EF -Calendar.pressedBackground = #DADEE7 -Calendar.selectedBackground = #2576EF -Calendar.defaultBackground = $fill.normal -Calendar.dateButton.arc = 6 -Calendar.dateButton.width = 24 -Calendar.dateButton.height = 24 +Calendar.day.selectedBackground = #2576EF #---- HelpButton ---- @@ -1411,9 +1405,16 @@ chart.selectedBorderColor = #2576EF [style]Button.originalButton = \ borderColor: null; \ - background: null; \ + background: $fill.normal; \ hoverBorderColor: null; +[style]Button.grayButton = \ + foreground: fade(@foreground, 29%); \ + borderColor: null; \ + background: $fill.normal; \ + hoverBorderColor: null; + + [style]Label.detailLabel = \ foreground: fade(@foreground, 90%); \ background: $fill.normal; From 80c0e44cdc5cfa950c1f17e21f1ae521d7085ced Mon Sep 17 00:00:00 2001 From: lemon Date: Sun, 22 Sep 2024 14:37:03 +0800 Subject: [PATCH 09/19] =?UTF-8?q?REPORT-134742=20fix:=20=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E7=BC=A9=E6=94=BE=E5=B7=A5=E5=85=B7=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/gui/date/CalendarNumberField.java | 3 ++- .../src/main/java/com/fr/design/gui/date/UICalendarPanel.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/date/CalendarNumberField.java b/designer-base/src/main/java/com/fr/design/gui/date/CalendarNumberField.java index c4a6c24c7a..454f3c525e 100644 --- a/designer-base/src/main/java/com/fr/design/gui/date/CalendarNumberField.java +++ b/designer-base/src/main/java/com/fr/design/gui/date/CalendarNumberField.java @@ -12,6 +12,7 @@ import java.awt.Toolkit; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; +import static com.fine.theme.utils.FineUIScale.createScaleDimension; import static com.fine.theme.utils.FineUIScale.scale; /** @@ -99,7 +100,7 @@ public class CalendarNumberField extends UINumberField { } public Dimension getPreferredSize() { - return scale(new Dimension(24, 24)); + return createScaleDimension(24, 24); } public boolean shouldResponseChangeListener() { diff --git a/designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java b/designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java index d8a6a627fd..27ae3f528f 100644 --- a/designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java +++ b/designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java @@ -235,7 +235,7 @@ public class UICalendarPanel extends JPanel { } }); - sPane.add(row(12, cell(timeLabel), cell(hms), flex(), cell(okButton)).getComponent()); + sPane.add(row(cell(timeLabel).weight(36), cell(hms).weight(180), flex(), cell(okButton).weight(48)).getComponent()); sPane.setBorder(new ScaledEmptyBorder(10, 12, 10, 12)); return sPane; } From 479c60d0ac480de01c9ddfa5f0785d33fd052baa Mon Sep 17 00:00:00 2001 From: lemon Date: Sun, 22 Sep 2024 14:49:20 +0800 Subject: [PATCH 10/19] =?UTF-8?q?REPORT-134742=20fix:=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=BC=96=E7=A0=81=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/date/UICalendarPanel.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java b/designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java index 27ae3f528f..7a9181e560 100644 --- a/designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java +++ b/designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java @@ -556,16 +556,9 @@ public class UICalendarPanel extends JPanel { panel.setOpaque(false); Insets insets = FineUIUtils.getUIInsets("InputTextField.borderInsets", defaultInsets); field.setBorder(new ScaledEmptyBorder(insets.top, insets.left, insets.bottom, insets.right)); - UIButton preButton = createArrowButton(new LazyIcon("up_arrow", ICON_WIDTH)); UIButton nextButton = createArrowButton(new LazyIcon("down_arrow", ICON_WIDTH)); - JPanel arrowPane = new JPanel(); - arrowPane.setPreferredSize(createScaleDimension(12, 24)); - arrowPane.setLayout(new GridLayout(2, 1)); - arrowPane.add(preButton); - arrowPane.add(nextButton); - arrowPane.setOpaque(false); - + JPanel arrowPane = createArrowPane(preButton, nextButton); panel.add(field, BorderLayout.CENTER); panel.add(arrowPane, BorderLayout.EAST); panel.setBorder(new FineRoundBorder()); @@ -590,6 +583,16 @@ public class UICalendarPanel extends JPanel { return panel; } + private JPanel createArrowPane(UIButton preButton, UIButton nextButton) { + JPanel arrowPane = new JPanel(); + arrowPane.setPreferredSize(createScaleDimension(12, 24)); + arrowPane.setLayout(new GridLayout(2, 1)); + arrowPane.add(preButton); + arrowPane.add(nextButton); + arrowPane.setOpaque(false); + return arrowPane; + } + private UIButton createArrowButton(Icon icon) { UIButton arrowButton = new UIButton(icon) { public boolean shouldResponseChangeListener() { From ceb7e421ff5b7c3e9750dce6370b80b473c08523 Mon Sep 17 00:00:00 2001 From: "Richard.Fang" Date: Mon, 23 Sep 2024 10:24:27 +0800 Subject: [PATCH 11/19] =?UTF-8?q?REPORT-134818=20fix:fbp=E5=9B=9E=E5=BD=92?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=9A=E4=BF=AE=E5=A4=8D=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E6=8E=A7=E4=BB=B6=E5=B1=9E=E6=80=A7=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E5=8B=BE=E9=80=89=E6=A1=86=E8=A7=A6=E5=8F=91=E7=83=AD?= =?UTF-8?q?=E5=8C=BA=E8=BF=87=E5=A4=A7=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/widget/ui/BasicSetVisiblePropertyPane.java | 7 +++++-- .../java/com/fr/design/parameter/RootDesignDefinePane.java | 6 +++--- .../fr/design/widget/ui/designer/ButtonGroupDictPane.java | 2 +- .../design/widget/ui/designer/CheckBoxGroupDefinePane.java | 3 ++- .../design/widget/ui/designer/ComboCheckBoxDefinePane.java | 4 +++- .../widget/ui/designer/CustomWritableRepeatEditorPane.java | 5 ++++- .../widget/ui/designer/DirectWriteEditorDefinePane.java | 4 ++-- .../design/widget/ui/designer/FieldEditorDefinePane.java | 2 +- .../com/fr/design/widget/ui/designer/LabelDefinePane.java | 4 ++-- .../com/fr/design/widget/ui/WritableRepeatEditorPane.java | 4 +++- 10 files changed, 26 insertions(+), 15 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/BasicSetVisiblePropertyPane.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/BasicSetVisiblePropertyPane.java index 05dd7923e7..4613437e3a 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/BasicSetVisiblePropertyPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/BasicSetVisiblePropertyPane.java @@ -3,6 +3,9 @@ package com.fr.design.mainframe.widget.ui; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.form.ui.Widget; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; + /** * Created by kerry on 2017/9/30. @@ -17,12 +20,12 @@ public class BasicSetVisiblePropertyPane extends FormBasicPropertyPane { protected void initComponent() { UICheckBox otherOtherConfig = createOtherConfig(); if(otherOtherConfig != null){ - corePane.add(otherOtherConfig); + corePane.add(row(cell(otherOtherConfig)).getComponent()); } visibleCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Widget_Visible"), true); visibleCheckBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Basic")); - corePane.add(visibleCheckBox); + corePane.add(row(cell(visibleCheckBox)).getComponent()); } public UICheckBox createOtherConfig(){ diff --git a/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java b/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java index 679284edd3..b6fbaea532 100644 --- a/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java @@ -275,9 +275,9 @@ public class RootDesignDefinePane extends AbstractDataModify { cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background"))).weight(LEFT_WEIGHT), cell(backgroundPane).weight(RIGHT_WEIGHT) ), - cell(displayReport), - cell(useParamsTemplate), - cell(fireAfterEditor) + row(cell(displayReport)), + row(cell(useParamsTemplate)), + row(cell(fireAfterEditor)) ).getComponent(); } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/ButtonGroupDictPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/ButtonGroupDictPane.java index 86238df132..c29aff770c 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/ButtonGroupDictPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/ButtonGroupDictPane.java @@ -42,7 +42,7 @@ public class ButtonGroupDictPane extends JPanel { cell(columnLabel).weight(LEFT_WEIGHT), cell(columnSpinner).weight(RIGHT_WEIGHT) ).getComponent(); this.add(column(VERTICAL_GAP, - cell(adaptiveCheckbox), + row(cell(adaptiveCheckbox)), cell(columnSettingRow) ).getComponent()); diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/CheckBoxGroupDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/CheckBoxGroupDefinePane.java index 97df720aa0..5a90856fd6 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/CheckBoxGroupDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/CheckBoxGroupDefinePane.java @@ -13,6 +13,7 @@ import javax.swing.JPanel; 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; import static com.fr.design.constants.LayoutConstants.VERTICAL_GAP; public class CheckBoxGroupDefinePane extends ButtonGroupDefinePane { @@ -41,7 +42,7 @@ public class CheckBoxGroupDefinePane extends ButtonGroupDefinePane returnTypePane = new ReturnTypePane(); return column(VERTICAL_GAP, - cell(supportTagCheckBox),cell(returnTypePane) + row(cell(supportTagCheckBox)), + cell(returnTypePane) ).getComponent(); } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/CustomWritableRepeatEditorPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/CustomWritableRepeatEditorPane.java index c57d05da12..df0afbcfb2 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/CustomWritableRepeatEditorPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/CustomWritableRepeatEditorPane.java @@ -7,6 +7,9 @@ import com.fr.form.ui.CustomWriteAbleRepeatEditor; import javax.swing.JPanel; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.swing.ui.layout.Layouts.cell; + /** * Author : Shockway * Date: 13-9-18 @@ -24,7 +27,7 @@ public abstract class CustomWritableRepeatEditorPane e cell(dicPane[0]).weight(LEFT_WEIGHT), cell(dicPane[1]).weight(RIGHT_WEIGHT) ), - cell(repeatCheckBox) + row(cell(repeatCheckBox)) ).getComponent(); if (waterMarkComponent[0] != null && waterMarkComponent[1] != null) { panel.add(row( @@ -115,7 +115,7 @@ public abstract class DirectWriteEditorDefinePane e public JPanel setValidatePane(){ directWriteCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Allow_Edit"), false); JPanel otherContentPane = column(LayoutConstants.VERTICAL_GAP).getComponent(); - otherContentPane.add(directWriteCheckBox); + otherContentPane.add(row(cell(directWriteCheckBox)).getComponent()); return otherContentPane; } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java index e847f7dac3..77a7ab450d 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java @@ -154,7 +154,7 @@ public abstract class FieldEditorDefinePane extends Abstr }); validatePane.add(column(VERTICAL_GAP, - cell(allowBlankCheckBox), + row(cell(allowBlankCheckBox)), cell(errorTipPane) ).getComponent()); diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/LabelDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/LabelDefinePane.java index 031b21466e..0ba933b964 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/LabelDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/LabelDefinePane.java @@ -82,8 +82,8 @@ public class LabelDefinePane extends AbstractDataModify