From cff40acbd2778392302b655f769ae7a962f91281 Mon Sep 17 00:00:00 2001 From: obo Date: Wed, 31 Jul 2024 14:16:13 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B6=85=E7=BA=A7=E9=93=BE=E6=8E=A5-=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8=E8=B6=85=E9=93=BE-=E6=82=AC=E6=B5=AE=E7=AA=97?= =?UTF-8?q?=E5=9B=BE=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/foldablepane/HeaderPane.java | 6 ++++-- .../com/fr/design/utils/gui/GUICoreUtils.java | 4 ++-- .../impl/ChartHyperPopAttrPane.java | 16 ++++++++++++---- .../impl/ChartHyperPoplinkPane.java | 3 ++- .../mainframe/chart/gui/ChartTypeButtonPane.java | 9 +++++---- .../chart/gui/data/DatabaseTableDataPane.java | 3 ++- .../chart/gui/data/NormalChartDataPane.java | 4 +++- .../mainframe/chart/gui/data/TableDataPane.java | 4 +++- .../table/CategoryPlotTableDataContentPane.java | 3 ++- .../gui/data/table/SeriesTypeUseComboxPane.java | 4 +++- .../style/ChartTextAttrPaneWithThemeStyle.java | 3 ++- .../chart/designer/style/VanChartTitlePane.java | 5 +++-- 12 files changed, 43 insertions(+), 21 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/foldablepane/HeaderPane.java b/designer-base/src/main/java/com/fr/design/foldablepane/HeaderPane.java index 31cc290324..4e4bca58bf 100644 --- a/designer-base/src/main/java/com/fr/design/foldablepane/HeaderPane.java +++ b/designer-base/src/main/java/com/fr/design/foldablepane/HeaderPane.java @@ -1,6 +1,7 @@ package com.fr.design.foldablepane; import com.fr.base.GraphHelper; +import com.fr.base.i18n.BidiUtils; import com.fr.design.constants.UIConstants; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxUtilities; @@ -59,7 +60,8 @@ public class HeaderPane extends JPanel { RenderingHints.VALUE_ANTIALIAS_ON); BufferedImage panelImage = createPanelImage(); g2d.drawImage(panelImage, null, 0, 0); - GraphHelper.drawString(g2d, this.title, TITLE_X, headHeight - fontSize / 2 - 1); + int x = BidiUtils.rtl() ? headWidth - TITLE_X - g2d.getFontMetrics().stringWidth(title) : TITLE_X; + GraphHelper.drawString(g2d, this.title, x, headHeight - fontSize / 2 - 1); } private BufferedImage createPanelImage() { @@ -75,7 +77,7 @@ public class HeaderPane extends JPanel { if (desktopHints != null) { g2d.setRenderingHints(desktopHints); } - int leftWdith = headWidth - LEFT_X; + int leftWdith = BidiUtils.rtl() ? TITLE_X : headWidth - LEFT_X; if (this.isShow) { image = UIConstants.DRAG_DOWN_SELECTED_SMALL; g2d.drawImage(image, leftWdith, LEFT_Y, null); diff --git a/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java b/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java index 3c7e23a757..b7eb704f56 100644 --- a/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java @@ -686,7 +686,7 @@ public final class GUICoreUtils { break; case 1: if (components[1] != null) { - pane.add(components[1], BorderLayout.EAST); + pane.add(components[1], BidiUtils.rtl() ? BorderLayout.WEST : BorderLayout.EAST); } break; case 2: @@ -696,7 +696,7 @@ public final class GUICoreUtils { break; case 3: if (components[3] != null) { - pane.add(components[3], BorderLayout.WEST); + pane.add(components[3], BidiUtils.rtl() ? BorderLayout.EAST : BorderLayout.WEST); } break; case CASE_FOUR: diff --git a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPopAttrPane.java b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPopAttrPane.java index ac30dbf3be..10b3d7c2e3 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPopAttrPane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPopAttrPane.java @@ -1,6 +1,7 @@ package com.fr.design.chart.series.SeriesCondition.impl; import com.fr.base.Parameter; +import com.fr.base.i18n.BidiUtils; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.web.ChartHyperPoplink; import com.fr.design.editor.ValueEditorPane; @@ -72,9 +73,9 @@ public class ChartHyperPopAttrPane extends AbstractChartAttrPane { double[] rowSize = { p,p,p,p,p,p}; Component[][] components = new Component[][]{ - new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title") + ":", SwingConstants.RIGHT), titleField}, - new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Designer_Width") + ":", SwingConstants.RIGHT), widthField}, - new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Height") + ":", SwingConstants.RIGHT), heightField}, + new Component[]{new BoldFontTextLabel(BidiUtils.reverseConcatenateStrings(getBoldFontTextLabelName("Fine-Design_Form_Widget_Style_Title")), getBoldFontTextLabelHorizontalAlignment()), titleField}, + new Component[]{new BoldFontTextLabel(BidiUtils.reverseConcatenateStrings(getBoldFontTextLabelName("Fine-Design_Basic_Designer_Width")), getBoldFontTextLabelHorizontalAlignment()), widthField}, + new Component[]{new BoldFontTextLabel(BidiUtils.reverseConcatenateStrings(getBoldFontTextLabelName("Fine-Design_Chart_Height")), getBoldFontTextLabelHorizontalAlignment()), heightField}, }; widthField.setText(String.valueOf(DEFAULT_V_VALUE)); @@ -90,7 +91,14 @@ public class ChartHyperPopAttrPane extends AbstractChartAttrPane { return pane; } - + private int getBoldFontTextLabelHorizontalAlignment() { + return BidiUtils.rtl() ? SwingConstants.LEFT : SwingConstants.RIGHT; + } + + private String getBoldFontTextLabelName(String i18ney) { + return BidiUtils.reverseConcatenateStrings(com.fr.design.i18n.Toolkit.i18nText(i18ney), ":"); + } + public void populateBean(ChartHyperPoplink chartHyperlink) { titleField.setText(chartHyperlink.getChartDigTitle()); diff --git a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java index 35b0c0d5bc..0230d1eac6 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java @@ -1,5 +1,6 @@ package com.fr.design.chart.series.SeriesCondition.impl; +import com.fr.base.i18n.BidiUtils; import com.fr.chart.chartattr.Bar2DPlot; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; @@ -51,7 +52,7 @@ public class ChartHyperPoplinkPane extends AbstractHyperLinkPane implemen button.add(copyButton); button.add(moveForwardButton); button.add(moveBackButton); - northPane.add(button, BorderLayout.WEST); - northPane.add(configButton, BorderLayout.EAST); - + northPane.add(button, BidiUtils.rtl() ? BorderLayout.EAST : BorderLayout.WEST); + northPane.add(configButton, BidiUtils.rtl() ? BorderLayout.WEST : BorderLayout.EAST); + BidiUtils.applyOrientationByLocale(this); initConfigCreator(); // Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK); @@ -340,7 +341,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen JPanel pane = null; for (int i = 0; i < indexList.size(); i++) { if (i % COL_COUNT == 0) { - pane = new JPanel(new FlowLayout(FlowLayout.LEFT)); + pane = new JPanel(new FlowLayout(BidiUtils.rtl() ? FlowLayout.RIGHT : FlowLayout.LEFT)); northPane.add(pane); } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/DatabaseTableDataPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/DatabaseTableDataPane.java index 40983c56b5..a98f7bc74a 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/DatabaseTableDataPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/DatabaseTableDataPane.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe.chart.gui.data; import com.fr.base.BaseUtils; import com.fr.base.TableData; +import com.fr.base.i18n.BidiUtils; import com.fr.data.impl.NameTableData; import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.UIConstants; @@ -40,7 +41,7 @@ public class DatabaseTableDataPane extends BasicPane{ this.setLayout(new BorderLayout(0,0)); if (label != null) { - this.add(label, BorderLayout.WEST); + this.add(label, BidiUtils.rtl() ? BorderLayout.EAST : BorderLayout.WEST); } JPanel pane = new JPanel(new BorderLayout(LayoutConstants.HGAP_LARGE,0)); diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java index 9943c79631..5526a51cb6 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.chart.gui.data; +import com.fr.base.i18n.BidiUtils; import com.fr.chart.chartattr.ChartCollection; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.chartx.data.DataLayoutHelper; @@ -14,6 +15,7 @@ import com.fr.van.chart.designer.AbstractVanChartScrollPane; import javax.swing.BorderFactory; import javax.swing.JPanel; +import javax.swing.SwingConstants; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; @@ -66,7 +68,7 @@ public class NormalChartDataPane extends DataContentsPane { if (ChartEditContext.supportReportData()) { JPanel northPane = new JPanel(new BorderLayout(LayoutConstants.HGAP_LARGE, 0)); northPane.add(jcb, BorderLayout.CENTER); - UILabel label1 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Source")); + UILabel label1 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Source"), BidiUtils.rtl() ? SwingConstants.RIGHT : SwingConstants.LEFT); label1.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT)); northPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{jcb, null, null, label1, null})); if (ChartEditContext.normalMode()) { diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/TableDataPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/TableDataPane.java index 82240bc6d2..6b6021f9bd 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/TableDataPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/TableDataPane.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe.chart.gui.data; import com.fr.base.TableData; +import com.fr.base.i18n.BidiUtils; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartdata.TableDataDefinition; @@ -18,6 +19,7 @@ import com.fr.design.utils.gui.UIComponentUtils; import com.fr.stable.StringUtils; import javax.swing.BorderFactory; +import javax.swing.SwingConstants; import java.awt.BorderLayout; import java.awt.Dimension; @@ -41,7 +43,7 @@ public class TableDataPane extends FurtherBasicBeanPane{ } private void initDataPane() { - UILabel label = new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Table_Data")); + UILabel label = new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Table_Data"), BidiUtils.rtl() ? SwingConstants.RIGHT : SwingConstants.LEFT); UIComponentUtils.setLineWrap(label, TABLE_DATA_LABEL_LINE_WRAP_WIDTH); UIComponentUtils.setPreferedWidth(label, ChartDataPane.LABEL_WIDTH); diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotTableDataContentPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotTableDataContentPane.java index 7d12e3e52d..4be80e2f0c 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotTableDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotTableDataContentPane.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.chart.gui.data.table; +import com.fr.base.i18n.BidiUtils; import com.fr.chart.base.ChartConstants; import com.fr.chart.chartattr.Bar2DPlot; import com.fr.chart.chartattr.ChartCollection; @@ -42,7 +43,7 @@ public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPa categoryCombox = new UIComboBox(); JPanel categoryPane = new JPanel(new BorderLayout(4,0)); categoryPane.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground())); - UILabel label1 = new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Style_Category")) ; + UILabel label1 = new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Style_Category"), BidiUtils.rtl() ? SwingConstants.RIGHT : SwingConstants.LEFT) ; label1.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH,ChartDataPane.LABEL_HEIGHT)); categoryCombox.setPreferredSize(new Dimension(100,20)); diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesTypeUseComboxPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesTypeUseComboxPane.java index cf78e59ffb..32f4049de0 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesTypeUseComboxPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesTypeUseComboxPane.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe.chart.gui.data.table; import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.base.i18n.BidiUtils; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartdata.MoreNameCDDefinition; @@ -17,6 +18,7 @@ import com.fr.design.utils.gui.GUICoreUtils; import javax.swing.BorderFactory; import javax.swing.JPanel; +import javax.swing.SwingConstants; import java.util.List; import java.awt.BorderLayout; import java.awt.CardLayout; @@ -102,7 +104,7 @@ public class SeriesTypeUseComboxPane extends BasicBeanPane { JPanel northPane = new JPanel(new BorderLayout(4, 0)); //使用系列名/系列值选项面板 - UILabel seriesLabel = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Name_From")); + UILabel seriesLabel = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Name_From"), BidiUtils.rtl() ? SwingConstants.RIGHT : SwingConstants.LEFT); seriesLabel.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT)); JPanel borderLayoutPane = GUICoreUtils.createBorderLayoutPane(new Component[]{content, null, null, seriesLabel, null}); northPane.add(borderLayoutPane); diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithThemeStyle.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithThemeStyle.java index 345d57de8a..1d824ea831 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithThemeStyle.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithThemeStyle.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.chart.gui.style; +import com.fr.base.i18n.BidiUtils; import com.fr.chart.base.TextAttr; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; @@ -41,7 +42,7 @@ public class ChartTextAttrPaneWithThemeStyle extends ChartTextAttrPane { double e = getEdithAreaWidth(); double p = TableLayout.PREFERRED; double[] columnSize = {f, e}; - UILabel text = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT); + UILabel text = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Character"), BidiUtils.rtl() ? SwingConstants.RIGHT : SwingConstants.LEFT); JPanel preButtonPane = TableLayout4VanChartHelper.createGapTableLayoutPane(new Component[][]{new Component[]{text, preButton}}, new double[]{p}, columnSize); textFontPane = TableLayout4VanChartHelper.createGapTableLayoutPane(getComponents(buttonPane), getRowSize(), columnSize); panel.add(preButtonPane, BorderLayout.CENTER); 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 3469e26246..9b72dc5529 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 @@ -3,6 +3,7 @@ package com.fr.van.chart.designer.style; import com.fr.base.BaseFormula; import com.fr.base.BaseUtils; import com.fr.base.Utils; +import com.fr.base.i18n.BidiUtils; import com.fr.chart.base.TextAttr; import com.fr.chartx.config.info.constant.ConfigType; import com.fr.design.formula.DefaultTinyFormulaPane; @@ -158,7 +159,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { UIComponentUtils.setLineWrap(useHtml); Component[][] components = new Component[][]{ new Component[]{null, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Text"), SwingConstants.LEFT), titleContent}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Text"), BidiUtils.rtl() ? SwingConstants.RIGHT : SwingConstants.LEFT), titleContent}, new Component[]{null, useHtml}, }; JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); @@ -178,7 +179,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { Component[][] components = new Component[][]{ new Component[]{null, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_BorderLayout_Constraints"), SwingConstants.LEFT), alignmentPane}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_BorderLayout_Constraints"), BidiUtils.rtl() ? SwingConstants.RIGHT : SwingConstants.LEFT), alignmentPane}, new Component[]{null, customFloatPositionButton} };