From c6645f2d33b0b750c27d4f2abeb31428b4f84374 Mon Sep 17 00:00:00 2001 From: obo Date: Tue, 23 Jul 2024 19:38:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B1=9E=E6=80=A7=E9=9D=A2=E6=9D=BF=E9=95=9C?= =?UTF-8?q?=E5=83=8F=E5=8C=96=EF=BC=8C=E4=BC=98=E5=8C=96=E4=B8=80=E4=BA=9B?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/base/i18n/BidiUtils.java | 33 ++++--------------- .../com/fr/design/actions/UpdateAction.java | 2 +- .../data/datapane/VerticalChoosePane.java | 5 +-- .../design/gui/controlpane/UIControlPane.java | 5 +-- .../fr/design/gui/frpane/RegFieldPane.java | 3 +- .../com/fr/design/gui/frpane/RegPane.java | 2 ++ .../fr/design/gui/icombobox/UIComboBox.java | 2 ++ .../fr/design/gui/icombobox/UIComboBoxUI.java | 4 ++- .../design/gui/imenu/UIMenuEastAttrItem.java | 1 + .../itableeditorpane/UITableEditorPane.java | 1 + .../itree/refreshabletree/TreeRootPane.java | 11 ++++--- .../fr/design/gui/style/TextFormatPane.java | 3 +- .../mainframe/CenterRegionContainerPane.java | 13 +++----- .../fr/design/mainframe/DesignerFrame.java | 10 +++--- .../mainframe/EastRegionContainerPane.java | 14 ++++---- .../mainframe/WestRegionContainerPane.java | 2 +- .../java/com/fr/design/menu/ToolBarDef.java | 2 +- .../fr/design/present/DictPresentPane.java | 2 ++ .../com/fr/design/utils/LinkStrUtils.java | 1 + .../btn/ButtonWithHotkeysDetailPane.java | 3 +- .../fr/design/mainframe/ReportFloatPane.java | 2 ++ .../cell/settingpane/CellExpandAttrPane.java | 3 +- .../cell/settingpane/CellOtherSetPane.java | 15 ++++++--- .../CellDesensitizationGroupsPane.java | 3 +- .../model/DesensitizationCellPane.java | 2 ++ .../settingpane/style/CustomStylePane.java | 3 ++ .../cell/settingpane/style/StylePane.java | 5 +-- .../com/fr/design/present/BarCodePane.java | 2 ++ .../fr/design/present/CurrencyLinePane.java | 4 ++- .../fr/design/widget/CellWidgetCardPane.java | 1 + .../java/com/fr/design/widget/WidgetPane.java | 3 +- .../ui/BasicWidgetPropertySettingPane.java | 3 +- .../design/widget/ui/CheckBoxDefinePane.java | 2 ++ .../ui/CustomWritableRepeatEditorPane.java | 5 +-- .../ui/DirectWriteEditorDefinePane.java | 9 +++-- .../widget/ui/FieldEditorDefinePane.java | 2 ++ .../widget/ui/IframeEditorDefinePane.java | 3 +- .../design/widget/ui/WaterMarkDictPane.java | 3 +- .../btn/TreeNodeToogleButtonDefinePane.java | 3 +- .../com/fr/quickeditor/CellQuickEditor.java | 2 ++ 40 files changed, 114 insertions(+), 80 deletions(-) diff --git a/designer-base/src/main/java/com/fr/base/i18n/BidiUtils.java b/designer-base/src/main/java/com/fr/base/i18n/BidiUtils.java index 52f251ab8b..b676619573 100644 --- a/designer-base/src/main/java/com/fr/base/i18n/BidiUtils.java +++ b/designer-base/src/main/java/com/fr/base/i18n/BidiUtils.java @@ -1,9 +1,7 @@ package com.fr.base.i18n; -import java.awt.BorderLayout; +import java.awt.Component; import java.awt.ComponentOrientation; -import java.awt.Container; -import java.awt.FlowLayout; import java.util.Locale; /** @@ -25,37 +23,18 @@ public class BidiUtils { return ComponentOrientation.getOrientation(ar); } - public static void applyOrientationByLocale(Container component) { + public static T applyOrientationByLocale(T component) { component.applyComponentOrientation(ComponentOrientation.getOrientation(ar)); + return component; } - public static void applyOrientationByLocale(Container ...component) { - for (Container container : component) { - container.applyComponentOrientation(ComponentOrientation.getOrientation(ar)); + public static void applyOrientationByLocale(Component... components) { + for (Component component : components) { + component.applyComponentOrientation(ComponentOrientation.getOrientation(ar)); } } public static boolean rtl() { return ComponentOrientation.getOrientation(ar) == ComponentOrientation.RIGHT_TO_LEFT; } - - public static String getBorderLayoutWest() { - return BidiUtils.rtl() ? BorderLayout.EAST : BorderLayout.WEST; - } - - public static String getBorderLayoutEast() { - return BidiUtils.rtl() ? BorderLayout.WEST : BorderLayout.EAST; - } - - public static int getFlowLayoutLeft() { - return BidiUtils.rtl() ? FlowLayout.RIGHT : FlowLayout.LEFT; - } - - public static int getFlowLayoutRight() { - return BidiUtils.rtl() ? FlowLayout.LEFT : FlowLayout.RIGHT; - } - - public static int getStableConstantsRight() { - return BidiUtils.rtl() ? com.fr.stable.Constants.LEFT : com.fr.stable.Constants.RIGHT; - } } diff --git a/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java b/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java index be0c571b7c..9861887844 100644 --- a/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java @@ -340,7 +340,7 @@ public abstract class UpdateAction extends ShortCut implements Action { setPressedIcon4Button(menuItem); setDisabledIcon4Button(menuItem); this.putValue(UIMenuItem.class.getName(), menuItem); - return menuItem; + return BidiUtils.applyOrientationByLocale(menuItem); } /** diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/VerticalChoosePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/VerticalChoosePane.java index 374efb1121..5469db1ada 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/VerticalChoosePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/VerticalChoosePane.java @@ -1,5 +1,6 @@ package com.fr.design.data.datapane; +import com.fr.base.i18n.BidiUtils; import com.fr.design.constants.LayoutConstants; import com.fr.design.data.datapane.preview.PreviewLabel; import com.fr.design.data.datapane.preview.PreviewLabel.Previewable; @@ -41,8 +42,8 @@ public class VerticalChoosePane extends ChoosePane implements DesignerBean { rs.add(tableNameComboBox, BorderLayout.CENTER); rs.add(GUICoreUtils.createFlowPane(new Component[]{new RefreshLabel(this), previewLabel}, FlowLayout.LEFT, LayoutConstants.HGAP_LARGE), BorderLayout.EAST); rs.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, -RIGHTBORDER)); - UILabel l1 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database"), UILabel.LEFT); - UILabel l2 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Model"), UILabel.LEFT); + UILabel l1 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database"), BidiUtils.rtl() ? UILabel.RIGHT : UILabel.LEFT); + UILabel l2 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Model"), BidiUtils.rtl() ? UILabel.RIGHT : UILabel.LEFT); UILabel l3 = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Select_Table"), MAX_WIDTH, UILabel.LEFT); if (labelSize > 0) { Dimension pSize = new Dimension(labelSize, 20); diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java index 12f904922d..c9361e0dc1 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java @@ -1,5 +1,6 @@ package com.fr.design.gui.controlpane; +import com.fr.base.i18n.BidiUtils; import com.fr.design.constants.UIConstants; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.controlpane.shortcutfactory.ShortCutFactory; @@ -175,8 +176,8 @@ public abstract class UIControlPane extends JControlPane { toolBarPane.add(topToolBar, BorderLayout.NORTH); JPanel leftTopPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - leftTopPane.add(toolBarPane, BorderLayout.EAST); - leftTopPane.add(addItemLabel, BorderLayout.CENTER); + leftTopPane.add(toolBarPane, BidiUtils.rtl() ? BorderLayout.WEST : BorderLayout.EAST); + leftTopPane.add(addItemLabel, BidiUtils.rtl() ? BorderLayout.EAST : BorderLayout.CENTER); return leftTopPane; } diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/RegFieldPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/RegFieldPane.java index 38e33514bc..895a260205 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/RegFieldPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/RegFieldPane.java @@ -1,5 +1,6 @@ package com.fr.design.gui.frpane; +import com.fr.base.i18n.BidiUtils; import com.fr.design.ExtraDesignClassManager; import com.fr.design.beans.ErrorMsgTextFieldAdapter; import com.fr.design.beans.UITextFieldAdapter; @@ -84,7 +85,7 @@ public class RegFieldPane extends RegPane { UILabel tipLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Error_Tip")); tipLabel.setPreferredSize(new Dimension(60, 20)); JPanel panel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{tipLabel, errorMsgTextFieldAdapter.getErrorMsgTextField()}}, TableLayoutHelper.FILL_LASTCOLUMN, 10, LayoutConstants.VGAP_MEDIUM); - this.add(panel); + this.add(BidiUtils.applyOrientationByLocale(panel)); } private void initRegErrorMsgField() { diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/RegPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/RegPane.java index ea92ee73ce..2b684d6851 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/RegPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/RegPane.java @@ -1,5 +1,6 @@ package com.fr.design.gui.frpane; +import com.fr.base.i18n.BidiUtils; import com.fr.design.constants.LayoutConstants; import com.fr.design.designer.IntervalConstants; import com.fr.design.dialog.BasicPane; @@ -91,6 +92,7 @@ public class RegPane extends BasicPane { centerPane.add(cardPane, BorderLayout.NORTH); jPanel.add(centerPane, BorderLayout.CENTER); this.add(jPanel, BorderLayout.NORTH); + BidiUtils.applyOrientationByLocale(this); regComboBox.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { RegExp regExp = (RegExp)regComboBox.getSelectedItem(); diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBox.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBox.java index e6130ca3da..c205f66f2b 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBox.java @@ -1,5 +1,6 @@ package com.fr.design.gui.icombobox; +import com.fr.base.i18n.BidiUtils; import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameObserver; import com.fr.design.event.UIObserver; @@ -71,6 +72,7 @@ public class UIComboBox extends JComboBox implements UIObserver, GlobalNameObser setRenderer(new UIComboBoxRenderer()); setEditor(new UIComboBoxEditor()); initListener(); + BidiUtils.applyOrientationByLocale(this); } protected void initListener() { diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxUI.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxUI.java index d4de4e8501..ed8720bb2b 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxUI.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxUI.java @@ -1,5 +1,6 @@ package com.fr.design.gui.icombobox; +import com.fr.base.i18n.BidiUtils; import com.fr.common.inputevent.InputEventBaseOnOS; import com.fr.design.constants.UIConstants; import com.fr.design.gui.ibutton.UIButton; @@ -96,7 +97,8 @@ public class UIComboBoxUI extends BasicComboBoxUI implements MouseListener { } g2d.setColor(linecolor); if (!comboBox.isPopupVisible()) { - g2d.drawRoundRect(0, 0, c.getWidth() - arrowButton.getWidth() + 3, c.getHeight() - 1, UIConstants.ARC, UIConstants.ARC); + int width = BidiUtils.rtl() ? c.getWidth() : c.getWidth() - arrowButton.getWidth() + 3; + g2d.drawRoundRect(0, 0, width, c.getHeight() - 1, UIConstants.ARC, UIConstants.ARC); } else { g2d.drawRoundRect(0, 0, c.getWidth(), c.getHeight() + 3, UIConstants.ARC, UIConstants.ARC); g2d.drawLine(0, c.getHeight() - 1, c.getWidth(), c.getHeight() - 1); diff --git a/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuEastAttrItem.java b/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuEastAttrItem.java index 0df132caf4..a395071374 100644 --- a/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuEastAttrItem.java +++ b/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuEastAttrItem.java @@ -1,5 +1,6 @@ package com.fr.design.gui.imenu; +import com.fr.base.i18n.BidiUtils; import com.fr.design.constants.UIConstants; import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.stable.Constants; diff --git a/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableEditorPane.java b/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableEditorPane.java index aca38b28d2..938d4bf4c1 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableEditorPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableEditorPane.java @@ -1,5 +1,6 @@ package com.fr.design.gui.itableeditorpane; +import com.fr.base.i18n.BidiUtils; import com.fr.design.border.UIRoundedBorder; import com.fr.design.constants.UIConstants; import com.fr.design.dialog.BasicPane; diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/TreeRootPane.java b/designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/TreeRootPane.java index 691749fac6..c9046cd25e 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/TreeRootPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/TreeRootPane.java @@ -1,13 +1,16 @@ package com.fr.design.gui.itree.refreshabletree; +import com.fr.base.i18n.BidiUtils; import com.fr.data.impl.TreeAttr; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.layout.FRGUIPaneFactory; +import groovy.swing.factory.LayoutFactory; import javax.swing.BorderFactory; import javax.swing.BoxLayout; import javax.swing.JPanel; +import java.awt.FlowLayout; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; @@ -32,7 +35,7 @@ public class TreeRootPane extends BasicPane { public TreeRootPane() { this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); - JPanel checkTypePane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane_First0(); + JPanel checkTypePane = BidiUtils.rtl() ? FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane() : FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane_First0(); checkTypePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); checkTypeCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Mutiple_Selection_Or_Not")); checkTypeCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); @@ -40,7 +43,7 @@ public class TreeRootPane extends BasicPane { checkTypePane.add(checkTypeCheckBox); this.add(checkTypePane); - JPanel loadTypePane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane_First0(); + JPanel loadTypePane = BidiUtils.rtl() ? FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane() : FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane_First0(); checkTypePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); loadTypeCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Load_By_Async")); loadTypeCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); @@ -48,14 +51,14 @@ public class TreeRootPane extends BasicPane { loadTypePane.add(loadTypeCheckBox); this.add(loadTypePane); - JPanel leafSelectPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane_First0(); + JPanel leafSelectPane = BidiUtils.rtl() ? FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane() : FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane_First0(); checkTypePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); leafSelectPane.add(layerTypeCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Select_Leaf_Only"))); layerTypeCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); this.add(leafSelectPane); - JPanel returnFullPathPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane_First0(); + JPanel returnFullPathPane = BidiUtils.rtl() ? FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane() : FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane_First0(); checkTypePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); returnFullPathPane.add(returnFullPathCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Return_Full_Path"))); returnFullPathCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); 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 0b8e8287ab..bd677fa1a1 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 @@ -4,6 +4,7 @@ import com.fr.base.CoreDecimalFormat; import com.fr.base.GraphHelper; import com.fr.base.Style; import com.fr.base.TextFormat; +import com.fr.base.i18n.BidiUtils; import com.fr.data.core.FormatField; import com.fr.data.core.FormatField.FormatContents; import com.fr.design.border.UIRoundedBorder; @@ -139,7 +140,7 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName protected void initLayout() { JPanel labeledFormatTypeComboBoxPane = new JPanel(new BorderLayout(20, 0)); - labeledFormatTypeComboBoxPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Report_Base_Format")), BorderLayout.WEST); + labeledFormatTypeComboBoxPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Report_Base_Format")), BidiUtils.rtl() ? BorderLayout.EAST : BorderLayout.WEST); labeledFormatTypeComboBoxPane.add(typeComboBox, BorderLayout.CENTER); JPanel labeledRoundingCheckboxPane = new JPanel(new BorderLayout(0, 0)); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java index 7857c8f3b5..6f4e38ad62 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java @@ -82,7 +82,7 @@ public class CenterRegionContainerPane extends JPanel { }; toolbarPane.setLayout(FRGUIPaneFactory.createBorderLayout()); eastPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - eastPane.add(largeToolbar = getToolBarMenuDock().createLargeToolbar(), BidiUtils.getBorderLayoutEast()); + eastPane.add(largeToolbar = getToolBarMenuDock().createLargeToolbar(), BidiUtils.rtl() ? BorderLayout.WEST : BorderLayout.EAST); eastCenterPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); combineUpTooBar(); eastCenterPane.add(combineUp, BorderLayout.NORTH); @@ -109,12 +109,9 @@ public class CenterRegionContainerPane extends JPanel { * 创建上工具栏 */ private void combineUpTooBar() { -// combineUp = new UIToolbar(BidiUtils.getFlowLayoutLeft()); -// combineUp.setBorder(new MatteBorder(new Insets(0, LEFT_ALIGN_GAP, 1, 0), UIConstants.LINE_COLOR)); -// combineUp.setLayout(new FlowLayout(BidiUtils.getFlowLayoutLeft(), 5, 2)); - combineUp = new UIToolbar(BidiUtils.getFlowLayoutLeft()); + combineUp = new UIToolbar(BidiUtils.rtl() ? FlowLayout.RIGHT : FlowLayout.LEFT); combineUp.setBorder(new MatteBorder(new Insets(0, LEFT_ALIGN_GAP, 1, 0), UIConstants.LINE_COLOR)); - combineUp.setLayout(new FlowLayout(BidiUtils.getFlowLayoutLeft(), 5, 2)); + combineUp.setLayout(new FlowLayout(BidiUtils.rtl() ? FlowLayout.RIGHT : FlowLayout.LEFT, 5, 2)); setUpUpToolBar(null); } @@ -279,8 +276,8 @@ public class CenterRegionContainerPane extends JPanel { //移除新建模板按钮 templateTabPane.remove(newWorkBookPane); } else { - eastPane.add(largeToolbar, BidiUtils.getBorderLayoutWest()); - templateTabPane.add(newWorkBookPane, BidiUtils.getBorderLayoutWest()); + eastPane.add(largeToolbar, BidiUtils.rtl() ? BorderLayout.EAST : BorderLayout.WEST); + templateTabPane.add(newWorkBookPane, BidiUtils.rtl() ? BorderLayout.EAST : BorderLayout.WEST); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 7068e712c2..616b822a85 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -267,7 +267,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta basePane.add(CenterRegionContainerPane.getInstance(), BorderLayout.CENTER); laoyoutWestPane(); - basePane.add(EastRegionContainerPane.getInstance(), BidiUtils.getBorderLayoutEast()); + basePane.add(EastRegionContainerPane.getInstance(), BidiUtils.rtl() ? BorderLayout.WEST : BorderLayout.EAST); basePane.setBounds(0, 0, contentWidth, contentHeight); // 数值越小。越在底层 @@ -479,7 +479,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta protected void laoyoutWestPane() { - basePane.add(WestRegionContainerPane.getInstance(), BidiUtils.getBorderLayoutWest()); + basePane.add(WestRegionContainerPane.getInstance(), BidiUtils.rtl() ? BorderLayout.EAST : BorderLayout.WEST); } // 调整windows大小 @@ -822,7 +822,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta DesignerOpenEmptyPanel designerOpenEmptyPanel = new DesignerOpenEmptyPanel(); BorderLayout layout = (BorderLayout) basePane.getLayout(); basePane.remove(layout.getLayoutComponent(BorderLayout.CENTER)); - basePane.remove(layout.getLayoutComponent(BidiUtils.getBorderLayoutEast())); + basePane.remove(layout.getLayoutComponent(BidiUtils.rtl() ? BorderLayout.WEST : BorderLayout.EAST)); basePane.add(designerOpenEmptyPanel, BorderLayout.CENTER); resetToolkitByPlus(ToolBarMenuDock.NULLAVOID); @@ -976,10 +976,10 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta basePane.add(center, BorderLayout.CENTER); } if (west != null) { - basePane.add(west, BidiUtils.getBorderLayoutWest()); + basePane.add(west, BidiUtils.rtl() ? BorderLayout.EAST : BorderLayout.WEST); } if (east != null) { - basePane.add(east, BidiUtils.getBorderLayoutEast()); + basePane.add(east, BidiUtils.rtl() ? BorderLayout.WEST : BorderLayout.EAST); } jTemplate.setComposite(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index 1357b48354..2ab7725105 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe; import com.fr.base.FRContext; +import com.fr.base.i18n.BidiUtils; import com.fr.base.svg.IconUtils; import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignerEnvManager; @@ -1189,7 +1190,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { @Override public void mouseClicked(MouseEvent e) { - if (e.getX() >= ARROW_RANGE_START) { + if ((BidiUtils.rtl() && e.getX() <= 30) || (!BidiUtils.rtl() && e.getX() >= ARROW_RANGE_START)) { onPop(); } } @@ -1204,7 +1205,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { @Override public void mousePressed(MouseEvent e) { - if (e.getX() < ARROW_RANGE_START) { + if ((BidiUtils.rtl() && e.getX() > 30) || (!BidiUtils.rtl() && e.getX() < ARROW_RANGE_START)) { mouseDownCompCoords = e.getPoint(); } } @@ -1213,7 +1214,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private MouseMotionListener mouseMotionListener = new MouseMotionListener() { @Override public void mouseMoved(MouseEvent e) { - if (e.getX() >= ARROW_RANGE_START) { + if ((BidiUtils.rtl() && e.getX() <= 30) || (!BidiUtils.rtl() && e.getX() >= ARROW_RANGE_START)) { setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); } else if (isMovable) { setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); @@ -1266,7 +1267,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { contentPane.setBackground(originColor); contentPane.setLayout(new BorderLayout()); UILabel label = new UILabel(title); - contentPane.add(label, BorderLayout.WEST); + contentPane.add(label, BidiUtils.rtl() ? BorderLayout.EAST : BorderLayout.WEST); contentPane.setBorder(new EmptyBorder(5, 10, 5, 0)); setLayout(new BorderLayout()); @@ -1321,7 +1322,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } else { button = UIConstants.POP_BUTTON_UP; } - SvgDrawUtils.doDrawSVG(g, () -> SvgDrawUtils.drawImage(g, button, (ARROW_RANGE_START + 8), 4, null)); + SvgDrawUtils.doDrawSVG(g, () -> SvgDrawUtils.drawImage(g, button, BidiUtils.rtl() ? 0 : ARROW_RANGE_START + 8, 4, null)); } } @@ -1375,8 +1376,9 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } public void adjustLocation() { + this.setLocation( - getLeftPane().getLocationOnScreen().x - CONTENT_WIDTH, + BidiUtils.rtl() ? getLeftPane().getLocationOnScreen().x : getLeftPane().getLocationOnScreen().x - CONTENT_WIDTH, DesignerContext.getDesignerFrame().getLocationOnScreen().y + 228 ); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/WestRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/WestRegionContainerPane.java index 669673779e..1cccd53f06 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/WestRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/WestRegionContainerPane.java @@ -31,7 +31,7 @@ public class WestRegionContainerPane extends UIResizableContainer { } public WestRegionContainerPane() { - super(DesignerFrameFileDealerPane.getInstance(), BidiUtils.getStableConstantsRight()); + super(DesignerFrameFileDealerPane.getInstance(), BidiUtils.rtl() ? com.fr.stable.Constants.LEFT : com.fr.stable.Constants.RIGHT); setDownPane(TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); diff --git a/designer-base/src/main/java/com/fr/design/menu/ToolBarDef.java b/designer-base/src/main/java/com/fr/design/menu/ToolBarDef.java index 3e5ed009a9..2bdee656f0 100644 --- a/designer-base/src/main/java/com/fr/design/menu/ToolBarDef.java +++ b/designer-base/src/main/java/com/fr/design/menu/ToolBarDef.java @@ -44,7 +44,7 @@ public class ToolBarDef { * 一个static的方法生成一个JToolBar */ public static UIToolbar createJToolBar() { - UIToolbar toolbar = new UIToolbar(BidiUtils.getFlowLayoutLeft()); + UIToolbar toolbar = new UIToolbar(BidiUtils.rtl() ? FlowLayout.RIGHT : FlowLayout.LEFT); toolbar.setBorder(BorderFactory.createEmptyBorder(2, 0, 2, 0)); return toolbar; } diff --git a/designer-base/src/main/java/com/fr/design/present/DictPresentPane.java b/designer-base/src/main/java/com/fr/design/present/DictPresentPane.java index 82cf70372b..a32566da57 100644 --- a/designer-base/src/main/java/com/fr/design/present/DictPresentPane.java +++ b/designer-base/src/main/java/com/fr/design/present/DictPresentPane.java @@ -3,6 +3,7 @@ package com.fr.design.present; import java.awt.BorderLayout; import java.awt.event.ItemListener; +import com.fr.base.i18n.BidiUtils; import com.fr.base.present.DictPresent; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.data.tabledata.Prepare4DataSourceChange; @@ -21,6 +22,7 @@ public class DictPresentPane extends FurtherBasicBeanPane implement dictionaryPane = new DictionaryPane(); this.setLayout(new BorderLayout()); this.add(dictionaryPane, BorderLayout.CENTER); + BidiUtils.applyOrientationByLocale(this); } @Override diff --git a/designer-base/src/main/java/com/fr/design/utils/LinkStrUtils.java b/designer-base/src/main/java/com/fr/design/utils/LinkStrUtils.java index 666d17b84a..bbee1f4643 100644 --- a/designer-base/src/main/java/com/fr/design/utils/LinkStrUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/LinkStrUtils.java @@ -53,6 +53,7 @@ public class LinkStrUtils { StringBuilder style = new StringBuilder("font-family:" + font.getFamily() + ";"); style.append("font-weight:").append(font.isBold() ? "bold" : "normal").append(";"); + //style.append("margin-bottom:").append("5px").append(";"); style.append("font-size:").append(font.getSize()).append("pt;"); style.append("color:rgb(").append(fontColor.getRed()).append(",").append(fontColor.getGreen()).append(",").append(fontColor.getBlue()).append(");"); style.append("background-color: rgb(").append(backgroundColor.getRed()).append(",").append(backgroundColor.getGreen()).append(",").append(backgroundColor.getBlue()).append(");"); diff --git a/designer-base/src/main/java/com/fr/design/widget/btn/ButtonWithHotkeysDetailPane.java b/designer-base/src/main/java/com/fr/design/widget/btn/ButtonWithHotkeysDetailPane.java index d146c73099..f76f8b0bdf 100644 --- a/designer-base/src/main/java/com/fr/design/widget/btn/ButtonWithHotkeysDetailPane.java +++ b/designer-base/src/main/java/com/fr/design/widget/btn/ButtonWithHotkeysDetailPane.java @@ -4,6 +4,7 @@ import java.awt.*; import javax.swing.*; +import com.fr.base.i18n.BidiUtils; import com.fr.design.designer.IntervalConstants; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.icombobox.DictionaryComboBox; @@ -59,7 +60,7 @@ public abstract class ButtonWithHotkeysDetailPane extends Butt } UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Advanced"), 280, 20, advancePane); this.add(uiExpandablePane); - + BidiUtils.applyOrientationByLocale(this); } protected abstract Component createCenterPane(); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ReportFloatPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/ReportFloatPane.java index 2e034076fc..c0e14fa688 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ReportFloatPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ReportFloatPane.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe; +import com.fr.base.i18n.BidiUtils; import com.fr.design.actions.UpdateAction; import com.fr.design.actions.core.ActionFactory; import com.fr.design.constants.UIConstants; @@ -71,6 +72,7 @@ public class ReportFloatPane extends JPanel { JPanel leftTopPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); leftTopPane.setBorder(BorderFactory.createEmptyBorder(12, 5, 0, 15)); this.add(leftTopPane, BorderLayout.NORTH); + BidiUtils.applyOrientationByLocale(this); } private void initInsertToolBar() { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java index 9549a3a7e8..c8520305f0 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.cell.settingpane; +import com.fr.base.i18n.BidiUtils; import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.UIConstants; import com.fr.design.expand.ExpandLeftFatherPane; @@ -63,7 +64,7 @@ public class CellExpandAttrPane extends AbstractCellAttrPane { horizontalExpandableCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_ExpandD_Horizontal_Extendable")); verticalExpandableCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_ExpandD_Vertical_Extendable")); initAllNames(); - return layoutPane(); + return BidiUtils.applyOrientationByLocale(layoutPane()); } private void initAllNames() { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java index 5ac64d401a..f8a6ccfe6d 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe.cell.settingpane; import com.fr.base.Style; +import com.fr.base.i18n.BidiUtils; import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.UIConstants; import com.fr.design.dialog.link.MessageWithLink; @@ -41,6 +42,7 @@ import com.fr.stable.Constants; import com.fr.stable.StringUtils; import javax.swing.BorderFactory; +import javax.swing.BoxLayout; import javax.swing.ButtonGroup; import javax.swing.JPanel; import javax.swing.SwingConstants; @@ -55,6 +57,7 @@ import java.awt.Insets; import java.awt.Rectangle; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; +import java.text.Bidi; import java.util.ArrayList; /** @@ -149,7 +152,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane { contentPane.add(new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Desensitization"), HEAD_WDITH, HEAD_HEIGTH, desensitizePane())); // VerticalFlowLayout 与 实现的滚动条有冲突,因此再加一层panel JPanel jPanel = new JPanel(); - jPanel.add(contentPane); + jPanel.add(BidiUtils.applyOrientationByLocale(contentPane)); initAllNames(); return jPanel; } @@ -226,9 +229,13 @@ public class CellOtherSetPane extends AbstractCellAttrPane { return new Insets(LayoutConstants.VGAP_MEDIUM, 0, LayoutConstants.VGAP_MEDIUM, 0); } }; - VerticalFlowLayout verticalFlowLayout = new VerticalFlowLayout(VerticalFlowLayout.CENTER, 0, 0); - verticalFlowLayout.setAlignLeft(true); - basicPane.setLayout(verticalFlowLayout); + basicPane.setLayout(new BoxLayout(basicPane, BoxLayout.Y_AXIS)); + + defaultAutoRadioButton.setAlignmentX(BidiUtils.rtl() ? Component.RIGHT_ALIGNMENT : Component.LEFT_ALIGNMENT); + noAutoRadioButton.setAlignmentX(BidiUtils.rtl() ? Component.RIGHT_ALIGNMENT : Component.LEFT_ALIGNMENT); + autoHeightRadioButton.setAlignmentX(BidiUtils.rtl() ? Component.RIGHT_ALIGNMENT : Component.LEFT_ALIGNMENT); + autoWidthRadioButton.setAlignmentX(BidiUtils.rtl() ? Component.RIGHT_ALIGNMENT : Component.LEFT_ALIGNMENT); + basicPane.add(defaultAutoRadioButton); basicPane.add(noAutoRadioButton); basicPane.add(autoHeightRadioButton); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/CellDesensitizationGroupsPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/CellDesensitizationGroupsPane.java index de4e046b84..4ef09ceb00 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/CellDesensitizationGroupsPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/CellDesensitizationGroupsPane.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.cell.settingpane.desensitization; +import com.fr.base.i18n.BidiUtils; import com.fr.design.constants.UIConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; @@ -97,7 +98,7 @@ public class CellDesensitizationGroupsPane extends JPanel { JPanel controlPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); controlPane.setBackground(Color.WHITE); - controlPane.add(getbuttonPane(), BorderLayout.WEST); + controlPane.add(getbuttonPane(), BidiUtils.rtl() ? BorderLayout.EAST : BorderLayout.WEST); JPanel pane = new JPanel(new BorderLayout(4, 4)); pane.add(editTable, BorderLayout.CENTER); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/DesensitizationCellPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/DesensitizationCellPane.java index 818a26205d..3911be9c84 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/DesensitizationCellPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/DesensitizationCellPane.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.cell.settingpane.desensitization.model; +import com.fr.base.i18n.BidiUtils; import com.fr.base.operator.org.OrganizationOperator; import com.fr.data.desensitize.rule.DesensitizationRuleManager; import com.fr.data.desensitize.rule.base.DesensitizationRule; @@ -103,6 +104,7 @@ public class DesensitizationCellPane extends BasicBeanPane { emptyTextField.setOpaque(false); editPanel.add(initTableCellPanel()); + BidiUtils.applyOrientationByLocale(editPanel, ruleTextField); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CustomStylePane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CustomStylePane.java index e1e095cbfc..fca95a18d4 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CustomStylePane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CustomStylePane.java @@ -3,6 +3,7 @@ package com.fr.design.mainframe.cell.settingpane.style; import com.fr.base.CellBorderStyle; import com.fr.base.NameStyle; import com.fr.base.Style; +import com.fr.base.i18n.BidiUtils; import com.fr.design.actions.utils.ReportActionUtils; import com.fr.design.constants.UIConstants; import com.fr.design.dialog.BasicPane; @@ -14,6 +15,7 @@ import com.fr.design.style.BorderUtils; import javax.swing.*; import javax.swing.event.ChangeListener; import java.awt.*; +import java.text.Bidi; import java.util.ArrayList; import java.util.List; @@ -40,6 +42,7 @@ public class CustomStylePane extends MultiTabPane