Browse Source

REPORT-58039 支持固定行数分页

research/11.0
pengda 3 years ago
parent
commit
5f6f736441
  1. 6
      designer-form/src/main/java/com/fr/design/form/parameter/FormParaTargetMode.java
  2. 68
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java
  3. 144
      designer-realize/src/main/java/com/fr/design/webattr/PageToolBarPane.java

6
designer-form/src/main/java/com/fr/design/form/parameter/FormParaTargetMode.java

@ -1,7 +1,6 @@
package com.fr.design.form.parameter; package com.fr.design.form.parameter;
import com.fr.base.svg.IconUtils;
import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.properties.WidgetPropertyTable; import com.fr.design.designer.properties.WidgetPropertyTable;
import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.core.WidgetOption;
@ -12,6 +11,7 @@ import com.fr.form.main.parameter.FormParameterUI;
import com.fr.form.parameter.FormSubmitButton; import com.fr.form.parameter.FormSubmitButton;
import com.fr.form.ui.PageFixedRowComboBox;
import java.util.ArrayList; import java.util.ArrayList;
public class FormParaTargetMode extends FormDesignerModeForSpecial<FormParaDesigner> { public class FormParaTargetMode extends FormDesignerModeForSpecial<FormParaDesigner> {
@ -28,7 +28,9 @@ public class FormParaTargetMode extends FormDesignerModeForSpecial<FormParaDesig
public WidgetOption[] getPredefinedWidgetOptions() { public WidgetOption[] getPredefinedWidgetOptions() {
return new WidgetOption[]{ return new WidgetOption[]{
WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Query_Button"), WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Query_Button"),
"/com/fr/web/images/form/resources/preview_16", FormSubmitButton.class)}; "/com/fr/web/images/form/resources/preview_16", FormSubmitButton.class),
WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Page_Fixed_Row_ComboBox"),
"/com/fr/design/images/buttonicon/widget/combo_box_16", PageFixedRowComboBox.class)};
} }
@Override @Override

68
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java

