Browse Source

Merge pull request #15075 in DESIGN/design from fbp/release to fbp/master

* commit '05631d59a091d62e26f724f4e51a902dfcb59bfe':
  调整控件弹窗高度计算
  REPORT-137581 【fr-fbp冒烟】【数据源】数据连接-SSH设置连接异常
  REPORT-137327 远程设计下切换目录卡顿优化 优化命名
  REPORT-137327 远程设计下切换目录卡顿优化 配置部分优化
  REPORT-137231 fix:模板导出成功图标未变化修复
  REPORT-137164 fix: 最近使用颜色展示问题
  REPORT-137164 fix: 最近使用颜色展示问题
  REPORT-135687 优化显示 1. 添加排序支持,序号,时间和大小排序 2. 日志异步记录
  REPORT-135687 优化显示 1. 添加序号 2. 时间显示优化 3. 添加滚动保持
  REPORT-136934 远程设计下双击目录卡顿优化
  无jira任务,修复打包
  REPORT-136650 fix:控件自适应按钮交互异常修复
  REPORT-136077 fix:属性面板兼容旧图标
  REPORT-135889 fix:远程失败堆栈页面优化
  无JIRA任务 改了前端bug,更新一波js
  js高级编辑缩放
  无jira任务,适配驱动改动
fbp/master
superman 2 months ago
parent
commit
87373b0441
  1. 2
      designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java
  2. 21
      designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java
  3. 3
      designer-base/src/main/java/com/fr/design/data/datapane/preview/ConnectionInfoBeanHelper.java
  4. 5
      designer-base/src/main/java/com/fr/design/dialog/UIDetailErrorLinkDialog.java
  5. 44
      designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java
  6. 2
      designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java
  7. 3
      designer-base/src/main/java/com/fr/design/javascript/JavaScriptImplPane.java
  8. 1
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java
  9. 83
      designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkHelper.java
  10. 76
      designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkTablePane.java
  11. 32
      designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkTableRowSorter.java
  12. 2
      designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java
  13. 98
      designer-base/src/main/resources/com/fr/design/data/tabledata/datacenter/web/data-choose.main.js
  14. 6
      designer-form/src/main/java/com/fr/design/mainframe/FormWidgetPopWindow.java
  15. 4
      designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java
  16. 51
      designer-realize/src/main/java/com/fanruan/config/SetupDataDesignerRemoteOperator.java
  17. 58
      designer-realize/src/main/java/com/fr/design/widget/ui/ButtonGroupDictPane.java
  18. 7
      designer-realize/src/main/java/com/fr/start/DesignLauncher.java

2
designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java

