Browse Source

Merge pull request #14904 in DESIGN/design from fbp/release to fbp/feature

* commit '6dfdccc9fded8006f811b611c2cd6e6087bd4732':
  REPORT-135687 新增调试界面-远程网络信息
  REPORT-135499 fix:fbp回归问题:超级链接-移动端弹窗布局调整
fbp/feature
superman 2 months ago
parent
commit
fbf303a0ea
  1. 47
      designer-base/src/main/java/com/fr/design/hyperlink/popup/MobilePopupRegularPane.java
  2. 48
      designer-base/src/main/java/com/fr/design/hyperlink/popup/StyleSettingPane.java
  3. 51
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/DebugModeMenuDef.java
  4. 19
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  5. 46
      designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkAction.java
  6. 109
      designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkTablePane.java
  7. 6
      designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java

47
designer-base/src/main/java/com/fr/design/hyperlink/popup/MobilePopupRegularPane.java

@ -1,11 +1,13 @@
package com.fr.design.hyperlink.popup; package com.fr.design.hyperlink.popup;
import com.fine.theme.utils.FineUIStyle;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.VerticalFlowLayout;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
@ -13,6 +15,11 @@ import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import static com.fine.swing.ui.layout.Layouts.column;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.swing.ui.layout.Layouts.flex;
public class MobilePopupRegularPane extends BasicPane { public class MobilePopupRegularPane extends BasicPane {
private String label; private String label;
@ -35,13 +42,15 @@ public class MobilePopupRegularPane extends BasicPane {
private void initComponent() { private void initComponent() {
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(this.createRadioButtonGroupPane(), BorderLayout.NORTH);
spinnerGroupPane = this.createSpinnerPane(); spinnerGroupPane = this.createSpinnerPane();
this.add(spinnerGroupPane, BorderLayout.CENTER); this.add(column(LayoutConstants.VERTICAL_GAP,
cell(this.createRadioButtonGroupPane()),
row(flex(1), cell(spinnerGroupPane).weight(3))
).getComponent());
} }
private JPanel createRadioButtonGroupPane() { private JPanel createRadioButtonGroupPane() {
radiosPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 5)); radiosPane = new JPanel(new BorderLayout());
customRadio = new UIRadioButton(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Custom")); customRadio = new UIRadioButton(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Custom"));
customRadio.addActionListener(radioActionListener); customRadio.addActionListener(radioActionListener);
@ -52,10 +61,8 @@ public class MobilePopupRegularPane extends BasicPane {
radioButtons.add(customRadio); radioButtons.add(customRadio);
radioButtons.add(autoRadio); radioButtons.add(autoRadio);
radiosPane.add(customRadio); radiosPane.add(row(30, cell(customRadio), cell(autoRadio), flex()).getComponent());
radiosPane.add(autoRadio); return row(cell(new UILabel(this.label, FineUIStyle.LABEL_SECONDARY)).weight(1), cell(radiosPane).weight(3)).getComponent();
return MobilePopupUIUtils.createLeftTileRightContentPanel(this.label, radiosPane, Color.GRAY, 20);
} }
private ActionListener radioActionListener = new ActionListener() { private ActionListener radioActionListener = new ActionListener() {
@ -66,33 +73,25 @@ public class MobilePopupRegularPane extends BasicPane {
}; };
private JPanel createSpinnerPane() { private JPanel createSpinnerPane() {
JPanel spinnerPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 15, 5)); JPanel spinnerPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 15, 0));
spinnerPane.setBorder(BorderFactory.createEmptyBorder(0, MobilePopupUIUtils.Left_Title_width, 0, 0)); spinnerPane.setBorder(new ScaledEmptyBorder(0, 0, 0, 0));
widthSpinner = new UISpinner(0, 100, 1, 95); widthSpinner = new UISpinner(0, 100, 1, 95);
widthSpinnerPane = this.createSpinnerLabelPane(widthSpinner, Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Width")); widthSpinnerPane = this.createSpinnerLabelPane(widthSpinner, Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Width"));
heightSpinner = new UISpinner(0, 100, 1, 95); heightSpinner = new UISpinner(0, 100, 1, 95);
heightSpinnerPane = this.createSpinnerLabelPane(heightSpinner, Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Height")); heightSpinnerPane = this.createSpinnerLabelPane(heightSpinner, Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Height"));
spinnerPane.add(row(cell(widthSpinnerPane), cell(heightSpinnerPane)).getComponent());
spinnerPane.add(widthSpinnerPane);
spinnerPane.add(heightSpinnerPane);
return spinnerPane; return spinnerPane;
} }
private JPanel createSpinnerLabelPane(UISpinner spinner, String labelText) { private JPanel createSpinnerLabelPane(UISpinner spinner, String labelText) {
JPanel spinnerLabelPane = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 5)); JPanel spinnerLabelPane = new JPanel(new BorderLayout());
JPanel spinnerPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 2,0));
UILabel percent = new UILabel("%"); UILabel percent = new UILabel("%");
spinnerPane.add(spinner);
spinnerPane.add(percent);
UILabel label = new UILabel(labelText); UILabel label = new UILabel(labelText);
label.setHorizontalAlignment(SwingConstants.CENTER); label.setHorizontalAlignment(SwingConstants.CENTER);
spinnerLabelPane.add(column(LayoutConstants.VGAP_SMALL,
spinnerLabelPane.add(spinnerPane); row(cell(spinner).weight(1), cell(percent)).weight(1),
spinnerLabelPane.add(label); cell(label)
).getComponent());
return spinnerLabelPane; return spinnerLabelPane;
} }

