|
|
@ -6,7 +6,6 @@ import com.fr.base.Style; |
|
|
|
import com.fr.base.TempNameStyle; |
|
|
|
import com.fr.base.TempNameStyle; |
|
|
|
import com.fr.base.extension.FileExtension; |
|
|
|
import com.fr.base.extension.FileExtension; |
|
|
|
import com.fr.base.io.XMLEncryptUtils; |
|
|
|
import com.fr.base.io.XMLEncryptUtils; |
|
|
|
import com.fr.base.remote.RemoteDeziConstants; |
|
|
|
|
|
|
|
import com.fr.config.ServerPreferenceConfig; |
|
|
|
import com.fr.config.ServerPreferenceConfig; |
|
|
|
import com.fr.design.DesignerEnvManager; |
|
|
|
import com.fr.design.DesignerEnvManager; |
|
|
|
import com.fr.design.actions.server.StyleListAction; |
|
|
|
import com.fr.design.actions.server.StyleListAction; |
|
|
@ -15,16 +14,16 @@ import com.fr.design.gui.ilable.UILabel; |
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
import com.fr.design.mainframe.DecodeDialog; |
|
|
|
import com.fr.design.mainframe.DecodeDialog; |
|
|
|
import com.fr.design.utils.gui.GUICoreUtils; |
|
|
|
import com.fr.design.utils.gui.GUICoreUtils; |
|
|
|
|
|
|
|
import com.fr.exception.PermissionDeniedException; |
|
|
|
|
|
|
|
import com.fr.exception.TplLockedException; |
|
|
|
import com.fr.file.FILE; |
|
|
|
import com.fr.file.FILE; |
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.fr.io.utils.ResourceIOUtils; |
|
|
|
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
import com.fr.main.impl.WorkBook; |
|
|
|
import com.fr.main.impl.WorkBook; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
import javax.swing.JDialog; |
|
|
|
import java.awt.*; |
|
|
|
import javax.swing.JPanel; |
|
|
|
|
|
|
|
import javax.swing.SwingConstants; |
|
|
|
|
|
|
|
import java.awt.BorderLayout; |
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
import java.awt.event.ActionListener; |
|
|
|
import java.awt.event.ActionListener; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
@ -34,44 +33,44 @@ import java.util.Iterator; |
|
|
|
* Created by juhaoyu on 2018/6/27. |
|
|
|
* Created by juhaoyu on 2018/6/27. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
class CptApp extends AbstractWorkBookApp { |
|
|
|
class CptApp extends AbstractWorkBookApp { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public String[] defaultExtensions() { |
|
|
|
public String[] defaultExtensions() { |
|
|
|
|
|
|
|
|
|
|
|
return new String[]{FileExtension.CPT.getExtension()}; |
|
|
|
return new String[]{FileExtension.CPT.getExtension()}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public WorkBook asIOFile(FILE file) { |
|
|
|
public WorkBook asIOFile(FILE file) { |
|
|
|
|
|
|
|
|
|
|
|
if (XMLEncryptUtils.isCptEncoded() && |
|
|
|
if (XMLEncryptUtils.isCptEncoded() && |
|
|
|
!XMLEncryptUtils.checkVaild(DesignerEnvManager.getEnvManager().getEncryptionKey())) { |
|
|
|
!XMLEncryptUtils.checkVaild(DesignerEnvManager.getEnvManager().getEncryptionKey())) { |
|
|
|
if (!new DecodeDialog(file).isPwdRight()) { |
|
|
|
if (!new DecodeDialog(file).isPwdRight()) { |
|
|
|
FRContext.getLogger().error(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ECP_Error_Pwd")); |
|
|
|
FRContext.getLogger().error(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ECP_Error_Pwd")); |
|
|
|
return new WorkBook(); |
|
|
|
return new WorkBook(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
WorkBook tpl = new WorkBook(); |
|
|
|
WorkBook tpl = new WorkBook(); |
|
|
|
// richer:打开报表通知
|
|
|
|
// richer:打开报表通知
|
|
|
|
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Template_Opening_And_Waiting", file.getName()) + "..."); |
|
|
|
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Template_Opening_And_Waiting", file.getName()) + "..."); |
|
|
|
TempNameStyle namestyle = TempNameStyle.getInstance(); |
|
|
|
TempNameStyle namestyle = TempNameStyle.getInstance(); |
|
|
|
namestyle.clear(); |
|
|
|
namestyle.clear(); |
|
|
|
String checkStr = StringUtils.EMPTY; |
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
checkStr = ResourceIOUtils.inputStream2String(file.asInputStream()); |
|
|
|
|
|
|
|
tpl.readStream(file.asInputStream()); |
|
|
|
tpl.readStream(file.asInputStream()); |
|
|
|
|
|
|
|
} catch (PermissionDeniedException exp) { |
|
|
|
|
|
|
|
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); |
|
|
|
} catch (Exception exp) { |
|
|
|
} catch (Exception exp) { |
|
|
|
String errorMessage = ComparatorUtils.equals(RemoteDeziConstants.INVALID_USER, checkStr) ? Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") |
|
|
|
FineLoggerFactory.getLogger().error(Toolkit.i18nText("Fine-Design_Report_NS_Exception_ReadError") + file, exp); |
|
|
|
: com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_NS_Exception_ReadError"); |
|
|
|
|
|
|
|
FineLoggerFactory.getLogger().error(errorMessage + file, exp); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
checkNameStyle(namestyle); |
|
|
|
checkNameStyle(namestyle); |
|
|
|
return tpl; |
|
|
|
return tpl; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static void checkNameStyle(TempNameStyle namestyle) { |
|
|
|
private static void checkNameStyle(TempNameStyle namestyle) { |
|
|
|
|
|
|
|
|
|
|
|
Iterator it = namestyle.getIterator(); |
|
|
|
Iterator it = namestyle.getIterator(); |
|
|
|
ArrayList<String> al = new ArrayList<String>(); |
|
|
|
ArrayList<String> al = new ArrayList<String>(); |
|
|
|
while (it.hasNext()) { |
|
|
|
while (it.hasNext()) { |
|
|
@ -81,9 +80,9 @@ class CptApp extends AbstractWorkBookApp { |
|
|
|
showConfirmDialog(al); |
|
|
|
showConfirmDialog(al); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static void showConfirmDialog(final ArrayList<String> namelist) { |
|
|
|
private static void showConfirmDialog(final ArrayList<String> namelist) { |
|
|
|
|
|
|
|
|
|
|
|
final JDialog jd = new JDialog(); |
|
|
|
final JDialog jd = new JDialog(); |
|
|
|
// 模态一下,因为可能会多个样式丢失
|
|
|
|
// 模态一下,因为可能会多个样式丢失
|
|
|
|
// jd.setModal(true);
|
|
|
|
// jd.setModal(true);
|
|
|
@ -96,14 +95,14 @@ class CptApp extends AbstractWorkBookApp { |
|
|
|
jl.setHorizontalAlignment(SwingConstants.CENTER); |
|
|
|
jl.setHorizontalAlignment(SwingConstants.CENTER); |
|
|
|
jd.add(jl, BorderLayout.CENTER); |
|
|
|
jd.add(jl, BorderLayout.CENTER); |
|
|
|
JPanel jp = new JPanel(); |
|
|
|
JPanel jp = new JPanel(); |
|
|
|
|
|
|
|
|
|
|
|
// ”是“按钮,点击之后将生成一个全局样式,并写入xml
|
|
|
|
// ”是“按钮,点击之后将生成一个全局样式,并写入xml
|
|
|
|
UIButton confirmButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Yes")); |
|
|
|
UIButton confirmButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Yes")); |
|
|
|
confirmButton.addActionListener(new ActionListener() { |
|
|
|
confirmButton.addActionListener(new ActionListener() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
for (String name : namelist) { |
|
|
|
for (String name : namelist) { |
|
|
|
ServerPreferenceConfig.getInstance().putStyle(name, Style.DEFAULT_STYLE); |
|
|
|
ServerPreferenceConfig.getInstance().putStyle(name, Style.DEFAULT_STYLE); |
|
|
@ -115,17 +114,17 @@ class CptApp extends AbstractWorkBookApp { |
|
|
|
new StyleListAction().actionPerformed(e);// 弹窗
|
|
|
|
new StyleListAction().actionPerformed(e);// 弹窗
|
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
UIButton noButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_No")); |
|
|
|
UIButton noButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_No")); |
|
|
|
noButton.addActionListener(new ActionListener() { |
|
|
|
noButton.addActionListener(new ActionListener() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
|
|
|
|
|
|
|
jd.dispose(); |
|
|
|
jd.dispose(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
jp.add(confirmButton); |
|
|
|
jp.add(confirmButton); |
|
|
|
jp.add(noButton); |
|
|
|
jp.add(noButton); |
|
|
|
jd.setTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Template_Custom_Style_Missed")); |
|
|
|
jd.setTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Template_Custom_Style_Missed")); |
|
|
@ -133,5 +132,5 @@ class CptApp extends AbstractWorkBookApp { |
|
|
|
GUICoreUtils.centerWindow(jd); |
|
|
|
GUICoreUtils.centerWindow(jd); |
|
|
|
jd.setVisible(true); |
|
|
|
jd.setVisible(true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|