Browse Source

Pull request #14732: REPORT-132283 & REPORT-132512 & REPORT-132661 & REPORT-130846 & REPORT-132274 【NewUI】东区支持拖拽 & 修复细节问题

Merge in DESIGN/design from ~LEVY.XIE/design:fbp/release to fbp/release

* commit '6d8b49ce602b2df6e3484e60cb344b95d39dbe98':
  REPORT-132512 & REPORT-132661 & REPORT-130846 & REPORT-132274 fix: NewUI细节问题修复
  REPORT-132283 feat: NewUI支持东区面板拖拽大小
  REPORT-132283 feat: NewUI支持东区面板拖拽大小
fbp/release
Levy.Xie-解安森 3 months ago
parent
commit
6e74d4f01c
  1. 13
      designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java
  2. 1
      designer-base/src/main/java/com/fr/design/data/datapane/sqlpane/SQLEditPane.java
  3. 127
      designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java
  4. 11
      designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java
  5. 11
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java
  6. 3
      designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties
  7. 3
      designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties
  8. 3
      designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties
  9. 3
      designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties
  10. 3
      designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties
  11. 3
      designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontNameAction.java
  12. 4
      designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontSizeAction.java
  13. 2
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java
  14. 1
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/CellDesensitizationGroupsPane.java

13
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));
}
}

1
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);
}

127
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
}
};

11
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();
}
});
}

11
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;
}
/**

3
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

3
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

3
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

3
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

3
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

3
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);

4
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);
//需求字体大小可编辑

2
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,

1
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)

Loading…
Cancel
Save