48
designer-base/src/main/java/com/fr/design/hyperlink/popup/StyleSettingPane.java

@ -1,6 +1,8 @@
package com.fr.design.hyperlink.popup; package com.fr.design.hyperlink.popup;
import com.fine.theme.utils.FineUIStyle;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.frpane.UINumberDragPane; import com.fr.design.gui.frpane.UINumberDragPane;
import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -57,10 +59,7 @@ public class StyleSettingPane extends BasicBeanPane<MobilePopupHyperlink> {
JPanel typePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel typePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
popupTypeLabel = new UILabel(""); popupTypeLabel = new UILabel("");
UILabel typeLabel = new UILabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Type")); UILabel typeLabel = new UILabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Type"));
typePane.add(row(44, typePane.add(row(cell(typeLabel).weight(1), row(cell(popupTypeLabel), flex()).weight(6)).getComponent());
cell(typeLabel),
cell(popupTypeLabel)
).getComponent());
return typePane; return typePane;
} }
@ -82,14 +81,11 @@ public class StyleSettingPane extends BasicBeanPane<MobilePopupHyperlink> {
borderColor = new NewColorSelectBox(100); borderColor = new NewColorSelectBox(100);
borderRadiusSpinner = new UISpinner(0, maxBorderRadius, 1, 20); borderRadiusSpinner = new UISpinner(0, maxBorderRadius, 1, 20);
UILabel borderLabel = new UILabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Border")); UILabel borderLabel = new UILabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Border"));
borderPane.add(row(44,
column(10, borderPane.add(column(LayoutConstants.VERTICAL_GAP,
cell(borderLabel).weight(0.3), row(cell(borderLabel).weight(1), cell(new UILabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Line"), FineUIStyle.LABEL_SECONDARY)).weight(1), cell(borderType).weight(2), flex(3)),
flex().weight(0.7)), row(flex(1), cell(new UILabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Colors"), FineUIStyle.LABEL_SECONDARY)).weight(1), cell(borderColor).weight(2), flex(3)),
column(10, row(flex(1), cell(new UILabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Radius"), FineUIStyle.LABEL_SECONDARY)).weight(1), cell(borderRadiusSpinner).weight(2), flex(3))
cell(MobilePopupUIUtils.createLeftTileRightContentPanel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Line"), borderType, Color.GRAY, 64)),
cell(MobilePopupUIUtils.createLeftTileRightContentPanel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Colors"), borderColor, Color.GRAY, 64)),
cell(MobilePopupUIUtils.createLeftTileRightContentPanel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Radius"), borderRadiusSpinner, Color.GRAY, 64)))
).getComponent()); ).getComponent());
return borderPane; return borderPane;
} }
@ -99,39 +95,31 @@ public class StyleSettingPane extends BasicBeanPane<MobilePopupHyperlink> {
bgPane.setLayout(new BorderLayout()); bgPane.setLayout(new BorderLayout());
bgColor = new NewColorSelectBox(100); bgColor = new NewColorSelectBox(100);
JPanel transparencyPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel transparencyPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
this.numberDragPane = new UINumberDragPane(0, 100); this.numberDragPane = new UINumberDragPane(0, 100);
transparencyPane.add(numberDragPane, BorderLayout.CENTER); transparencyPane.add(numberDragPane, BorderLayout.CENTER);
transparencyPane.add(new UILabel(" %"), BorderLayout.EAST); transparencyPane.add(new UILabel(" %"), BorderLayout.EAST);
JLabel bgLabel = new JLabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Background")); JLabel bgLabel = new JLabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Background"));
bgPane.add(row(44,
column(10, bgPane.add(column(LayoutConstants.VERTICAL_GAP,
cell(bgLabel).weight(0.6), row(cell(bgLabel).weight(1), cell(new UILabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Colors"), FineUIStyle.LABEL_SECONDARY)).weight(1), cell(bgColor).weight(2), flex(3)),
flex().weight(0.4)), row(flex(1), cell(new UILabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Opacity"), FineUIStyle.LABEL_SECONDARY)).weight(1), cell(transparencyPane).weight(3), flex(2))
column(10,
cell(MobilePopupUIUtils.createLeftTileRightContentPanel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Colors"), bgColor, Color.GRAY, 64)),
cell(MobilePopupUIUtils.createLeftTileRightContentPanel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Opacity"), transparencyPane, Color.GRAY, 64))
)
).getComponent()); ).getComponent());
return bgPane; return bgPane;
} }
private JPanel createPopupSizePane() { private JPanel createPopupSizePane() {
JPanel sizePane = new JPanel(new BorderLayout()); JPanel sizePane = new JPanel(new BorderLayout());
mobileRegularPane = new MobilePopupRegularPane(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Mobile_Rules")); mobileRegularPane = new MobilePopupRegularPane(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Mobile_Rules"));
padRegularPane = new MobilePopupRegularPane(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Pad_Rules")); padRegularPane = new MobilePopupRegularPane(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Pad_Rules"));
JLabel sizeLabel = new JLabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Size")); JLabel sizeLabel = new JLabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Size"));
sizePane.add(row(20, sizePane.add(column(LayoutConstants.VERTICAL_GAP,
column(10, row(
cell(sizeLabel).weight(0.16), column(LayoutConstants.VERTICAL_GAP, cell(sizeLabel), flex()).weight(1),
flex().weight(0.84)), cell(mobileRegularPane).weight(4), flex(2)
column(10, ),
cell(mobileRegularPane), row(flex(1), cell(padRegularPane).weight(4), flex(2))
cell(padRegularPane)
)
).getComponent()); ).getComponent());
return sizePane; return sizePane;
} }

51
designer-base/src/main/java/com/fr/design/mainframe/toolbar/DebugModeMenuDef.java

@ -0,0 +1,51 @@
package com.fr.design.mainframe.toolbar;
import com.fanruan.gui.UiInspector;
import com.fine.theme.light.ui.laf.FineDarkLaf;
import com.fine.theme.light.ui.laf.FineLightLaf;
import com.fr.design.actions.UpdateAction;
import com.fr.design.gui.UILookAndFeel;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.menu.MenuDef;
import com.fr.design.remote.ui.debug.RemoteDesignNetWorkAction;
import java.awt.event.ActionEvent;
/**
* 调试模式菜单
*
* @author vito
* @since 11.0
* Created on 2024/9/24
*/
public class DebugModeMenuDef extends MenuDef {
public DebugModeMenuDef() {
super("Debug");
addLookAndFeelMenu();
addRemotePane();
}
private void addUIInspect() {
this.addShortCut(new UpdateAction() {
@Override
public void actionPerformed(ActionEvent e) {
new UiInspector().showInspector(DesignerContext.getDesignerFrame());
}
});
}
private void addLookAndFeelMenu() {
MenuDef lookAndFeel = new MenuDef("Look And Feel", 'L');
lookAndFeel.addShortCut(
new LookAndFeelAction(new FineLightLaf()),
new LookAndFeelAction(new FineDarkLaf()),
new LookAndFeelAction(new UILookAndFeel())
);
this.addShortCut(lookAndFeel);
}
private void addRemotePane() {
this.addShortCut(new RemoteDesignNetWorkAction());
}
}

19
designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -3,8 +3,6 @@
*/ */
package com.fr.design.mainframe.toolbar; package com.fr.design.mainframe.toolbar;
import com.fine.theme.light.ui.laf.FineDarkLaf;
import com.fine.theme.light.ui.laf.FineLightLaf;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignState; import com.fr.design.DesignState;
@ -34,7 +32,6 @@ import com.fr.design.actions.file.SwitchExistEnv;
import com.fr.design.actions.help.AboutAction; import com.fr.design.actions.help.AboutAction;
import com.fr.design.actions.help.FineUIAction; import com.fr.design.actions.help.FineUIAction;
import com.fr.design.actions.help.TutorialAction; import com.fr.design.actions.help.TutorialAction;
import com.fr.design.actions.help.WebDemoAction;
import com.fr.design.actions.help.alphafine.AlphaFineAction; import com.fr.design.actions.help.alphafine.AlphaFineAction;
import com.fr.design.actions.help.alphafine.AlphaFineConfigManager; import com.fr.design.actions.help.alphafine.AlphaFineConfigManager;
import com.fr.design.actions.server.ConnectionListAction; import com.fr.design.actions.server.ConnectionListAction;
@ -49,7 +46,6 @@ import com.fr.design.fun.MenuHandler;
import com.fr.design.fun.OemProcessor; import com.fr.design.fun.OemProcessor;
import com.fr.design.fun.PluginManagerProvider; import com.fr.design.fun.PluginManagerProvider;
import com.fr.design.fun.TableDataPaneProcessor; import com.fr.design.fun.TableDataPaneProcessor;
import com.fr.design.gui.UILookAndFeel;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UICombinationButton; import com.fr.design.gui.ibutton.UICombinationButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -66,9 +62,7 @@ import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.remote.action.RemoteDesignAuthManagerAction; import com.fr.design.remote.action.RemoteDesignAuthManagerAction;
import com.fr.design.update.actions.SoftwareUpdateAction;
import com.fr.design.utils.ThemeUtils; import com.fr.design.utils.ThemeUtils;
import com.fr.env.detect.ui.EnvDetectorAction;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.locale.LocaleAction; import com.fr.general.locale.LocaleAction;
@ -298,7 +292,7 @@ public abstract class ToolBarMenuDock {
// 当前仅UI开发者模式显示外观配置选项 // 当前仅UI开发者模式显示外观配置选项
if (DesignerUIModeConfig.getInstance().isUIDevMode()) { if (DesignerUIModeConfig.getInstance().isUIDevMode()) {
menuList.add(createLookAndFeel()); menuList.add(new DebugModeMenuDef());
} }
// 添加全部UpdateAction到actionmanager中 // 添加全部UpdateAction到actionmanager中
@ -668,17 +662,6 @@ public abstract class ToolBarMenuDock {
return menuDef; return menuDef;
} }
public MenuDef createLookAndFeel() {
MenuDef menuDef = new MenuDef("外观", 'H');
menuDef.addShortCut(
new LookAndFeelAction(new FineLightLaf()),
new LookAndFeelAction(new FineDarkLaf()),
new LookAndFeelAction(new UILookAndFeel())
);
insertMenu(menuDef, "laf");
return menuDef;
}
public MenuDef createCommunityMenuDef() { public MenuDef createCommunityMenuDef() {

46
designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkAction.java

@ -0,0 +1,46 @@
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;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.workspace.WorkContext;
import javax.swing.JDialog;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
/**
* 远程设计网络调试
*
* @author vito
* @since 11.0
* Created on 2024/9/24
*/
public class RemoteDesignNetWorkAction extends UpdateAction {
public static final String TITLE = "Remote Design NetWork";
public RemoteDesignNetWorkAction() {
setName(TITLE);
}
@Override
public void actionPerformed(ActionEvent e) {
if (WorkContext.getCurrent().isLocal()) {
return;
}
JDialog jDialog = new JDialog(DesignerContext.getDesignerFrame(), TITLE);
jDialog.setSize(calculatePaneDimension());
jDialog.add(new RemoteDesignNetWorkTablePane());
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));
}
}

109
designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkTablePane.java

@ -0,0 +1,109 @@
package com.fr.design.remote.ui.debug;
import com.fanruan.workplace.http.debug.RequestInfo;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.workspace.WorkContext;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import java.awt.BorderLayout;
import java.awt.Component;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import static com.fanruan.workplace.http.debug.RemoteDesignDebugEvent.REMOTE_HTTP_REQUEST;
/**
* 远程设计网络调试面板
*
* @author vito
* @since 11.0
* Created on 2024/9/24
*/
public class RemoteDesignNetWorkTablePane extends JPanel {
private static final int K = 1024;
private static final int TWO = 2;
private JTable uiTable;
private DefaultTableModel model;
public RemoteDesignNetWorkTablePane() {
setLayout(new BorderLayout());
setBorder(new ScaledEmptyBorder(10, 10, 10, 10));
initComponent();
initListener();
}
private void initComponent() {
model = new DefaultTableModel();
model.addColumn("status");
model.addColumn("time");
model.addColumn("path");
model.addColumn("cost");
model.addColumn("request size");
model.addColumn("response size");
model.addColumn("request");
model.addColumn("response");
uiTable = new JTable(model);
add(new JScrollPane(uiTable), BorderLayout.CENTER);
}
private void initListener() {
EventDispatcher.listen(REMOTE_HTTP_REQUEST, new Listener<RequestInfo>() {
@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 static void adjustColumnWidths(JTable table) {
for (int column = 0; column < table.getColumnCount() - TWO; column++) {
TableColumn tableColumn = table.getColumnModel().getColumn(column);
int preferredWidth = 20;
int maxWidth = tableColumn.getMaxWidth();
tableColumn.setMinWidth(0);
// 从最后一行来调整大小
int row = table.getRowCount() - 1;
TableCellRenderer cellRenderer = table.getCellRenderer(row, column);
Component component = table.prepareRenderer(cellRenderer, row, column);
int width = component.getPreferredSize().width + table.getIntercellSpacing().width;
preferredWidth = Math.max(preferredWidth, Math.min(width, maxWidth));
tableColumn.setPreferredWidth(preferredWidth);
}
}
private static String dateFormat(Date date) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return dateFormat.format(date);
}
private static String simpleSize(long bytes) {
if (bytes < 0) {
return bytes + "";
} else if (bytes < K) {
return bytes + " B";
} else {
DecimalFormat df = new DecimalFormat("#.00");
return df.format((float) bytes / K) + " K";
}
}
}

6
designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java

@ -182,9 +182,9 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background"))).weight(LEFT_WEIGHT), cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background"))).weight(LEFT_WEIGHT),
cell(backgroundPane).weight(RIGHT_WEIGHT) cell(backgroundPane).weight(RIGHT_WEIGHT)
), ),
cell(displayReport), row(cell(displayReport)),
cell(useParamsTemplate), row(cell(useParamsTemplate)),
cell(fireAfterEditor), row(cell(fireAfterEditor)),
row( row(
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Display_Position"))).weight(LEFT_WEIGHT), cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Display_Position"))).weight(LEFT_WEIGHT),
cell(hAlignmentPane).weight(RIGHT_WEIGHT) cell(hAlignmentPane).weight(RIGHT_WEIGHT)

Loading…
Cancel
Save