Browse Source

Merge branch 'fbp/release' of ssh://code.fineres.com:7999/~renekton/design into fbp/release

fbp/release
renekton 2 months ago
parent
commit
4e79732b65
  1. 7
      designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java
  2. 4
      designer-base/src/main/java/com/fr/design/data/datapane/TreeTableDataComboBox.java
  3. 5
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java
  4. 14
      designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java
  5. 43
      designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java
  6. 51
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/DebugModeMenuDef.java
  7. 19
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  8. 46
      designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkAction.java
  9. 109
      designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkTablePane.java
  10. 32
      designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java
  11. 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.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<T> extends BasicBeanPane<T> {
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();

4
designer-base/src/main/java/com/fr/design/data/datapane/TreeTableDataComboBox.java

@ -13,7 +13,6 @@ import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.security.encryption.transmission.TransmissionEncryptionManager;
import com.fr.stable.StringUtils;
import com.fr.workspace.server.repository.connection.ConnectionRepository;
import com.fr.workspace.server.repository.tabledata.TableDataRepository;
@ -73,14 +72,11 @@ public class TreeTableDataComboBox extends UIComboBox {
Map<String, TableData> map = new HashMap<>();
final Map<String, Connection> connectionMap = ConnectionInfoBeanHelper.createConnectionMap(ConnectionRepository.getInstance().getAll());
try {
TransmissionEncryptionManager.setTransEncryptionLevel(1);
for (ServerDataSetBean bean : beans) {
map.put(bean.getDatasetName() , TableDataBeanHelper.getTableDataSet(connectionMap, bean.getDatasetType(), bean.getDatasetData()));
}
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
TransmissionEncryptionManager.removeTransEncryptionLevel();
}
for (Map.Entry<String, TableData> entry : map.entrySet()) {
TableData tableData = entry.getValue();

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;
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;
}

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.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;
}

43
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() {

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;
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.vcs.DesignerMode;
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.FineUIAction;
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.AlphaFineConfigManager;
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.PluginManagerProvider;
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.UICombinationButton;
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.os.impl.SupportOSImpl;
import com.fr.design.remote.action.RemoteDesignAuthManagerAction;
import com.fr.design.update.actions.SoftwareUpdateAction;
import com.fr.design.utils.ThemeUtils;
import com.fr.env.detect.ui.EnvDetectorAction;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.general.locale.LocaleAction;
@ -298,7 +292,7 @@ public abstract class ToolBarMenuDock {
// 当前仅UI开发者模式显示外观配置选项
if (DesignerUIModeConfig.getInstance().isUIDevMode()) {
menuList.add(createLookAndFeel());
menuList.add(new DebugModeMenuDef());
}
// 添加全部UpdateAction到actionmanager中
@ -668,17 +662,6 @@ public abstract class ToolBarMenuDock {
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() {

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";
}
}
}

32
designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java vendored

@ -55,6 +55,7 @@ import com.fr.env.detect.EnvDetectorCenter;
import com.fr.event.EventDispatcher;
import com.fr.general.FRLogger;
import com.fr.general.log.Log4jConfig;
import com.fr.general.log.Log4jConfigFactory;
import com.fr.general.log.Log4jUtils;
import com.fr.intelli.metrics.Compute;
import com.fr.intelli.metrics.DBMonitorInterceptor;
@ -88,6 +89,7 @@ import com.fr.stable.db.session.DBSession;
import com.fr.stable.project.ProjectConstants;
import com.fr.tenant.context.TenantContext;
import com.fr.tenant.context.provider.CurrentTenantKey;
import com.fr.third.apache.logging.log4j.Level;
import com.fr.third.apache.logging.log4j.core.config.Configurator;
import com.fr.third.net.bytebuddy.implementation.MethodDelegation;
import com.fr.third.net.bytebuddy.matcher.ElementMatchers;
@ -244,6 +246,8 @@ public class DesignEnvComponent {
* ----------- logger --------
*/
private void startLogger() {
// 获取本地的日志级别配置
Log4jConfigFactory.getInstance().setRootLevel(Log4jConfig.getInstance().getRootLevel());
URI uri = Log4jUtils.buildUserConfigURI(StringUtils.EMPTY);
FRLogger.getLogger().config(uri);
// 日志配置更新的监听在FRLogger里面,fbp去掉了但是设计器本地还是需要这个监听的,初始化的时候监听一下
@ -251,21 +255,19 @@ public class DesignEnvComponent {
}
private void listenConfig() {
/// 等fbp改完,现在先配合打包注释掉
// ValidateConfigManger.getInstance().registerListener(new ConfigChangeListener() {
//
// @Override
// public boolean accept(Class<? extends Configuration> configClass) {
// return configClass.equals(Log4jConfig.class);
// }
//
// @Override
// public void change() {
// // The root logger is the topmost logger with a name of "" (the empty string).
// Configurator.setAllLevels("", Log4jConfig.getInstance().getRootLevel());
// }
// });
ValidateConfigManger.getInstance().registerListener(new ConfigChangeListener() {
@Override
public boolean accept(Class<? extends Configuration> configClass) {
return configClass.equals(Log4jConfig.class);
}
@Override
public void change() {
// The root logger is the topmost logger with a name of "" (the empty string).
Configurator.setAllLevels("", Log4jConfig.getInstance().getRootLevel());
}
});
}
private void stopLogger() {

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.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;
}
}
/**

Loading…
Cancel
Save