diff --git a/designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java b/designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java index bf48c66c6d..92ee62ff5e 100644 --- a/designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java +++ b/designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java @@ -6,6 +6,7 @@ import com.fr.design.border.FineBorderFactory; import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.DesignSizeI18nManager; import com.fr.stable.os.OperatingSystem; import com.fr.value.AtomicClearableLazyValue; @@ -16,6 +17,7 @@ import javax.swing.UIManager; import java.awt.Color; import java.awt.Component; import java.awt.Composite; +import java.awt.Dimension; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; @@ -435,4 +437,15 @@ public class FineUIUtils { Font newSizeFont = font.deriveFont(font.getStyle(), scale(size)); c.setFont(newSizeFont); } + + /** + * 获取缩放后的国际化尺寸 + * + * @param i18nDimensionKey 国际化key值 + * @return 缩放后的国际化尺寸 + */ + public static Dimension getScaledI18nDimension(String i18nDimensionKey) { + return FineUIScale.scale(DesignSizeI18nManager.getInstance().i18nDimension(i18nDimensionKey)); + } + } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/sqlpane/SQLEditPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/sqlpane/SQLEditPane.java index 7f5d083004..c0849032d3 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/sqlpane/SQLEditPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/sqlpane/SQLEditPane.java @@ -57,6 +57,7 @@ public class SQLEditPane extends RSyntaxTextArea { if (requestDroptarget) { new SQLPaneDropTarget(this); } + setBorder(null); } diff --git a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java index d85793d5c4..b3d6e054d5 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java +++ b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java @@ -3,27 +3,26 @@ package com.fr.design.gui.icontainer; import com.fine.theme.icon.LazyIcon; import com.fine.theme.utils.FineUIScale; +import com.fine.theme.utils.FineUIUtils; import com.fr.design.base.mode.DesignModeContext; import com.fr.design.constants.UIConstants; -import com.fr.design.gui.ibutton.UIButton; import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.mainframe.DesignerContext; -import com.fr.design.utils.gui.GUICoreUtils; import javax.swing.BorderFactory; -import javax.swing.UIManager; +import javax.swing.Icon; import javax.swing.JComponent; -import javax.swing.JFrame; import javax.swing.JPanel; -import javax.swing.Icon; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; import javax.swing.border.Border; -import java.awt.BorderLayout; import java.awt.Component; import java.awt.Container; import java.awt.Cursor; import java.awt.Dimension; import java.awt.Graphics; import java.awt.LayoutManager; +import java.awt.Point; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionListener; @@ -34,32 +33,87 @@ import java.awt.event.MouseMotionListener; public class UIEastResizableContainer extends JPanel { private static final long serialVersionUID = 1854340560790476907L; - public static final int MAX_CONTAINER_WIDTH = FineUIScale.scale(340); - public static final int MIN_CONTAINER_WIDTH = FineUIScale.scale(286); + public static final int MAX_CONTAINER_WIDTH = FineUIUtils.getScaledI18nDimension( + "com.fr.design.mainframe.EastRegionContainerPane.maximum").width; + public static final int MIN_CONTAINER_WIDTH = FineUIUtils.getScaledI18nDimension( + "com.fr.design.mainframe.EastRegionContainerPane.minimum").width; + public static final int STD_CONTAINER_WIDTH = FineUIUtils.getScaledI18nDimension( + "com.fr.design.mainframe.EastRegionContainerPane.standard").width; + + private int containerWidth = STD_CONTAINER_WIDTH; + private int preferredWidth = STD_CONTAINER_WIDTH; + protected final int leftPaneWidth = FineUIScale.scale(42); + protected final int topToolPaneHeight = FineUIScale.scale(40); - private int containerWidth = FineUIScale.scale(240); - private int preferredWidth = FineUIScale.scale(240); - private int topToolPaneHeight = FineUIScale.scale(40); - private int leftPaneWidth = FineUIScale.scale(42); + private static final int ARROW_RANGE = FineUIScale.scale(35); private JComponent leftPane; private JComponent rightPane; private TopToolPane topToolPane; - - private static final int ARROW_MARGIN = FineUIScale.scale(15); - private static final int ARROW_RANGE = FineUIScale.scale(35); - + private static final int DRAG_GAP_SIZE = 10; + private Point dragPoint; public UIEastResizableContainer() { this(new JPanel(), new JPanel()); + initMouseListener(); + } + + private void initMouseListener() { + MouseAdapter mouseAdapter = new MouseAdapter() { + @Override + public void mouseMoved(MouseEvent e) { + updateCursor(e); + } + + @Override + public void mousePressed(MouseEvent e) { + if (isEnableDrag(e)) { + dragPoint = e.getPoint(); + } + } + + @Override + public void mouseDragged(MouseEvent e) { + resizePanel(e); + } + }; + + addMouseListener(mouseAdapter); + addMouseMotionListener(mouseAdapter); + } + + private void updateCursor(MouseEvent e) { + if (isEnableDrag(e)) { + setCursor(Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR)); + } else { + setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + } + } + + protected boolean isEnableDrag(MouseEvent e) { + return e.getX() <= DRAG_GAP_SIZE && isRightPaneVisible(); + } + + protected void resizePanel(MouseEvent e) { + if (!isRightPaneVisible()) { + return; + } + int dx = e.getX() - dragPoint.x; + Dimension size = getSize(); + + int newWidth = size.width - dx; + // 限制container大小为指定范围 + containerWidth = Math.max(MIN_CONTAINER_WIDTH, Math.min(newWidth, MAX_CONTAINER_WIDTH)); + + SwingUtilities.invokeLater(this::revalidate); } /** * 设置面板宽度 * - * @param width + * @param width 宽度 */ public void setContainerWidth(int width) { this.containerWidth = width; @@ -70,8 +124,6 @@ public class UIEastResizableContainer extends JPanel { return containerWidth > leftPaneWidth; } - - private void setPreferredWidth(int width) { this.preferredWidth = width; } @@ -81,7 +133,7 @@ public class UIEastResizableContainer extends JPanel { this.rightPane = rightPane; this.topToolPane = new TopToolPane(); topToolPane.setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP, 1, 0)); - topToolPane.setBorder(BorderFactory.createMatteBorder(0 ,1, 0, 1, UIManager.getColor("East.border"))); + topToolPane.setBorder(BorderFactory.createMatteBorder(0, 1, 0, 1, UIManager.getColor("East.border"))); setLayout(containerLayout); add(topToolPane); @@ -89,38 +141,6 @@ public class UIEastResizableContainer extends JPanel { add(rightPane); } - public static void main(String... args) { - JFrame jf = new JFrame("test"); - jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - JPanel content = (JPanel) jf.getContentPane(); - content.setLayout(new BorderLayout()); - - JPanel leftPane = new JPanel(); -// leftPane.setBackground(Color.yellow); - JPanel rightPane = new JPanel(); -// rightPane.setBackground(Color.green); - - UIButton b1, b2; - b1 = new UIButton("b1"); - b2 = new UIButton("b2"); - b1.setPreferredSize(new Dimension(40, 40)); - b2.setPreferredSize(new Dimension(40, 40)); - leftPane.add(b1); - leftPane.add(b2); - - - UIEastResizableContainer bb = new UIEastResizableContainer(leftPane, rightPane); - - JPanel cc = new JPanel(); -// cc.setBackground(Color.WHITE); - - content.add(bb, BorderLayout.EAST); - content.add(cc, BorderLayout.CENTER); - GUICoreUtils.centerWindow(jf); - jf.setSize(500, 500); - jf.setVisible(true); - } - /** * 将面板设置成最佳的宽度 */ @@ -156,7 +176,6 @@ public class UIEastResizableContainer extends JPanel { @Override public void removeLayoutComponent(Component comp) { - // TODO Auto-generated method stub } @@ -182,7 +201,7 @@ public class UIEastResizableContainer extends JPanel { @Override public void addLayoutComponent(String name, Component comp) { - // do nothing + } }; diff --git a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java index 6cd8e8df4f..4d1b5e69bd 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java +++ b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java @@ -391,17 +391,6 @@ public class UIResizableContainer extends JPanel { repaint(); } - @Override - public void mouseClicked(MouseEvent e) { - if (e.getX() <= ARROW_RANGE) { - toolPaneY = 0; - } else if (e.getX() >= getWidth() - ARROW_RANGE) { - toolPaneY = UIResizableContainer.this.getHeight() - toolPaneHeight - getParameterPaneHeight(); - } else { - return; - } - refreshContainer(); - } }); } 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 0ee74940d6..6fae3748ff 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 @@ -142,10 +142,13 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private static int containerWidth() { - if (FRContext.isChineseEnv()) { - return UIEastResizableContainer.MIN_CONTAINER_WIDTH; - } - return UIEastResizableContainer.MAX_CONTAINER_WIDTH; + return UIEastResizableContainer.STD_CONTAINER_WIDTH; + } + + @Override + protected boolean isEnableDrag(MouseEvent e) { + return super.isEnableDrag(e) + && e.getY() > topToolPaneHeight + leftPane.getPreferredSize().height; } /** diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties index bd57c7c32a..499e824afd 100644 --- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties +++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties @@ -30,3 +30,6 @@ com.fr.design.formula.FormulaPaneWhenReserveFormula=1200*600 com.fr.design.mainframe.mobile.ui.MobileStyleDefinePane.configLabel=130*20 com.fr.design.mainframe.mobile.utils.DesignerUtils.configLabel=140*20 com.fr.design.update.ui.dialog.UpdateMainDialog.updateButton=100*24 +com.fr.design.mainframe.EastRegionContainerPane.maximum=600*400 +com.fr.design.mainframe.EastRegionContainerPane.minimum=340*400 +com.fr.design.mainframe.EastRegionContainerPane.standard=480*400 diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties index b0b998ddac..e568b81094 100644 --- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties +++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties @@ -29,3 +29,6 @@ com.fr.design.formula.FormulaPaneWhenReserveFormula=900*600 com.fr.design.mainframe.mobile.ui.MobileStyleDefinePane.configLabel=100*20 com.fr.design.mainframe.mobile.utils.DesignerUtils.configLabel=130*20 com.fr.design.update.ui.dialog.UpdateMainDialog.updateButton=160*24 +com.fr.design.mainframe.EastRegionContainerPane.maximum=600*400 +com.fr.design.mainframe.EastRegionContainerPane.minimum=340*400 +com.fr.design.mainframe.EastRegionContainerPane.standard=480*400 diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties index 9aa1bde25b..8a0a06bf2b 100644 --- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties +++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties @@ -29,3 +29,6 @@ com.fr.design.formula.FormulaPaneWhenReserveFormula=900*600 com.fr.design.mainframe.mobile.ui.MobileStyleDefinePane.configLabel=75*20 com.fr.design.mainframe.mobile.utils.DesignerUtils.configLabel=100*20 com.fr.design.update.ui.dialog.UpdateMainDialog.updateButton=80*24 +com.fr.design.mainframe.EastRegionContainerPane.maximum=500*400 +com.fr.design.mainframe.EastRegionContainerPane.minimum=340*400 +com.fr.design.mainframe.EastRegionContainerPane.standard=340*400 diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties index c9b48d9b7f..484f747bb3 100644 --- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties +++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties @@ -29,3 +29,6 @@ com.fr.design.formula.FormulaPaneWhenReserveFormula=900*600 com.fr.design.mainframe.mobile.ui.MobileStyleDefinePane.configLabel=75*20 com.fr.design.mainframe.mobile.utils.DesignerUtils.configLabel=100*20 com.fr.design.update.ui.dialog.UpdateMainDialog.updateButton=80*24 +com.fr.design.mainframe.EastRegionContainerPane.maximum=400*400 +com.fr.design.mainframe.EastRegionContainerPane.minimum=286*400 +com.fr.design.mainframe.EastRegionContainerPane.standard=286*400 diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties index 6296fb0c87..2faed5896d 100644 --- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties +++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties @@ -28,3 +28,6 @@ com.fr.design.formula.FormulaPaneWhenReserveFormula=900*600 com.fr.design.mainframe.mobile.ui.MobileStyleDefinePane.configLabel=75*20 com.fr.design.mainframe.mobile.utils.DesignerUtils.configLabel=100*20 com.fr.design.update.ui.dialog.UpdateMainDialog.updateButton=80*24 +com.fr.design.mainframe.EastRegionContainerPane.maximum=400*400 +com.fr.design.mainframe.EastRegionContainerPane.minimum=286*400 +com.fr.design.mainframe.EastRegionContainerPane.standard=286*400 diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontNameAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontNameAction.java index c6f0f6416d..735802057e 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontNameAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontNameAction.java @@ -3,7 +3,6 @@ */ package com.fr.design.actions.cell.style; -import com.fine.theme.utils.FineUIScale; import com.fr.design.utils.DesignUtils; import com.fr.stable.os.OperatingSystem; import java.awt.Dimension; @@ -84,7 +83,7 @@ public class ReportFontNameAction extends AbstractStyleAction { UIComboBox itemComponent = new UIComboBox(DesignUtils.getAvailableFontFamilyNames4Report()); this.putValue(UIComboBox.class.getName(), itemComponent); //设置最佳宽度. - itemComponent.setPreferredSize(FineUIScale.scale(new Dimension(140, 24))); + itemComponent.setPreferredSize(new Dimension(150, 24)); itemComponent.setEnabled(this.isEnabled()); itemComponent.addActionListener(this); diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontSizeAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontSizeAction.java index 5a19a507bd..f9564a8a2e 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontSizeAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontSizeAction.java @@ -95,8 +95,8 @@ public class ReportFontSizeAction extends AbstractStyleAction { UIComboBox itemComponent = new UIComboBox(integerList); this.putValue(UIComboBox.class.getName(), itemComponent); - itemComponent.setMinimumSize(new Dimension(50, 20)); - itemComponent.setPreferredSize(new Dimension(50, 20)); + itemComponent.setMinimumSize(new Dimension(70, 24)); + itemComponent.setPreferredSize(new Dimension(70, 24)); itemComponent.setEnabled(this.isEnabled()); itemComponent.addActionListener(this); //需求字体大小可编辑 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 0483a4662d..e80002e52c 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 @@ -360,7 +360,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane { ).getComponent()) .addSupplier("showChar", () -> column(LayoutConstants.VERTICAL_GAP, cell(textOverflowCheckBox), - row(cell(showPartLabel).weight(1.2), cell(showPartComboBox).weight(1.6), flex(0.1), cell(numberLabel).weight(0.5), cell(showCharNums).weight(0.8)), + row(cell(showPartLabel).weight(1.2), cell(showPartComboBox).weight(1.4), flex(0.1), cell(numberLabel).weight(0.5), cell(showCharNums).weight(1.0)), row(cell(hideTypeLabel).weight(1.2), cell(textOverflowTypeComboBox).weight(3.0)) ).getComponent()) .addSupplier("showCell", () -> column(LayoutConstants.VERTICAL_GAP, 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 e741da25cd..5831e9aa0e 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 @@ -62,6 +62,7 @@ public class CellDesensitizationGroupsPane extends JPanel { private JPanel initAddPane(CellDesensitizationTableModel model) { UIButton addButton = new UIButton(model.getAction()); UILabel addLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_Desensitization_Setting")); + addLabel.setToolTipText(Toolkit.i18nText("Fine-Design_Report_Desensitization_Setting")); return Layouts.row( cell(addLabel).weight(1.2), cell(addButton).weight(3.0)