Browse Source
* commit '45067de975370de09eb58181f004a9309e4243ec': REPORT-77217 ConnectionProvider-修改之后数据连接信息无法保存 同步10.0 【问题原因】产生假保存的原因是,在保存的时候会判断现有的Connection与以前存储的Connection是否有不同,如果不同就代表需要更新。实际上插件中的Connection相关类没有写equals方法,然后新旧Connection被认为是相同了,就没有走后面的更新配置的逻辑 【改动方案】拉rinoux、vito、hugh一起沟通了下方案,暂时主代码里做个兼容,让主代码内置的两种Connection去判断是否要更新,其余的Connection(插件Connection)都必须更新 【review建议】同步10.0 REPORT-75991 插件完整性校验,弹窗链接帮助文档说明 【问题原因】安全类需求,将原来仅对官方插件开启的 插件完整性校验,扩大到了 第三方插件。但弹窗不明确,对于用户侧没有闭环,需要添加帮助文档链接,帮助用户清楚前因后果与解决方案。 【改动方案】1.提示文案内容修改;2.提示中存在超链接,将插件这边因为"插件完整性校验"而失败的弹窗单独处理了下,由原本的JOptionPane修改为JEditorPane 【review建议】其它的弹窗暂时没有变动的需求,跟产品沟通过了,如果以后有必要统一的时候再来统一处理 REPORT-72635 - 数据连接面板为空的问题(含控制权限) 有些新类,没提交进去 REPORT-72635 - 数据连接面板为空的问题(含控制权限) 【问题原因】同步到10.0 【改动思路】同步到10.0 【review建议】无 REPORT-76370 提供一个数据连接前置检查接口&提交10.0 REPORT-76370 提供一个数据连接前置检查接口&提交10.0 REPORT-38555 fix:数字控件中内容可以输入空格和减号 REPORT-38555 fix:数字控件中内容可以输入空格和减号 REPORT-38523 fix: 右侧单元格属性表鼠标事件有误,修改了mouseReleased事件persist/10.0 10.0.19.2022.08.03
superman
2 years ago
22 changed files with 764 additions and 58 deletions
@ -0,0 +1,57 @@
|
||||
package com.fr.design.data.datapane.auth; |
||||
|
||||
import com.fr.base.TableData; |
||||
import com.fr.data.impl.Connection; |
||||
import com.fr.data.impl.DBTableData; |
||||
import com.fr.data.impl.NameDatabaseConnection; |
||||
import com.fr.stable.StringUtils; |
||||
import com.fr.workspace.WorkContext; |
||||
import com.fr.workspace.server.connection.DBConnectAuth; |
||||
|
||||
import java.util.Collection; |
||||
import java.util.Collections; |
||||
|
||||
/** |
||||
* 数据连接权限相关的工具类 |
||||
* @author Yvan |
||||
*/ |
||||
public class TableDataAuthHelper { |
||||
|
||||
/** |
||||
* 编辑数据集时是否需要检查权限 |
||||
* @param tableData |
||||
* @return |
||||
*/ |
||||
public static boolean needCheckAuthWhenEdit(TableData tableData) { |
||||
// 远程设计下,编辑DBTableData时需要判断权限
|
||||
return !WorkContext.getCurrent().isLocal() && tableData instanceof DBTableData; |
||||
} |
||||
|
||||
/** |
||||
* 获取无权限数据连接集合 |
||||
* 远程下需要调用RPC,为耗时操作,谨慎使用 |
||||
* @return |
||||
*/ |
||||
public static Collection<String> getNoAuthConnections() { |
||||
// 获取无权限连接集合
|
||||
Collection<String> noAuthConnections = WorkContext.getCurrent().get(DBConnectAuth.class).getNoAuthConnections(); |
||||
return noAuthConnections == null ? Collections.emptyList() : noAuthConnections; |
||||
} |
||||
|
||||
/** |
||||
* 通过数据集获取其数据连接的名称 |
||||
* |
||||
* 注意: |
||||
* 1. Connection接口本身是不提供名称的,只有我们内部为了使用方便,将其包装成了NameDataBaseConnection |
||||
* 如果不是NameDataBaseConnection类型,则无名称,因此这里只能用判断类型的方式获取名称 |
||||
* 2. 仅支持DBTableData获取连接名 |
||||
* @return |
||||
*/ |
||||
public static String getConnectionNameByDBTableData(DBTableData tableData) { |
||||
Connection database = tableData.getDatabase(); |
||||
if (database instanceof NameDatabaseConnection) { |
||||
return ((NameDatabaseConnection) database).getName(); |
||||
} |
||||
return StringUtils.EMPTY; |
||||
} |
||||
} |
@ -0,0 +1,23 @@
|
||||
package com.fr.design.data.tabledata.tabledatapane.loading; |
||||
|
||||
|
||||
|
||||
/** |
||||
* 可切换的DBTableData对应的数据集面板,需要使用CardLayout布局 |
||||
* 主要是给插件适配用的 |
||||
* @author Yvan |
||||
*/ |
||||
public interface SwitchableTableDataPane { |
||||
|
||||
/** Loading面板 */ |
||||
String LOADING_PANE_NAME = "Loading"; |
||||
/** 内容面板 */ |
||||
String CONTENT_PANE_NAME = "Content"; |
||||
|
||||
/** |
||||
* 根据面板名称切换面板 |
||||
* @param paneName 面板名称 |
||||
*/ |
||||
void switchTo(String paneName); |
||||
|
||||
} |
@ -0,0 +1,54 @@
|
||||
package com.fr.design.data.tabledata.tabledatapane.loading; |
||||
|
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.i18n.Toolkit; |
||||
|
||||
import javax.swing.JPanel; |
||||
import java.awt.CardLayout; |
||||
|
||||
/** |
||||
* @author Yvan |
||||
*/ |
||||
public class TableDataLoadingPane extends BasicPane { |
||||
|
||||
/** Loading面板 */ |
||||
public static final String LOADING_PANE_NAME = "Loading"; |
||||
/** 无权限提示面板 */ |
||||
public static final String NO_AUTH_PANE_NAME = "NoAuthority"; |
||||
/** 错误提示面板 */ |
||||
public static final String ERROR_NAME = "Error"; |
||||
|
||||
private CardLayout card; |
||||
|
||||
/** 加载中面板 */ |
||||
private JPanel loadingPane; |
||||
/** 错误提示面板 */ |
||||
private JPanel errorPane; |
||||
/** 数据连接无权限面板 */ |
||||
private JPanel noAuthorityPane; |
||||
|
||||
public TableDataLoadingPane() { |
||||
initPanes(); |
||||
} |
||||
|
||||
private void initPanes() { |
||||
card = new CardLayout(); |
||||
this.setLayout(card); |
||||
loadingPane = new TipsPane(true); |
||||
errorPane = new TipsPane(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Error")); |
||||
noAuthorityPane = new TipsPane(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_No_Auth")); |
||||
add(LOADING_PANE_NAME, loadingPane); |
||||
add(NO_AUTH_PANE_NAME, noAuthorityPane); |
||||
add(ERROR_NAME, errorPane); |
||||
switchTo(LOADING_PANE_NAME); |
||||
} |
||||
|
||||
public void switchTo(String panelName) { |
||||
card.show(this, panelName); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Toolkit.i18nText("Fine-Design_Basic_DS-Database_Query"); |
||||
} |
||||
} |
@ -0,0 +1,45 @@
|
||||
package com.fr.design.data.tabledata.tabledatapane.loading; |
||||
|
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
|
||||
import javax.swing.JPanel; |
||||
import javax.swing.JProgressBar; |
||||
import javax.swing.SwingConstants; |
||||
import java.awt.BorderLayout; |
||||
|
||||
/** |
||||
* 提示面板,支持自定义提示,支持进度条配置可选 |
||||
* @author Yvan |
||||
*/ |
||||
public class TipsPane extends JPanel { |
||||
|
||||
/** |
||||
* 默认提示 |
||||
*/ |
||||
private static final String LOADING = Toolkit.i18nText("Fine-Design_Basic_Loading_And_Waiting"); |
||||
|
||||
public TipsPane () { |
||||
this(LOADING, false); |
||||
} |
||||
|
||||
public TipsPane (String tip) { |
||||
this(tip, false); |
||||
} |
||||
|
||||
public TipsPane (boolean needProgressBar) { |
||||
this(LOADING, needProgressBar); |
||||
} |
||||
|
||||
public TipsPane (String tips, boolean needProgressBar) { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
UILabel tipsLabel = new UILabel(tips, SwingConstants.CENTER); |
||||
this.add(tipsLabel, BorderLayout.CENTER); |
||||
if (needProgressBar) { |
||||
JProgressBar progressBar = new JProgressBar(); |
||||
progressBar.setIndeterminate(true); |
||||
this.add(progressBar, BorderLayout.SOUTH); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,70 @@
|
||||
package com.fr.design.extra.exe.callback.handle; |
||||
|
||||
import com.fr.design.dialog.FineJOptionPane; |
||||
import com.fr.design.dialog.link.MessageWithLink; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.plugin.error.PluginErrorCode; |
||||
import com.fr.plugin.manage.control.PluginTaskResult; |
||||
|
||||
/** |
||||
* 帮助处理插件操作(安装、更新等)的弹窗 |
||||
* @author Yvan |
||||
*/ |
||||
public class PluginCallBackHelper { |
||||
|
||||
private static final String NEW_LINE_TAG = "<br/>"; |
||||
private static final String REFERENCE = Toolkit.i18nText("Fine-Design_Basic_Plugin_File_Validate_Reference"); |
||||
private static final String HELP_DOCUMENT_NAME = Toolkit.i18nText("Fine-Design_Basic_Plugin_File_Validate_HELP_DOCUMENT_NAME"); |
||||
private static final String CONNECTOR = "-"; |
||||
private static final String HELP_DOCUMENT_LINK = Toolkit.i18nText("Fine-Design_Basic_Plugin_File_Validate_HELP_DOCUMENT_LINK"); |
||||
|
||||
|
||||
/** |
||||
* 展示插件操作失败后的提示弹窗 |
||||
* @param result |
||||
* @param pluginInfo |
||||
*/ |
||||
public static void showErrorMessage(PluginTaskResult result, String pluginInfo) { |
||||
// 单独处理下插件完整性校验失败的提示
|
||||
if (PluginCallBackHelper.needHandleInvalidatePackage(result)) { |
||||
MessageWithLink messageWithLink = PluginCallBackHelper.generate4InvalidatePackage(pluginInfo); |
||||
PluginTaskResultErrorDialog resultDialog = new PluginTaskResultErrorDialog(null, messageWithLink); |
||||
resultDialog.showResult(); |
||||
} else { |
||||
FineJOptionPane.showMessageDialog(null, pluginInfo, Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), FineJOptionPane.ERROR_MESSAGE); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 判断是否需要处理 插件安装包校验失败 导致的安装失败任务 |
||||
* @param result |
||||
* @return |
||||
*/ |
||||
private static boolean needHandleInvalidatePackage(PluginTaskResult result) { |
||||
return !result.isSuccess() && result.getCode() == PluginErrorCode.InstallPackageValidateFailed; |
||||
} |
||||
|
||||
/** |
||||
* 根据插件原始报错信息,构建MessageWithLink |
||||
* @param originInfo |
||||
* @return |
||||
*/ |
||||
private static MessageWithLink generate4InvalidatePackage(String originInfo) { |
||||
|
||||
return new MessageWithLink(getSupplementaryMessage(originInfo), HELP_DOCUMENT_NAME, HELP_DOCUMENT_LINK); |
||||
} |
||||
|
||||
/** |
||||
* 根据插件原始报错信息,获取增加了补充说明后的信息 |
||||
* @param originInfo |
||||
* @return |
||||
*/ |
||||
private static String getSupplementaryMessage(String originInfo) { |
||||
return new StringBuilder() |
||||
.append(originInfo) |
||||
.append(NEW_LINE_TAG) |
||||
.append(REFERENCE) |
||||
.append(CONNECTOR) |
||||
.toString(); |
||||
} |
||||
} |
@ -0,0 +1,86 @@
|
||||
package com.fr.design.extra.exe.callback.handle; |
||||
|
||||
import com.fr.base.svg.IconUtils; |
||||
import com.fr.design.dialog.link.MessageWithLink; |
||||
import com.fr.design.gui.ibutton.UIButton; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.VerticalFlowLayout; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.JDialog; |
||||
import javax.swing.JPanel; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Dimension; |
||||
import java.awt.Frame; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
|
||||
/** |
||||
* 当前仅处理Error提示,之后有需要再扩展 |
||||
* @author Yvan |
||||
*/ |
||||
public class PluginTaskResultErrorDialog extends JDialog { |
||||
|
||||
private static final Dimension LABEL = new Dimension(60, 90); |
||||
|
||||
private JPanel contentPane; |
||||
|
||||
private UILabel errorLabel; |
||||
|
||||
private UIButton confirmButton; |
||||
|
||||
private MessageWithLink messageWithLink; |
||||
|
||||
public PluginTaskResultErrorDialog(Frame parent, MessageWithLink messageWithLink) { |
||||
super(parent, true); |
||||
this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning")); |
||||
this.messageWithLink = messageWithLink; |
||||
|
||||
initContentPane(); |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
this.setResizable(false); |
||||
this.add(contentPane, BorderLayout.CENTER); |
||||
this.setSize(new Dimension( 380, 160)); |
||||
GUICoreUtils.centerWindow(this); |
||||
} |
||||
|
||||
/** |
||||
* 初始化内容面板 |
||||
*/ |
||||
private void initContentPane() { |
||||
this.contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
// error图标
|
||||
errorLabel = new UILabel(IconUtils.readIcon("/com/fr/design/standard/system/error_tips.svg")); |
||||
errorLabel.setPreferredSize(LABEL); |
||||
errorLabel.setBorder(BorderFactory.createEmptyBorder(10, 20, 40, 20)); |
||||
// 提示内容
|
||||
JPanel messagePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
messagePane.add(errorLabel, BorderLayout.WEST); |
||||
messagePane.add(messageWithLink, BorderLayout.CENTER); |
||||
messagePane.setBorder(BorderFactory.createEmptyBorder(20, 10, 0, 10)); |
||||
this.contentPane.add(messagePane, BorderLayout.CENTER); |
||||
// 确定按钮
|
||||
confirmButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Button_OK")); |
||||
confirmButton.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
hideResult(); |
||||
} |
||||
}); |
||||
JPanel confirmPane = new JPanel(new VerticalFlowLayout()); |
||||
confirmPane.add(confirmButton); |
||||
confirmPane.setBorder(BorderFactory.createEmptyBorder(0, 160, 10, 0)); |
||||
this.contentPane.add(confirmPane, BorderLayout.SOUTH); |
||||
} |
||||
|
||||
public void showResult() { |
||||
this.setVisible(true); |
||||
} |
||||
|
||||
public void hideResult() { |
||||
this.setVisible(false); |
||||
} |
||||
} |
After Width: | Height: | Size: 1.6 KiB |
@ -0,0 +1,44 @@
|
||||
package com.fr.design.gui.itextfield; |
||||
|
||||
import org.junit.Assert; |
||||
import org.junit.Test; |
||||
|
||||
/** |
||||
* @author Destiny.Lin |
||||
* @version 10.0 |
||||
* created by Destiny.Lin on 2022-07-11 |
||||
*/ |
||||
public class UINumberFieldTest { |
||||
|
||||
@Test |
||||
public void testUINumberFieldTest(){ |
||||
UINumberField uiNumberField = new UINumberField(); |
||||
uiNumberField.setFieldDocument(); |
||||
//异常输入测试
|
||||
uiNumberField.setText("-.1"); |
||||
Assert.assertEquals("",uiNumberField.getText()); |
||||
uiNumberField.setText(".-1"); |
||||
Assert.assertEquals("",uiNumberField.getText()); |
||||
uiNumberField.setText("1-"); |
||||
Assert.assertEquals("",uiNumberField.getText()); |
||||
uiNumberField.setText("1-1"); |
||||
Assert.assertEquals("",uiNumberField.getText()); |
||||
uiNumberField.setText("1 "); |
||||
Assert.assertEquals("",uiNumberField.getText()); |
||||
uiNumberField.setText(".1"); |
||||
Assert.assertEquals("",uiNumberField.getText()); |
||||
uiNumberField.setText("1 -"); |
||||
Assert.assertEquals("",uiNumberField.getText()); |
||||
|
||||
//正常输入测试
|
||||
uiNumberField.setText("0.1"); |
||||
Assert.assertEquals("0.1",uiNumberField.getText()); |
||||
uiNumberField.setText("1"); |
||||
Assert.assertEquals("1",uiNumberField.getText()); |
||||
uiNumberField.setText("-1.5"); |
||||
Assert.assertEquals("-1.5",uiNumberField.getText()); |
||||
uiNumberField.setText("-123.123"); |
||||
Assert.assertEquals("-123.123",uiNumberField.getText()); |
||||
|
||||
} |
||||
} |
Loading…
Reference in new issue