|
|
|
@ -7,6 +7,7 @@ import com.fr.design.gui.ilable.UILabel;
|
|
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
|
import com.fr.design.mainframe.DesignerContext; |
|
|
|
|
import com.fr.design.mainframe.JTemplate; |
|
|
|
|
import com.fr.design.worker.save.CallbackSaveWorker; |
|
|
|
|
import com.fr.file.FILE; |
|
|
|
|
import com.fr.file.FileNodeFILE; |
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
@ -29,6 +30,7 @@ import java.awt.event.WindowEvent;
|
|
|
|
|
import java.util.Set; |
|
|
|
|
import java.util.concurrent.ExecutionException; |
|
|
|
|
|
|
|
|
|
import static com.fr.design.dialog.FineJOptionPane.showConfirmDialog; |
|
|
|
|
import static javax.swing.JOptionPane.OK_CANCEL_OPTION; |
|
|
|
|
import static javax.swing.JOptionPane.OK_OPTION; |
|
|
|
|
import static javax.swing.JOptionPane.WARNING_MESSAGE; |
|
|
|
@ -72,7 +74,9 @@ public class CheckButton extends UIButton {
|
|
|
|
|
uiLabel.setIcon(BaseUtils.readIcon("com/fr/design/images/correct.png")); |
|
|
|
|
message.setText("<html>" + Toolkit.i18nText("Fine_Designer_Check_Font_Success") + "</html>"); |
|
|
|
|
} else { |
|
|
|
|
if (dialog != null) { |
|
|
|
|
dialog.dispose(); |
|
|
|
|
} |
|
|
|
|
StringBuilder textBuilder = new StringBuilder(); |
|
|
|
|
textBuilder.append(Toolkit.i18nText("Fine_Designer_Check_Font_Missing_Font")).append("\n"); |
|
|
|
|
for (String font : set) { |
|
|
|
@ -88,13 +92,45 @@ public class CheckButton extends UIButton {
|
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
JTemplate jtemplate = DesignerContext.getDesignerFrame().getSelectedJTemplate(); |
|
|
|
|
JTemplate<?, ?> jtemplate = DesignerContext.getDesignerFrame().getSelectedJTemplate(); |
|
|
|
|
if (jtemplate == null || jtemplate.getEditingFILE() == null) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
FILE currentTemplate = jtemplate.getEditingFILE(); |
|
|
|
|
if (currentTemplate instanceof FileNodeFILE) { |
|
|
|
|
checkThread.execute(); |
|
|
|
|
// 判断下模板是否存在 不存在先提示
|
|
|
|
|
if (!currentTemplate.exists()) { |
|
|
|
|
int selVal = showConfirmDialog( |
|
|
|
|
DesignerContext.getDesignerFrame(), |
|
|
|
|
Toolkit.i18nText("Fine-Design_Basic_Web_Preview_Message"), |
|
|
|
|
Toolkit.i18nText("Fine_Designer_Check_Font"), |
|
|
|
|
OK_CANCEL_OPTION, |
|
|
|
|
WARNING_MESSAGE |
|
|
|
|
); |
|
|
|
|
if (OK_OPTION == selVal) { |
|
|
|
|
CallbackSaveWorker worker = jtemplate.saveAs(); |
|
|
|
|
worker.addSuccessCallback(new Runnable() { |
|
|
|
|
@Override |
|
|
|
|
public void run() { |
|
|
|
|
startCheck(checkThread); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
worker.start(jtemplate.getTarget().getTemplateID()); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
if (!jtemplate.isSaved()) { |
|
|
|
|
CallbackSaveWorker worker = jtemplate.save(); |
|
|
|
|
worker.addSuccessCallback(new Runnable() { |
|
|
|
|
@Override |
|
|
|
|
public void run() { |
|
|
|
|
startCheck(checkThread); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
worker.start(jtemplate.getTarget().getTemplateID()); |
|
|
|
|
} else { |
|
|
|
|
startCheck(checkThread); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
//模板不在报表环境下,提示保存
|
|
|
|
|
int selVal = FineJOptionPane.showConfirmDialog( |
|
|
|
@ -103,27 +139,27 @@ public class CheckButton extends UIButton {
|
|
|
|
|
Toolkit.i18nText("Fine_Designer_Check_Font"), |
|
|
|
|
OK_CANCEL_OPTION, |
|
|
|
|
WARNING_MESSAGE); |
|
|
|
|
|
|
|
|
|
if (OK_OPTION == selVal) { |
|
|
|
|
//保存成功才执行检测
|
|
|
|
|
if (jtemplate.saveAsTemplate2Env()) { |
|
|
|
|
checkThread.execute(); |
|
|
|
|
CallbackSaveWorker worker = jtemplate.saveAs2Env(); |
|
|
|
|
worker.addSuccessCallback(new Runnable() { |
|
|
|
|
@Override |
|
|
|
|
public void run() { |
|
|
|
|
startCheck(checkThread); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
worker.start(jtemplate.getTarget().getTemplateID()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
initDialogPane(); |
|
|
|
|
okButton.addActionListener(new ActionListener() { |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
dialog.dispose(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
private void startCheck(SwingWorker<Set<String>, Void> checkThread) { |
|
|
|
|
initDialogPane(); |
|
|
|
|
dialog.addWindowListener(new WindowAdapter() { |
|
|
|
|
public void windowClosed(WindowEvent e) { |
|
|
|
|
checkThread.cancel(true); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
checkThread.execute(); |
|
|
|
|
dialog.setVisible(true); |
|
|
|
|
dialog.dispose(); |
|
|
|
|
} |
|
|
|
@ -150,6 +186,11 @@ public class CheckButton extends UIButton {
|
|
|
|
|
uiLabel = new UILabel(); |
|
|
|
|
okButton = new UIButton(Toolkit.i18nText("Fine-Design_Report_OK")); |
|
|
|
|
okButton.setEnabled(false); |
|
|
|
|
okButton.addActionListener(new ActionListener() { |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
dialog.dispose(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
dialog = new JDialog(); |
|
|
|
|
dialog.setTitle(Toolkit.i18nText("Fine_Designer_Check_Font")); |
|
|
|
|
dialog.setModal(true); |
|
|
|
|