Browse Source

Pull request #4151: REPORT-51309 & REPORT-51281 & REPORT-51378 & REPORT-51490 导出-字体检测-检测按钮相关问题

Merge in DESIGN/design from ~BRUCE.DENG/design:feature/10.0 to feature/10.0

* commit '3dd4d3d564dfc220bf4307209f45e0ee65835a3e':
  REPORT-51281 & 	REPORT-51378 & REPORT-51490 导出-字体检测-模板保存相关问题
  REPORT-51309 导出-字体检测-检测按钮提示的文字显示不全
feature/10.0
Bruce.Deng 4 years ago
parent
commit
1c529c7160
  1. 77
      designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java
  2. 17
      designer-base/src/main/java/com/fr/design/mainframe/check/CheckFontInfoDialog.java

77
designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java

@ -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);

17
designer-base/src/main/java/com/fr/design/mainframe/check/CheckFontInfoDialog.java

@ -17,7 +17,6 @@ import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.UIManager;
import java.awt.BorderLayout;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.event.ActionEvent;
@ -100,26 +99,14 @@ public class CheckFontInfoDialog extends JDialog implements ActionListener {
directUiLabel.setIcon(UIManager.getIcon("OptionPane.narrow.down"));
}
}
@Override
public void mouseEntered(MouseEvent e) {
detailLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}
@Override
public void mouseExited(MouseEvent e) {
detailLabel.setCursor(Cursor.getDefaultCursor());
}
});
//底部的按钮面板
UIButton okButton = new UIButton(Toolkit.i18nText("Fine-Design_Report_OK"));
JPanel buttonPanel = FRGUIPaneFactory.createBorderLayout_L_Pane();
buttonPanel.setBorder(BorderFactory.createEmptyBorder(0,10,10,10));
buttonPanel.add(okButton, BorderLayout.EAST);
okButton.addActionListener(this);
bottomPanel = FRGUIPaneFactory.createBorderLayout_L_Pane();
bottomPanel.add(buttonPanel);
bottomPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
bottomPanel.add(okButton, BorderLayout.EAST);
this.setTitle(Toolkit.i18nText("Fine_Designer_Check_Font"));
this.setResizable(false);

Loading…
Cancel
Save