Browse Source

Merge pull request #4158 in DESIGN/design from feature/10.0 to feature/x

* commit 'bb44c733e24b1586b61fbd9a81e586dd4233503e':
  CHART-19104 鼠标的click事件不能稳定触发,改为change事件
  REPORT-51281 & 	REPORT-51378 & REPORT-51490 导出-字体检测-模板保存相关问题
  REPORT-51309 导出-字体检测-检测按钮提示的文字显示不全
research/11.0
superman 4 years ago
parent
commit
3d2760ae0b
  1. 71
      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
  3. 32
      designer-chart/src/main/java/com/fr/van/chart/designer/component/format/VanChartFormatPaneWithCheckBox.java

71
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.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 {
if (dialog != null) {
dialog.dispose(); 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);

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.JTextArea;
import javax.swing.UIManager; import javax.swing.UIManager;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Cursor;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Frame; import java.awt.Frame;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -100,26 +99,14 @@ public class CheckFontInfoDialog extends JDialog implements ActionListener {
directUiLabel.setIcon(UIManager.getIcon("OptionPane.narrow.down")); 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")); 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); okButton.addActionListener(this);
bottomPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); 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.setTitle(Toolkit.i18nText("Fine_Designer_Check_Font"));
this.setResizable(false); this.setResizable(false);

32
designer-chart/src/main/java/com/fr/van/chart/designer/component/format/VanChartFormatPaneWithCheckBox.java

@ -12,13 +12,12 @@ import com.fr.plugin.chart.base.format.AttrTooltipFormat;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.text.Format;
import java.util.Map;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Point; import java.awt.Point;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.text.Format;
import java.util.Map;
/** /**
* Created by Mitisky on 16/2/23. * Created by Mitisky on 16/2/23.
@ -54,32 +53,7 @@ public abstract class VanChartFormatPaneWithCheckBox extends JPanel{
this.add(formatButton, BorderLayout.EAST); this.add(formatButton, BorderLayout.EAST);
initFormatListener(); initFormatListener();
isSelectedBox.addMouseListener(new MouseListener() { isSelectedBox.addChangeListener((e)-> isDirty = true);
@Override
public void mouseClicked(MouseEvent e) {
isDirty = true;
}
@Override
public void mousePressed(MouseEvent e) {
}
@Override
public void mouseReleased(MouseEvent e) {
}
@Override
public void mouseEntered(MouseEvent e) {
}
@Override
public void mouseExited(MouseEvent e) {
}
});
} }
protected abstract String getCheckBoxText(); protected abstract String getCheckBoxText();

Loading…
Cancel
Save