@ -27,7 +27,8 @@ import com.fr.report.cell.cellattr.CellInsertPolicyAttr;
import com.fr.report.cell.cellattr.CellPageAttr; import com.fr.report.cell.cellattr.CellPageAttr;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.design.i18n.Toolkit;
import java.awt.Color;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.ButtonGroup; import javax.swing.ButtonGroup;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -75,6 +76,11 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
private UICheckBox canBreakOnPaginateCheckBox; private UICheckBox canBreakOnPaginateCheckBox;
private UICheckBox repeatCheckBox; private UICheckBox repeatCheckBox;
//固定行数分页
private UICheckBox pageFixedRowDataCheckBox;
private UILabel currentPageFixedRowDataTipLabel;
private TemplateCellElement pageFixedRowDataCell;
// 自动调整 // 自动调整
private UIRadioButton autoHeightRadioButton; // 自动调整行高 private UIRadioButton autoHeightRadioButton; // 自动调整行高
private UIRadioButton autoWidthRadioButton; // 自动调整列宽 private UIRadioButton autoWidthRadioButton; // 自动调整列宽
@ -90,6 +96,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
private JPanel insertRowPolicyPane; private JPanel insertRowPolicyPane;
private JPanel defaultValuePane; private JPanel defaultValuePane;
private static final Color TIPS_FONT_COLOR = new Color(0x8f8f92);
/** /**
* 初始化 * 初始化
* *
@ -263,8 +270,10 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
pageBeforeColumnCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_Page_Before_Column")); pageBeforeColumnCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_Page_Before_Column"));
pageAfterColumnCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_Page_After_Column")); pageAfterColumnCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_Page_After_Column"));
canBreakOnPaginateCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellPage_Can_Break_On_Paginate")); canBreakOnPaginateCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_CellPage_Can_Break_On_Paginate"));
repeatCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellPage_Repeat_Content_When_Paging")); repeatCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_CellPage_Repeat_Content_When_Paging"));
pageFixedRowDataCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_CellWrite_Page_Fixed_Row_Cell"));
currentPageFixedRowDataTipLabel = new UILabel(" (" + Toolkit.i18nText("Fine-Design_Report_CellWrite_No_Page_Fixed_Row_Cell") +")");
pageBeforeRowCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER); pageBeforeRowCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
pageAfterRowCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER); pageAfterRowCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
@ -272,11 +281,13 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
pageAfterColumnCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER); pageAfterColumnCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
canBreakOnPaginateCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER); canBreakOnPaginateCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
repeatCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER); repeatCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
pageFixedRowDataCheckBox.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
currentPageFixedRowDataTipLabel.setBorder(UIConstants.CELL_ATTR_ZEROBORDER);
currentPageFixedRowDataTipLabel.setForeground(TIPS_FONT_COLOR);
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p, p, p, p, p, p, p}; double[] rowSize = {p, p, p, p, p, p, p, p, p, p, p,p};
double[] columnSize = {p}; double[] columnSize = {p};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1},{1,1},{1,1}};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null}, new Component[]{null},
new Component[]{pageBeforeRowCheckBox}, new Component[]{pageBeforeRowCheckBox},
@ -287,6 +298,9 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
new Component[]{null}, new Component[]{null},
new Component[]{canBreakOnPaginateCheckBox}, new Component[]{canBreakOnPaginateCheckBox},
new Component[]{repeatCheckBox}, new Component[]{repeatCheckBox},
new Component[]{null},
new Component[]{pageFixedRowDataCheckBox},
new Component[]{currentPageFixedRowDataTipLabel}
}; };
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_LARGE); return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_LARGE);
@ -345,6 +359,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
repeatCheckBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellPage_Repeat_Content_When_Paging")); repeatCheckBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellPage_Repeat_Content_When_Paging"));
insertRowPolicyButtonGroup.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_Policy")); insertRowPolicyButtonGroup.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_Policy"));
valueEditor.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_Policy")); valueEditor.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_Policy"));
pageFixedRowDataCheckBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_Page_Fixed_Row_Cell"));
} }
@ -356,6 +371,9 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
@Override @Override
protected void populateBean() { protected void populateBean() {
this.currentPageFixedRowDataTipLabel.setText(" (" + Toolkit.i18nText("Fine-Design_Report_CellWrite_No_Page_Fixed_Row_Cell") + ")");
this.pageFixedRowDataCell = null;
checkPageFixedRow();
CellGUIAttr cellGUIAttr = cellElement.getCellGUIAttr(); CellGUIAttr cellGUIAttr = cellElement.getCellGUIAttr();
if (cellGUIAttr == null) { if (cellGUIAttr == null) {
cellGUIAttr = CellGUIAttr.DEFAULT_CELLGUIATTR; cellGUIAttr = CellGUIAttr.DEFAULT_CELLGUIATTR;
@ -411,6 +429,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
this.pageAfterColumnCheckBox.setSelected(cellPageAttr.isPageAfterColumn()); this.pageAfterColumnCheckBox.setSelected(cellPageAttr.isPageAfterColumn());
this.canBreakOnPaginateCheckBox.setSelected(cellPageAttr.isCanBreakOnPaginate()); this.canBreakOnPaginateCheckBox.setSelected(cellPageAttr.isCanBreakOnPaginate());
this.repeatCheckBox.setSelected(cellPageAttr.isRepeat()); this.repeatCheckBox.setSelected(cellPageAttr.isRepeat());
this.pageFixedRowDataCheckBox.setSelected(cellPageAttr.isPageFixedRow());
CellInsertPolicyAttr cellInsertPolicyAttr = cellElement.getCellInsertPolicyAttr();// 插入 CellInsertPolicyAttr cellInsertPolicyAttr = cellElement.getCellInsertPolicyAttr();// 插入
if (cellInsertPolicyAttr == null) { if (cellInsertPolicyAttr == null) {
cellInsertPolicyAttr = new CellInsertPolicyAttr(); cellInsertPolicyAttr = new CellInsertPolicyAttr();
@ -536,6 +555,20 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
cellPageAttr.setRepeat(this.repeatCheckBox.isSelected()); cellPageAttr.setRepeat(this.repeatCheckBox.isSelected());
} }
if (ComparatorUtils.equals(getGlobalName(), Toolkit.i18nText("Fine-Design_Report_CellWrite_Page_Fixed_Row_Cell"))) {
cellPageAttr.setPageFixedRow(this.pageFixedRowDataCheckBox.isSelected());
if (this.pageFixedRowDataCheckBox.isSelected()) {
if (pageFixedRowDataCell != null && pageFixedRowDataCell != cellElement) {
pageFixedRowDataCell.getCellPageAttr().setPageFixedRow(false);
}
pageFixedRowDataCell = cellElement;
currentPageFixedRowDataTipLabel.setText(" (" + Toolkit.i18nText("Fine-Design_Report_CellWrite_Current_Page_Fixed_Row_Cell") + cellElement.toString() + ")");
} else {
if (pageFixedRowDataCell != null && pageFixedRowDataCell == cellElement) {
currentPageFixedRowDataTipLabel.setText(" (" + Toolkit.i18nText("Fine-Design_Report_CellWrite_No_Page_Fixed_Row_Cell") + ")");
}
}
}
cellElement.setCellPageAttr(cellPageAttr); cellElement.setCellPageAttr(cellPageAttr);
if (ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_Policy"))) { if (ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_Policy"))) {
@ -579,6 +612,29 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
} }
} }
private void checkPageFixedRow() {
TemplateElementCase elementCase = elementCasePane.getEditingElementCase();
int rowCount = elementCase.getRowCount();
int columnCount = elementCase.getColumnCount();
boolean find = false;
for (int row = 0; row < rowCount; row++) {
for (int column = 0; column < columnCount; column++) {
TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row);
if (cellElement != null) {
if (cellElement.getCellPageAttr() != null && cellElement.getCellPageAttr().isPageFixedRow()) {
this.pageFixedRowDataCell = cellElement;
this.currentPageFixedRowDataTipLabel.setText(" (" + Toolkit.i18nText("Fine-Design_Report_CellWrite_Current_Page_Fixed_Row_Cell") + cellElement.toString() + ")");
find = true;
break;
}
}
}
if (find) {
break;
}
}
}
/** /**
* 返回界面的标题 * 返回界面的标题
* *

144
designer-realize/src/main/java/com/fr/design/webattr/PageToolBarPane.java

@ -9,24 +9,40 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel; 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.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.event.Listener; import com.fr.form.event.Listener;
import com.fr.general.ComparatorUtils;
import com.fr.report.web.Location; import com.fr.report.web.Location;
import com.fr.report.web.ToolBarManager; import com.fr.report.web.ToolBarManager;
import com.fr.report.web.WebContent; import com.fr.report.web.WebContent;
import com.fr.report.web.WebPage; import com.fr.report.web.WebPage;
import com.fr.stable.StringUtils;
import com.fr.transaction.Configurations; import com.fr.transaction.Configurations;
import com.fr.transaction.Worker; import com.fr.transaction.Worker;
import com.fr.web.attr.ReportWebAttr; import com.fr.web.attr.ReportWebAttr;
import com.fr.design.i18n.Toolkit;
import javax.swing.*; import java.awt.BorderLayout;
import java.awt.*; import java.awt.Color;
import java.awt.Component;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; 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.awt.event.KeyListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.ButtonGroup;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
public class PageToolBarPane extends AbstractEditToolBarPane { public class PageToolBarPane extends AbstractEditToolBarPane {
@ -38,51 +54,83 @@ public class PageToolBarPane extends AbstractEditToolBarPane {
private UICheckBox isAutoScaleBox; private UICheckBox isAutoScaleBox;
private UICheckBox isTDHeavyBox; private UICheckBox isTDHeavyBox;
private EventPane eventPane; private EventPane eventPane;
private UILabel showLocationLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Show_Location") + ":");
private UILabel showListenersLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Editing_Listeners") + ":");
private UIButton editToolBarButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit")); private UIButton editToolBarButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit"));
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]*$");
public PageToolBarPane() { public PageToolBarPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel allPanel = FRGUIPaneFactory.createBorderLayout_L_Pane();
this.add(allPanel, BorderLayout.CENTER);
JPanel north = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1);
allPanel.add(north, BorderLayout.NORTH);
ButtonGroup buttonGroup = new ButtonGroup(); ButtonGroup buttonGroup = new ButtonGroup();
leftRadioButton.setSelected(true); leftRadioButton.setSelected(true);
buttonGroup.add(centerRadioButton); buttonGroup.add(centerRadioButton);
buttonGroup.add(leftRadioButton); buttonGroup.add(leftRadioButton);
north.add(GUICoreUtils.createFlowPane(new Component[] { JPanel buttonPane = new JPanel(FRGUIPaneFactory.createBoxFlowLayout());
showLocationLabel, new UILabel(" "), centerRadioButton, leftRadioButton}, FlowLayout.LEFT)); buttonPane.add(centerRadioButton);
buttonPane.add(leftRadioButton);
isShowAsImageBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Is_Paint_Page")); isShowAsImageBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Is_Paint_Page"));
north.add(GUICoreUtils.createFlowPane(isShowAsImageBox, FlowLayout.LEFT));
isAutoScaleBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_IS_Auto_Scale")); isAutoScaleBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_IS_Auto_Scale"));
north.add(GUICoreUtils.createFlowPane(isAutoScaleBox, FlowLayout.LEFT));
isTDHeavyBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_IS_TD_HEAVY_EXPORT"), false); isTDHeavyBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_IS_TD_HEAVY_EXPORT"), false);
north.add(GUICoreUtils.createFlowPane(isTDHeavyBox, FlowLayout.LEFT)); 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());
}
});
editToolBarButton.addActionListener(editBtnListener); editToolBarButton.addActionListener(editBtnListener);
JPanel editToolBarButtonPanel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
editToolBarButtonPanel.add(editToolBarButton);
isUseToolBarCheckBox.setSelected(true); isUseToolBarCheckBox.setSelected(true);
isUseToolBarCheckBox.addActionListener(new ActionListener() { isUseToolBarCheckBox.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
editToolBarButton.setEnabled(isUseToolBarCheckBox.isSelected()); editToolBarButton.setEnabled(isUseToolBarCheckBox.isSelected());
} }
}); });
north.add(GUICoreUtils.createFlowPane(new Component[] {isUseToolBarCheckBox, editToolBarButton}, FlowLayout.LEFT));
north.add(GUICoreUtils.createFlowPane(showListenersLabel, FlowLayout.LEFT)); double p = TableLayout.PREFERRED;
eventPane = new EventPane(new WebPage().supportedEvents());
pageFixedRowCountTextField = new UITextField(5);
pageFixedRowCountTextField.setText("30");
pageFixedRowCountTextField.setToolTipText(Toolkit.i18nText("Fine-Design_Report_Page_Fixed_Row_Count_Tip"));
pageFixedRowCountTextField.addKeyListener(rowCountKeyListener);
pageFixedRowCountTextField.addInputMethodListener(rowCountInputMethodListener);
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, p};
Component[][] components = new Component[][]{
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Show_Location") + ":", UILabel.RIGHT), buttonPane, null, null},
new Component[]{new UILabel(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},
new Component[]{isUseToolBarCheckBox, editToolBarButtonPanel, null, null}
};
JPanel northPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.add(northPanel, BorderLayout.NORTH);
eventPane = new EventPane(new WebPage().supportedEvents());
JPanel center = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel center = FRGUIPaneFactory.createBorderLayout_S_Pane();
center.add(eventPane, BorderLayout.CENTER); center.add(eventPane, BorderLayout.CENTER);
allPanel.add(center, BorderLayout.CENTER);
//wei : 默认没config.xml的情况下,就有默认工具栏 //wei : 默认没config.xml的情况下,就有默认工具栏
ToolBarManager toolBarManager = ToolBarManager.createDefaultToolBar(); ToolBarManager toolBarManager = ToolBarManager.createDefaultToolBar();
toolBarManager.setToolBarLocation(Location.createTopEmbedLocation()); toolBarManager.setToolBarLocation(Location.createTopEmbedLocation());
this.toolBarManagers = new ToolBarManager[] {toolBarManager}; this.toolBarManagers = new ToolBarManager[]{toolBarManager};
this.add(center, BorderLayout.CENTER);
} }
@Override @Override
@ -101,8 +149,8 @@ public class PageToolBarPane extends AbstractEditToolBarPane {
this.leftRadioButton.setEnabled(isEnabled); this.leftRadioButton.setEnabled(isEnabled);
this.isUseToolBarCheckBox.setEnabled(isEnabled); this.isUseToolBarCheckBox.setEnabled(isEnabled);
this.editToolBarButton.setEnabled(isEnabled && isUseToolBarCheckBox.isSelected()); this.editToolBarButton.setEnabled(isEnabled && isUseToolBarCheckBox.isSelected());
this.showLocationLabel.setEnabled(isEnabled); this.isPageFixedRowBox.setEnabled(isEnabled);
this.showListenersLabel.setEnabled(isEnabled); this.pageFixedRowCountTextField.setEditable(isEnabled);
} }
@Override @Override
@ -140,6 +188,9 @@ public class PageToolBarPane extends AbstractEditToolBarPane {
} }
eventPane.populate(list); eventPane.populate(list);
} }
isPageFixedRowBox.setSelected(webPage.isPageFixedRow());
pageFixedRowCountTextField.setText(webPage.getPageFixedRowCount().toString());
pageFixedRowCountTextField.setEnabled(webPage.isPageFixedRow());
} }
@Override @Override
@ -158,6 +209,10 @@ public class PageToolBarPane extends AbstractEditToolBarPane {
webPage.setShowAsImage(isShowAsImageBox.isSelected()); webPage.setShowAsImage(isShowAsImageBox.isSelected());
webPage.setAutoScaleWhenEmbeddedInIframe(isAutoScaleBox.isSelected()); webPage.setAutoScaleWhenEmbeddedInIframe(isAutoScaleBox.isSelected());
webPage.setTDHeavy(isTDHeavyBox.isSelected()); webPage.setTDHeavy(isTDHeavyBox.isSelected());
webPage.setPageFixedRow(isPageFixedRowBox.isSelected());
if (!ComparatorUtils.equals(pageFixedRowCountTextField.getText(), StringUtils.EMPTY)) {
webPage.setPageFixedRowCount(Integer.parseInt(pageFixedRowCountTextField.getText()));
}
return webPage; return webPage;
} }
@ -193,4 +248,41 @@ public class PageToolBarPane extends AbstractEditToolBarPane {
}); });
serverPageDialog.setVisible(true); serverPageDialog.setVisible(true);
} }
InputMethodListener rowCountInputMethodListener = 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) {
}
};
KeyListener rowCountKeyListener = new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e) {
String rowCount = pageFixedRowCountTextField.getText();
if (!isRowCountValid(rowCount)) {
pageFixedRowCountTextField.setText(StringUtils.EMPTY);
}
}
};
private boolean isRowCountValid(String rowCount) {
Matcher matcher = ROW_COUNT.matcher(rowCount);
if(matcher.find()){
int count = Integer.parseInt(matcher.group());
return count > 0 && count < 501;
}
return false;
}
} }

Loading…
Cancel
Save