Browse Source

Pull request #14902: REPORT-130379 fix:NewUI富文本编辑器字体缩放适配

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

* commit '26955702ee050dc73321f29bd2ececef97983e24':
  REPORT-130379 fix:NewUI富文本编辑器字体缩放适配
  无jira 自查newui细节问题处理
fbp/merge
Levy.Xie-解安森 3 months ago
parent
commit
277bd5ec93
  1. 7
      designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java
  2. 5
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java
  3. 14
      designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java
  4. 43
      designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java
  5. 20
      designer-realize/src/main/java/com/fr/design/report/RichTextEditingPane.java

7
designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java

@ -5,10 +5,10 @@ import com.fine.theme.icon.LazyIcon;
import com.fine.theme.light.ui.FineRoundBorder; import com.fine.theme.light.ui.FineRoundBorder;
import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIUtils; import com.fine.theme.utils.FineUIUtils;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.fr.common.annotations.Open; import com.fr.common.annotations.Open;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.border.FineBorderFactory;
import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
@ -19,7 +19,6 @@ import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
@ -73,13 +72,11 @@ public abstract class ConditionAttributesPane<T> extends BasicBeanPane<T> {
UIToolbar toolBar = ToolBarDef.createJToolBar(); UIToolbar toolBar = ToolBarDef.createJToolBar();
toolBar.setLayout(new BorderLayout()); toolBar.setLayout(new BorderLayout());
toolBar.setBorder(new FineRoundBorder());
toolBar.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE));
toolbarDef.updateToolBar(toolBar); toolbarDef.updateToolBar(toolBar);
addItemPane.add(toolBar, BorderLayout.WEST); addItemPane.add(toolBar, BorderLayout.WEST);
addItemPane.setBorder(new FineRoundBorder()); addItemPane.setBorder(FineBorderFactory.createWrappedRoundBorder());
addItemPane.setPreferredSize(new Dimension(addItemPane.getPreferredSize().width, FineUIScale.scale(24))); addItemPane.setPreferredSize(new Dimension(addItemPane.getPreferredSize().width, FineUIScale.scale(24)));
selectedItemPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); selectedItemPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane();

5
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java

@ -1,13 +1,13 @@
package com.fr.design.data.datapane.connect; package com.fr.design.data.datapane.connect;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.icon.LazyIcon;
import com.fine.theme.light.ui.FineRoundBorder;
import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIScale;
import com.formdev.flatlaf.ui.FlatUIUtils; import com.formdev.flatlaf.ui.FlatUIUtils;
import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.data.core.db.TableProcedure; import com.fr.data.core.db.TableProcedure;
import com.fr.data.impl.AbstractDatabaseConnection; import com.fr.data.impl.AbstractDatabaseConnection;
import com.fr.data.impl.Connection; import com.fr.data.impl.Connection;
import com.fr.design.border.FineBorderFactory;
import com.fr.design.border.UIRoundedBorder; import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.data.tabledata.tabledatapane.loading.SwitchableTableDataPane; import com.fr.design.data.tabledata.tabledatapane.loading.SwitchableTableDataPane;
@ -175,7 +175,8 @@ public class ConnectionTableProcedurePane extends BasicPane {
UILabel searchLabel = new UILabel(new LazyIcon("search")); UILabel searchLabel = new UILabel(new LazyIcon("search"));
searchLabel.setBorder(new ScaledEmptyBorder(0, 3, 0, 3)); searchLabel.setBorder(new ScaledEmptyBorder(0, 3, 0, 3));
searchField.setBorder(null); searchField.setBorder(null);
panel.add(row(cell(searchLabel), cell(searchField).weight(1)).with(it -> it.setBorder(new FineRoundBorder())).getComponent()); panel.add(row(cell(searchLabel), cell(searchField).weight(1)).with(
it -> it.setBorder(FineBorderFactory.createWrappedRoundBorder())).getComponent());
panel.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); panel.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE));
return panel; return panel;
} }

14
designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java

