From 12b30ab68faae87ad84fc6b4b17fae99ae3e336b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Levy=2EXie-=E8=A7=A3=E5=AE=89=E6=A3=AE?= Date: Tue, 24 Sep 2024 20:22:57 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=97=A0jira=20=E8=87=AA=E6=9F=A5newui?= =?UTF-8?q?=E7=BB=86=E8=8A=82=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../condition/ConditionAttributesPane.java | 7 +-- .../connect/ConnectionTableProcedurePane.java | 5 ++- .../fr/design/javascript/JSContentPane.java | 14 ++---- .../JSContentWithDescriptionPane.java | 43 +++++++++++-------- 4 files changed, 32 insertions(+), 37 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java b/designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java index 62882fd028..c7bfe98e22 100644 --- a/designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java +++ b/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.utils.FineUIScale; import com.fine.theme.utils.FineUIUtils; -import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.common.annotations.Open; import com.fr.design.actions.UpdateAction; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.border.FineBorderFactory; import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.menu.ToolBarDef; @@ -19,7 +19,6 @@ import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.JScrollPane; import java.awt.BorderLayout; -import java.awt.Color; import java.awt.Dimension; import java.util.Iterator; import java.util.LinkedHashMap; @@ -73,13 +72,11 @@ public abstract class ConditionAttributesPane extends BasicBeanPane { UIToolbar toolBar = ToolBarDef.createJToolBar(); toolBar.setLayout(new BorderLayout()); - toolBar.setBorder(new FineRoundBorder()); - toolBar.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); toolbarDef.updateToolBar(toolBar); addItemPane.add(toolBar, BorderLayout.WEST); - addItemPane.setBorder(new FineRoundBorder()); + addItemPane.setBorder(FineBorderFactory.createWrappedRoundBorder()); addItemPane.setPreferredSize(new Dimension(addItemPane.getPreferredSize().width, FineUIScale.scale(24))); selectedItemPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java index e441b0266a..7e13e49175 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java @@ -1,13 +1,13 @@ package com.fr.design.data.datapane.connect; import com.fine.theme.icon.LazyIcon; -import com.fine.theme.light.ui.FineRoundBorder; import com.fine.theme.utils.FineUIScale; import com.formdev.flatlaf.ui.FlatUIUtils; import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.data.core.db.TableProcedure; import com.fr.data.impl.AbstractDatabaseConnection; import com.fr.data.impl.Connection; +import com.fr.design.border.FineBorderFactory; import com.fr.design.border.UIRoundedBorder; import com.fr.design.constants.UIConstants; 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")); searchLabel.setBorder(new ScaledEmptyBorder(0, 3, 0, 3)); 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)); return panel; } diff --git a/designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java b/designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java index c63c027841..401065a010 100644 --- a/designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java +++ b/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.utils.FineUIUtils; -import com.fr.base.svg.IconUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.DesignerEnvManager; -import com.fr.design.border.UIRoundedBorder; import com.fr.design.constants.KeyWords; -import com.fr.design.constants.UIConstants; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; 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.js.JavaScriptImpl; -import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.KeyStroke; import javax.swing.SwingConstants; @@ -42,8 +39,6 @@ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; 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.cell; @@ -51,10 +46,9 @@ public class JSContentPane extends BasicPane { protected RSyntaxTextArea contentTextArea; private UILabel funNameLabel = new UILabel(); private AutoCompletion ac; - private static final Dimension FUNCTION_NAME_LABEL_SIZE = new Dimension(300, 80); private String[] defaultArgs; private int titleWidth = 180; - private JPanel labelPane = new JPanel(); + private JPanel labelPane = new JPanel(FRGUIPaneFactory.createScaledBorderLayout(10, 0)); private NewJavaScriptImplPane newJavaScriptImplPane = null; private JavaScriptImpl javaScript; private JSImplUpdateAction jsImplUpdateAction; @@ -189,17 +183,15 @@ public class JSContentPane extends BasicPane { }.execute(); } }); - labelPane.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0)); labelPane.add(label,BorderLayout.CENTER); JPanel jsParaPane = new JPanel(new BorderLayout()); funNameLabel.setBackground(FineUIUtils.getUIColor("background.normal", "background.normal")); UIScrollPane scrollPane = new UIScrollPane(funNameLabel); scrollPane.setOpaque(true); - scrollPane.setBorder(new UIRoundedBorder(UIConstants.TITLED_BORDER_COLOR, 1, UIConstants.ARC)); jsParaPane.add(row(4, cell(scrollPane).weight(1), cell(labelPane) - ).getComponent()); + ).with(it -> it.setBorder(new ScaledEmptyBorder(0, 0, 0, 10))).getComponent()); return jsParaPane; } diff --git a/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java b/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java index 47f9898def..cdd7601c35 100644 --- a/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java +++ b/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java @@ -1,9 +1,11 @@ package com.fr.design.javascript; 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.design.border.UIRoundedBorder; -import com.fr.design.constants.UIConstants; +import com.fr.design.border.FineBorderFactory; import com.fr.design.gui.autocomplete.AutoCompleteExtraRefreshComponent; import com.fr.design.gui.autocomplete.BasicCompletion; import com.fr.design.gui.autocomplete.CompletionCellRenderer; @@ -54,7 +56,6 @@ import java.awt.Color; import java.awt.Component; import java.awt.Cursor; import java.awt.Desktop; -import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.FocusAdapter; @@ -72,7 +73,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; -import java.util.Locale; import java.util.concurrent.ExecutionException; public class JSContentWithDescriptionPane extends JSContentPane implements KeyListener { @@ -424,27 +424,27 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi JPanel mainPane = new JPanel(card); initHelpDocumentList(); UIScrollPane helpDOCScrollPane = new UIScrollPane(helpDOCList); - helpDOCScrollPane.setPreferredSize(new Dimension(200, 200)); + helpDOCScrollPane.setPreferredSize(FineUIScale.createScaleDimension(200, 200)); helpDOCScrollPane.setBorder(null); mainPane.add(helpDOCScrollPane, DOC_LIST_CARD); UILabel imageLabel = new UILabel(); 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(); - imagePane.setBorder(BorderFactory.createEmptyBorder(0, 42, 0, 0)); + imagePane.setBorder(new ScaledEmptyBorder(0, 42, 0, 0)); imagePane.add(imageLabel); imagePane.setBackground(Color.WHITE); 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); reloadLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); - reloadLabel.setPreferredSize(new Dimension(180, 20)); + reloadLabel.setPreferredSize(FineUIScale.createScaleDimension(180, 20)); reloadLabel.setForeground(Color.blue); 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.add(imagePane); labelPane.add(failedLabel); @@ -506,7 +506,7 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); if (value instanceof HelpDocument) { this.setText(((HelpDocument) value).getName()); - this.setForeground(Color.BLUE); + this.setForeground(FlatUIUtils.getUIColor("brand.normal", Color.BLUE)); } return this; } @@ -545,10 +545,12 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi private void initDescriptionArea(JPanel descriptionPanel) { descriptionTextArea = new UITextArea(); + descriptionTextArea.setBorder(null); 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); - descriptionTextArea.setBackground(Color.white); + descriptionTextArea.setBackground(FlatUIUtils.getUIColor("fill.normal", Color.WHITE)); descriptionTextArea.setLineWrap(true); descriptionTextArea.setWrapStyleWord(true); descriptionTextArea.setEditable(false); @@ -581,10 +583,12 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi private void initInterfaceModuleTree(JPanel interfacePanel) { moduleTree = new JTree(); + FineUIStyle.setStyle(moduleTree, FineUIStyle.PURE_TREE); + 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); - moduleTreePane.setPreferredSize(new Dimension(180, 200)); + moduleTreePane.setPreferredSize(FineUIScale.createScaleDimension(180, 200)); moduleTree.setRootVisible(false); moduleTree.setShowsRootHandles(true); @@ -648,13 +652,14 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi private void initInterfaceNameList(JPanel interfacePanel) { interfaceNameList = new JList(new DefaultListModel()); + FineUIStyle.setStyle(interfaceNameList, FineUIStyle.PURE_LIST); UIScrollPane interfaceNamePanelScrollPane = new UIScrollPane(interfaceNameList); - interfaceNamePanelScrollPane.setPreferredSize(new Dimension(180, 200)); + interfaceNamePanelScrollPane.setPreferredSize(FineUIScale.createScaleDimension(180, 200)); interfacePanel.add( this.createNamePane(Toolkit.i18nText("Fine-Design_Interface") + ":", interfaceNamePanelScrollPane), BorderLayout.CENTER); - interfaceNamePanelScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC)); + interfaceNamePanelScrollPane.setBorder(FineBorderFactory.createWrappedRoundBorder()); initInterfaceNameModule(); initInterfaceNameListSelectionListener(); initInterfaceNameListMouseListener(); @@ -857,8 +862,8 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi popupMenu = new JPopupMenu(); JScrollPane tipsScrollPane = new JScrollPane(tipsList); popupMenu.add(tipsScrollPane); - tipsScrollPane.setPreferredSize(new Dimension(220, 146)); - tipsScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC)); + tipsScrollPane.setPreferredSize(FineUIScale.createScaleDimension(220, 146)); + tipsScrollPane.setBorder(FineBorderFactory.createWrappedRoundBorder()); } private void popTips() { From 26955702ee050dc73321f29bd2ececef97983e24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Levy=2EXie-=E8=A7=A3=E5=AE=89=E6=A3=AE?= Date: Tue, 24 Sep 2024 20:23:38 +0800 Subject: [PATCH 2/2] =?UTF-8?q?REPORT-130379=20fix:NewUI=E5=AF=8C=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E7=BC=96=E8=BE=91=E5=99=A8=E5=AD=97=E4=BD=93=E7=BC=A9?= =?UTF-8?q?=E6=94=BE=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/report/RichTextEditingPane.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/designer-realize/src/main/java/com/fr/design/report/RichTextEditingPane.java b/designer-realize/src/main/java/com/fr/design/report/RichTextEditingPane.java index 39061a4b6d..12efcceab6 100644 --- a/designer-realize/src/main/java/com/fr/design/report/RichTextEditingPane.java +++ b/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.RichTextConverter; +import java.awt.Font; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; import javax.swing.text.DefaultHighlighter; +import javax.swing.text.DefaultStyledDocument; import javax.swing.text.Element; import javax.swing.text.Highlighter; import javax.swing.text.StyledDocument; @@ -27,6 +29,8 @@ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; +import static com.formdev.flatlaf.util.UIScale.scale; + /** * 富文本的编辑区域 * @@ -50,6 +54,22 @@ public class RichTextEditingPane extends UITextPane{ public RichTextEditingPane() { this.addMouseListener(doubleClickFormulaListener); 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; + } } /**