@ -170,7 +170,7 @@ public abstract class AbstractExportAction<E extends JTemplate<?, ?>> extends JT
this.setProgress(100);
FineLoggerFactory.getLogger().info("\"" + name + "\"" + Toolkit.i18nText("Fine-Design_Report_Finish_Export") + "!");
FineJOptionPane.showMessageDialog(
FineJOptionPane.showSuccessMessageDialog(
DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Report_Exported_Successfully") + "\n" + name);

21
designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java

@ -1,5 +1,6 @@
package com.fr.design.data.datapane.connect;
import com.fanruan.datasource.driver.bean.DriverLoaderBean;
import com.fine.swing.ui.layout.Layouts;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineUIUtils;
@ -361,7 +362,7 @@ public class JDBCDefPane extends JPanel {
private void initMap() {
Map<String, DriverLoader> driverLoaders = null;
try {
driverLoaders = ConnectionRepository.getInstance().getDriverLoaders();
driverLoaders = toDriverLoaders(ConnectionRepository.getInstance().getDriverLoaders());
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
driverLoaders = new HashMap<>();
@ -370,6 +371,24 @@ public class JDBCDefPane extends JPanel {
nameAndRepresent = getDriverLoaderAndRepresent(driverLoaders);
}
private Map<String, DriverLoader> toDriverLoaders(Map<String, DriverLoaderBean> driverLoaders) {
Map<String, DriverLoader> map = new HashMap<>();
for (Map.Entry<String, DriverLoaderBean> entry : driverLoaders.entrySet()) {
map.put(entry.getKey(), createDriverLoader(entry.getValue()));
}
return map;
}
private DriverLoader createDriverLoader(DriverLoaderBean value) {
DriverLoader driverLoader = new DriverLoader();
driverLoader.setName(value.getName());
driverLoader.setDriverClass(value.getDriverClass());
driverLoader.setDriverJarFiles(value.getDriverJarFiles());
driverLoader.setLoadingStrategy(value.getLoadingStrategy());
driverLoader.setDriverList(value.getDriverList());
return driverLoader;
}
private HashBiMap<String, String> getDriverLoaderAndRepresent(Map<String, DriverLoader> driverLoaders) {
HashBiMap<String, String> driverHashBiMap = HashBiMap.create();
if (WorkContext.getCurrent().isWarDeploy()) {

3
designer-base/src/main/java/com/fr/design/data/datapane/preview/ConnectionInfoBeanHelper.java

@ -27,7 +27,6 @@ import com.fr.module.tool.ActivatorToolBox;
import com.fr.security.encryption.transmission.TransmissionEncryptionManager;
import com.fr.stable.Constants;
import com.fr.stable.StringUtils;
import com.fr.third.fasterxml.jackson.core.JsonProcessingException;
import com.fr.third.fasterxml.jackson.databind.ObjectMapper;
import com.fr.third.springframework.beans.BeanUtils;
import com.fr.workspace.server.repository.WorkplaceConstants;
@ -180,7 +179,7 @@ public class ConnectionInfoBeanHelper {
.redirectPort(jdbcConnection.getSsh().getRedirectPort())
.redirectIp((jdbcConnection.getSsh()).getRedirectIp())
.sshTimeOut(((BaseSsh) jdbcConnection.getSsh()).getTimeOut())
.sshSecret(withPassword ? ((BaseSsh) jdbcConnection.getSsh()).getSecret() : DecisionServiceConstants.DEFAULT_PASSWORD)
.sshSecret(withPassword ? DataEncryptionHelper.encrypt(((BaseSsh) jdbcConnection.getSsh()).getSecret()) : DecisionServiceConstants.DEFAULT_PASSWORD)
.sshPrivateKeyPath(jdbcConnection.getSsh().getSshType() == SshType.KEY ? ((KeyVerifySsh) jdbcConnection.getSsh()).getPrivateKeyPath() : StringUtils.EMPTY)
.usingSsl((jdbcConnection.getSsl()).isUsingSsl())
.sslType(jdbcConnection.getSsl().getSslType().toString())

5
designer-base/src/main/java/com/fr/design/dialog/UIDetailErrorLinkDialog.java

@ -5,6 +5,7 @@ import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIStyle;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.base.GraphHelper;
import com.fr.design.border.FineBorderFactory;
import com.fr.design.dialog.link.MessageWithLink;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icontainer.UIScrollPane;
@ -14,7 +15,6 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.IOUtils;
import com.fr.stable.StringUtils;
import java.awt.BorderLayout;
import java.awt.Color;
@ -30,7 +30,6 @@ import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.PrintWriter;
import java.io.StringWriter;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
@ -179,9 +178,11 @@ public class UIDetailErrorLinkDialog extends UIDialog {
public StackPane(String stack) {
setLayout(new BorderLayout());
UITextArea textArea = new UITextArea();
textArea.setBorder(null);
textArea.setEditable(false);
textArea.setText(stack);
UIScrollPane scrollPane = new UIScrollPane(textArea);
scrollPane.setBorder(FineBorderFactory.createWrappedRoundBorder());
add(scrollPane);
// 滚动条默认在顶部
SwingUtilities.invokeLater(new Runnable() {

44
designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java

@ -37,11 +37,17 @@ import com.fr.workspace.base.UserInfo;
import com.fr.workspace.server.repository.vcs.VcsRepository;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import javax.swing.ToolTipManager;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.Desktop;
import java.awt.Dimension;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseAdapter;
@ -53,8 +59,6 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.Enumeration;
import java.util.Objects;
import java.util.Observable;
import java.util.Observer;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
@ -88,12 +92,7 @@ public class TemplateTreePane extends JPanel implements FileOperations {
ToolTipManager.sharedInstance().registerComponent(reportletsTree);
FileLockStateObservable.getInstance().addObserver(new Observer() {
@Override
public void update(Observable o, Object arg) {
TemplateTreePane.this.refresh();
}
});
FileLockStateObservable.getInstance().addObserver((o, arg) -> TemplateTreePane.this.refresh());
/*
* Tree.MouseAdapter
@ -102,6 +101,9 @@ public class TemplateTreePane extends JPanel implements FileOperations {
@Override
public void mousePressed(MouseEvent evt) {
if (isDirectorySelection()) {
return;
}
if (evt.getClickCount() == 2) {
DesignCacheManager.processByCacheTableData(() -> openFile());
}
@ -157,6 +159,16 @@ public class TemplateTreePane extends JPanel implements FileOperations {
});
}
/**
* 选中的是否目录
*
* @return 是否目录
*/
private boolean isDirectorySelection() {
FileNode fileNode = reportletsTree.getSelectedFileNode();
return fileNode != null && fileNode.isDirectory();
}
public TemplateFileTree getTemplateFileTree() {
return this.reportletsTree;
}
@ -256,7 +268,7 @@ public class TemplateTreePane extends JPanel implements FileOperations {
}
@Nullable
private JTemplate<?, ?> getOpenedTemplate(String path) {
private JTemplate<?, ?> getOpenedTemplate(String path) {
for (JTemplate<?, ?> template : HistoryTemplateListCache.getInstance().getHistoryList()) {
if (ComparatorUtils.equals(template.getEditingFILE().getPath(), path)) {
return template;
@ -380,7 +392,7 @@ public class TemplateTreePane extends JPanel implements FileOperations {
TreePath[] paths = reportletsTree.getSelectionPaths();
if (paths == null) {
reportletsTree.refresh();
} else {
} else {
for (TreePath path : Objects.requireNonNull(reportletsTree.getSelectionPaths())) {
reportletsTree.refreshParent(path);
}
@ -389,7 +401,7 @@ public class TemplateTreePane extends JPanel implements FileOperations {
}
private void deleteNodes(Collection<ExpandMutableTreeNode> nodes) {
new SwingWorker<Boolean,Void>(){
new SwingWorker<Boolean, Void>() {
@Override
protected Boolean doInBackground() throws Exception {
boolean success = true;
@ -415,6 +427,7 @@ public class TemplateTreePane extends JPanel implements FileOperations {
}
return success;
}
@Override
protected void done() {
try {
@ -518,6 +531,7 @@ public class TemplateTreePane extends JPanel implements FileOperations {
}
return false;
}
public void setToolbarStateChangeListener(FileToolbarStateChangeListener listener) {
this.toolBarStateChangeListener = listener;
}
@ -526,8 +540,8 @@ public class TemplateTreePane extends JPanel implements FileOperations {
/**
* 仅支持在拥有完整权限的文件夹下进行新建和重命名操作那么是可以看到改文件夹下所有文件的
*
* @param newName 原名
* @param suffix 后缀名
* @param newName 原名
* @param suffix 后缀名
* @param baseOnSelf 检验目录时是基于自身目录的子节点还是基于父目录的子节点进行校验
* @return 是否有重名的
*/

2
designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java

@ -762,7 +762,7 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi
private JPanel createTipsPane() {
JPanel tipsPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
tipsPane.setLayout(new BorderLayout(4, 4));
tipsPane.setBorder(BorderFactory.createEmptyBorder(30, 2, 0, 0));
tipsPane.setBorder(new ScaledEmptyBorder(30, 2, 0, 0));
JPanel searchPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
searchPane.setLayout(new BorderLayout(4, 4));
keyWordTextField.setPlaceholder(Toolkit.i18nText("Fine-Design_Search_Interface"));

3
designer-base/src/main/java/com/fr/design/javascript/JavaScriptImplPane.java

@ -30,6 +30,7 @@ import java.util.List;
import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.theme.utils.FineUIScale.scale;
public class JavaScriptImplPane extends AbstractHyperLinkPane<JavaScriptImpl> {
private static final int BOTTOM_BORDER = 12;
@ -73,7 +74,7 @@ public class JavaScriptImplPane extends AbstractHyperLinkPane<JavaScriptImpl> {
cell(FineUIUtils.wrapComponentWithTitle(importedJsPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportServerP_Import_JavaScript"))).weight(0.5),
cell(FineUIUtils.wrapComponentWithTitle(parameterPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameter"))).weight(0.5)
).getComponent());
topPane.setPreferredSize(new Dimension(super.getPreferredSize().width, 150));
topPane.setPreferredSize(new Dimension(super.getPreferredSize().width, scale(150)));
this.setLayout(new BorderLayout());
this.add(topPane, BorderLayout.NORTH);

1
designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java

@ -1041,6 +1041,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
button.setIcon(new LazyIcon(getBtnIconId(), ICON_WIDTH));
button.setDisabledIcon(new LazyIcon(btnIconName + ICON_SUFFIX_DISABLED, ICON_WIDTH));
} else {
iconSuffix = ICON_SUFFIX_NORMAL_DEPRECATED;
button.setIcon(IconUtils.readIcon(getBtnIconUrl()));
button.setDisabledIcon(IconUtils.readIcon(getIconBaseDir() + btnIconName + ICON_SUFFIX_DISABLED_DEPRECATED));
}

83
designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkHelper.java

@ -0,0 +1,83 @@
package com.fr.design.remote.ui.debug;
import com.fr.stable.StringUtils;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* 帮助类
*
* @author vito
* @since 11.0
* Created on 2024/10/11
*/
public class RemoteDesignNetWorkHelper {
private static final int UNIT = 1000;
private static final int UNIT_BYTES = 1024;
private static final String SECOND = "s";
private static final int K = 1024;
private static final int MS = 1000;
static String dateFormat(Date date) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
return dateFormat.format(date);
}
static String simpleTime(long time) {
if (time < 0) {
return time + "";
} else if (time < MS) {
return time + " ms";
} else {
DecimalFormat df = new DecimalFormat("#.0");
return df.format((float) time / MS) + " s";
}
}
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";
}
}
static long parseCostToMS(String timeStr) {
String[] split = timeStr.split(" ");
if (split.length > 1) {
double number = Double.parseDouble(split[0]);
String unit = split[1].toLowerCase();
if (StringUtils.equals(unit, SECOND)) {
return (long) (number * UNIT);
}
return (long) number;
}
return 0;
}
static long parseSizeToBytes(String sizeStr) {
String[] split = sizeStr.split(" ");
if (split.length > 1) {
double number = Double.parseDouble(split[0]);
String unit = split[1].toUpperCase();
switch (unit) {
case "K":
return (long) (number * UNIT_BYTES);
case "M":
return (long) (number * UNIT_BYTES * UNIT_BYTES);
case "G":
return (long) (number * UNIT_BYTES * UNIT_BYTES * UNIT_BYTES);
default:
return (long) number;
}
}
return 0;
}
}

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

@ -4,6 +4,7 @@ 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.design.gui.ibutton.UIToggleButton;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
@ -13,17 +14,19 @@ import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JToolBar;
import javax.swing.SwingUtilities;
import javax.swing.border.EmptyBorder;
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 java.util.concurrent.atomic.AtomicLong;
import static com.fanruan.workplace.http.debug.RemoteDesignDebugEvent.REMOTE_HTTP_REQUEST;
import static com.fr.design.remote.ui.debug.RemoteDesignNetWorkHelper.dateFormat;
import static com.fr.design.remote.ui.debug.RemoteDesignNetWorkHelper.simpleSize;
import static com.fr.design.remote.ui.debug.RemoteDesignNetWorkHelper.simpleTime;
/**
* 远程设计网络调试面板
@ -33,25 +36,29 @@ import static com.fanruan.workplace.http.debug.RemoteDesignDebugEvent.REMOTE_HTT
* 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;
private final AtomicLong count = new AtomicLong(0);
private boolean scrollRectToVisible = false;
private final Listener<RequestInfo> remoteDesignDebugListener = 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(),
SwingUtilities.invokeLater(() -> {
model.addRow(new Object[]{
count.incrementAndGet(),
dateFormat(requestInfo.getDate()),
requestInfo.getPath().substring(WorkContext.getCurrent().getPath().length() - 1),
requestInfo.getStatus(),
simpleTime(requestInfo.getConsume()),
simpleSize(requestInfo.getRequestSize()),
simpleSize(requestInfo.getResponseSize()),
requestInfo.getSendBody(),
requestInfo.getReturnBody(),
});
adjustColumnWidths(uiTable);
});
adjustColumnWidths(uiTable);
}
};
@ -69,15 +76,17 @@ public class RemoteDesignNetWorkTablePane extends JPanel {
private void initTable() {
model = new DefaultTableModel();
model.addColumn("status");
model.addColumn("No.");
model.addColumn("time");
model.addColumn("path");
model.addColumn("status");
model.addColumn("cost");
model.addColumn("request size");
model.addColumn("response size");
model.addColumn("request");
model.addColumn("response");
uiTable = new JTable(model);
uiTable.setRowSorter(new RemoteDesignNetWorkTableRowSorter(model));
add(new JScrollPane(uiTable), BorderLayout.CENTER);
}
@ -86,7 +95,8 @@ public class RemoteDesignNetWorkTablePane extends JPanel {
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"));
UIButton remove = new UIButton(new LazyIcon("remove"));
UIToggleButton refresh = new UIToggleButton(new LazyIcon("refresh"));
run.setEnabled(false);
run.setToolTipText("Start Record");
run.addActionListener(e -> {
@ -100,10 +110,16 @@ public class RemoteDesignNetWorkTablePane extends JPanel {
run.setEnabled(true);
forbid.setEnabled(false);
});
refresh.setToolTipText("Clear Records");
refresh.addActionListener(e -> model.setRowCount(0));
remove.setToolTipText("Clear Records");
remove.addActionListener(e -> {
model.setRowCount(0);
count.set(0);
});
refresh.setToolTipText("Always Scroll To Visible");
refresh.addChangeListener(e -> scrollRectToVisible = !scrollRectToVisible);
jToolBar.add(run);
jToolBar.add(forbid);
jToolBar.add(remove);
jToolBar.add(refresh);
add(jToolBar, BorderLayout.NORTH);
}
@ -120,36 +136,24 @@ public class RemoteDesignNetWorkTablePane extends JPanel {
EventDispatcher.listen(REMOTE_HTTP_REQUEST, remoteDesignDebugListener);
}
private static void adjustColumnWidths(JTable table) {
private void adjustColumnWidths(JTable table) {
int row = table.getRowCount() - 1;
// 从最后一行来调整大小
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";
if (scrollRectToVisible) {
table.scrollRectToVisible(table.getCellRect(row, 0, true));
}
}
}

32
designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkTableRowSorter.java

@ -0,0 +1,32 @@
package com.fr.design.remote.ui.debug;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableRowSorter;
import java.util.Comparator;
/**
* 行排序器
*
* @author vito
* @since 11.0
* Created on 2024/10/11
*/
public class RemoteDesignNetWorkTableRowSorter extends TableRowSorter<DefaultTableModel> {
public RemoteDesignNetWorkTableRowSorter(DefaultTableModel model) {
super(model);
setComparator(0, (Comparator<Long>) Long::compareTo);
setComparator(4, Comparator.comparingLong(RemoteDesignNetWorkHelper::parseCostToMS));
setComparator(5, Comparator.comparingLong(RemoteDesignNetWorkHelper::parseSizeToBytes));
setComparator(6, Comparator.comparingLong(RemoteDesignNetWorkHelper::parseSizeToBytes));
}
@Override
public boolean isSortable(int column) {
return column == 0
|| column == 4
|| column == 5
|| column == 6;
}
}

2
designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java

@ -462,7 +462,7 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
int size = colors.length;
for (int i = 1; i <= total; i++) {
ColorCell cell = (ColorCell) this.pane.getComponent(i);
Color color = i < size ? colors[size - i - 1] : UsedColorPane.DEFAULT_COLOR;
Color color = i <= size ? colors[size - i] : UsedColorPane.DEFAULT_COLOR;
cell.setColor(color == null ? UsedColorPane.DEFAULT_COLOR : color);
}
}

98
designer-base/src/main/resources/com/fr/design/data/tabledata/datacenter/web/data-choose.main.js

File diff suppressed because one or more lines are too long

6
designer-form/src/main/java/com/fr/design/mainframe/FormWidgetPopWindow.java

@ -17,6 +17,8 @@ import java.awt.Toolkit;
import java.awt.event.AWTEventListener;
import java.awt.event.MouseEvent;
import static com.fine.theme.utils.FineUIScale.scale;
//august:
public class FormWidgetPopWindow extends JWindow {
private WidgetOption[] options;
@ -127,8 +129,8 @@ public class FormWidgetPopWindow extends JWindow {
public Dimension preferredLayoutSize(Container parent) {
Insets insets = parent.getInsets();
int nmembers = parent.getComponentCount();
return new Dimension(maxLine * 28 + insets.left + insets.right + right + left, (nmembers / maxLine + 1)
* 24 + insets.top + insets.bottom + top + bottom);
return new Dimension(maxLine * scale(28) + insets.left + insets.right + scale(right) + scale(left),
(int) Math.ceil((float) nmembers / maxLine) * scale(26) + insets.top + insets.bottom + scale(top) + scale(bottom));
}
@Override

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

@ -12,6 +12,7 @@ import com.fanruan.carina.annotions.Stop;
import com.fanruan.carina.annotions.Supplemental;
import com.fanruan.config.ConfigProviderFactory;
import com.fanruan.config.LocalConfigSource;
import com.fanruan.config.SetupDataDesignerRemoteOperator;
import com.fanruan.config.realm.ConfigRealm;
import com.fanruan.dao.context.DBContextProvider;
import com.fanruan.dao.context.DBContextStarter;
@ -51,6 +52,7 @@ import com.fr.config.holder.ConfigChangeListener;
import com.fr.config.holder.ValidateConfigManger;
import com.fr.config.impl.ConfConfigProviderImpl;
import com.fr.config.impl.ConfigInsecurityElementProviderImpl;
import com.fr.config.utils.SetupDataHelper;
import com.fr.decision.service.context.ServiceContext;
import com.fr.design.backup.EnvBackupHelper;
import com.fr.env.detect.EnvDetectorCenter;
@ -351,6 +353,7 @@ public class DesignEnvComponent {
DaoContext.setXmlEntityDao(new RemoteXmlEntityDao());
DaoContext.setClassHelperDao(new RemoteClassHelperDao());
DaoContext.setEntityDao(new RemoteEntityDao());
SetupDataHelper.getInstance().registerOperator(SetupDataDesignerRemoteOperator.getInstance());
} else {
//本地
TransactorFactory.setTransactor(new HibernateTransactor());
@ -369,6 +372,7 @@ public class DesignEnvComponent {
private void stopConfConfig() {
SetupDataHelper.getInstance().resetOperator();
DaoContext.setClassHelperDao(null);
DaoContext.setEntityDao(null);
DaoContext.setXmlEntityDao(null);

51
designer-realize/src/main/java/com/fanruan/config/SetupDataDesignerRemoteOperator.java

@ -0,0 +1,51 @@
package com.fanruan.config;
import com.fanruan.repository.ConfigRepository;
import com.fr.config.utils.ConfData;
import com.fr.config.utils.ConfigReadUtils;
import com.fr.config.utils.PrefixHandler;
import com.fr.config.utils.SetupDataOperator;
import com.fr.stable.StringUtils;
/**
* 设计器远程下获取Updata的操作类
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/10/14
*/
public class SetupDataDesignerRemoteOperator implements SetupDataOperator {
private static final SetupDataDesignerRemoteOperator INSTANCE = new SetupDataDesignerRemoteOperator();
/**
* 单例
*/
public static SetupDataDesignerRemoteOperator getInstance() {
return INSTANCE;
}
@Override
public ConfData getData(String prefix, String tenantId) {
return ConfigRepository.getInstance().getConfigByConfigsCache(getConfigNameSpace(prefix), () -> {
ConfData data = new ConfData();
data.setDataMap(ConfigReadUtils.getData(prefix, tenantId));
data.setMap(ConfigReadUtils.getClassInfo(prefix, tenantId));
return data;
});
}
private String getConfigNameSpace(String id) {
if (StringUtils.isEmpty(id)) {
throw new IllegalArgumentException("id cannot be null");
}
int length = id.length();
for (int i = 0; i < length; i++) {
if (PrefixHandler.SEPERATOR == id.charAt(i)) {
return id.substring(0, i);
}
}
throw new IllegalArgumentException("cannot resolve namespace of " + id);
}
}

58
designer-realize/src/main/java/com/fr/design/widget/ui/ButtonGroupDictPane.java

@ -1,8 +1,9 @@
package com.fr.design.widget.ui;
import com.fine.swing.ui.layout.Row;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.data.Dictionary;
import com.fr.design.gui.core.ReactiveCardPane;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UIBasicSpinner;
@ -11,11 +12,8 @@ import com.fr.design.mainframe.widget.accessibles.AccessibleDictionaryEditor;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.form.ui.ButtonGroup;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.SpinnerNumberModel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.column;
@ -29,7 +27,7 @@ public class ButtonGroupDictPane extends JPanel {
private UICheckBox adaptiveCheckbox;
private UILabel columnLabel;
private AccessibleDictionaryEditor dictPane;
private ReactiveCardPane reactiveCardPane;
private Row showColumn;
public ButtonGroupDictPane() {
@ -41,51 +39,29 @@ public class ButtonGroupDictPane extends JPanel {
*/
public void initComponents() {
dictPane = new AccessibleDictionaryEditor();
this.setLayout(FRGUIPaneFactory.createBorderLayout());
adaptiveCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Adaptive"), true);
adaptiveCheckbox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
adaptiveCheckbox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
boolean selected = adaptiveCheckbox.isSelected();
if (selected) {
reactiveCardPane.select("adaptive").populate();
} else {
reactiveCardPane.select("inadaptive").populate();
}
}
});
UILabel dictLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_DS_Dictionary"));
this.columnLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Group_Display_Columns") + ":", dictLabel.getPreferredSize().width);
columnSpinner = new UIBasicSpinner(new SpinnerNumberModel(0, 0, Integer.MAX_VALUE, 1));
reactiveCardPane = ReactiveCardPane.create()
.addSupplier("adaptive", () -> column(
10,
row(cell(dictLabel).weight(LEFT_WEIGHT), cell(dictPane).weight(RIGHT_WEIGHT)),
row(cell(adaptiveCheckbox)),
row(cell(columnLabel).weight(LEFT_WEIGHT), cell(columnSpinner).weight(RIGHT_WEIGHT))
).getComponent()
).addSupplier("inadaptive", () -> column(
10,
row(cell(dictLabel).weight(LEFT_WEIGHT), cell(dictPane).weight(RIGHT_WEIGHT)),
row(cell(adaptiveCheckbox))
).getComponent());
reactiveCardPane.select("inadaptive").populate();
this.add(reactiveCardPane);
showColumn = row(cell(columnLabel).weight(LEFT_WEIGHT), cell(columnSpinner).weight(RIGHT_WEIGHT)).getComponent();
this.setLayout(FRGUIPaneFactory.createBorderLayout());
adaptiveCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Adaptive"), true);
adaptiveCheckbox.setBorder(new ScaledEmptyBorder(0, 0, 0, 0));
adaptiveCheckbox.addActionListener(e -> {
boolean selected = adaptiveCheckbox.isSelected();
showColumn.setVisible(!selected);
});
this.add(column(10,
row(cell(dictLabel).weight(LEFT_WEIGHT), cell(dictPane).weight(RIGHT_WEIGHT)),
row(cell(adaptiveCheckbox)),
cell(showColumn)
).getComponent());
}
public void populate(ButtonGroup buttonGroup) {
dictPane.setValue(buttonGroup.getDictionary());
adaptiveCheckbox.setSelected(buttonGroup.isAdaptive());
boolean selected = adaptiveCheckbox.isSelected();
if (selected) {
reactiveCardPane.select("adaptive").populate();
} else {
reactiveCardPane.select("inadaptive").populate();
}
showColumn.setVisible(!selected);
columnSpinner.setValue(buttonGroup.getColumnsInRow());
}

7
designer-realize/src/main/java/com/fr/start/DesignLauncher.java

@ -34,6 +34,11 @@ public class DesignLauncher extends XmlCarinaLauncher {
return context;
}
@Override
protected void initEncryption() throws CarinaException {
}
@Override
protected void initTenant() throws CarinaException {
}
@ -41,7 +46,7 @@ public class DesignLauncher extends XmlCarinaLauncher {
@Override
protected void initServiceDiscovery() throws CarinaException {
try {
Carina.properties(DiscoveryProperties.class).setServer("local");
Carina.properties(DiscoveryProperties.class).setType("local");
// 服务发现初始化
DiscoveryFactory.initialize();
} catch (Exception e) {

Loading…
Cancel
Save