@ -2,11 +2,9 @@ package com.fr.design.javascript;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineUIUtils; import com.fine.theme.utils.FineUIUtils;
import com.fr.base.svg.IconUtils; import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.KeyWords; import com.fr.design.constants.KeyWords;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
@ -27,7 +25,6 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.js.JavaScriptImpl; import com.fr.js.JavaScriptImpl;
import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.KeyStroke; import javax.swing.KeyStroke;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
@ -42,8 +39,6 @@ import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.ArrayList; import java.util.ArrayList;
import static com.fine.swing.ui.layout.Layouts.fix;
import static com.fine.swing.ui.layout.Layouts.flex;
import static com.fine.swing.ui.layout.Layouts.row; import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.cell;
@ -51,10 +46,9 @@ public class JSContentPane extends BasicPane {
protected RSyntaxTextArea contentTextArea; protected RSyntaxTextArea contentTextArea;
private UILabel funNameLabel = new UILabel(); private UILabel funNameLabel = new UILabel();
private AutoCompletion ac; private AutoCompletion ac;
private static final Dimension FUNCTION_NAME_LABEL_SIZE = new Dimension(300, 80);
private String[] defaultArgs; private String[] defaultArgs;
private int titleWidth = 180; private int titleWidth = 180;
private JPanel labelPane = new JPanel(); private JPanel labelPane = new JPanel(FRGUIPaneFactory.createScaledBorderLayout(10, 0));
private NewJavaScriptImplPane newJavaScriptImplPane = null; private NewJavaScriptImplPane newJavaScriptImplPane = null;
private JavaScriptImpl javaScript; private JavaScriptImpl javaScript;
private JSImplUpdateAction jsImplUpdateAction; private JSImplUpdateAction jsImplUpdateAction;
@ -189,17 +183,15 @@ public class JSContentPane extends BasicPane {
}.execute(); }.execute();
} }
}); });
labelPane.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0));
labelPane.add(label,BorderLayout.CENTER); labelPane.add(label,BorderLayout.CENTER);
JPanel jsParaPane = new JPanel(new BorderLayout()); JPanel jsParaPane = new JPanel(new BorderLayout());
funNameLabel.setBackground(FineUIUtils.getUIColor("background.normal", "background.normal")); funNameLabel.setBackground(FineUIUtils.getUIColor("background.normal", "background.normal"));
UIScrollPane scrollPane = new UIScrollPane(funNameLabel); UIScrollPane scrollPane = new UIScrollPane(funNameLabel);
scrollPane.setOpaque(true); scrollPane.setOpaque(true);
scrollPane.setBorder(new UIRoundedBorder(UIConstants.TITLED_BORDER_COLOR, 1, UIConstants.ARC));
jsParaPane.add(row(4, jsParaPane.add(row(4,
cell(scrollPane).weight(1), cell(scrollPane).weight(1),
cell(labelPane) cell(labelPane)
).getComponent()); ).with(it -> it.setBorder(new ScaledEmptyBorder(0, 0, 0, 10))).getComponent());
return jsParaPane; return jsParaPane;
} }

43
designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java

