|
|
|
@ -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; |
|
|
|
@ -67,12 +69,14 @@ public class CheckButton extends UIButton {
|
|
|
|
|
if (set == null) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if(set.isEmpty()) { |
|
|
|
|
if (set.isEmpty()) { |
|
|
|
|
okButton.setEnabled(true); |
|
|
|
|
uiLabel.setIcon(BaseUtils.readIcon("com/fr/design/images/correct.png")); |
|
|
|
|
message.setText("<html>" + Toolkit.i18nText("Fine_Designer_Check_Font_Success") + "</html>"); |
|
|
|
|
} else { |
|
|
|
|
dialog.dispose(); |
|
|
|
|
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,14 +92,46 @@ 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(); |
|
|
|
|
}else { |
|
|
|
|
if (currentTemplate instanceof FileNodeFILE) { |
|
|
|
|
// 判断下模板是否存在 不存在先提示
|
|
|
|
|
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( |
|
|
|
|
DesignerContext.getDesignerFrame(), |
|
|
|
@ -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); |
|
|
|
|