Browse Source

Merge pull request #1543 in BA/design from ~ZACK/design:9.0release to release/9.0

* commit '03677be8966141d8afa319e0d2c32708da30ec59':
  REPORT-5979 多次导入excel
superman 8 years ago
parent
commit
f57d9b07e7
  1. 87
      designer/src/com/fr/design/webattr/EditToolBar.java
  2. 6
      designer/src/com/fr/design/webattr/ReportWebWidgetConstants.java

87
designer/src/com/fr/design/webattr/EditToolBar.java

@ -34,13 +34,12 @@ import com.fr.report.web.button.Export;
import com.fr.report.web.button.PDFPrint;
import com.fr.report.web.button.Print;
import com.fr.report.web.button.write.AppendColumnRow;
import com.fr.report.web.button.write.ExcelImport;
import com.fr.report.web.button.write.Submit;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.*;
@ -295,6 +294,7 @@ public class EditToolBar extends BasicPane {
/**
* 动作
*
* @param e 事件
*/
public void actionPerformed(ActionEvent e) {
@ -320,7 +320,8 @@ public class EditToolBar extends BasicPane {
private CardLayout card;
private JPanel centerPane;
private UICheckBox icon, text, pdf, excelP, excelO, excelS, image, word,
flashPrint, pdfPrint, appletPrint, serverPrint, isPopup, isVerify, failSubmit, isCurSheet;
flashPrint, pdfPrint, appletPrint, serverPrint, isPopup, isVerify, failSubmit,
isCurSheet, excelImClean, excelImCover, excelImAppend, excelImCust;
private UIBasicSpinner count;
private Widget widget;
private UITextField nameField;
@ -381,6 +382,7 @@ public class EditToolBar extends BasicPane {
centerPane.setLayout(card);
centerPane.add("custom", getCustomPane());
centerPane.add("export", getExport());
centerPane.add("import", getImport());
centerPane.add("print", getPrint());
centerPane.add("none", none);
centerPane.add("pdfprint", getPdfPrintSetting());
@ -427,7 +429,7 @@ public class EditToolBar extends BasicPane {
export.add(word);
export.add(Box.createVerticalStrut(2));
export.add(image);
for(int i=0; i<ArrayUtils.getLength(exportToolBarProviders); i++){
for (int i = 0; i < ArrayUtils.getLength(exportToolBarProviders); i++) {
export = exportToolBarProviders[i].updateCenterPane(export);
}
@ -435,6 +437,24 @@ public class EditToolBar extends BasicPane {
return export;
}
private JPanel getImport() {
JPanel excelImport = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane();
excelImClean = new UICheckBox(Inter.getLocText("FR-Engine_Excel_Import_Clean"));
excelImCover = new UICheckBox(Inter.getLocText("FR-Engine_Excel_Import_Cover"));
excelImAppend = new UICheckBox(Inter.getLocText("FR-Engine_Excel_Import_Append"));
excelImCust = new UICheckBox(Inter.getLocText("FR-Engine-Utils-Import_Excel_Data_Customized"));
excelImport.add(excelImCover);
excelImport.add(Box.createVerticalStrut(2));
excelImport.add(excelImClean);
excelImport.add(Box.createVerticalStrut(2));
excelImport.add(excelImAppend);
excelImport.add(Box.createVerticalStrut(2));
excelImport.add(excelImCust);
excelImport.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText(new String[]{"Form-Button", "Property", "Set"}), null));
return excelImport;
}
private JPanel getPrint() {
JPanel print = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane();
// print.setLayout(new BoxLayout(print, BoxLayout.Y_AXIS));
@ -496,7 +516,7 @@ public class EditToolBar extends BasicPane {
if (!(widget instanceof CustomToolBarButton)) {
return;
}
if (javaScriptPane == null || ((CustomToolBarButton)widget).getJSImpl() == null) {
if (javaScriptPane == null || ((CustomToolBarButton) widget).getJSImpl() == null) {
javaScriptPane = JavaScriptActionPane.createDefault();
}
javaScriptPane.setPreferredSize(new Dimension(750, 500));
@ -513,6 +533,7 @@ public class EditToolBar extends BasicPane {
/**
* 更新
*
* @param widget 对应组件
*/
public void populate(Widget widget) {
@ -533,6 +554,8 @@ public class EditToolBar extends BasicPane {
populateSubmit();
} else if (widget instanceof CustomToolBarButton) {
populateCustomToolBarButton();
} else if (widget instanceof ExcelImport) {
populateImport();
}
Set<ExtraButtonToolBarProvider> extraButtonSet = ExtraDesignClassManager.getInstance().getArray(ExtraButtonToolBarProvider.XML_TAG);
@ -541,12 +564,12 @@ public class EditToolBar extends BasicPane {
}
}
private void populateAppendColumnRow(){
private void populateAppendColumnRow() {
card.show(centerPane, "appendcount");
count.setValue(((AppendColumnRow) widget).getCount());
}
private void populateExport(){
private void populateExport() {
card.show(centerPane, "export");
Export export = (Export) widget;
this.pdf.setSelected(export.isPdfAvailable());
@ -555,14 +578,24 @@ public class EditToolBar extends BasicPane {
this.excelS.setSelected(export.isExcelSAvailable());
this.word.setSelected(export.isWordAvailable());
this.image.setSelected(export.isImageAvailable());
if(exportToolBarProviders != null){
for(int i=0; i<exportToolBarProviders.length; i++){
exportToolBarProviders[i].populate();;
if (exportToolBarProviders != null) {
for (int i = 0; i < exportToolBarProviders.length; i++) {
exportToolBarProviders[i].populate();
;
}
}
}
private void populateCustomToolBarButton(){
private void populateImport() {
card.show(centerPane, "import");
ExcelImport export = (ExcelImport) widget;
this.excelImCover.setSelected(export.isExcelCoverAvailable());
this.excelImClean.setSelected(export.isExcelCleanAvailable());
this.excelImAppend.setSelected(export.isExcelAppendAvailable());
this.excelImCust.setSelected(export.isExcelCustAvailable());
}
private void populateCustomToolBarButton() {
card.show(centerPane, "custom");
CustomToolBarButton customToolBarButton = (CustomToolBarButton) widget;
if (customToolBarButton.getJSImpl() != null) {
@ -570,7 +603,7 @@ public class EditToolBar extends BasicPane {
}
}
private void populateSubmit(){
private void populateSubmit() {
card.show(centerPane, "submit");
Submit submit = ((Submit) widget);
this.isVerify.setSelected(submit.isVerify());
@ -581,13 +614,13 @@ public class EditToolBar extends BasicPane {
this.isCurSheet.setSelected(submit.isOnlySubmitSelect());
}
private void populatePDFPrint(){
private void populatePDFPrint() {
card.show(centerPane, "pdfprint");
PDFPrint pdfPrint = (PDFPrint) widget;
this.isPopup.setSelected(pdfPrint.isPopup());
}
private void populatePrint(){
private void populatePrint() {
card.show(centerPane, "print");
Print print = (Print) widget;
this.pdfPrint.setSelected(print.isPDFPrint());
@ -596,7 +629,7 @@ public class EditToolBar extends BasicPane {
this.serverPrint.setSelected(print.isServerPrint());
}
private void populateDefault(){
private void populateDefault() {
Button button = (Button) widget;
this.icon.setSelected(button.isShowIcon());
this.text.setSelected(button.isShowText());
@ -623,6 +656,8 @@ public class EditToolBar extends BasicPane {
updateSubmit();
} else if (widget instanceof CustomToolBarButton) {
((CustomToolBarButton) widget).setJSImpl(this.javaScriptPane.updateBean());
} else if (widget instanceof ExcelImport) {
updateImport();
}
if (widget instanceof Button) {
updateDefault();
@ -636,21 +671,21 @@ public class EditToolBar extends BasicPane {
return widget;
}
private void updateDefault(){
private void updateDefault() {
((Button) widget).setShowIcon(this.icon.isSelected());
((Button) widget).setShowText(this.text.isSelected());
((Button) widget).setText(this.nameField.getText());
((Button) widget).setIconName(this.iconPane.update());
}
private void updateSubmit(){
private void updateSubmit() {
Submit submit = ((Submit) widget);
submit.setVerify(this.isVerify.isSelected());
submit.setFailVerifySubmit(this.failSubmit.isSelected());
submit.setOnlySubmitSelect(this.isCurSheet.isSelected());
}
private void updatePrint(){
private void updatePrint() {
Print print = (Print) widget;
print.setAppletPrint(this.appletPrint.isSelected());
print.setFlashPrint(this.flashPrint.isSelected());
@ -658,7 +693,7 @@ public class EditToolBar extends BasicPane {
print.setServerPrint(this.serverPrint.isSelected());
}
private void updateExport(){
private void updateExport() {
Export export = (Export) widget;
export.setPdfAvailable(this.pdf.isSelected());
export.setExcelPAvailable(this.excelP.isSelected());
@ -666,12 +701,20 @@ public class EditToolBar extends BasicPane {
export.setExcelSAvailable(this.excelS.isSelected());
export.setWordAvailable(this.word.isSelected());
export.setImageAvailable(this.image.isSelected());
if(exportToolBarProviders != null){
for(int i=0; i<exportToolBarProviders.length; i++){
exportToolBarProviders[i].update();;
if (exportToolBarProviders != null) {
for (int i = 0; i < exportToolBarProviders.length; i++) {
exportToolBarProviders[i].update();
}
}
}
private void updateImport() {
ExcelImport excelImport = (ExcelImport) widget;
excelImport.setExcelCleanAvailable(this.excelImClean.isSelected());
excelImport.setExcelCoverAvailable(this.excelImCover.isSelected());
excelImport.setExcelAppendAvailable(this.excelImAppend.isSelected());
excelImport.setExcelCustAvailable(this.excelImCust.isSelected());
}
}
}

6
designer/src/com/fr/design/webattr/ReportWebWidgetConstants.java

@ -32,7 +32,7 @@ public class ReportWebWidgetConstants {
public static WidgetOption[] getWriteToolBarInstance() {
return new WidgetOption[]{SUBMIT, VERIFY, EMAIL, EXPORT, PDF, EXCELP, EXCELO, EXCELS, WORD, PRINT, FLASHPRINT, APPLETPRINT, PDFPRINT, IMPORTEXCELDATA, SHOWCELLVALUE,
APPENDCOLUMNROW, DELETECOLUMNROW, SETPRINTEROFFSET, WRITEOFFLINEHTML, CUSTOM_BUTTON, WRITESTASH, WRITESTASHCLEAR, IMPORTEXCELDATA_CUSTOMIZED};
APPENDCOLUMNROW, DELETECOLUMNROW, SETPRINTEROFFSET, WRITEOFFLINEHTML, CUSTOM_BUTTON, WRITESTASH, WRITESTASHCLEAR, IMPORTEXCELDATA_CUSTOMIZED, IMPORTEXCEL};
}
public static WidgetOption[] getFormToolBarInstance() {
@ -148,5 +148,7 @@ public class ReportWebWidgetConstants {
// 数据清空
public static final WidgetOption WRITESTASHCLEAR = WidgetOptionFactory
.createByWidgetClass(Inter.getLocText("FR-Engine-Write_Clear"), BaseUtils.readIcon("/com/fr/web/images/edit/clearstash.png"), ClearStashedButton.class);
//Excel导入
public static final WidgetOption IMPORTEXCEL= WidgetOptionFactory.createByWidgetClass(Inter.getLocText("FR-Engine_Excel_Import_Repeat"),
BaseUtils.readIcon("/com/fr/web/images/excel.png"), ExcelImport.class);
}
Loading…
Cancel
Save