From 89b7b0db9d4436d9d8d57e13254bb9312ff41387 Mon Sep 17 00:00:00 2001 From: lemon Date: Wed, 25 Sep 2024 16:44:15 +0800 Subject: [PATCH 1/3] =?UTF-8?q?REPORT-135492=20&=20REPORT-135490=20?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E5=B1=9E=E6=80=A7=E5=B8=83=E5=B1=80=E8=B0=83?= =?UTF-8?q?=E6=95=B4,=20=E5=A2=9E=E5=8A=A0=E5=AD=97=E4=BD=93=E7=9B=91?= =?UTF-8?q?=E5=90=AC=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/condition/SingleConditionPane.java | 26 ++++++----- .../java/com/fr/design/style/FRFontPane.java | 44 ++++++++++++------- .../light/ui/laf/FineLightLaf.properties | 2 +- .../com/fr/design/condition/BackPane.java | 12 ++--- .../design/condition/BorderHighlightPane.java | 7 ++- .../com/fr/design/condition/FontPane.java | 10 ++--- .../fr/design/condition/ForeGroundPane.java | 9 ++-- .../fr/design/condition/HyperlinkPane.java | 9 ++-- .../fr/design/condition/NewRealValuePane.java | 9 ++-- .../com/fr/design/condition/PaddingPane.java | 11 ++--- .../com/fr/design/condition/PagePane.java | 9 ++-- .../condition/PresentHighlightPane.java | 9 ++-- .../java/com/fr/design/condition/WHPane.java | 9 ++-- .../design/condition/WidgetHighlightPane.java | 9 ++-- 14 files changed, 89 insertions(+), 86 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/condition/SingleConditionPane.java b/designer-base/src/main/java/com/fr/design/condition/SingleConditionPane.java index cc98b6500c..a58d459bc6 100644 --- a/designer-base/src/main/java/com/fr/design/condition/SingleConditionPane.java +++ b/designer-base/src/main/java/com/fr/design/condition/SingleConditionPane.java @@ -6,31 +6,37 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import com.fine.theme.icon.LazyIcon; +import com.fine.theme.utils.FineUIStyle; import com.formdev.flatlaf.ui.FlatUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.dialog.BasicPane; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.flex; + public abstract class SingleConditionPane extends BasicPane { private static final long serialVersionUID = -4274960170813368817L; - + protected UIButton cancel; - + public SingleConditionPane(){ this(true); } - + public SingleConditionPane(boolean isRemove) { this.setLayout(FRGUIPaneFactory.createScaledBorderLayout(10, 0)); + this.setBorder(new ScaledEmptyBorder(4, 8, 4, 8)); if (isRemove) { - + if(cancel == null) { cancel = new UIButton(new LazyIcon("remove")); cancel.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Action_Remove")); cancel.addActionListener(cancleListener); - cancel.setBackground(FlatUIUtils.getUIColor("default.background", new Color(246, 248, 250, 255))); - cancel.setBorder(null); + FineUIStyle.setStyle(cancel, FineUIStyle.ORIGINAL_BUTTON); } addCancel(); } @@ -40,9 +46,9 @@ public abstract class SingleConditionPane extends BasicPane { * 添加删除按钮 */ public void addCancel() { - this.add(cancel, BorderLayout.EAST); + this.add(column(flex(), cell(cancel), flex()).getComponent(), BorderLayout.EAST); } - + ActionListener cancleListener = new ActionListener() { public void actionPerformed(ActionEvent e) { doCancel(); @@ -55,8 +61,8 @@ public abstract class SingleConditionPane extends BasicPane { public abstract void doCancel(); public abstract void setDefault(); - + public abstract void populate(T condition); - + public abstract T update(); } diff --git a/designer-base/src/main/java/com/fr/design/style/FRFontPane.java b/designer-base/src/main/java/com/fr/design/style/FRFontPane.java index 091cedaeeb..db136c6e61 100644 --- a/designer-base/src/main/java/com/fr/design/style/FRFontPane.java +++ b/designer-base/src/main/java/com/fr/design/style/FRFontPane.java @@ -61,20 +61,20 @@ public class FRFontPane extends BasicPane { private UICheckBox isSubscriptCheckBox; private FRFontPreviewArea preview; - + private EventListenerList eventChangeList = new EventListenerList(); - + public static Integer[] Font_Sizes = {new Integer(6), new Integer(8), new Integer(9), new Integer(10), new Integer(11), new Integer(12), new Integer(14), new Integer(16), new Integer(18), new Integer(20), new Integer(22), new Integer(24), new Integer(26), new Integer(28), new Integer(36), new Integer(48), new Integer(72)}; - + public FRFontPane() { this.initComponents(); } - + protected void initComponents() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); @@ -82,18 +82,18 @@ public class FRFontPane extends BasicPane { // 名字 fontNameComboBox = new UIComboBox(DesignUtils.getAvailableFontFamilyNames4Report()); this.fontNameComboBox.addActionListener(actionListener); - + // 字形和大小 fontSizeStylePane = new FontSizeStylePane(); - + // 下划线 和 颜色 this.underlineCombo = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY); this.underlineCombo.addActionListener(actionListener); foregroundColorPane = new ColorSelectBox(140); foregroundColorPane.addSelectChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { - fireStateChanged(); - } + fireStateChanged(); + } }); initCheckbox(); @@ -166,11 +166,11 @@ public class FRFontPane extends BasicPane { column(5, cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"))), cell(preview).weight(1)).weight(1) ).getComponent()); } - + public void addChangeListener(ChangeListener changeListener) { eventChangeList.add(ChangeListener.class, changeListener); } - + /** */ public void fireStateChanged() { @@ -186,19 +186,19 @@ public class FRFontPane extends BasicPane { } } } - + ActionListener actionListener = new ActionListener() { public void actionPerformed(ActionEvent e) { - fireStateChanged(); - } + fireStateChanged(); + } }; - + ChangeListener changeListener = new ChangeListener() { public void stateChanged(ChangeEvent e) { - fireStateChanged(); - } + fireStateChanged(); + } }; - + @Override protected String title4PopupWindow() { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Sytle_FRFont"); @@ -217,6 +217,16 @@ public class FRFontPane extends BasicPane { updatePreviewLabel(); } }; + ItemListener updatePreviewItemListener = new ItemListener() { + public void itemStateChanged(ItemEvent e) { + updatePreviewLabel(); + } + }; + + this.fontNameComboBox.addItemListener(updatePreviewItemListener); + this.fontSizeStylePane.fontComboBox.addItemListener(updatePreviewItemListener); + this.fontSizeStylePane.fontSizeComboBox.addItemListener(updatePreviewItemListener); + this.isStrikethroughCheckBox.addActionListener(updatePreviewActionListener); this.isShadowCheckBox.addActionListener(updatePreviewActionListener); this.isSuperscriptCheckBox.addActionListener(updatePreviewActionListener); diff --git a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties index 644c474ba0..ad0843117f 100644 --- a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties +++ b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties @@ -1410,7 +1410,7 @@ chart.selectedBorderColor = #2576EF [style]Button.originalButton = \ borderColor: null; \ - background: $fill.normal; \ + background: null; \ hoverBorderColor: null; [style]Button.grayButton = \ diff --git a/designer-realize/src/main/java/com/fr/design/condition/BackPane.java b/designer-realize/src/main/java/com/fr/design/condition/BackPane.java index 1e9b013905..cafd7b39f3 100644 --- a/designer-realize/src/main/java/com/fr/design/condition/BackPane.java +++ b/designer-realize/src/main/java/com/fr/design/condition/BackPane.java @@ -23,6 +23,7 @@ import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.row; import static com.fine.theme.utils.FineClientProperties.ADAPTIVE_COMBO_BOX; import static com.fine.theme.utils.FineClientProperties.COMBO_BOX_TYPE; +import static com.fine.theme.utils.FineUIScale.scale; /** * @author richie @@ -36,9 +37,9 @@ public class BackPane extends ConditionAttrSingleConditionPane public BackPane(final ConditionAttributesPane conditionAttributesPane) { super(conditionAttributesPane); - backgroundLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background") + ":"); + backgroundLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background")); this.backgroundPreviewPane = new BackgroundPreviewLabel(); - this.backgroundPreviewPane.setPreferredSize(FineUIScale.scale(new Dimension(80, 20))); + this.backgroundPreviewPane.setPreferredSize(new Dimension(scale(100), backgroundPreviewPane.getPreferredSize().height)); UIButton editBackgroundButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit")); editBackgroundButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -62,12 +63,11 @@ public class BackPane extends ConditionAttrSingleConditionPane this.backScopeComboBox.putClientProperty(COMBO_BOX_TYPE, ADAPTIVE_COMBO_BOX); this.backgroundPreviewPane.setBackgroundObject(ColorBackground.getInstance(Color.WHITE)); - this.add(row(10, cell(backgroundLabel).weight(0.2), row( - 10, + this.add(row(4, cell(backgroundLabel), cell(backgroundPreviewPane), cell(editBackgroundButton), - cell(backScopeComboBox)).weight(0.8) - ).with(it -> it.setBorder(new ScaledEmptyBorder(5, 5, 5, 0))).getComponent(), BorderLayout.CENTER); + cell(backScopeComboBox) + ).getComponent(), BorderLayout.CENTER); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/condition/BorderHighlightPane.java b/designer-realize/src/main/java/com/fr/design/condition/BorderHighlightPane.java index 0d2c8919cf..16c5ae95ab 100644 --- a/designer-realize/src/main/java/com/fr/design/condition/BorderHighlightPane.java +++ b/designer-realize/src/main/java/com/fr/design/condition/BorderHighlightPane.java @@ -79,10 +79,9 @@ public class BorderHighlightPane extends ConditionAttrSingleConditionPane it.setBorder(new ScaledEmptyBorder(5, 5, 5, 0))).getComponent(), BorderLayout.CENTER); + this.add(row(4, cell(borderLabel), + cell(borderButton) + ).getComponent(), BorderLayout.CENTER); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/condition/FontPane.java b/designer-realize/src/main/java/com/fr/design/condition/FontPane.java index f7bb808d22..acc8aa8453 100644 --- a/designer-realize/src/main/java/com/fr/design/condition/FontPane.java +++ b/designer-realize/src/main/java/com/fr/design/condition/FontPane.java @@ -37,10 +37,9 @@ public class FontPane extends ConditionAttrSingleConditionPane public FontPane(final ConditionAttributesPane conditionAttributesPane) { super(conditionAttributesPane); - fontLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Sytle_FRFont") + ":"); + fontLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Sytle_FRFont")); frFontPreviewPane = new FRFontPreviewArea(); frFontPreviewPane.setBorder(BorderFactory.createTitledBorder("")); - frFontPreviewPane.setPreferredSize(FineUIScale.scale(new Dimension(80, 20))); UIButton editFRFontButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit")); editFRFontButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -66,12 +65,11 @@ public class FontPane extends ConditionAttrSingleConditionPane this.fontScopeComboBox.putClientProperty(COMBO_BOX_TYPE, ADAPTIVE_COMBO_BOX); this.frFontPreviewPane.setFontObject(DesignUtils.getDefaultGUIFont()); - this.add(row(10, cell(fontLabel).weight(0.2), row( - 10, + this.add(row(4, cell(fontLabel), cell(frFontPreviewPane), cell(editFRFontButton), - cell(fontScopeComboBox)).weight(0.8) - ).with(it -> it.setBorder(new ScaledEmptyBorder(5, 5, 5, 0))).getComponent(), BorderLayout.CENTER); + cell(fontScopeComboBox) + ).getComponent(), BorderLayout.CENTER); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/condition/ForeGroundPane.java b/designer-realize/src/main/java/com/fr/design/condition/ForeGroundPane.java index 635bedd3e9..2e1fb4cdee 100644 --- a/designer-realize/src/main/java/com/fr/design/condition/ForeGroundPane.java +++ b/designer-realize/src/main/java/com/fr/design/condition/ForeGroundPane.java @@ -29,7 +29,7 @@ public class ForeGroundPane extends ConditionAttrSingleConditionPane it.setBorder(new ScaledEmptyBorder(5, 5, 5, 0))).getComponent(), BorderLayout.CENTER); + cell(foreScopeComboBox) + ).getComponent(), BorderLayout.CENTER); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/condition/HyperlinkPane.java b/designer-realize/src/main/java/com/fr/design/condition/HyperlinkPane.java index d090ddf476..5a4ea2bdad 100644 --- a/designer-realize/src/main/java/com/fr/design/condition/HyperlinkPane.java +++ b/designer-realize/src/main/java/com/fr/design/condition/HyperlinkPane.java @@ -61,19 +61,18 @@ public class HyperlinkPane extends ConditionAttrSingleConditionPane it.setBorder(new ScaledEmptyBorder(5, 5, 5, 0))).getComponent(), BorderLayout.CENTER); + cell(useHyperlink) + ).getComponent(), BorderLayout.CENTER); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/condition/NewRealValuePane.java b/designer-realize/src/main/java/com/fr/design/condition/NewRealValuePane.java index 468d4cfaae..e0a813417d 100644 --- a/designer-realize/src/main/java/com/fr/design/condition/NewRealValuePane.java +++ b/designer-realize/src/main/java/com/fr/design/condition/NewRealValuePane.java @@ -23,13 +23,12 @@ public class NewRealValuePane extends ConditionAttrSingleConditionPane it.setBorder(new ScaledEmptyBorder(5, 5, 5, 0))).getComponent(), BorderLayout.CENTER); + this.add(row(10, cell(label), + cell(valueEditor) + ).getComponent(), BorderLayout.CENTER); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/condition/PaddingPane.java b/designer-realize/src/main/java/com/fr/design/condition/PaddingPane.java index 891a9e34f3..740f6c0d51 100644 --- a/designer-realize/src/main/java/com/fr/design/condition/PaddingPane.java +++ b/designer-realize/src/main/java/com/fr/design/condition/PaddingPane.java @@ -42,10 +42,10 @@ public class PaddingPane extends ConditionAttrSingleConditionPane it.setPreferredSize(new Dimension(-1, FineUIScale.scale(53)))), row( - 10, + this.add(row(4, column(4, cell(label).weight(0.5), flex(0.5)), column(5, cell(paddingLeftSpinner).weight(0.5),cell(paddingLeft).weight(0.5)), column(5, cell(paddingRightSpinner).weight(0.5),cell(paddingRight).weight(0.5)), - column(5, cell(paddingScopeComboBox).weight(0.5), flex(0.5))).weight(0.8) - ).with(it -> it.setBorder(new ScaledEmptyBorder(5, 5, 5, 0))).getComponent()); + column(5, cell(paddingScopeComboBox).weight(0.5), flex(0.5))).getComponent()); } /** diff --git a/designer-realize/src/main/java/com/fr/design/condition/PagePane.java b/designer-realize/src/main/java/com/fr/design/condition/PagePane.java index e496ce3f42..0834582af2 100644 --- a/designer-realize/src/main/java/com/fr/design/condition/PagePane.java +++ b/designer-realize/src/main/java/com/fr/design/condition/PagePane.java @@ -25,7 +25,7 @@ public class PagePane extends ConditionAttrSingleConditionPane public PagePane(ConditionAttributesPane conditionAttributesPane) { super(conditionAttributesPane); - pageLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Pagination") + ":"); + pageLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Pagination")); this.pageComboBox = new UIComboBox(new String[] { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_No_Pagination"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cell_Write_Page_After_Row"), @@ -35,10 +35,9 @@ public class PagePane extends ConditionAttrSingleConditionPane this.pageComboBox.putClientProperty(COMBO_BOX_TYPE, ADAPTIVE_COMBO_BOX); this.pageComboBox.setSelectedIndex(0); - this.add(row(10, cell(pageLabel).weight(0.2), row( - 10, - cell(pageComboBox)).weight(0.8) - ).with(it -> it.setBorder(new ScaledEmptyBorder(5, 5, 5, 0))).getComponent(), BorderLayout.CENTER); + this.add(row(4, cell(pageLabel), + cell(pageComboBox) + ).getComponent(), BorderLayout.CENTER); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/condition/PresentHighlightPane.java b/designer-realize/src/main/java/com/fr/design/condition/PresentHighlightPane.java index 330c172dfc..28febb9408 100644 --- a/designer-realize/src/main/java/com/fr/design/condition/PresentHighlightPane.java +++ b/designer-realize/src/main/java/com/fr/design/condition/PresentHighlightPane.java @@ -40,7 +40,7 @@ public class PresentHighlightPane extends ConditionAttrSingleConditionPane it.setBorder(new ScaledEmptyBorder(5, 5, 5, 0))).getComponent(), BorderLayout.CENTER); + cell(type) + ).getComponent(), BorderLayout.CENTER); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/condition/WHPane.java b/designer-realize/src/main/java/com/fr/design/condition/WHPane.java index 2677b43bb3..3dbe1ca025 100644 --- a/designer-realize/src/main/java/com/fr/design/condition/WHPane.java +++ b/designer-realize/src/main/java/com/fr/design/condition/WHPane.java @@ -31,18 +31,17 @@ public abstract class WHPane extends ConditionAttrSingleConditionPane it.setBorder(new ScaledEmptyBorder(5, 5, 5, 0))).getComponent(), BorderLayout.CENTER); + cell(unitLabel) + ).getComponent(), BorderLayout.CENTER); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/condition/WidgetHighlightPane.java b/designer-realize/src/main/java/com/fr/design/condition/WidgetHighlightPane.java index 1bf3bc072b..8d05b7d48b 100644 --- a/designer-realize/src/main/java/com/fr/design/condition/WidgetHighlightPane.java +++ b/designer-realize/src/main/java/com/fr/design/condition/WidgetHighlightPane.java @@ -63,7 +63,7 @@ public class WidgetHighlightPane extends ConditionAttrSingleConditionPane it.setBorder(new ScaledEmptyBorder(5, 5, 5, 0))).getComponent(), BorderLayout.CENTER); + cell(useWidget) + ).getComponent(), BorderLayout.CENTER); } @Override From f1eadc89e2e55c8803e3e604af2fde40bc648013 Mon Sep 17 00:00:00 2001 From: vito Date: Wed, 25 Sep 2024 17:30:19 +0800 Subject: [PATCH 2/3] =?UTF-8?q?REPORT-135687=20=E4=BF=AE=E5=A4=8D=E6=A1=86?= =?UTF-8?q?=E4=BD=93=E5=A4=A7=E5=B0=8F&=E6=B7=BB=E5=8A=A0=E6=B8=85?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/debug/RemoteDesignNetWorkAction.java | 23 +++++- .../debug/RemoteDesignNetWorkTablePane.java | 80 +++++++++++++++---- 2 files changed, 82 insertions(+), 21 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkAction.java b/designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkAction.java index 29f149eed8..7e4147f759 100644 --- a/designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkAction.java +++ b/designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkAction.java @@ -1,6 +1,5 @@ package com.fr.design.remote.ui.debug; -import com.fine.theme.utils.FineUIScale; import com.fr.design.actions.UpdateAction; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrame; @@ -8,8 +7,14 @@ import com.fr.design.utils.gui.GUICoreUtils; import com.fr.workspace.WorkContext; import javax.swing.JDialog; +import javax.swing.JOptionPane; import java.awt.Dimension; import java.awt.event.ActionEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; + +import static com.fine.theme.utils.FineUIScale.createScaleDimension; +import static com.fine.theme.utils.FineUIScale.unscale; /** * 远程设计网络调试 @@ -28,19 +33,29 @@ public class RemoteDesignNetWorkAction extends UpdateAction { @Override public void actionPerformed(ActionEvent e) { if (WorkContext.getCurrent().isLocal()) { + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), + "Remote Design NetWork can't show on local environment."); return; } JDialog jDialog = new JDialog(DesignerContext.getDesignerFrame(), TITLE); jDialog.setSize(calculatePaneDimension()); - jDialog.add(new RemoteDesignNetWorkTablePane()); + RemoteDesignNetWorkTablePane netWorkPane = new RemoteDesignNetWorkTablePane(); + jDialog.add(netWorkPane); + jDialog.addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + netWorkPane.clear(); + super.windowClosing(e); + } + }); GUICoreUtils.centerWindow(jDialog); jDialog.setVisible(true); } private static Dimension calculatePaneDimension() { DesignerFrame parent = DesignerContext.getDesignerFrame(); - return new Dimension((int) (FineUIScale.unscale(parent.getWidth()) * 0.8), - (int) (FineUIScale.unscale(parent.getHeight()) * 0.6)); + return createScaleDimension((int) (unscale(parent.getWidth()) * 0.8), + (int) (unscale(parent.getHeight()) * 0.6)); } } diff --git a/designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkTablePane.java b/designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkTablePane.java index 456d6266d4..21cb2ab049 100644 --- a/designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkTablePane.java +++ b/designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkTablePane.java @@ -1,7 +1,9 @@ package com.fr.design.remote.ui.debug; import com.fanruan.workplace.http.debug.RequestInfo; +import com.fine.theme.icon.LazyIcon; import com.formdev.flatlaf.util.ScaledEmptyBorder; +import com.fr.design.gui.ibutton.UIButton; import com.fr.event.Event; import com.fr.event.EventDispatcher; import com.fr.event.Listener; @@ -10,6 +12,8 @@ import com.fr.workspace.WorkContext; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; +import javax.swing.JToolBar; +import javax.swing.border.EmptyBorder; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumn; @@ -34,14 +38,36 @@ public class RemoteDesignNetWorkTablePane extends JPanel { private JTable uiTable; private DefaultTableModel model; + private final Listener remoteDesignDebugListener = new Listener() { + @Override + public void on(Event event, RequestInfo requestInfo) { + model.addRow(new Object[]{ + requestInfo.getStatus(), + dateFormat(requestInfo.getDate()), + requestInfo.getPath().substring(WorkContext.getCurrent().getPath().length() - 1), + requestInfo.getConsume() + "ms", + simpleSize(requestInfo.getRequestSize()), + simpleSize(requestInfo.getResponseSize()), + requestInfo.getSendBody(), + requestInfo.getReturnBody(), + }); + adjustColumnWidths(uiTable); + } + }; + public RemoteDesignNetWorkTablePane() { setLayout(new BorderLayout()); setBorder(new ScaledEmptyBorder(10, 10, 10, 10)); initComponent(); - initListener(); + addListener(); } private void initComponent() { + initTable(); + initToolBar(); + } + + private void initTable() { model = new DefaultTableModel(); model.addColumn("status"); model.addColumn("time"); @@ -55,23 +81,43 @@ public class RemoteDesignNetWorkTablePane extends JPanel { add(new JScrollPane(uiTable), BorderLayout.CENTER); } - private void initListener() { - EventDispatcher.listen(REMOTE_HTTP_REQUEST, new Listener() { - @Override - public void on(Event event, RequestInfo requestInfo) { - model.addRow(new Object[]{ - requestInfo.getStatus(), - dateFormat(requestInfo.getDate()), - requestInfo.getPath().substring(WorkContext.getCurrent().getPath().length() - 1), - requestInfo.getConsume() + "ms", - simpleSize(requestInfo.getRequestSize()), - simpleSize(requestInfo.getResponseSize()), - requestInfo.getSendBody(), - requestInfo.getReturnBody(), - }); - adjustColumnWidths(uiTable); - } + private void initToolBar() { + JToolBar jToolBar = new JToolBar(); + jToolBar.setBorder(new EmptyBorder(5, 0, 10, 0)); + UIButton run = new UIButton(new LazyIcon("run")); + UIButton forbid = new UIButton(new LazyIcon("forbid")); + UIButton refresh = new UIButton(new LazyIcon("remove")); + run.setEnabled(false); + run.setToolTipText("Start Record"); + run.addActionListener(e -> { + addListener(); + run.setEnabled(false); + forbid.setEnabled(true); + }); + forbid.setToolTipText("Stop Record"); + forbid.addActionListener(e -> { + EventDispatcher.stopListen(remoteDesignDebugListener); + run.setEnabled(true); + forbid.setEnabled(false); }); + refresh.setToolTipText("Clear Records"); + refresh.addActionListener(e -> model.setRowCount(0)); + jToolBar.add(run); + jToolBar.add(forbid); + jToolBar.add(refresh); + add(jToolBar, BorderLayout.NORTH); + } + + /** + * 清理监听 + */ + public void clear() { + EventDispatcher.stopListen(remoteDesignDebugListener); + } + + + private void addListener() { + EventDispatcher.listen(REMOTE_HTTP_REQUEST, remoteDesignDebugListener); } private static void adjustColumnWidths(JTable table) { From cd67e9b355f7b3cb2137d21abca23efc482efb43 Mon Sep 17 00:00:00 2001 From: vito Date: Wed, 25 Sep 2024 17:33:06 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=20=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/remote/ui/debug/RemoteDesignNetWorkAction.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkAction.java b/designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkAction.java index 7e4147f759..e0cfa2524e 100644 --- a/designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkAction.java +++ b/designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkAction.java @@ -1,13 +1,13 @@ package com.fr.design.remote.ui.debug; import com.fr.design.actions.UpdateAction; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrame; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.workspace.WorkContext; import javax.swing.JDialog; -import javax.swing.JOptionPane; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.WindowAdapter; @@ -33,7 +33,7 @@ public class RemoteDesignNetWorkAction extends UpdateAction { @Override public void actionPerformed(ActionEvent e) { if (WorkContext.getCurrent().isLocal()) { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), "Remote Design NetWork can't show on local environment."); return; }