You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
2.0 KiB
58 lines
2.0 KiB
package com.fr.design.data.datapane.connect; |
|
|
|
import com.fr.design.dialog.BasicDialog; |
|
import com.fr.design.dialog.DialogActionAdapter; |
|
import com.fr.design.dialog.FineJOptionPane; |
|
import com.fr.design.editlock.EditLockUtils; |
|
import com.fr.design.i18n.Toolkit; |
|
import com.fr.design.mainframe.DesignerContext; |
|
import com.fr.file.ConnectionConfig; |
|
import com.fr.report.LockItem; |
|
|
|
import javax.swing.JOptionPane; |
|
|
|
/** |
|
* @author hades |
|
* @version 11.0 |
|
* Created by hades on 2021/9/8 |
|
*/ |
|
public class ConnectionListDialogActionAdapter extends DialogActionAdapter { |
|
|
|
private final ConnectionManagerPane connectionManagerPane; |
|
private final BasicDialog connectionListDialog; |
|
private final ConnectionConfig connectionConfig; |
|
|
|
public ConnectionListDialogActionAdapter(ConnectionManagerPane connectionManagerPane, |
|
BasicDialog connectionListDialog, |
|
ConnectionConfig connectionConfig) { |
|
this.connectionManagerPane = connectionManagerPane; |
|
this.connectionListDialog = connectionListDialog; |
|
this.connectionConfig = connectionConfig; |
|
} |
|
|
|
@Override |
|
public void doOk() { |
|
if (!connectionManagerPane.isNamePermitted()) { |
|
connectionListDialog.setDoOKSucceed(false); |
|
return; |
|
} |
|
try { |
|
connectionManagerPane.update(connectionConfig); |
|
} catch (Exception e) { |
|
connectionListDialog.setDoOKSucceed(false); |
|
FineJOptionPane.showMessageDialog(connectionManagerPane, e.getMessage(), Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE); |
|
return; |
|
} |
|
DesignerContext.getDesignerBean("databasename").refreshBeanElement(); |
|
// 关闭定义数据连接页面,为其解锁 |
|
EditLockUtils.unlock(LockItem.CONNECTION); |
|
|
|
} |
|
|
|
@Override |
|
public void doCancel() { |
|
// 关闭定义数据连接页面,为其解锁 |
|
super.doCancel(); |
|
EditLockUtils.unlock(LockItem.CONNECTION); |
|
} |
|
}
|
|
|