@ -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.SegmentationManager ;
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.http.HttpClient ;
import com.fr.io.TemplateWorkBookIO ;
import com.fr.io.exporter.ImageExporter ;
import com.fr.json.JSONObject ;
import com.fr.log.FineLoggerFactory ;
import com.fr.main.impl.WorkBook ;
import com.fr.stable.CodeUtils ;
import com.fr.stable.StringUtils ;
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.swing.BorderFactory ;
import javax.swing.DefaultListModel ;
@ -601,14 +599,15 @@ public class AlphaFineDialog extends UIDialog {
checkWorker ( ) ;
this . showWorker = new SwingWorker < BufferedImage , Void > ( ) {
@Override
protected BufferedImage doInBackground ( ) {
Form form = null ;
protected BufferedImage doInBackground ( ) throws Exception {
byte [ ] bytes = null ;
try {
form = FormIO . readForm ( fileName ) ;
} catch ( Exception e ) {
FineLoggerFactory . getLogger ( ) . error ( e . getMessage ( ) , e ) ;
bytes = WorkContext . getCurrent ( ) . get ( TemplateExportOperator . class ) . exportFormAsImageData ( fileName ) ;
} catch ( Exception ignored ) {
// 兼容下老版本
bytes = new LocalExportOperator ( ) . exportFormAsImageData ( fileName ) ;
}
return FormIO . exportFormAsImage ( form ) ;
return TemplateExportOperator . byteDataToImage ( bytes ) ;
}
@Override
@ -631,15 +630,15 @@ public class AlphaFineDialog extends UIDialog {
checkWorker ( ) ;
this . showWorker = new SwingWorker < BufferedImage , Void > ( ) {
@Override
protected BufferedImage doInBackground ( ) {
WorkBook workBook = null ;
protected BufferedImage doInBackground ( ) throws Exception {
byte [ ] bytes = null ;
try {
workBook = ( WorkBook ) TemplateWorkBookIO . readTemplateWorkBook ( fileName ) ;
} catch ( Exception e ) {
FineLoggerFactory . getLogger ( ) . error ( e . getMessage ( ) , e ) ;
bytes = WorkContext . getCurrent ( ) . get ( TemplateExportOperator . class ) . exportWorkBookAsImageData ( fileName ) ;
} catch ( Exception ignored ) {
// 兼容下老版本
bytes = new LocalExportOperator ( ) . exportWorkBookAsImageData ( fileName ) ;
}
BufferedImage bufferedImage = new ImageExporter ( ) . exportToImage ( workBook ) ;
return bufferedImage ;
return TemplateExportOperator . byteDataToImage ( bytes ) ;
}
@Override