Browse Source
* commit '1968b50a166ff5d5204e2984603e9dc9e09fc352': REPORT-83391 更新命名细节 REPORT-83197【设计器】启动页性能优化 遗漏了两部分,代码修复下。 REPORT-83391 顶部参数面板体验优化 交互更新,自动查找的时候最大值为4,最小值为1 REPORT-83197【设计器】启动页性能优化 和 vito 讨论,这里的异步可以直接改成 invokeLater 省心省力, get REPORT-83197【设计器】启动页性能优化 将异步功能放到 UIUtil 中去执行。避免多线程问题 REPORT-83391 顶部参数面板体验优化 交互更新,增加联动效果 REPORT-83197【设计器】启动页性能优化 根据工具提示,修复代码质量 REPORT-83197【设计器】启动页性能优化 根据工具提示,修复代码质量 REPORT-83197【设计器】启动页性能优化 1、DesignerEnvManager 异步加载 2、插件更新功能优化, 改成异步 3、启动页启动时样式变化 4、设计器异步面板加载 REPORT-75091 - 数据脱敏(报表) 【问题原因】处理新增代码行数太多的问题 【改动思路】将新增的UI面板拆出来 【review建议】 REPORT-83391 顶部参数面板体验优化 修改.*导入 REPORT-83391 顶部参数面板体验优化 修改下变量命名 REPORT-83391 顶部参数面板体验优化 REPORT-83625 适配BaseCriteria在cbb中的包名改动 REPORT-75091 - 数据脱敏(报表) 【问题原因】上版本因为迭代延期屏蔽了代码功能入口 【改动思路】将屏蔽取消 【review建议】newui
superman
2 years ago
17 changed files with 1087 additions and 257 deletions
@ -0,0 +1,120 @@
|
||||
package com.fr.design.data.datapane.preview.desensitization.view; |
||||
|
||||
import com.fr.base.svg.IconUtils; |
||||
import com.fr.design.constants.UIConstants; |
||||
import com.fr.design.data.datapane.preview.PreviewTablePane; |
||||
import com.fr.design.gui.ibutton.UIToggleButton; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.itoolbar.UIToolbar; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.menu.SeparatorDef; |
||||
import com.fr.design.menu.ToolBarDef; |
||||
|
||||
import javax.swing.Icon; |
||||
import javax.swing.JPanel; |
||||
import java.awt.Component; |
||||
import java.awt.FlowLayout; |
||||
import java.awt.event.MouseAdapter; |
||||
import java.awt.event.MouseEvent; |
||||
|
||||
/** |
||||
* 数据集预览-脱敏配置面板,主要展示当前脱敏开启状态、当前脱敏设定数量等 |
||||
* |
||||
* @author Yvan |
||||
* @version 11.0 |
||||
* Created by Yvan on 2022/11/14 |
||||
*/ |
||||
public class PreviewTableDesensitizationPane extends JPanel { |
||||
|
||||
private static final String DATA_DESENSITIZATION_CONFIG = Toolkit.i18nText("Fine-Design_Report_Desensitization_Config"); |
||||
private static final String LEFT_BRACKET = "("; |
||||
private static final String RIGHT_BRACKET = ")"; |
||||
private static final String COUNT = Toolkit.i18nText("Fine-Design_Report_Desensitization_Count"); |
||||
|
||||
/** |
||||
* 预览面板 |
||||
*/ |
||||
private PreviewTablePane previewTablePane; |
||||
|
||||
/** |
||||
* "数据脱敏设置"-标签 |
||||
*/ |
||||
private UILabel desensitizationLabel; |
||||
|
||||
/** |
||||
* 脱敏效果预览按钮 |
||||
*/ |
||||
private UIToggleButton previewToggle; |
||||
|
||||
|
||||
public PreviewTableDesensitizationPane(PreviewTablePane previewTablePane) { |
||||
this.previewTablePane = previewTablePane; |
||||
initComponents(); |
||||
} |
||||
|
||||
/** |
||||
* 初始化面板 |
||||
*/ |
||||
private void initComponents() { |
||||
this.setLayout(new FlowLayout(FlowLayout.LEFT)); |
||||
this.add(initDesensitizationLabel()); |
||||
this.add(initToolBar()); |
||||
this.add(initPreviewButton()); |
||||
} |
||||
|
||||
/** |
||||
* 初始化Label |
||||
* |
||||
* @return |
||||
*/ |
||||
private Component initDesensitizationLabel() { |
||||
// 初始化Label
|
||||
desensitizationLabel = new UILabel(DATA_DESENSITIZATION_CONFIG); |
||||
desensitizationLabel.setForeground(UIConstants.NORMAL_BLUE); |
||||
desensitizationLabel.addMouseListener(new MouseAdapter() { |
||||
@Override |
||||
public void mouseClicked(MouseEvent e) { |
||||
previewTablePane.clickDesensitizationLabel(); |
||||
} |
||||
}); |
||||
return desensitizationLabel; |
||||
} |
||||
|
||||
/** |
||||
* 初始化分隔符 |
||||
* |
||||
* @return |
||||
*/ |
||||
private UIToolbar initToolBar() { |
||||
ToolBarDef toolbarDef = new ToolBarDef(); |
||||
toolbarDef.addShortCut(SeparatorDef.DEFAULT); |
||||
UIToolbar toolBar = ToolBarDef.createJToolBar(); |
||||
toolBar.setBorderPainted(false); |
||||
toolbarDef.updateToolBar(toolBar); |
||||
return toolBar; |
||||
} |
||||
|
||||
/** |
||||
* 初始化脱敏效果预览按钮 |
||||
* |
||||
* @return |
||||
*/ |
||||
private UIToggleButton initPreviewButton() { |
||||
previewToggle = new UIToggleButton(new Icon[]{IconUtils.readIcon("/com/fr/design/images/m_file/preview"), IconUtils.readIcon("/com/fr/design/images/m_file/preview")}, true); |
||||
previewToggle.setToolTipText(Toolkit.i18nText("Fine-Design_Report_Desensitization_Preview")); |
||||
previewToggle.setSelected(false); |
||||
previewToggle.addActionListener(e -> { |
||||
// 切换TableModel的脱敏状态
|
||||
previewTablePane.togglePreviewTableModelDesensitizeStatus(); |
||||
// 刷新预览页面,展示
|
||||
previewTablePane.refreshTable(); |
||||
}); |
||||
return previewToggle; |
||||
} |
||||
|
||||
public void setDesensitizationCount(boolean desensitizeOpen, int count) { |
||||
desensitizationLabel.setText(desensitizeOpen ? |
||||
DATA_DESENSITIZATION_CONFIG + LEFT_BRACKET + count + RIGHT_BRACKET + COUNT : |
||||
DATA_DESENSITIZATION_CONFIG); |
||||
} |
||||
} |
@ -0,0 +1,118 @@
|
||||
package com.fr.startup.ui; |
||||
|
||||
import com.fr.concurrent.FineExecutors; |
||||
import com.fr.concurrent.NamedThreadFactory; |
||||
import com.fr.design.gui.iprogressbar.ProgressDialog; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.ui.util.UIUtil; |
||||
import com.fr.event.Event; |
||||
import com.fr.event.EventDispatcher; |
||||
import com.fr.event.Listener; |
||||
import com.fr.module.ModuleEvent; |
||||
|
||||
import java.awt.Frame; |
||||
import java.util.concurrent.ScheduledExecutorService; |
||||
import java.util.concurrent.TimeUnit; |
||||
|
||||
/** |
||||
* 启动加载面板 |
||||
* |
||||
* @author Harrison |
||||
* @version 11.0 |
||||
* created by Harrison on 2022/11/08 |
||||
**/ |
||||
public class StartupLoadingPanel { |
||||
|
||||
/** |
||||
* 每次更新的步伐 |
||||
*/ |
||||
private static final int STEP = 1; |
||||
|
||||
/** |
||||
* 40ms更新进度 |
||||
*/ |
||||
private static final int STEP_HEARTBEAT = 40; |
||||
|
||||
private final Listener<String> MODULE_LISTENER = new Listener<String>() { |
||||
@Override |
||||
public void on(Event event, String param) { |
||||
moduleId = param; |
||||
} |
||||
}; |
||||
|
||||
private ProgressDialog progressDialog; |
||||
private String moduleId; |
||||
private int progress; |
||||
|
||||
public StartupLoadingPanel(Frame frame) { |
||||
this.progressDialog = new ProgressDialog(frame); |
||||
this.moduleId = Toolkit.i18nText("Fine-Design_Basic_Initializing"); |
||||
|
||||
initListeners(); |
||||
} |
||||
|
||||
/** |
||||
* 隐藏 |
||||
*/ |
||||
public void hide() { |
||||
this.progress = progressDialog.getProgressMaximum(); |
||||
} |
||||
|
||||
/** |
||||
* 展示 |
||||
*/ |
||||
public void show() { |
||||
|
||||
final ScheduledExecutorService scheduler = FineExecutors.newScheduledThreadPool(1, |
||||
new NamedThreadFactory("StartupLoadingPanel")); |
||||
scheduler.scheduleAtFixedRate(new Runnable() { |
||||
@Override |
||||
public void run() { |
||||
UIUtil.invokeAndWaitIfNeeded(() -> { |
||||
if (isComplete()) { |
||||
scheduler.shutdown(); |
||||
progressDialog.dispose(); |
||||
resetListeners(); |
||||
return; |
||||
} |
||||
if (!progressDialog.isVisible()) { |
||||
progressDialog.setVisible(true); |
||||
String moduleId = getModuleId(); |
||||
progressDialog.updateLoadingText(moduleId); |
||||
} |
||||
progressDialog.setProgressValue(incrementProgress()); |
||||
}); |
||||
} |
||||
}, 0, STEP_HEARTBEAT, TimeUnit.MILLISECONDS); |
||||
|
||||
} |
||||
|
||||
private void initListeners() { |
||||
|
||||
EventDispatcher.listen(ModuleEvent.MajorModuleStarting, MODULE_LISTENER); |
||||
} |
||||
|
||||
private void resetListeners() { |
||||
|
||||
EventDispatcher.stopListen(MODULE_LISTENER); |
||||
} |
||||
|
||||
private boolean isComplete() { |
||||
return this.progress >= progressDialog.getProgressMaximum(); |
||||
} |
||||
|
||||
private String getModuleId() { |
||||
|
||||
return this.moduleId; |
||||
} |
||||
|
||||
private int incrementProgress() { |
||||
|
||||
if (progress != progressDialog.getProgressMaximum()) { |
||||
progress += STEP; |
||||
} |
||||
return progress; |
||||
} |
||||
|
||||
|
||||
} |
Loading…
Reference in new issue