@ -1,9 +1,11 @@
package com.fr.design.javascript; package com.fr.design.javascript;
import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIStyle;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.base.svg.IconUtils; import com.fr.base.svg.IconUtils;
import com.fr.design.border.UIRoundedBorder; import com.fr.design.border.FineBorderFactory;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.autocomplete.AutoCompleteExtraRefreshComponent; import com.fr.design.gui.autocomplete.AutoCompleteExtraRefreshComponent;
import com.fr.design.gui.autocomplete.BasicCompletion; import com.fr.design.gui.autocomplete.BasicCompletion;
import com.fr.design.gui.autocomplete.CompletionCellRenderer; import com.fr.design.gui.autocomplete.CompletionCellRenderer;
@ -54,7 +56,6 @@ import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Cursor; import java.awt.Cursor;
import java.awt.Desktop; import java.awt.Desktop;
import java.awt.Dimension;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.FocusAdapter; import java.awt.event.FocusAdapter;
@ -72,7 +73,6 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
public class JSContentWithDescriptionPane extends JSContentPane implements KeyListener { public class JSContentWithDescriptionPane extends JSContentPane implements KeyListener {
@ -424,27 +424,27 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi
JPanel mainPane = new JPanel(card); JPanel mainPane = new JPanel(card);
initHelpDocumentList(); initHelpDocumentList();
UIScrollPane helpDOCScrollPane = new UIScrollPane(helpDOCList); UIScrollPane helpDOCScrollPane = new UIScrollPane(helpDOCList);
helpDOCScrollPane.setPreferredSize(new Dimension(200, 200)); helpDOCScrollPane.setPreferredSize(FineUIScale.createScaleDimension(200, 200));
helpDOCScrollPane.setBorder(null); helpDOCScrollPane.setBorder(null);
mainPane.add(helpDOCScrollPane, DOC_LIST_CARD); mainPane.add(helpDOCScrollPane, DOC_LIST_CARD);
UILabel imageLabel = new UILabel(); UILabel imageLabel = new UILabel();
imageLabel.setIcon(IconUtils.readIcon("com/fr/design/javascript/jsapi/images/connectFailed.svg")); imageLabel.setIcon(IconUtils.readIcon("com/fr/design/javascript/jsapi/images/connectFailed.svg"));
imageLabel.setPreferredSize(new Dimension(180, 65)); imageLabel.setPreferredSize(FineUIScale.createScaleDimension(180, 65));
JPanel imagePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel imagePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
imagePane.setBorder(BorderFactory.createEmptyBorder(0, 42, 0, 0)); imagePane.setBorder(new ScaledEmptyBorder(0, 42, 0, 0));
imagePane.add(imageLabel); imagePane.add(imageLabel);
imagePane.setBackground(Color.WHITE); imagePane.setBackground(Color.WHITE);
UILabel failedLabel = new UILabel(Toolkit.i18nText("Fine-Design_Net_Connect_Failed"), 0); UILabel failedLabel = new UILabel(Toolkit.i18nText("Fine-Design_Net_Connect_Failed"), 0);
failedLabel.setPreferredSize(new Dimension(180, 20)); failedLabel.setPreferredSize(FineUIScale.createScaleDimension(180, 20));
UILabel reloadLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Reload"), 0); UILabel reloadLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Reload"), 0);
reloadLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); reloadLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
reloadLabel.setPreferredSize(new Dimension(180, 20)); reloadLabel.setPreferredSize(FineUIScale.createScaleDimension(180, 20));
reloadLabel.setForeground(Color.blue); reloadLabel.setForeground(Color.blue);
JPanel labelPane = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, 0, 0, 0); JPanel labelPane = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, 0, 0, 0);
labelPane.setBorder(BorderFactory.createEmptyBorder(35, 45, 0, 0)); labelPane.setBorder(new ScaledEmptyBorder(35, 45, 0, 0));
labelPane.setBackground(Color.WHITE); labelPane.setBackground(Color.WHITE);
labelPane.add(imagePane); labelPane.add(imagePane);
labelPane.add(failedLabel); labelPane.add(failedLabel);
@ -506,7 +506,7 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value instanceof HelpDocument) { if (value instanceof HelpDocument) {
this.setText(((HelpDocument) value).getName()); this.setText(((HelpDocument) value).getName());
this.setForeground(Color.BLUE); this.setForeground(FlatUIUtils.getUIColor("brand.normal", Color.BLUE));
} }
return this; return this;
} }
@ -545,10 +545,12 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi
private void initDescriptionArea(JPanel descriptionPanel) { private void initDescriptionArea(JPanel descriptionPanel) {
descriptionTextArea = new UITextArea(); descriptionTextArea = new UITextArea();
descriptionTextArea.setBorder(null);
UIScrollPane descriptionScrollPane = new UIScrollPane(descriptionTextArea); UIScrollPane descriptionScrollPane = new UIScrollPane(descriptionTextArea);
descriptionScrollPane.setPreferredSize(new Dimension(300, 200)); descriptionScrollPane.setBorder(FineBorderFactory.createWrappedRoundBorder());
descriptionScrollPane.setPreferredSize(FineUIScale.createScaleDimension(300, 200));
descriptionPanel.add(this.createNamePane(Toolkit.i18nText("Fine-Design_Interface_Description"), descriptionScrollPane), BorderLayout.CENTER); descriptionPanel.add(this.createNamePane(Toolkit.i18nText("Fine-Design_Interface_Description"), descriptionScrollPane), BorderLayout.CENTER);
descriptionTextArea.setBackground(Color.white); descriptionTextArea.setBackground(FlatUIUtils.getUIColor("fill.normal", Color.WHITE));
descriptionTextArea.setLineWrap(true); descriptionTextArea.setLineWrap(true);
descriptionTextArea.setWrapStyleWord(true); descriptionTextArea.setWrapStyleWord(true);
descriptionTextArea.setEditable(false); descriptionTextArea.setEditable(false);
@ -581,10 +583,12 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi
private void initInterfaceModuleTree(JPanel interfacePanel) { private void initInterfaceModuleTree(JPanel interfacePanel) {
moduleTree = new JTree(); moduleTree = new JTree();
FineUIStyle.setStyle(moduleTree, FineUIStyle.PURE_TREE);
UIScrollPane moduleTreePane = new UIScrollPane(moduleTree); UIScrollPane moduleTreePane = new UIScrollPane(moduleTree);
moduleTreePane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC)); moduleTreePane.setBorder(FineBorderFactory.createWrappedRoundBorder());
interfacePanel.add(this.createNamePane(Toolkit.i18nText("Fine-Design_Module"), moduleTreePane), BorderLayout.WEST); interfacePanel.add(this.createNamePane(Toolkit.i18nText("Fine-Design_Module"), moduleTreePane), BorderLayout.WEST);
moduleTreePane.setPreferredSize(new Dimension(180, 200)); moduleTreePane.setPreferredSize(FineUIScale.createScaleDimension(180, 200));
moduleTree.setRootVisible(false); moduleTree.setRootVisible(false);
moduleTree.setShowsRootHandles(true); moduleTree.setShowsRootHandles(true);
@ -648,13 +652,14 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi
private void initInterfaceNameList(JPanel interfacePanel) { private void initInterfaceNameList(JPanel interfacePanel) {
interfaceNameList = new JList(new DefaultListModel()); interfaceNameList = new JList(new DefaultListModel());
FineUIStyle.setStyle(interfaceNameList, FineUIStyle.PURE_LIST);
UIScrollPane interfaceNamePanelScrollPane = new UIScrollPane(interfaceNameList); UIScrollPane interfaceNamePanelScrollPane = new UIScrollPane(interfaceNameList);
interfaceNamePanelScrollPane.setPreferredSize(new Dimension(180, 200)); interfaceNamePanelScrollPane.setPreferredSize(FineUIScale.createScaleDimension(180, 200));
interfacePanel.add( interfacePanel.add(
this.createNamePane(Toolkit.i18nText("Fine-Design_Interface") + ":", interfaceNamePanelScrollPane), this.createNamePane(Toolkit.i18nText("Fine-Design_Interface") + ":", interfaceNamePanelScrollPane),
BorderLayout.CENTER); BorderLayout.CENTER);
interfaceNamePanelScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC)); interfaceNamePanelScrollPane.setBorder(FineBorderFactory.createWrappedRoundBorder());
initInterfaceNameModule(); initInterfaceNameModule();
initInterfaceNameListSelectionListener(); initInterfaceNameListSelectionListener();
initInterfaceNameListMouseListener(); initInterfaceNameListMouseListener();
@ -857,8 +862,8 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi
popupMenu = new JPopupMenu(); popupMenu = new JPopupMenu();
JScrollPane tipsScrollPane = new JScrollPane(tipsList); JScrollPane tipsScrollPane = new JScrollPane(tipsList);
popupMenu.add(tipsScrollPane); popupMenu.add(tipsScrollPane);
tipsScrollPane.setPreferredSize(new Dimension(220, 146)); tipsScrollPane.setPreferredSize(FineUIScale.createScaleDimension(220, 146));
tipsScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC)); tipsScrollPane.setBorder(FineBorderFactory.createWrappedRoundBorder());
} }
private void popTips() { private void popTips() {

20
designer-realize/src/main/java/com/fr/design/report/RichTextEditingPane.java

@ -14,12 +14,14 @@ import com.fr.log.FineLoggerFactory;
import com.fr.report.cell.cellattr.core.RichText; import com.fr.report.cell.cellattr.core.RichText;
import com.fr.report.cell.cellattr.core.RichTextConverter; import com.fr.report.cell.cellattr.core.RichTextConverter;
import java.awt.Font;
import java.awt.event.FocusAdapter; import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent; import java.awt.event.FocusEvent;
import java.awt.event.FocusListener; import java.awt.event.FocusListener;
import javax.swing.text.AttributeSet; import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException; import javax.swing.text.BadLocationException;
import javax.swing.text.DefaultHighlighter; import javax.swing.text.DefaultHighlighter;
import javax.swing.text.DefaultStyledDocument;
import javax.swing.text.Element; import javax.swing.text.Element;
import javax.swing.text.Highlighter; import javax.swing.text.Highlighter;
import javax.swing.text.StyledDocument; import javax.swing.text.StyledDocument;
@ -27,6 +29,8 @@ import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseListener; import java.awt.event.MouseListener;
import static com.formdev.flatlaf.util.UIScale.scale;
/** /**
* 富文本的编辑区域 * 富文本的编辑区域
* *
@ -50,6 +54,22 @@ public class RichTextEditingPane extends UITextPane{
public RichTextEditingPane() { public RichTextEditingPane() {
this.addMouseListener(doubleClickFormulaListener); this.addMouseListener(doubleClickFormulaListener);
this.addFocusListener(focusListener); this.addFocusListener(focusListener);
setDocument(new ScaledStyledDocument());
}
/**
* 支持字体缩放的Document对象
*/
public static class ScaledStyledDocument extends DefaultStyledDocument {
@Override
public Font getFont(AttributeSet a) {
Font font = super.getFont(a);
if (font != null) {
return font.deriveFont(font.getStyle(), scale(font.getSize()));
}
return null;
}
} }
/** /**

Loading…
Cancel
Save