|
|
|
@ -9,24 +9,40 @@ import com.fr.design.gui.ibutton.UIButton;
|
|
|
|
|
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.utils.gui.GUICoreUtils; |
|
|
|
|
import com.fr.design.layout.TableLayout; |
|
|
|
|
import com.fr.design.layout.TableLayoutHelper; |
|
|
|
|
import com.fr.form.event.Listener; |
|
|
|
|
|
|
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
|
import com.fr.report.web.Location; |
|
|
|
|
import com.fr.report.web.ToolBarManager; |
|
|
|
|
import com.fr.report.web.WebContent; |
|
|
|
|
import com.fr.report.web.WebPage; |
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
import com.fr.transaction.Configurations; |
|
|
|
|
import com.fr.transaction.Worker; |
|
|
|
|
import com.fr.web.attr.ReportWebAttr; |
|
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
|
import java.awt.*; |
|
|
|
|
import java.awt.BorderLayout; |
|
|
|
|
import java.awt.Color; |
|
|
|
|
import java.awt.Component; |
|
|
|
|
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.awt.event.KeyListener; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
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 { |
|
|
|
|
|
|
|
|
@ -38,51 +54,87 @@ public class PageToolBarPane extends AbstractEditToolBarPane {
|
|
|
|
|
private UICheckBox isAutoScaleBox; |
|
|
|
|
private UICheckBox isTDHeavyBox; |
|
|
|
|
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 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]*$"); |
|
|
|
|
|
|
|
|
|
//固定行数分页,每页最多500行,最少1行数据
|
|
|
|
|
private static final int MAX_ROW_COUNT = 500; |
|
|
|
|
private static final int MIN_ROW_COUNT = 1; |
|
|
|
|
|
|
|
|
|
public PageToolBarPane() { |
|
|
|
|
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(); |
|
|
|
|
leftRadioButton.setSelected(true); |
|
|
|
|
buttonGroup.add(centerRadioButton); |
|
|
|
|
buttonGroup.add(leftRadioButton); |
|
|
|
|
north.add(GUICoreUtils.createFlowPane(new Component[] { |
|
|
|
|
showLocationLabel, new UILabel(" "), centerRadioButton, leftRadioButton}, FlowLayout.LEFT)); |
|
|
|
|
JPanel buttonPane = new JPanel(FRGUIPaneFactory.createBoxFlowLayout()); |
|
|
|
|
buttonPane.add(centerRadioButton); |
|
|
|
|
buttonPane.add(leftRadioButton); |
|
|
|
|
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")); |
|
|
|
|
north.add(GUICoreUtils.createFlowPane(isAutoScaleBox, FlowLayout.LEFT)); |
|
|
|
|
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); |
|
|
|
|
JPanel editToolBarButtonPanel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); |
|
|
|
|
editToolBarButtonPanel.add(editToolBarButton); |
|
|
|
|
isUseToolBarCheckBox.setSelected(true); |
|
|
|
|
isUseToolBarCheckBox.addActionListener(new ActionListener() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
editToolBarButton.setEnabled(isUseToolBarCheckBox.isSelected()); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
north.add(GUICoreUtils.createFlowPane(new Component[] {isUseToolBarCheckBox, editToolBarButton}, FlowLayout.LEFT)); |
|
|
|
|
north.add(GUICoreUtils.createFlowPane(showListenersLabel, FlowLayout.LEFT)); |
|
|
|
|
eventPane = new EventPane(new WebPage().supportedEvents()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
|
|
|
|
|
|
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(); |
|
|
|
|
center.add(eventPane, BorderLayout.CENTER); |
|
|
|
|
allPanel.add(center, BorderLayout.CENTER); |
|
|
|
|
//wei : 默认没config.xml的情况下,就有默认工具栏
|
|
|
|
|
ToolBarManager toolBarManager = ToolBarManager.createDefaultToolBar(); |
|
|
|
|
toolBarManager.setToolBarLocation(Location.createTopEmbedLocation()); |
|
|
|
|
this.toolBarManagers = new ToolBarManager[] {toolBarManager}; |
|
|
|
|
this.toolBarManagers = new ToolBarManager[]{toolBarManager}; |
|
|
|
|
|
|
|
|
|
this.add(center, BorderLayout.CENTER); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -101,8 +153,8 @@ public class PageToolBarPane extends AbstractEditToolBarPane {
|
|
|
|
|
this.leftRadioButton.setEnabled(isEnabled); |
|
|
|
|
this.isUseToolBarCheckBox.setEnabled(isEnabled); |
|
|
|
|
this.editToolBarButton.setEnabled(isEnabled && isUseToolBarCheckBox.isSelected()); |
|
|
|
|
this.showLocationLabel.setEnabled(isEnabled); |
|
|
|
|
this.showListenersLabel.setEnabled(isEnabled); |
|
|
|
|
this.isPageFixedRowBox.setEnabled(isEnabled); |
|
|
|
|
this.pageFixedRowCountTextField.setEditable(isEnabled); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -140,6 +192,9 @@ public class PageToolBarPane extends AbstractEditToolBarPane {
|
|
|
|
|
} |
|
|
|
|
eventPane.populate(list); |
|
|
|
|
} |
|
|
|
|
isPageFixedRowBox.setSelected(webPage.isPageFixedRow()); |
|
|
|
|
pageFixedRowCountTextField.setText(webPage.getPageFixedRowCount().toString()); |
|
|
|
|
pageFixedRowCountTextField.setEnabled(webPage.isPageFixedRow()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -158,6 +213,10 @@ public class PageToolBarPane extends AbstractEditToolBarPane {
|
|
|
|
|
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; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -193,4 +252,41 @@ public class PageToolBarPane extends AbstractEditToolBarPane {
|
|
|
|
|
}); |
|
|
|
|
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 >= MIN_ROW_COUNT && count <= MAX_ROW_COUNT; |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|