diff --git a/designer-base/src/main/java/com/fr/design/file/DefaultTemplateTreeDefineProcessor.java b/designer-base/src/main/java/com/fr/design/file/DefaultTemplateTreeDefineProcessor.java index 9bee877aee..80e3bd4987 100644 --- a/designer-base/src/main/java/com/fr/design/file/DefaultTemplateTreeDefineProcessor.java +++ b/designer-base/src/main/java/com/fr/design/file/DefaultTemplateTreeDefineProcessor.java @@ -1,5 +1,6 @@ package com.fr.design.file; +import com.fr.base.i18n.BidiUtils; import com.fr.design.actions.UpdateAction; import com.fr.design.actions.file.DelFileAction; import com.fr.design.actions.file.LocateAction; @@ -395,10 +396,11 @@ public class DefaultTemplateTreeDefineProcessor extends AbstractTemplateTreeDefi } }); - JPanel bottomPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 0)); + JPanel bottomPanel = new JPanel(new FlowLayout(FlowLayout.TRAILING, 10, 0)); bottomPanel.setBorder(BorderFactory.createEmptyBorder(10, 15, 10, 10)); bottomPanel.add(confirmButton); bottomPanel.add(cancelButton); + BidiUtils.applyOrientationByLocale(bottomPanel); this.add(bottomPanel, BorderLayout.SOUTH); this.setSize(new Dimension(600, 400)); diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateDirTreePane.java b/designer-base/src/main/java/com/fr/design/file/TemplateDirTreePane.java index 08531b895c..bb64597017 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateDirTreePane.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateDirTreePane.java @@ -1,6 +1,7 @@ package com.fr.design.file; import com.fr.base.FRContext; +import com.fr.base.i18n.BidiUtils; import com.fr.design.gui.itree.filetree.TemplateDirTree; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.i18n.Toolkit; @@ -40,6 +41,7 @@ public class TemplateDirTreePane extends JPanel { remindPane = new TemplateDirSearchRemindPane(getTemplateDirTree()); this.add(remindPane, BorderLayout.CENTER); + BidiUtils.applyOrientationByLocale(this); } public TemplateDirTree getTemplateDirTree() { diff --git a/designer-base/src/main/java/com/fr/design/gui/itextfield/UITextField.java b/designer-base/src/main/java/com/fr/design/gui/itextfield/UITextField.java index 10edf9fe00..2bcb7182c0 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itextfield/UITextField.java +++ b/designer-base/src/main/java/com/fr/design/gui/itextfield/UITextField.java @@ -1,5 +1,6 @@ package com.fr.design.gui.itextfield; +import com.fr.base.i18n.BidiUtils; import com.fr.common.inputevent.InputEventBaseOnOS; import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameObserver; @@ -71,6 +72,7 @@ public class UITextField extends JTextField implements UIObserver, GlobalNameObs public void init() { InputEventBaseOnOS.addBasicEditInputMap(this); initListener(); + BidiUtils.applyOrientationByLocale(this); } protected void initListener() { @@ -174,7 +176,7 @@ public class UITextField extends JTextField implements UIObserver, GlobalNameObs RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setColor(getDisabledTextColor()); - g.drawString(placeholder, getInsets().left, pG.getFontMetrics() + g.drawString(placeholder, BidiUtils.rtl() ? (int) (this.getBounds().getWidth() - getInsets().left - g.getFontMetrics().stringWidth(placeholder)) : getInsets().left, pG.getFontMetrics() .getMaxAscent() + getInsets().top + 1); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/manager/search/searcher/control/pane/TemplateDirTreeSearchPane.java b/designer-base/src/main/java/com/fr/design/mainframe/manager/search/searcher/control/pane/TemplateDirTreeSearchPane.java index 07636ce631..8cec19347c 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/manager/search/searcher/control/pane/TemplateDirTreeSearchPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/manager/search/searcher/control/pane/TemplateDirTreeSearchPane.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.manager.search.searcher.control.pane; +import com.fr.base.i18n.BidiUtils; import com.fr.base.svg.IconUtils; import com.fr.design.constants.UIConstants; import com.fr.design.file.TemplateDirTreePane; @@ -13,6 +14,7 @@ import com.fr.design.search.event.TreeSearchStatusChangeListener; import com.fr.stable.StringUtils; import javax.swing.BorderFactory; +import javax.swing.Box; import javax.swing.JPanel; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; @@ -64,23 +66,41 @@ public class TemplateDirTreeSearchPane extends JPanel implements TreeSearchStatu searchPane = new JPanel(FRGUIPaneFactory.createBorderLayout()); searchPane.setBorder(BorderFactory.createLineBorder(UIConstants.TOOLBAR_BORDER_COLOR)); searchPane.setBackground(Color.WHITE); + + // 中间输入框 + initSearchTextField(); + + searchPane.add(createSearchPanel(), BorderLayout.LINE_START); + searchPane.add(searchTextField, BorderLayout.CENTER); + searchPane.add(createReturnPanel(), BorderLayout.LINE_END); + BidiUtils.applyOrientationByLocale(searchPane); + } + + private JPanel createSearchPanel() { // 左侧搜索图标 UILabel searchLabel = new UILabel(IconUtils.readIcon("/com/fr/design/images/data/search")); - searchLabel.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0)); + JPanel searchLabelPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + searchLabelPanel.setBackground(Color.WHITE); + searchLabelPanel.setBorder(BorderFactory.createEmptyBorder()); + searchLabelPanel.add(Box.createHorizontalStrut(5)); + searchLabelPanel.add(searchLabel); searchLabel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { // do nothing } }); + return searchLabelPanel; + } - // 中间输入框 - initSearchTextField(); - + private JPanel createReturnPanel() { // 右侧返回图标 UILabel returnLabel = new UILabel(IconUtils.readIcon("/com/fr/design/images/data/clear")); + JPanel returnLabelPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + returnLabelPanel.setBackground(Color.WHITE); + returnLabelPanel.add(returnLabel); + returnLabelPanel.add(Box.createHorizontalStrut(5)); returnLabel.setToolTipText(Toolkit.i18nText("Fine-Design_Tree_Search_Return")); - returnLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 11)); returnLabel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { @@ -88,10 +108,7 @@ public class TemplateDirTreeSearchPane extends JPanel implements TreeSearchStatu TemplateDirTreePane.getInstance().refreshDockingView(); } }); - - searchPane.add(searchLabel, BorderLayout.WEST); - searchPane.add(searchTextField, BorderLayout.CENTER); - searchPane.add(returnLabel, BorderLayout.EAST); + return returnLabelPanel; } private void initSearchTextField() {