Browse Source

REPORT-50201 远程af搜索模板,部分模板右侧加载不出来

zheng-1641779399395
hades 3 years ago
parent
commit
6cfbdf33a2
  1. 35
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

35
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

@ -32,19 +32,17 @@ import com.fr.design.mainframe.alphafine.search.manager.impl.RecentSearchManager
import com.fr.design.mainframe.alphafine.search.manager.impl.RecommendSearchManager; import com.fr.design.mainframe.alphafine.search.manager.impl.RecommendSearchManager;
import com.fr.design.mainframe.alphafine.search.manager.impl.SegmentationManager; import com.fr.design.mainframe.alphafine.search.manager.impl.SegmentationManager;
import com.fr.design.mainframe.alphafine.search.manager.impl.SimilarSearchManager; import com.fr.design.mainframe.alphafine.search.manager.impl.SimilarSearchManager;
import com.fr.form.main.Form;
import com.fr.form.main.FormIO;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.io.TemplateWorkBookIO;
import com.fr.io.exporter.ImageExporter;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.main.impl.WorkBook;
import com.fr.stable.CodeUtils; import com.fr.stable.CodeUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.exporter.LocalExportOperator;
import com.fr.workspace.server.exporter.TemplateExportOperator;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.DefaultListModel; import javax.swing.DefaultListModel;
@ -601,14 +599,15 @@ public class AlphaFineDialog extends UIDialog {
checkWorker(); checkWorker();
this.showWorker = new SwingWorker<BufferedImage, Void>() { this.showWorker = new SwingWorker<BufferedImage, Void>() {
@Override @Override
protected BufferedImage doInBackground() { protected BufferedImage doInBackground() throws Exception {
Form form = null; byte[] bytes = null;
try { try {
form = FormIO.readForm(fileName); bytes = WorkContext.getCurrent().get(TemplateExportOperator.class).exportFormAsImageData(fileName);
} catch (Exception e) { } catch (Exception ignored) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); // 兼容下老版本
bytes = new LocalExportOperator().exportFormAsImageData(fileName);
} }
return FormIO.exportFormAsImage(form); return TemplateExportOperator.byteDataToIamge(bytes);
} }
@Override @Override
@ -631,15 +630,15 @@ public class AlphaFineDialog extends UIDialog {
checkWorker(); checkWorker();
this.showWorker = new SwingWorker<BufferedImage, Void>() { this.showWorker = new SwingWorker<BufferedImage, Void>() {
@Override @Override
protected BufferedImage doInBackground() { protected BufferedImage doInBackground() throws Exception {
WorkBook workBook = null; byte[] bytes = null;
try { try {
workBook = (WorkBook) TemplateWorkBookIO.readTemplateWorkBook(fileName); bytes = WorkContext.getCurrent().get(TemplateExportOperator.class).exportWorkBookAsImageData(fileName);
} catch (Exception e) { } catch (Exception ignored) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); // 兼容下老版本
bytes = new LocalExportOperator().exportWorkBookAsImageData(fileName);
} }
BufferedImage bufferedImage = new ImageExporter().exportToImage(workBook); return TemplateExportOperator.byteDataToIamge(bytes);
return bufferedImage;
} }
@Override @Override

Loading…
Cancel
Save