From da67399d434cc25ec778919cc670d6e59eb50038 Mon Sep 17 00:00:00 2001 From: renekton Date: Sat, 17 Aug 2024 16:01:18 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BE=B9=E6=A1=86=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/file/SaveSomeTemplatePane.java | 8 ++- .../design/gui/controlpane/UIControlPane.java | 9 +-- .../controlpane/UIListGroupControlPane.java | 15 +++-- .../fr/design/gui/date/UICalendarPanel.java | 44 ++++++++------ .../javascript/Commit2DBJavaScriptPane.java | 14 ++++- .../ImageBackgroundQuickPane.java | 4 +- .../DBManipulationInWidgetEventPane.java | 19 ++++-- .../write/submit/DBManipulationPane.java | 59 +++++++++++-------- .../designer/component/LineTypeComboBox.java | 8 ++- .../widget/FloatWidgetManageCardPane.java | 1 + ...InsertDBManipulationInWidgetEventPane.java | 14 +++-- 11 files changed, 122 insertions(+), 73 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java b/designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java index de8ca831d9..8ee5c61fb2 100644 --- a/designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java +++ b/designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java @@ -1,5 +1,7 @@ package com.fr.design.file; +import com.fine.theme.light.ui.FineRoundBorder; +import com.formdev.flatlaf.util.SystemInfo; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; @@ -8,6 +10,7 @@ import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilist.UIList; +import com.fr.design.gui.iscrollbar.UIScrollBarUI; import com.fr.design.gui.itree.checkboxtree.NullTristateCheckBox; import com.fr.design.gui.itree.checkboxtree.TristateCheckBox; import com.fr.design.layout.FRGUIPaneFactory; @@ -81,13 +84,16 @@ public class SaveSomeTemplatePane extends BasicPane { this.add(tip, BorderLayout.NORTH); templatesChoosePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); UIScrollPane scrollPane = new UIScrollPane(templatesChoosePane); + scrollPane.setBorder(new FineRoundBorder()); + if (SystemInfo.isWindows) { + scrollPane.getVerticalScrollBar().setUI(new UIScrollBarUI()); + } this.add(scrollPane, BorderLayout.CENTER); this.isJudgeCurrentEditingTemplate = isNeedTojudgeCurrent; } private void initTemplatesChoosePane(boolean judgeJTemplateMustSave) { - templatesChoosePane.setBorder(BorderFactory.createTitledBorder("")); for (int i = 0; i < unSavedTemplate.size(); i++) { templateCheckBoxes[i] = new UICheckBox(unSavedTemplate.get(i).getEditingFILE().getName()); templateCheckBoxes[i].setSelected(true); diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java index cb305f9cc4..890fc5885d 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java @@ -49,6 +49,7 @@ import java.awt.event.WindowEvent; import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.theme.utils.FineUIScale.scale; /** * Created by plough on 2017/7/21. @@ -199,7 +200,7 @@ public abstract class UIControlPane extends JControlPane { PopupEditDialog(JComponent pane) { super(DesignerContext.getDesignerFrame()); setUndecorated(true); - pane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + pane.setBorder(new ScaledEmptyBorder(10, 10, 10, 10)); this.editPane = pane; JPanel editPaneWrapper = new JPanel(new BorderLayout()); popupToolPane = new PopupToolPane(this); @@ -207,7 +208,7 @@ public abstract class UIControlPane extends JControlPane { editPaneWrapper.add(editPane, BorderLayout.CENTER); editPaneWrapper.setBorder(BorderFactory.createLineBorder(UIConstants.POP_DIALOG_BORDER, 1)); this.getContentPane().add(editPaneWrapper, BorderLayout.CENTER); - setSize(FineUIScale.scale(new Dimension(WIDTH, HEIGHT))); + setSize(scale(new Dimension(WIDTH, HEIGHT))); this.setVisible(false); initListener(); } @@ -375,7 +376,7 @@ public abstract class UIControlPane extends JControlPane { titleLabel = new UILabel(title); FineUIStyle.setStyle(titleLabel, FineUIStyle.LABEL_BOLD); contentPane.add(titleLabel, BorderLayout.WEST); - contentPane.setBorder(new EmptyBorder(5, 14, 6, 0)); + contentPane.setBorder(new ScaledEmptyBorder(5, 14, 6, 0)); setLayout(new BorderLayout()); add(contentPane, BorderLayout.CENTER); @@ -391,7 +392,7 @@ public abstract class UIControlPane extends JControlPane { @Override public Dimension getPreferredSize() { - return new Dimension(super.getPreferredSize().width, 28); + return new Dimension(super.getPreferredSize().width, scale(28)); } } } diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java index e1a507b55c..547900386b 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java @@ -44,6 +44,10 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.theme.utils.FineUIScale.scale; + /** * Created by kerry on 5/31/21 */ @@ -84,7 +88,7 @@ public abstract class UIListGroupControlPane extends UIControlPane implements Li @Override protected JPanel getLeftTopPane(UIToolbar topToolBar) { UIToolbar toolbar = getTopToolBar(); - toolbar.setPreferredSize(FineUIScale.scale(new Dimension(160, 24))); + toolbar.setPreferredSize(scale(new Dimension(160, 24))); return super.getLeftTopPane(topToolBar); } @@ -555,13 +559,12 @@ public abstract class UIListGroupControlPane extends UIControlPane implements Li super.paint(g); } }; - label.setBorder(BorderFactory.createMatteBorder(0, 0, FineUIScale.scale(1), 0, FineUIUtils.getUIColor("fill.hover", "fill.hover"))); + label.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, FineUIUtils.getUIColor("fill.hover", "fill.hover"))); label.setForeground(UIManager.getColor("List.wrapper.text.fontColor")); - label.setFont(label.getFont().deriveFont(11F)); - label.setPreferredSize(new Dimension(this.getPreferredSize().width, FineUIScale.scale(24))); + label.setFont(label.getFont().deriveFont(scale(11F))); + label.setPreferredSize(new Dimension(this.getPreferredSize().width, scale(24))); this.nameEdList = nameEdList; - this.add(label, BorderLayout.NORTH); - this.add(this.nameEdList, BorderLayout.CENTER); + this.add(column(cell(label), cell(this.nameEdList)).getComponent()); } public UINameEdList getNameEdList() { diff --git a/designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java b/designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java index 4532dfdeb4..18f44a0e6a 100644 --- a/designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java +++ b/designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java @@ -58,10 +58,16 @@ import java.util.Set; import static com.fine.theme.utils.FineUIScale.scale; public class UICalendarPanel extends JPanel { - private static final Font FONT_UI = DesignUtils.getDefaultGUIFont().applySize(12); - private static final Font FONT_BLACK = new Font(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Black_Font"), Font.PLAIN, 12); + private static final Font FONT_UI = DesignUtils.getDefaultGUIFont().applySize(scale(12)); + private static final Font FONT_BLACK = new Font(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Black_Font"), Font.PLAIN, scale(12)); private static final int WEEKDAY_COUNT = 7; private static final int TOTAL_DAYS_COUNT = 42; + + private static final int WIDTH = scale(31); + private static final int HEIGHT = scale(19); + private static final int START_X = scale(30); + private static final int START_Y = scale(19); + //卡顿日志所在地址 private static final String JOURNAL_FILE_PATH = StableUtils.pathJoin(ProductConstantsBase.getEnvHome(), "journal_log"); protected Color selectedBackground; @@ -432,7 +438,7 @@ public class UICalendarPanel extends JPanel { gp.setBorder(null); UIDayLabel label = new UIDayLabel(setupCalendar.getTime()); label.setHorizontalAlignment(SwingConstants.RIGHT); - label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 9)); + label.setBorder(new ScaledEmptyBorder(0, 0, 0, 9)); if ("1".equals(label.getText())) { isCurrentMonth = !isCurrentMonth; } @@ -655,12 +661,12 @@ public class UICalendarPanel extends JPanel { public void paint(Graphics g) { super.paint(g); - int width = 31; - int height = 19; + int width = UICalendarPanel.WIDTH; + int height = UICalendarPanel.HEIGHT; Color oldColor = g.getColor(); g.setColor(new Color(0xDADADA)); - int start_x = 30; - int start_y = 19; + int start_x = UICalendarPanel.START_X; + int start_y = UICalendarPanel.START_Y; for (int i = 0; i < 6; i++) { g.drawLine(start_x, 0, start_x, getHeight()); start_x += width; @@ -683,19 +689,19 @@ public class UICalendarPanel extends JPanel { private void paintChindPane(Graphics g, int index) { if (index % 7 == 0) { - int y1 = index / 7 * 19; - g.drawLine(0, y1, 30, y1); - g.drawLine(0, y1 + 19, 30, y1 + 19); - g.drawLine(30, y1, 30, y1 + 19); + int y1 = index / 7 * UICalendarPanel.HEIGHT; + g.drawLine(0, y1, UICalendarPanel.START_X, y1); + g.drawLine(0, y1 + UICalendarPanel.HEIGHT, UICalendarPanel.START_X, y1 + UICalendarPanel.HEIGHT); + g.drawLine(UICalendarPanel.START_X, y1, UICalendarPanel.START_X, y1 + UICalendarPanel.HEIGHT); } else if (index % 7 == 6) { - int y1 = index / 7 * 19; - g.drawLine(185, y1, 216, y1); - g.drawLine(185, y1 + 19, 216, y1 + 19); - g.drawLine(185, y1, 185, y1 + 19); + int y1 = index / 7 * UICalendarPanel.HEIGHT; + g.drawLine(scale(185), y1, scale(216), y1); + g.drawLine(scale(185), y1 + UICalendarPanel.HEIGHT, scale(216), y1 + UICalendarPanel.HEIGHT); + g.drawLine(scale(185), y1, scale(185), y1 + UICalendarPanel.HEIGHT); } else { - int x1 = index % 7 * 31 - 1; - int y1 = index / 7 * 19; - g.drawRect(x1, y1, 31, 19); + int x1 = index % 7 * UICalendarPanel.WIDTH - 1; + int y1 = index / 7 * UICalendarPanel.HEIGHT; + g.drawRect(x1, y1, UICalendarPanel.WIDTH, UICalendarPanel.HEIGHT); } } @@ -833,7 +839,7 @@ public class UICalendarPanel extends JPanel { uiLabel.setHorizontalAlignment(SwingConstants.CENTER); uiLabel.setBackground(null); uiLabel.setBorder(null); - uiLabel.setPreferredSize(new Dimension(6, 10)); + uiLabel.setPreferredSize(scale(new Dimension(6, 10))); return uiLabel; } diff --git a/designer-base/src/main/java/com/fr/design/javascript/Commit2DBJavaScriptPane.java b/designer-base/src/main/java/com/fr/design/javascript/Commit2DBJavaScriptPane.java index e5100b54b3..a475fa1cdb 100644 --- a/designer-base/src/main/java/com/fr/design/javascript/Commit2DBJavaScriptPane.java +++ b/designer-base/src/main/java/com/fr/design/javascript/Commit2DBJavaScriptPane.java @@ -1,8 +1,10 @@ package com.fr.design.javascript; +import com.fine.theme.utils.FineUIScale; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.gui.frpane.CommitTabbedPane; import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.write.submit.DBManipulationPane; import com.fr.js.Commit2DBJavaScript; @@ -15,6 +17,9 @@ import java.awt.Dimension; import java.util.ArrayList; import java.util.List; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.swing.ui.layout.Layouts.cell; + public class Commit2DBJavaScriptPane extends FurtherBasicBeanPane { private List dbmPaneList = new ArrayList(); private CommitTabbedPane commitTabbedPane; @@ -50,13 +55,18 @@ public class Commit2DBJavaScriptPane extends FurtherBasicBeanPane { // peter:编辑的TablePane JPanel editTablePane = new JPanel(new BorderLayout(FineUIScale.scale(10), 0)); - editTablePane.setBounds(0, 0, FineUIScale.scale(280), FineUIScale.scale(180)); + Dimension editTableDimension = createEditTablePreferredSize(); + editTablePane.setBounds(0, 0, editTableDimension.width, editTableDimension.height); keyColumnValuesTable = new KeyColumnNameValueTable(); editTablePane.add(new UIScrollPane(keyColumnValuesTable), BorderLayout.CENTER); keyColumnValuesTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); @@ -180,18 +181,15 @@ public class DBManipulationPane extends BasicBeanPane { cell(FineUIUtils.wrapComponentWithTitle(chooseTable, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_Table")))) .getComponent()); JPanel bottomPane = initBottomPane(); - this.add(new AttrScrollPane() { - @Override - protected JPanel createContentPane() { - JPanel contentPane = new JPanel(new BorderLayout()); - contentPane.add(column(10, - cell(northPane), - cell(FineUIUtils.wrapComponentWithTitle(editTablePane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_Value"))), - cell(bottomPane)) - .getComponent(), BorderLayout.CENTER); - return contentPane; - } - }); + + JPanel contentPane = new JPanel(new BorderLayout()); + contentPane.add(column(10, + cell(northPane), + cell(FineUIUtils.wrapComponentWithTitle(editTablePane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_Value"))), + cell(bottomPane)) + .getComponent(), BorderLayout.CENTER); + + this.add(new UIScrollPane(contentPane)); initJTableColumn(); @@ -264,17 +262,17 @@ public class DBManipulationPane extends BasicBeanPane { UpdateCheckBox.setEnabled(b); } - private JPanel initBottomPane() { + protected JPanel initBottomPane() { JPanel eventPane = new JPanel(new BorderLayout()); eventPane.setPreferredSize(createControlBtnPanePreferredSize()); - eventPane.add(addEventButton(), BorderLayout.WEST); + eventPane.add(addEventButton()); JPanel conditionPane = this.createConditionPane(); JPanel btPane = new JPanel(FRGUIPaneFactory.createBorderLayout()); btPane.add(column(5, cell(FineUIUtils.wrapComponentWithTitle(conditionPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Submit_Condition"))), - cell(eventPane) + row(cell(eventPane), cell(new UILabel())) ).getComponent()); return btPane; } @@ -315,8 +313,8 @@ public class DBManipulationPane extends BasicBeanPane { DefaultTreeCellRenderer cr = (DefaultTreeCellRenderer) conditionsTree.getCellRenderer(); cr.setForeground(UIConstants.NORMAL_BACKGROUND); JScrollPane jp = new JScrollPane(conditionsTree); - jp.setPreferredSize(FineUIScale.scale(new Dimension(0, 40))); - addComponent(conditionPane, jp); + jp.setPreferredSize(createJpPreferredSize()); + jp.setVisible(setJpVisible()); String submitCondition = Toolkit.i18nText("Fine-Design_Basic_Set_Submit_Condition"); UIButton addSubmitConditionButton = new UIButton(submitCondition); addSubmitConditionButton.setToolTipText(submitCondition); @@ -354,12 +352,11 @@ public class DBManipulationPane extends BasicBeanPane { }); JPanel controlBtnPane = new JPanel(new BorderLayout()); - controlBtnPane.setPreferredSize(FineUIScale.scale(new Dimension(122, 20))); + controlBtnPane.setPreferredSize(createControlBtnPanePreferredSize()); controlBtnPane.add(addSubmitConditionButton, BorderLayout.NORTH); - conditionPane.add(row( - cell(jp).weight(1.0), - cell(new Spacer(122).add(controlBtnPane)) - ).getComponent()); + conditionPane.setPreferredSize(createConditionPanePreferredSize()); + conditionPane.add(controlBtnPane, setControlBtnPanePosition()); + conditionPane.add(jp, BorderLayout.CENTER); return conditionPane; } @@ -372,13 +369,25 @@ public class DBManipulationPane extends BasicBeanPane { mainPane.add(addPane, BorderLayout.CENTER); } + protected Dimension createEditTablePreferredSize() { + return FineUIScale.scale(new Dimension(280, 180)); + } protected Dimension createConditionPanePreferredSize() { - return FineUIScale.scale(new Dimension(454, 80)); + return FineUIScale.scale(new Dimension(454, 60)); + } + + protected boolean setJpVisible() { + return true; } + protected Dimension createJpPreferredSize() { + return FineUIScale.scale(new Dimension(280, 60)); + } + + protected Dimension createControlBtnPanePreferredSize() { - return new Dimension(110, 20); + return FineUIScale.scale(new Dimension(110, 20)); } protected String setControlBtnPanePosition() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/LineTypeComboBox.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/LineTypeComboBox.java index 395d615926..bb9c858760 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/LineTypeComboBox.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/LineTypeComboBox.java @@ -14,6 +14,8 @@ import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; +import static com.fine.theme.utils.FineUIScale.scale; + /** * Created by shine on 2019/08/30. */ @@ -47,10 +49,10 @@ public class LineTypeComboBox extends UIComboBox { switch (this.lineType) { case SOLID: - GraphHelper.drawLine(g2d, 4, d.height / 2, d.width - 8, d.height / 2); + GraphHelper.drawLine(g2d, scale(4), d.height / 2, d.width - scale(8), d.height / 2); break; case DASHED: - GraphHelper.drawLine(g2d, 4, d.height / 2, d.width - 8, d.height / 2, Constants.LINE_DASH); + GraphHelper.drawLine(g2d, scale(4), d.height / 2, d.width - scale(8), d.height / 2, Constants.LINE_DASH); break; default: break; @@ -59,7 +61,7 @@ public class LineTypeComboBox extends UIComboBox { } public Dimension getPreferredSize() { - return new Dimension(60, 16); + return scale(new Dimension(60, 16)); } public Dimension getMinimumSize() { diff --git a/designer-realize/src/main/java/com/fr/design/widget/FloatWidgetManageCardPane.java b/designer-realize/src/main/java/com/fr/design/widget/FloatWidgetManageCardPane.java index be73821840..4a060a9a89 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/FloatWidgetManageCardPane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/FloatWidgetManageCardPane.java @@ -11,6 +11,7 @@ public class FloatWidgetManageCardPane extends EastCellWidgetCardPane { /** * 悬浮窗控件管理 + * @param pane 面板 */ public FloatWidgetManageCardPane(ElementCasePane pane) { super(pane); diff --git a/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationInWidgetEventPane.java b/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationInWidgetEventPane.java index 28a35ef2fd..476c664fe0 100644 --- a/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationInWidgetEventPane.java +++ b/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationInWidgetEventPane.java @@ -1,5 +1,7 @@ package com.fr.design.write.submit; +import com.fine.theme.utils.FineUIScale; +import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.ElementCasePane; import javax.swing.*; @@ -17,19 +19,19 @@ public class SmartInsertDBManipulationInWidgetEventPane extends SmartInsertDBMan super(ePane); } - protected void setBorderAndLayout(JPanel jPanel){ - jPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); - } - protected void addComponent(JPanel mainPane,JScrollPane addPane){ } protected Dimension createConditionPanePreferredSize(){ - return new Dimension(454, 30); + return FineUIScale.scale(new Dimension(454, 20)); + } + + protected boolean setJpVisible() { + return false; } protected Dimension createControlBtnPanePreferredSize(){ - return new Dimension(92, 20); + return FineUIScale.scale(new Dimension(110, 20)); } protected String setControlBtnPanePosition(){