|
|
|
@ -9,8 +9,9 @@ import com.fr.design.layout.TableLayout;
|
|
|
|
|
import com.fr.design.layout.TableLayoutHelper; |
|
|
|
|
import com.fr.io.attr.ImageExportAttr; |
|
|
|
|
import com.fr.io.attr.ReportExportAttr; |
|
|
|
|
import com.fr.report.ReportConfigManager; |
|
|
|
|
|
|
|
|
|
import java.awt.Color; |
|
|
|
|
import javax.swing.AbstractButton; |
|
|
|
|
import javax.swing.BorderFactory; |
|
|
|
|
import javax.swing.ButtonGroup; |
|
|
|
|
import javax.swing.JComponent; |
|
|
|
@ -35,33 +36,26 @@ public class ImageExportPane extends AbstractExportPane {
|
|
|
|
|
private UIRadioButton globalFormatJpg; |
|
|
|
|
private UIRadioButton globalFormatPng; |
|
|
|
|
|
|
|
|
|
private UIRadioButton previewResolutionBtnS; |
|
|
|
|
private UIRadioButton previewResolutionBtnM; |
|
|
|
|
|
|
|
|
|
private UIRadioButton previewRenderSpeed; |
|
|
|
|
private UIRadioButton previewRenderQuality; |
|
|
|
|
private UIRadioButton templateThumbnail; |
|
|
|
|
private UIRadioButton templatePaging; |
|
|
|
|
|
|
|
|
|
private static final int RESOLUTION_S = 96; |
|
|
|
|
private static final int RESOLUTION_M = 192; |
|
|
|
|
private static final int RESOLUTION_L = 300; |
|
|
|
|
|
|
|
|
|
private static final int DPI_SCALE_S = 1; |
|
|
|
|
private static final int DPI_SCALE_M = 2; |
|
|
|
|
|
|
|
|
|
private static final int GAP = 20; |
|
|
|
|
|
|
|
|
|
public static final String GLOBAL_CONF = Toolkit.i18nText("Fine-Design_Image_Export_Global_Configuration"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ReportExportAttr reportExportAttr; |
|
|
|
|
public static final String GLOBAL_CONF = Toolkit.i18nText("Fine-Design_Image_Export_Setting"); |
|
|
|
|
|
|
|
|
|
public ImageExportPane() { |
|
|
|
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
|
|
|
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); |
|
|
|
|
JPanel globalTitlePane = FRGUIPaneFactory.createTitledBorderPane(GLOBAL_CONF); |
|
|
|
|
JPanel previewSetting = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Basic_Preview")); |
|
|
|
|
JPanel tipsTitlePane = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Report_Advice")); |
|
|
|
|
UILabel tipLabel = new UILabel(Toolkit.i18nText("Fine-Design_Image_Export_Tips")); |
|
|
|
|
tipLabel.setForeground(Color.RED); |
|
|
|
|
tipsTitlePane.add(tipLabel); |
|
|
|
|
this.add(globalTitlePane, BorderLayout.NORTH); |
|
|
|
|
this.add(previewSetting, BorderLayout.CENTER); |
|
|
|
|
initGlobalSettings(); |
|
|
|
|
|
|
|
|
|
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
@ -69,6 +63,7 @@ public class ImageExportPane extends AbstractExportPane {
|
|
|
|
|
{new UILabel(Toolkit.i18nText("Fine-Design_Image_Export_Resolution") + ":"), this.globalResolutionBtnS, this.globalResolutionBtnM, this.globalResolutionBtnL}, |
|
|
|
|
{new UILabel(Toolkit.i18nText("Fine-Design_Report_Format") + ":"), this.globalFormatJpg, null, this.globalFormatPng}, |
|
|
|
|
{new UILabel(Toolkit.i18nText("Fine-Design_Image_Export_Rendering_Quality") + ":"), this.globalRenderQuality, null, this.globalRenderSpeed}, |
|
|
|
|
{new UILabel(Toolkit.i18nText("Fine-Design_Image_Export_Typesetting") + ":"), this.templateThumbnail, null, this.templatePaging} |
|
|
|
|
}; |
|
|
|
|
centerPane.add( |
|
|
|
|
TableLayoutHelper.createCommonTableLayoutPane( |
|
|
|
@ -77,23 +72,8 @@ public class ImageExportPane extends AbstractExportPane {
|
|
|
|
|
new double[]{TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL}, |
|
|
|
|
GAP), |
|
|
|
|
BorderLayout.CENTER); |
|
|
|
|
centerPane.add(tipsTitlePane,BorderLayout.SOUTH); |
|
|
|
|
globalTitlePane.add(centerPane, BorderLayout.CENTER); |
|
|
|
|
JPanel templateCenterPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
|
JComponent[][] templateComps = { |
|
|
|
|
{new UILabel(Toolkit.i18nText("Fine-Design_Report_Engine_Enlarge_Or_Reduce") + ":"), this.previewResolutionBtnS, this.previewResolutionBtnM}, |
|
|
|
|
{new UILabel(Toolkit.i18nText("Fine-Design_Image_Export_Rendering_Quality") + ":"), this.previewRenderQuality, this.previewRenderSpeed}, |
|
|
|
|
}; |
|
|
|
|
templateCenterPane.add( |
|
|
|
|
TableLayoutHelper.createCommonTableLayoutPane( |
|
|
|
|
templateComps, |
|
|
|
|
new double[]{TableLayout.FILL, TableLayout.FILL, TableLayout.FILL}, |
|
|
|
|
new double[]{TableLayout.FILL, TableLayout.FILL, TableLayout.FILL}, |
|
|
|
|
GAP), |
|
|
|
|
BorderLayout.CENTER); |
|
|
|
|
|
|
|
|
|
previewSetting.add(templateCenterPane, BorderLayout.CENTER); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -101,36 +81,29 @@ public class ImageExportPane extends AbstractExportPane {
|
|
|
|
|
globalResolutionBtnS = new UIRadioButton("96dpi", true); |
|
|
|
|
globalResolutionBtnM = new UIRadioButton("192dpi"); |
|
|
|
|
globalResolutionBtnL = new UIRadioButton("300dpi"); |
|
|
|
|
ButtonGroup globalResolutionBtnGroup = new ButtonGroup(); |
|
|
|
|
globalResolutionBtnGroup.add(globalResolutionBtnS); |
|
|
|
|
globalResolutionBtnGroup.add(globalResolutionBtnM); |
|
|
|
|
globalResolutionBtnGroup.add(globalResolutionBtnL); |
|
|
|
|
wrapButtonsInButtonGroup(globalResolutionBtnS, globalResolutionBtnM, globalResolutionBtnL); |
|
|
|
|
|
|
|
|
|
globalFormatJpg = new UIRadioButton("jpg", true); |
|
|
|
|
globalFormatPng = new UIRadioButton("png"); |
|
|
|
|
ButtonGroup globalFormatGroup = new ButtonGroup(); |
|
|
|
|
globalFormatGroup.add(globalFormatJpg); |
|
|
|
|
globalFormatGroup.add(globalFormatPng); |
|
|
|
|
wrapButtonsInButtonGroup(globalFormatJpg, globalFormatPng); |
|
|
|
|
|
|
|
|
|
globalRenderQuality = new UIRadioButton(Toolkit.i18nText("Fine-Design_Image_Export_Quality_First"), true); |
|
|
|
|
globalRenderSpeed = new UIRadioButton(Toolkit.i18nText(("Fine-Design_Image_Export_Speed_Priority"))); |
|
|
|
|
ButtonGroup globalRenderGroup = new ButtonGroup(); |
|
|
|
|
globalRenderGroup.add(globalRenderQuality); |
|
|
|
|
globalRenderGroup.add(globalRenderSpeed); |
|
|
|
|
|
|
|
|
|
previewResolutionBtnS = new UIRadioButton("100%", true); |
|
|
|
|
previewResolutionBtnM = new UIRadioButton("200%"); |
|
|
|
|
ButtonGroup previewResolutionBtnGroup = new ButtonGroup(); |
|
|
|
|
previewResolutionBtnGroup.add(previewResolutionBtnS); |
|
|
|
|
previewResolutionBtnGroup.add(previewResolutionBtnM); |
|
|
|
|
|
|
|
|
|
previewRenderSpeed = new UIRadioButton(Toolkit.i18nText("Fine-Design_Image_Export_Speed_Priority")); |
|
|
|
|
previewRenderQuality = new UIRadioButton(Toolkit.i18nText("Fine-Design_Image_Export_Quality_First")); |
|
|
|
|
ButtonGroup previewRenderGroup = new ButtonGroup(); |
|
|
|
|
previewRenderGroup.add(previewRenderQuality); |
|
|
|
|
previewRenderGroup.add(previewRenderSpeed); |
|
|
|
|
wrapButtonsInButtonGroup(globalRenderQuality, globalRenderSpeed); |
|
|
|
|
|
|
|
|
|
templateThumbnail = new UIRadioButton(Toolkit.i18nText("Fine-Design_Image_Export_Thumbnail")); |
|
|
|
|
templatePaging = new UIRadioButton(Toolkit.i18nText("Fine-Design_Image_Export_Paging")); |
|
|
|
|
wrapButtonsInButtonGroup(templateThumbnail, templatePaging); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void wrapButtonsInButtonGroup(AbstractButton... buttons) { |
|
|
|
|
if (buttons != null) { |
|
|
|
|
ButtonGroup buttonGroup = new ButtonGroup(); |
|
|
|
|
for (AbstractButton button : buttons) { |
|
|
|
|
buttonGroup.add(button); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 展示界面 |
|
|
|
@ -150,10 +123,6 @@ public class ImageExportPane extends AbstractExportPane {
|
|
|
|
|
updateBean(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private ImageExportAttr getGlobalImageExportAttr() { |
|
|
|
|
return ReportConfigManager.getProviderInstance().getImageExportAttr(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 标题 |
|
|
|
|
* |
|
|
|
@ -166,7 +135,11 @@ public class ImageExportPane extends AbstractExportPane {
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void populateBean(Object exportAttr) { |
|
|
|
|
ImageExportAttr attr = getGlobalImageExportAttr(); |
|
|
|
|
ReportExportAttr reportExportAttr = (ReportExportAttr) exportAttr; |
|
|
|
|
ImageExportAttr attr = reportExportAttr.getImageExportAttr(); |
|
|
|
|
if (attr == null) { |
|
|
|
|
attr = new ImageExportAttr(); |
|
|
|
|
} |
|
|
|
|
switch (attr.getResolution()) { |
|
|
|
|
case 192: |
|
|
|
|
globalResolutionBtnM.setSelected(true); |
|
|
|
@ -187,24 +160,17 @@ public class ImageExportPane extends AbstractExportPane {
|
|
|
|
|
} else { |
|
|
|
|
globalRenderQuality.setSelected(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (attr.getPreviewRenderQuality() == ImageExportAttr.RENDER_SPEED) { |
|
|
|
|
previewRenderSpeed.setSelected(true); |
|
|
|
|
} else { |
|
|
|
|
previewRenderQuality.setSelected(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (attr.getPreviewResolutionScale() == DPI_SCALE_S) { |
|
|
|
|
previewResolutionBtnS.setSelected(true); |
|
|
|
|
if (attr.isPaging()) { |
|
|
|
|
templatePaging.setSelected(true); |
|
|
|
|
} else { |
|
|
|
|
previewResolutionBtnM.setSelected(true); |
|
|
|
|
templateThumbnail.setSelected(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void updateBean(Object exportAttr) { |
|
|
|
|
ImageExportAttr attr = getGlobalImageExportAttr(); |
|
|
|
|
ReportExportAttr reportExportAttr = (ReportExportAttr) exportAttr; |
|
|
|
|
ImageExportAttr attr = new ImageExportAttr(); |
|
|
|
|
if (globalResolutionBtnS.isSelected()) { |
|
|
|
|
attr.setResolution(RESOLUTION_S); |
|
|
|
|
} else if (globalResolutionBtnM.isSelected()) { |
|
|
|
@ -222,17 +188,8 @@ public class ImageExportPane extends AbstractExportPane {
|
|
|
|
|
} else { |
|
|
|
|
attr.setRenderQuality(ImageExportAttr.RENDER_QUALITY); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (previewRenderSpeed.isSelected()) { |
|
|
|
|
attr.setPreviewRenderQuality(ImageExportAttr.RENDER_SPEED); |
|
|
|
|
} else { |
|
|
|
|
attr.setPreviewRenderQuality(ImageExportAttr.RENDER_QUALITY); |
|
|
|
|
} |
|
|
|
|
if (previewResolutionBtnS.isSelected()) { |
|
|
|
|
attr.setPreviewResolutionScale(DPI_SCALE_S); |
|
|
|
|
} else { |
|
|
|
|
attr.setPreviewResolutionScale(DPI_SCALE_M); |
|
|
|
|
} |
|
|
|
|
attr.setPaging(templatePaging.isSelected()); |
|
|
|
|
reportExportAttr.setImageExportAttr(attr); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|