Browse Source

REPORT-135233 调整TemplateChecker

fbp/release
Destiny.Lin 2 months ago
parent
commit
4107751f05
  1. 44
      designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java

44
designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java

@ -1,32 +1,22 @@
package com.fr.design.mainframe.check; package com.fr.design.mainframe.check;
import com.fanruan.repository.TemplateRepository;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineUIUtils; import com.fine.theme.utils.FineUIUtils;
import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.base.BaseUtils;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.DesignSizeI18nManager;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.worker.save.CallbackSaveWorker; import com.fr.design.worker.save.CallbackSaveWorker;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.file.FileNodeFILE; import com.fr.file.FileNodeFILE;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.rpc.ExceptionHandler;
import com.fr.rpc.RPCInvokerExceptionInfo;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.check.TemplateChecker;
import javax.swing.BoxLayout; import javax.swing.*;
import javax.swing.JDialog; import java.awt.*;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
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.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
@ -34,14 +24,9 @@ import java.awt.event.WindowEvent;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.*;
import static com.fine.swing.ui.layout.Layouts.column;
import static com.fine.swing.ui.layout.Layouts.flex;
import static com.fine.swing.ui.layout.Layouts.row;
import static com.fr.design.dialog.FineJOptionPane.showConfirmDialog; import static com.fr.design.dialog.FineJOptionPane.showConfirmDialog;
import static javax.swing.JOptionPane.OK_CANCEL_OPTION; import static javax.swing.JOptionPane.*;
import static javax.swing.JOptionPane.OK_OPTION;
import static javax.swing.JOptionPane.WARNING_MESSAGE;
public class CheckButton extends UIButton { public class CheckButton extends UIButton {
@ -174,16 +159,15 @@ public class CheckButton extends UIButton {
private Set<String> check(JTemplate jtemplate) { private Set<String> check(JTemplate jtemplate) {
String path = jtemplate.getEditingFILE().getEnvFullName(); String path = jtemplate.getEditingFILE().getEnvFullName();
Set<String> fontSet = WorkContext.getCurrent().get(TemplateChecker.class, new ExceptionHandler<Void>() { Set<String> fontSet = null;
try {
@Override fontSet = TemplateRepository.getInstance().checkFont(path);
public Void callHandler(RPCInvokerExceptionInfo rpcInvokerExceptionInfo) { } catch (Exception e) {
imageLabel.setIcon(new LazyIcon("error", 20)); imageLabel.setIcon(new LazyIcon("error", 20));
message.setText("<html>" + Toolkit.i18nText("Fine_Designer_Check_Font_Upgrade") + "</html>"); message.setText("<html>" + Toolkit.i18nText("Fine_Designer_Check_Font_Upgrade") + "</html>");
okButton.setEnabled(true); okButton.setEnabled(true);
return null; return null;
} }
}).checkFont(path);
return fontSet; return fontSet;
} }

Loading…
Cancel
Save