|
|
|
@ -5,13 +5,26 @@ import com.fr.design.gui.core.WidgetOption;
|
|
|
|
|
import com.fr.design.gui.ibutton.UIRadioButton; |
|
|
|
|
import com.fr.design.gui.icheckbox.UICheckBox; |
|
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
|
import com.fr.design.gui.itextfield.UITextField; |
|
|
|
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
|
|
|
import com.fr.design.layout.TableLayout; |
|
|
|
|
import com.fr.design.layout.TableLayoutHelper; |
|
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
|
import com.fr.report.web.ToolBarManager; |
|
|
|
|
import com.fr.report.web.WebPage; |
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
import com.fr.web.attr.ReportWebAttr; |
|
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
|
|
|
|
|
|
import java.awt.Color; |
|
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
|
import java.awt.event.ActionListener; |
|
|
|
|
import java.awt.event.InputMethodEvent; |
|
|
|
|
import java.awt.event.InputMethodListener; |
|
|
|
|
import java.awt.event.KeyAdapter; |
|
|
|
|
import java.awt.event.KeyEvent; |
|
|
|
|
import java.util.regex.Matcher; |
|
|
|
|
import java.util.regex.Pattern; |
|
|
|
|
import javax.swing.ButtonGroup; |
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
import java.awt.Component; |
|
|
|
@ -25,6 +38,15 @@ public class PageWebSettingPane extends WebSettingPane<WebPage> {
|
|
|
|
|
private UICheckBox isShowAsImageBox; |
|
|
|
|
private UICheckBox isAutoScaleBox; |
|
|
|
|
private UICheckBox isTDHeavyBox; |
|
|
|
|
private UICheckBox isPageFixedRowBox; |
|
|
|
|
private UITextField pageFixedRowCountTextField; |
|
|
|
|
private static final Color TIPS_FONT_COLOR = new Color(0x8f8f92); |
|
|
|
|
private static final Pattern ROW_COUNT = Pattern.compile("^[1-5][\\d]*$"); |
|
|
|
|
private static final String DEFAULT_ROW_COUNT = "30"; |
|
|
|
|
|
|
|
|
|
//固定行数分页,每页最多500行,最少1行数据
|
|
|
|
|
private static final int MAX_ROW_COUNT = 500; |
|
|
|
|
private static final int MIN_ROW_COUNT = 1; |
|
|
|
|
|
|
|
|
|
public PageWebSettingPane() { |
|
|
|
|
super(); |
|
|
|
@ -44,13 +66,57 @@ public class PageWebSettingPane extends WebSettingPane<WebPage> {
|
|
|
|
|
isShowAsImageBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Is_Paint_Page")); |
|
|
|
|
isAutoScaleBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_IS_Auto_Scale")); |
|
|
|
|
isTDHeavyBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_IS_TD_HEAVY_EXPORT"), false); |
|
|
|
|
isPageFixedRowBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_Page_Fixed_Row")); |
|
|
|
|
isPageFixedRowBox.addActionListener(new ActionListener() { |
|
|
|
|
@Override |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
pageFixedRowCountTextField.setEnabled(isPageFixedRowBox.isSelected()); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
|
double[] columnSize = { p,p,p}; |
|
|
|
|
double[] rowSize = { p, p,p,p }; |
|
|
|
|
|
|
|
|
|
pageFixedRowCountTextField = new UITextField(5); |
|
|
|
|
pageFixedRowCountTextField.setToolTipText(Toolkit.i18nText("Fine-Design_Report_Page_Fixed_Row_Count_Tip")); |
|
|
|
|
pageFixedRowCountTextField.addKeyListener(new KeyAdapter() { |
|
|
|
|
@Override |
|
|
|
|
public void keyReleased(KeyEvent e) { |
|
|
|
|
String rowCount = pageFixedRowCountTextField.getText(); |
|
|
|
|
if (!isRowCountValid(rowCount)) { |
|
|
|
|
pageFixedRowCountTextField.setText(StringUtils.EMPTY); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
pageFixedRowCountTextField.addInputMethodListener(new InputMethodListener() { |
|
|
|
|
@Override |
|
|
|
|
public void inputMethodTextChanged(InputMethodEvent event) { |
|
|
|
|
if (null == event.getText()) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
char ch = event.getText().current(); |
|
|
|
|
if (!(ch >= '0' && ch <= '9')) { |
|
|
|
|
event.consume(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@Override |
|
|
|
|
public void caretPositionChanged(InputMethodEvent event) { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
UILabel linesPerPageLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_Rows_Per_Page") + ":"); |
|
|
|
|
Component[][] rowCountTextFieldComponents = {{linesPerPageLabel,pageFixedRowCountTextField}}; |
|
|
|
|
JPanel linesPerPagePane = TableLayoutHelper.createTableLayoutPane(rowCountTextFieldComponents, new double[]{p}, new double[]{p,p}); |
|
|
|
|
UILabel tipLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_Page_Fixed_Row_Tip")); |
|
|
|
|
tipLabel.setForeground(TIPS_FONT_COLOR); |
|
|
|
|
|
|
|
|
|
double[] columnSize = {p, p, p, p}; |
|
|
|
|
double[] rowSize = {p, p, p, p}; |
|
|
|
|
Component[][] components = new Component[][]{ |
|
|
|
|
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Show_Location") + ":", UILabel.RIGHT), buttonpane,null}, |
|
|
|
|
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Page") + ":", UILabel.RIGHT), isShowAsImageBox, isAutoScaleBox}, |
|
|
|
|
new Component[]{null, isTDHeavyBox, null} |
|
|
|
|
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Show_Location") + ":", UILabel.RIGHT), buttonpane, null, null}, |
|
|
|
|
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_PageSetup_Page") + ":", UILabel.RIGHT), isShowAsImageBox, isAutoScaleBox, isTDHeavyBox}, |
|
|
|
|
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Paging_Settings") + ":", UILabel.RIGHT), isPageFixedRowBox, linesPerPagePane, null}, |
|
|
|
|
new Component[]{null, tipLabel, null, null} |
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
return TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); |
|
|
|
@ -65,6 +131,8 @@ public class PageWebSettingPane extends WebSettingPane<WebPage> {
|
|
|
|
|
isShowAsImageBox.setEnabled(isSelected); |
|
|
|
|
isAutoScaleBox.setEnabled(isSelected); |
|
|
|
|
isTDHeavyBox.setEnabled(isSelected); |
|
|
|
|
isPageFixedRowBox.setEnabled(isSelected); |
|
|
|
|
pageFixedRowCountTextField.setEnabled(isSelected); |
|
|
|
|
} |
|
|
|
|
protected void setDefault(){ |
|
|
|
|
super.setDefault(); |
|
|
|
@ -72,6 +140,9 @@ public class PageWebSettingPane extends WebSettingPane<WebPage> {
|
|
|
|
|
isShowAsImageBox.setSelected(false); |
|
|
|
|
isAutoScaleBox.setSelected(false); |
|
|
|
|
isTDHeavyBox.setSelected(false); |
|
|
|
|
isPageFixedRowBox.setSelected(false); |
|
|
|
|
pageFixedRowCountTextField.setText(DEFAULT_ROW_COUNT); |
|
|
|
|
pageFixedRowCountTextField.setEnabled(false); |
|
|
|
|
} |
|
|
|
|
@Override |
|
|
|
|
protected void populateSubWebSettingrBean(WebPage webPage) { |
|
|
|
@ -87,6 +158,9 @@ public class PageWebSettingPane extends WebSettingPane<WebPage> {
|
|
|
|
|
isShowAsImageBox.setSelected(webPage.isShowAsImage()); |
|
|
|
|
isAutoScaleBox.setSelected(webPage.isAutoScaleWhenEmbeddedInIframe()); |
|
|
|
|
isTDHeavyBox.setSelected(webPage.isTDHeavy()); |
|
|
|
|
isPageFixedRowBox.setSelected(webPage.isPageFixedRow()); |
|
|
|
|
pageFixedRowCountTextField.setText(webPage.getPageFixedRowCount().toString()); |
|
|
|
|
pageFixedRowCountTextField.setEnabled(webPage.isPageFixedRow()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -96,6 +170,10 @@ public class PageWebSettingPane extends WebSettingPane<WebPage> {
|
|
|
|
|
webPage.setShowAsImage(isShowAsImageBox.isSelected()); |
|
|
|
|
webPage.setAutoScaleWhenEmbeddedInIframe(isAutoScaleBox.isSelected()); |
|
|
|
|
webPage.setTDHeavy(isTDHeavyBox.isSelected()); |
|
|
|
|
webPage.setPageFixedRow(isPageFixedRowBox.isSelected()); |
|
|
|
|
if (!ComparatorUtils.equals(pageFixedRowCountTextField.getText(), StringUtils.EMPTY)) { |
|
|
|
|
webPage.setPageFixedRowCount(Integer.parseInt(pageFixedRowCountTextField.getText())); |
|
|
|
|
} |
|
|
|
|
return webPage; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -128,4 +206,13 @@ public class PageWebSettingPane extends WebSettingPane<WebPage> {
|
|
|
|
|
protected void setWebContent(ReportWebAttr reportWebAttr,WebPage webContent) { |
|
|
|
|
reportWebAttr.setWebPage(webContent); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private boolean isRowCountValid(String rowCount) { |
|
|
|
|
Matcher matcher = ROW_COUNT.matcher(rowCount); |
|
|
|
|
if (matcher.find()) { |
|
|
|
|
int count = Integer.parseInt(matcher.group()); |
|
|
|
|
return count >= MIN_ROW_COUNT && count <= MAX_ROW_COUNT; |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|