diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/TemplateLockedHandler.java b/designer-realize/src/main/java/com/fr/design/mainframe/TemplateLockedHandler.java new file mode 100644 index 0000000000..516cb4ceb0 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/mainframe/TemplateLockedHandler.java @@ -0,0 +1,27 @@ +package com.fr.design.mainframe; + +import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.util.UIUtil; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/5/14 + */ +public class TemplateLockedHandler { + + public static void generateTipAndRefresh() { + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Basic_Template_Locked_Tip"), + Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), + FineJOptionPane.WARNING_MESSAGE); + DesignerFrameFileDealerPane.getInstance().refresh(); + } + }); + } + +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/CptApp.java b/designer-realize/src/main/java/com/fr/design/mainframe/app/CptApp.java index 4e9980a499..431b401fc9 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/CptApp.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/app/CptApp.java @@ -13,6 +13,7 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DecodeDialog; +import com.fr.design.mainframe.TemplateLockedHandler; import com.fr.design.ui.util.UIUtil; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.exception.DecryptTemplateException; @@ -68,6 +69,7 @@ class CptApp extends AbstractWorkBookApp { FineLoggerFactory.getLogger().error(Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + file, exp); } catch (TplLockedException exp) { FineLoggerFactory.getLogger().error(file + Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked"), exp); + TemplateLockedHandler.generateTipAndRefresh(); } catch (Exception exp) { FineLoggerFactory.getLogger().error(Toolkit.i18nText("Fine-Design_Report_NS_Exception_ReadError") + file, exp); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java b/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java index 02692c991c..4100a03c87 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java @@ -10,6 +10,7 @@ import com.fr.design.mainframe.BaseJForm; import com.fr.design.mainframe.DecodeDialog; import com.fr.design.mainframe.JForm; import com.fr.design.mainframe.JTemplate; +import com.fr.design.mainframe.TemplateLockedHandler; import com.fr.design.worker.open.OpenResult; import com.fr.design.worker.open.OpenWorker; import com.fr.exception.DecryptTemplateException; @@ -106,6 +107,7 @@ class FormApp extends AbstractAppProvider { FineLoggerFactory.getLogger().error(Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + file, exp); } catch (TplLockedException exp) { FineLoggerFactory.getLogger().error(file + Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked"), exp); + TemplateLockedHandler.generateTipAndRefresh(); } catch (Exception exp) { FineLoggerFactory.getLogger().error("Failed to generate frm from " + file, exp); return null; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/XlsApp.java b/designer-realize/src/main/java/com/fr/design/mainframe/app/XlsApp.java index 3741f8b35d..5b135ccdfe 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/XlsApp.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/app/XlsApp.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe.app; import com.fr.base.extension.FileExtension; import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.TemplateLockedHandler; import com.fr.exception.RemoteDesignPermissionDeniedException; import com.fr.exception.TplLockedException; import com.fr.file.FILE; @@ -30,6 +31,7 @@ class XlsApp extends AbstractWorkBookApp { FineLoggerFactory.getLogger().error(Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + tplFile, exp); } catch (TplLockedException exp) { FineLoggerFactory.getLogger().error(tplFile + Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked"), exp); + TemplateLockedHandler.generateTipAndRefresh(); } catch (Exception exp) { FineLoggerFactory.getLogger().error("Failed to generate xls from " + tplFile, exp); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/XlsxApp.java b/designer-realize/src/main/java/com/fr/design/mainframe/app/XlsxApp.java index 9d66cffb8f..f5a5498cf8 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/XlsxApp.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/app/XlsxApp.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe.app; import com.fr.base.extension.FileExtension; import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.TemplateLockedHandler; import com.fr.exception.RemoteDesignPermissionDeniedException; import com.fr.exception.TplLockedException; import com.fr.file.FILE; @@ -31,6 +32,7 @@ class XlsxApp extends AbstractWorkBookApp { FineLoggerFactory.getLogger().error(Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + tplFile, exp); } catch (TplLockedException exp) { FineLoggerFactory.getLogger().error(tplFile + Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked"), exp); + TemplateLockedHandler.generateTipAndRefresh(); } catch (Exception exp) { FineLoggerFactory.getLogger().error("Failed to generate xlsx from " + tplFile, exp); }