|
|
@ -7,6 +7,7 @@ import com.fr.design.gui.ilable.UILabel; |
|
|
|
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.file.FILE; |
|
|
|
import com.fr.file.FILE; |
|
|
|
import com.fr.file.FileNodeFILE; |
|
|
|
import com.fr.file.FileNodeFILE; |
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
@ -29,6 +30,7 @@ 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.fr.design.dialog.FineJOptionPane.showConfirmDialog; |
|
|
|
import static javax.swing.JOptionPane.OK_CANCEL_OPTION; |
|
|
|
import static javax.swing.JOptionPane.OK_CANCEL_OPTION; |
|
|
|
import static javax.swing.JOptionPane.OK_OPTION; |
|
|
|
import static javax.swing.JOptionPane.OK_OPTION; |
|
|
|
import static javax.swing.JOptionPane.WARNING_MESSAGE; |
|
|
|
import static javax.swing.JOptionPane.WARNING_MESSAGE; |
|
|
@ -67,12 +69,14 @@ public class CheckButton extends UIButton { |
|
|
|
if (set == null) { |
|
|
|
if (set == null) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if(set.isEmpty()) { |
|
|
|
if (set.isEmpty()) { |
|
|
|
okButton.setEnabled(true); |
|
|
|
okButton.setEnabled(true); |
|
|
|
uiLabel.setIcon(BaseUtils.readIcon("com/fr/design/images/correct.png")); |
|
|
|
uiLabel.setIcon(BaseUtils.readIcon("com/fr/design/images/correct.png")); |
|
|
|
message.setText("<html>" + Toolkit.i18nText("Fine_Designer_Check_Font_Success") + "</html>"); |
|
|
|
message.setText("<html>" + Toolkit.i18nText("Fine_Designer_Check_Font_Success") + "</html>"); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
dialog.dispose(); |
|
|
|
if (dialog != null) { |
|
|
|
|
|
|
|
dialog.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
StringBuilder textBuilder = new StringBuilder(); |
|
|
|
StringBuilder textBuilder = new StringBuilder(); |
|
|
|
textBuilder.append(Toolkit.i18nText("Fine_Designer_Check_Font_Missing_Font")).append("\n"); |
|
|
|
textBuilder.append(Toolkit.i18nText("Fine_Designer_Check_Font_Missing_Font")).append("\n"); |
|
|
|
for (String font : set) { |
|
|
|
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) { |
|
|
|
if (jtemplate == null || jtemplate.getEditingFILE() == null) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
FILE currentTemplate = jtemplate.getEditingFILE(); |
|
|
|
FILE currentTemplate = jtemplate.getEditingFILE(); |
|
|
|
if(currentTemplate instanceof FileNodeFILE){ |
|
|
|
if (currentTemplate instanceof FileNodeFILE) { |
|
|
|
checkThread.execute(); |
|
|
|
// 判断下模板是否存在 不存在先提示
|
|
|
|
}else { |
|
|
|
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( |
|
|
|
int selVal = FineJOptionPane.showConfirmDialog( |
|
|
|
DesignerContext.getDesignerFrame(), |
|
|
|
DesignerContext.getDesignerFrame(), |
|
|
@ -103,27 +139,27 @@ public class CheckButton extends UIButton { |
|
|
|
Toolkit.i18nText("Fine_Designer_Check_Font"), |
|
|
|
Toolkit.i18nText("Fine_Designer_Check_Font"), |
|
|
|
OK_CANCEL_OPTION, |
|
|
|
OK_CANCEL_OPTION, |
|
|
|
WARNING_MESSAGE); |
|
|
|
WARNING_MESSAGE); |
|
|
|
|
|
|
|
|
|
|
|
if (OK_OPTION == selVal) { |
|
|
|
if (OK_OPTION == selVal) { |
|
|
|
//保存成功才执行检测
|
|
|
|
CallbackSaveWorker worker = jtemplate.saveAs2Env(); |
|
|
|
if (jtemplate.saveAsTemplate2Env()) { |
|
|
|
worker.addSuccessCallback(new Runnable() { |
|
|
|
checkThread.execute(); |
|
|
|
@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() { |
|
|
|
dialog.addWindowListener(new WindowAdapter() { |
|
|
|
public void windowClosed(WindowEvent e) { |
|
|
|
public void windowClosed(WindowEvent e) { |
|
|
|
checkThread.cancel(true); |
|
|
|
checkThread.cancel(true); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
checkThread.execute(); |
|
|
|
dialog.setVisible(true); |
|
|
|
dialog.setVisible(true); |
|
|
|
dialog.dispose(); |
|
|
|
dialog.dispose(); |
|
|
|
} |
|
|
|
} |
|
|
@ -150,6 +186,11 @@ public class CheckButton extends UIButton { |
|
|
|
uiLabel = new UILabel(); |
|
|
|
uiLabel = new UILabel(); |
|
|
|
okButton = new UIButton(Toolkit.i18nText("Fine-Design_Report_OK")); |
|
|
|
okButton = new UIButton(Toolkit.i18nText("Fine-Design_Report_OK")); |
|
|
|
okButton.setEnabled(false); |
|
|
|
okButton.setEnabled(false); |
|
|
|
|
|
|
|
okButton.addActionListener(new ActionListener() { |
|
|
|
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
|
|
|
dialog.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
dialog = new JDialog(); |
|
|
|
dialog = new JDialog(); |
|
|
|
dialog.setTitle(Toolkit.i18nText("Fine_Designer_Check_Font")); |
|
|
|
dialog.setTitle(Toolkit.i18nText("Fine_Designer_Check_Font")); |
|
|
|
dialog.setModal(true); |
|
|
|
dialog.setModal(true); |
|
|
|