|
|
@ -9,8 +9,9 @@ import com.fr.design.layout.TableLayout; |
|
|
|
import com.fr.design.layout.TableLayoutHelper; |
|
|
|
import com.fr.design.layout.TableLayoutHelper; |
|
|
|
import com.fr.io.attr.ImageExportAttr; |
|
|
|
import com.fr.io.attr.ImageExportAttr; |
|
|
|
import com.fr.io.attr.ReportExportAttr; |
|
|
|
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.BorderFactory; |
|
|
|
import javax.swing.ButtonGroup; |
|
|
|
import javax.swing.ButtonGroup; |
|
|
|
import javax.swing.JComponent; |
|
|
|
import javax.swing.JComponent; |
|
|
@ -35,33 +36,26 @@ public class ImageExportPane extends AbstractExportPane { |
|
|
|
private UIRadioButton globalFormatJpg; |
|
|
|
private UIRadioButton globalFormatJpg; |
|
|
|
private UIRadioButton globalFormatPng; |
|
|
|
private UIRadioButton globalFormatPng; |
|
|
|
|
|
|
|
|
|
|
|
private UIRadioButton previewResolutionBtnS; |
|
|
|
private UIRadioButton templateThumbnail; |
|
|
|
private UIRadioButton previewResolutionBtnM; |
|
|
|
private UIRadioButton templatePaging; |
|
|
|
|
|
|
|
|
|
|
|
private UIRadioButton previewRenderSpeed; |
|
|
|
|
|
|
|
private UIRadioButton previewRenderQuality; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static final int RESOLUTION_S = 96; |
|
|
|
private static final int RESOLUTION_S = 96; |
|
|
|
private static final int RESOLUTION_M = 192; |
|
|
|
private static final int RESOLUTION_M = 192; |
|
|
|
private static final int RESOLUTION_L = 300; |
|
|
|
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; |
|
|
|
private static final int GAP = 20; |
|
|
|
|
|
|
|
|
|
|
|
public static final String GLOBAL_CONF = Toolkit.i18nText("Fine-Design_Image_Export_Global_Configuration"); |
|
|
|
public static final String GLOBAL_CONF = Toolkit.i18nText("Fine-Design_Image_Export_Setting"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ReportExportAttr reportExportAttr; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ImageExportPane() { |
|
|
|
public ImageExportPane() { |
|
|
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
|
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
|
|
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); |
|
|
|
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); |
|
|
|
JPanel globalTitlePane = FRGUIPaneFactory.createTitledBorderPane(GLOBAL_CONF); |
|
|
|
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(globalTitlePane, BorderLayout.NORTH); |
|
|
|
this.add(previewSetting, BorderLayout.CENTER); |
|
|
|
|
|
|
|
initGlobalSettings(); |
|
|
|
initGlobalSettings(); |
|
|
|
|
|
|
|
|
|
|
|
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
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_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_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_Rendering_Quality") + ":"), this.globalRenderQuality, null, this.globalRenderSpeed}, |
|
|
|
|
|
|
|
{new UILabel(Toolkit.i18nText("Fine-Design_Image_Export_Typesetting") + ":"), this.templateThumbnail, null, this.templatePaging} |
|
|
|
}; |
|
|
|
}; |
|
|
|
centerPane.add( |
|
|
|
centerPane.add( |
|
|
|
TableLayoutHelper.createCommonTableLayoutPane( |
|
|
|
TableLayoutHelper.createCommonTableLayoutPane( |
|
|
@ -77,23 +72,8 @@ public class ImageExportPane extends AbstractExportPane { |
|
|
|
new double[]{TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL}, |
|
|
|
new double[]{TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL}, |
|
|
|
GAP), |
|
|
|
GAP), |
|
|
|
BorderLayout.CENTER); |
|
|
|
BorderLayout.CENTER); |
|
|
|
|
|
|
|
centerPane.add(tipsTitlePane,BorderLayout.SOUTH); |
|
|
|
globalTitlePane.add(centerPane, BorderLayout.CENTER); |
|
|
|
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); |
|
|
|
globalResolutionBtnS = new UIRadioButton("96dpi", true); |
|
|
|
globalResolutionBtnM = new UIRadioButton("192dpi"); |
|
|
|
globalResolutionBtnM = new UIRadioButton("192dpi"); |
|
|
|
globalResolutionBtnL = new UIRadioButton("300dpi"); |
|
|
|
globalResolutionBtnL = new UIRadioButton("300dpi"); |
|
|
|
ButtonGroup globalResolutionBtnGroup = new ButtonGroup(); |
|
|
|
wrapButtonsInButtonGroup(globalResolutionBtnS, globalResolutionBtnM, globalResolutionBtnL); |
|
|
|
globalResolutionBtnGroup.add(globalResolutionBtnS); |
|
|
|
|
|
|
|
globalResolutionBtnGroup.add(globalResolutionBtnM); |
|
|
|
|
|
|
|
globalResolutionBtnGroup.add(globalResolutionBtnL); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
globalFormatJpg = new UIRadioButton("jpg", true); |
|
|
|
globalFormatJpg = new UIRadioButton("jpg", true); |
|
|
|
globalFormatPng = new UIRadioButton("png"); |
|
|
|
globalFormatPng = new UIRadioButton("png"); |
|
|
|
ButtonGroup globalFormatGroup = new ButtonGroup(); |
|
|
|
wrapButtonsInButtonGroup(globalFormatJpg, globalFormatPng); |
|
|
|
globalFormatGroup.add(globalFormatJpg); |
|
|
|
|
|
|
|
globalFormatGroup.add(globalFormatPng); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
globalRenderQuality = new UIRadioButton(Toolkit.i18nText("Fine-Design_Image_Export_Quality_First"), true); |
|
|
|
globalRenderQuality = new UIRadioButton(Toolkit.i18nText("Fine-Design_Image_Export_Quality_First"), true); |
|
|
|
globalRenderSpeed = new UIRadioButton(Toolkit.i18nText(("Fine-Design_Image_Export_Speed_Priority"))); |
|
|
|
globalRenderSpeed = new UIRadioButton(Toolkit.i18nText(("Fine-Design_Image_Export_Speed_Priority"))); |
|
|
|
ButtonGroup globalRenderGroup = new ButtonGroup(); |
|
|
|
wrapButtonsInButtonGroup(globalRenderQuality, globalRenderSpeed); |
|
|
|
globalRenderGroup.add(globalRenderQuality); |
|
|
|
|
|
|
|
globalRenderGroup.add(globalRenderSpeed); |
|
|
|
templateThumbnail = new UIRadioButton(Toolkit.i18nText("Fine-Design_Image_Export_Thumbnail")); |
|
|
|
|
|
|
|
templatePaging = new UIRadioButton(Toolkit.i18nText("Fine-Design_Image_Export_Paging")); |
|
|
|
previewResolutionBtnS = new UIRadioButton("100%", true); |
|
|
|
wrapButtonsInButtonGroup(templateThumbnail, templatePaging); |
|
|
|
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); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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(); |
|
|
|
updateBean(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private ImageExportAttr getGlobalImageExportAttr() { |
|
|
|
|
|
|
|
return ReportConfigManager.getProviderInstance().getImageExportAttr(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 标题 |
|
|
|
* 标题 |
|
|
|
* |
|
|
|
* |
|
|
@ -166,7 +135,11 @@ public class ImageExportPane extends AbstractExportPane { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void populateBean(Object exportAttr) { |
|
|
|
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()) { |
|
|
|
switch (attr.getResolution()) { |
|
|
|
case 192: |
|
|
|
case 192: |
|
|
|
globalResolutionBtnM.setSelected(true); |
|
|
|
globalResolutionBtnM.setSelected(true); |
|
|
@ -187,24 +160,17 @@ public class ImageExportPane extends AbstractExportPane { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
globalRenderQuality.setSelected(true); |
|
|
|
globalRenderQuality.setSelected(true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (attr.isPaging()) { |
|
|
|
if (attr.getPreviewRenderQuality() == ImageExportAttr.RENDER_SPEED) { |
|
|
|
templatePaging.setSelected(true); |
|
|
|
previewRenderSpeed.setSelected(true); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
previewRenderQuality.setSelected(true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (attr.getPreviewResolutionScale() == DPI_SCALE_S) { |
|
|
|
|
|
|
|
previewResolutionBtnS.setSelected(true); |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
previewResolutionBtnM.setSelected(true); |
|
|
|
templateThumbnail.setSelected(true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void updateBean(Object exportAttr) { |
|
|
|
public void updateBean(Object exportAttr) { |
|
|
|
ImageExportAttr attr = getGlobalImageExportAttr(); |
|
|
|
ReportExportAttr reportExportAttr = (ReportExportAttr) exportAttr; |
|
|
|
|
|
|
|
ImageExportAttr attr = new ImageExportAttr(); |
|
|
|
if (globalResolutionBtnS.isSelected()) { |
|
|
|
if (globalResolutionBtnS.isSelected()) { |
|
|
|
attr.setResolution(RESOLUTION_S); |
|
|
|
attr.setResolution(RESOLUTION_S); |
|
|
|
} else if (globalResolutionBtnM.isSelected()) { |
|
|
|
} else if (globalResolutionBtnM.isSelected()) { |
|
|
@ -222,17 +188,8 @@ public class ImageExportPane extends AbstractExportPane { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
attr.setRenderQuality(ImageExportAttr.RENDER_QUALITY); |
|
|
|
attr.setRenderQuality(ImageExportAttr.RENDER_QUALITY); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
attr.setPaging(templatePaging.isSelected()); |
|
|
|
if (previewRenderSpeed.isSelected()) { |
|
|
|
reportExportAttr.setImageExportAttr(attr); |
|
|
|
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); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|