|
|
@ -72,7 +72,6 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript |
|
|
|
private ExportRadioGroup templateRadioGroup; |
|
|
|
private ExportRadioGroup templateRadioGroup; |
|
|
|
private UIRadioButton currentTemplateRadio; |
|
|
|
private UIRadioButton currentTemplateRadio; |
|
|
|
private UIRadioButton otherTemplateRadio; |
|
|
|
private UIRadioButton otherTemplateRadio; |
|
|
|
private UIComboBox exportTypeComboBox; |
|
|
|
|
|
|
|
private CardLayout card; |
|
|
|
private CardLayout card; |
|
|
|
private JPanel templatePanel; |
|
|
|
private JPanel templatePanel; |
|
|
|
private CurrentTemplatePane currentTemplatePane; |
|
|
|
private CurrentTemplatePane currentTemplatePane; |
|
|
@ -110,6 +109,8 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript |
|
|
|
private FormulaEditor fileNameFormulaEditor; |
|
|
|
private FormulaEditor fileNameFormulaEditor; |
|
|
|
private UICheckBox extendParametersCheckBox; |
|
|
|
private UICheckBox extendParametersCheckBox; |
|
|
|
private ReportletParameterViewPane parameterViewPane; |
|
|
|
private ReportletParameterViewPane parameterViewPane; |
|
|
|
|
|
|
|
private UIComboBox exportTypeComboBox; |
|
|
|
|
|
|
|
private UILabel fileNameTipLabel; |
|
|
|
|
|
|
|
|
|
|
|
public CurrentTemplatePane() { |
|
|
|
public CurrentTemplatePane() { |
|
|
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
|
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
|
@ -167,7 +168,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript |
|
|
|
fileNameFormulaEditor = new FormulaEditor(Toolkit.i18nText("Fine-Design_Report_Parameter_Formula")); |
|
|
|
fileNameFormulaEditor = new FormulaEditor(Toolkit.i18nText("Fine-Design_Report_Parameter_Formula")); |
|
|
|
fileNameFormulaEditor.setVisible(false); |
|
|
|
fileNameFormulaEditor.setVisible(false); |
|
|
|
fileNameFormulaEditor.setEnabled(false); |
|
|
|
fileNameFormulaEditor.setEnabled(false); |
|
|
|
UILabel fileNameTipLabel = new UILabel("<html><body style=\"color:rgb(147,147,147)\">" + Toolkit.i18nText("Fine-Design_Basic_Export_JS_Title_Tip_Front") + "\\/:*?\"<>|" + Toolkit.i18nText("Fine-Design_Basic_Export_JS_Title_Tip_Back") + "</html>"); |
|
|
|
fileNameTipLabel = new UILabel("<html><body style=\"color:rgb(147,147,147)\">" + Toolkit.i18nText("Fine-Design_Basic_Export_JS_Title_Tip_Front") + "\\/:*?\"<>|" + Toolkit.i18nText("Fine-Design_Basic_Export_JS_Title_Tip_Back") + "</html>"); |
|
|
|
fileNameTipLabel.setVisible(false); |
|
|
|
fileNameTipLabel.setVisible(false); |
|
|
|
fileNameRadioGroup.addActionListener(new ActionListener() { |
|
|
|
fileNameRadioGroup.addActionListener(new ActionListener() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -196,6 +197,56 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript |
|
|
|
fileNamePane.setBorder(BorderFactory.createEmptyBorder(5, 2, 5, 2)); |
|
|
|
fileNamePane.setBorder(BorderFactory.createEmptyBorder(5, 2, 5, 2)); |
|
|
|
return fileNamePane; |
|
|
|
return fileNamePane; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public void updateSingleJavaScript(SingleJavaScript js){ |
|
|
|
|
|
|
|
js.setTemplatePath(DEFAULT); |
|
|
|
|
|
|
|
js.setExportType(GeneralUtils.objectToString(exportTypeComboBox.getSelectedItem())); |
|
|
|
|
|
|
|
js.setDefaultFileName(defaultNameRadio.isSelected()); |
|
|
|
|
|
|
|
js.setFileName(getFileName()); |
|
|
|
|
|
|
|
js.setExtendParameters(extendParametersCheckBox.isSelected()); |
|
|
|
|
|
|
|
if (extendParametersCheckBox.isSelected()) { |
|
|
|
|
|
|
|
js.setParameters(null); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
if (parameterViewPane != null) { |
|
|
|
|
|
|
|
List<ParameterProvider> parameterList = parameterViewPane.update(); |
|
|
|
|
|
|
|
if (!parameterList.isEmpty()) { |
|
|
|
|
|
|
|
Parameter[] parameters = new Parameter[parameterList.size()]; |
|
|
|
|
|
|
|
parameterList.toArray(parameters); |
|
|
|
|
|
|
|
js.setParameters(parameters); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public void populateSingleJavaScript(SingleJavaScript js){ |
|
|
|
|
|
|
|
exportTypeComboBox.setSelectedItem(js.getExportType()); |
|
|
|
|
|
|
|
fileNameRadioGroup.selectIndexButton(js.isDefaultFileName() ? 0 : 1); |
|
|
|
|
|
|
|
if (!js.isDefaultFileName()) { |
|
|
|
|
|
|
|
fileNameFormulaEditor.setEnabled(true); |
|
|
|
|
|
|
|
fileNameFormulaEditor.setVisible(true); |
|
|
|
|
|
|
|
fileNameTipLabel.setVisible(true); |
|
|
|
|
|
|
|
fileNameFormulaEditor.setValue(BaseFormula.createFormulaBuilder().build(js.getFileName())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (js.isExtendParameters()) { |
|
|
|
|
|
|
|
extendParametersCheckBox.setSelected(true); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
extendParametersCheckBox.setSelected(false); |
|
|
|
|
|
|
|
if (this.parameterViewPane != null) { |
|
|
|
|
|
|
|
List<ParameterProvider> parameterList = this.parameterViewPane.update(); |
|
|
|
|
|
|
|
parameterList.clear(); |
|
|
|
|
|
|
|
ParameterProvider[] parameters = js.getParameters(); |
|
|
|
|
|
|
|
this.parameterViewPane.populate(parameters); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private JPanel initExportTypePane() { |
|
|
|
|
|
|
|
UILabel typeLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Type") + ":"); |
|
|
|
|
|
|
|
exportTypeComboBox = getComboBoxWithModel(new String[]{ExportJavaScript.EXPORT_PDF, ExportJavaScript.EXPORT_EXCEL_PAGE, ExportJavaScript.EXPORT_EXCEL_SIMPLE, ExportJavaScript.EXPORT_EXCEL_SHEET, ExportJavaScript.EXPORT_WORD, ExportJavaScript.EXPORT_IMAGE} |
|
|
|
|
|
|
|
, EXPORT_TYPES_MAP); |
|
|
|
|
|
|
|
Component[][] components = new Component[][]{{typeLabel, exportTypeComboBox}}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JPanel exportTypePane = TableLayoutHelper.createTableLayoutPane(components, new double[]{p}, new double[]{p, p}); |
|
|
|
|
|
|
|
exportTypePane.setBorder(BorderFactory.createEmptyBorder(5, 2, 5, 2)); |
|
|
|
|
|
|
|
return exportTypePane; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected String title4PopupWindow() { |
|
|
|
protected String title4PopupWindow() { |
|
|
@ -214,6 +265,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript |
|
|
|
this.setBorder(UITitledBorder.createBorderWithTitle(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template_Other"))); |
|
|
|
this.setBorder(UITitledBorder.createBorderWithTitle(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template_Other"))); |
|
|
|
|
|
|
|
|
|
|
|
editorPane = new UITableEditorPane<>(new ExportJSTableModel()); |
|
|
|
editorPane = new UITableEditorPane<>(new ExportJSTableModel()); |
|
|
|
|
|
|
|
editorPane.setHeaderResizing(false); |
|
|
|
|
|
|
|
|
|
|
|
this.add(editorPane, BorderLayout.CENTER); |
|
|
|
this.add(editorPane, BorderLayout.CENTER); |
|
|
|
} |
|
|
|
} |
|
|
@ -221,6 +273,12 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript |
|
|
|
public void reset() { |
|
|
|
public void reset() { |
|
|
|
editorPane.populate(new SingleJavaScript[0]); |
|
|
|
editorPane.populate(new SingleJavaScript[0]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public void updateExportJavaScript(ExportJavaScript exportJavaScript){ |
|
|
|
|
|
|
|
List<SingleJavaScript> javaScripts = editorPane.update(); |
|
|
|
|
|
|
|
for (SingleJavaScript js : javaScripts) { |
|
|
|
|
|
|
|
exportJavaScript.addOtherTemplateJS(js); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected String title4PopupWindow() { |
|
|
|
protected String title4PopupWindow() { |
|
|
@ -433,7 +491,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { |
|
|
|
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { |
|
|
|
exportTypeComboBox.setSelectedItem(value); |
|
|
|
exportTypeComboBox.setSelectedItem(getList().get(row).getExportType()); |
|
|
|
return exportTypeComboBox; |
|
|
|
return exportTypeComboBox; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -489,7 +547,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { |
|
|
|
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { |
|
|
|
fileNameComboBox.setSelectedItem(value); |
|
|
|
fileNameComboBox.setSelectedItem(getList().get(row).isDefaultFileName() ? DEFAULT : CUSTOM); |
|
|
|
return fileNameComboBox; |
|
|
|
return fileNameComboBox; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -588,7 +646,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { |
|
|
|
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { |
|
|
|
parameterSetting.setSelectedItem(value); |
|
|
|
parameterSetting.setSelectedItem(getList().get(row).isExtendParameters() ? DEFAULT : CUSTOM); |
|
|
|
return parameterSetting; |
|
|
|
return parameterSetting; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -729,17 +787,6 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript |
|
|
|
this.add(totalPanel); |
|
|
|
this.add(totalPanel); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private JPanel initExportTypePane() { |
|
|
|
|
|
|
|
UILabel typeLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Type") + ":"); |
|
|
|
|
|
|
|
exportTypeComboBox = getComboBoxWithModel(new String[]{ExportJavaScript.EXPORT_PDF, ExportJavaScript.EXPORT_EXCEL_PAGE, ExportJavaScript.EXPORT_EXCEL_SIMPLE, ExportJavaScript.EXPORT_EXCEL_SHEET, ExportJavaScript.EXPORT_WORD, ExportJavaScript.EXPORT_IMAGE} |
|
|
|
|
|
|
|
, EXPORT_TYPES_MAP); |
|
|
|
|
|
|
|
Component[][] components = new Component[][]{{typeLabel, exportTypeComboBox}}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JPanel exportTypePane = TableLayoutHelper.createTableLayoutPane(components, new double[]{p}, new double[]{p, p}); |
|
|
|
|
|
|
|
exportTypePane.setBorder(BorderFactory.createEmptyBorder(5, 2, 5, 2)); |
|
|
|
|
|
|
|
return exportTypePane; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private JPanel initChooseTemplatePane() { |
|
|
|
private JPanel initChooseTemplatePane() { |
|
|
|
UILabel templateLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template") + ":"); |
|
|
|
UILabel templateLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template") + ":"); |
|
|
|
templateRadioGroup = new ExportRadioGroup(); |
|
|
|
templateRadioGroup = new ExportRadioGroup(); |
|
|
@ -780,30 +827,10 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript |
|
|
|
otherTemplatePane.reset(); |
|
|
|
otherTemplatePane.reset(); |
|
|
|
} |
|
|
|
} |
|
|
|
this.templateRadioGroup.selectIndexButton(ob.isCurrentTemplate() ? 0 : 1); |
|
|
|
this.templateRadioGroup.selectIndexButton(ob.isCurrentTemplate() ? 0 : 1); |
|
|
|
if (ob.isCurrentTemplate()) { |
|
|
|
currentTemplatePane.populateSingleJavaScript(ob.getCurrentTemplateJavaScript()); |
|
|
|
SingleJavaScript js = ob.getJavaScript(); |
|
|
|
|
|
|
|
exportTypeComboBox.setSelectedItem(js.getExportType()); |
|
|
|
OtherTemplatePane pane = (OtherTemplatePane) this.templatePanel.getComponent(1); |
|
|
|
currentTemplatePane.fileNameRadioGroup.selectIndexButton(js.isDefaultFileName() ? 0 : 1); |
|
|
|
pane.editorPane.populate(ob.getJsListForOtherTemplates().toArray(new SingleJavaScript[ob.getJsListForOtherTemplates().size()])); |
|
|
|
if (!js.isDefaultFileName()) { |
|
|
|
|
|
|
|
currentTemplatePane.fileNameFormulaEditor.setEnabled(true); |
|
|
|
|
|
|
|
currentTemplatePane.fileNameFormulaEditor.setVisible(true); |
|
|
|
|
|
|
|
currentTemplatePane.fileNameFormulaEditor.setValue(BaseFormula.createFormulaBuilder().build(js.getFileName())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (js.isExtendParameters()) { |
|
|
|
|
|
|
|
currentTemplatePane.extendParametersCheckBox.setSelected(true); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
currentTemplatePane.extendParametersCheckBox.setSelected(false); |
|
|
|
|
|
|
|
if (this.parameterViewPane != null) { |
|
|
|
|
|
|
|
List<ParameterProvider> parameterList = this.parameterViewPane.update(); |
|
|
|
|
|
|
|
parameterList.clear(); |
|
|
|
|
|
|
|
ParameterProvider[] parameters = js.getParameters(); |
|
|
|
|
|
|
|
this.parameterViewPane.populate(parameters); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
OtherTemplatePane pane = (OtherTemplatePane) this.templatePanel.getComponent(1); |
|
|
|
|
|
|
|
pane.editorPane.populate(ob.getJsList().toArray(new SingleJavaScript[ob.getJsList().size()])); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -817,33 +844,12 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript |
|
|
|
public void updateBean(ExportJavaScript exportJavaScript) { |
|
|
|
public void updateBean(ExportJavaScript exportJavaScript) { |
|
|
|
boolean selected = currentTemplateRadio.isSelected(); |
|
|
|
boolean selected = currentTemplateRadio.isSelected(); |
|
|
|
exportJavaScript.setCurrentTemplate(selected); |
|
|
|
exportJavaScript.setCurrentTemplate(selected); |
|
|
|
if (selected) { |
|
|
|
SingleJavaScript js = new SingleJavaScript(); |
|
|
|
SingleJavaScript js = new SingleJavaScript(); |
|
|
|
js.setCurrentTemplate(selected); |
|
|
|
js.setCurrentTemplate(true); |
|
|
|
currentTemplatePane.updateSingleJavaScript(js); |
|
|
|
js.setTemplatePath(DEFAULT); |
|
|
|
exportJavaScript.addCurrentTemplateJS(js); |
|
|
|
js.setExportType(GeneralUtils.objectToString(exportTypeComboBox.getSelectedItem())); |
|
|
|
|
|
|
|
js.setDefaultFileName(currentTemplatePane.defaultNameRadio.isSelected()); |
|
|
|
otherTemplatePane.updateExportJavaScript(exportJavaScript); |
|
|
|
js.setFileName(getFileName()); |
|
|
|
|
|
|
|
js.setExtendParameters(currentTemplatePane.extendParametersCheckBox.isSelected()); |
|
|
|
|
|
|
|
if (currentTemplatePane.extendParametersCheckBox.isSelected()) { |
|
|
|
|
|
|
|
exportJavaScript.setParameters(null); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
if (parameterViewPane != null) { |
|
|
|
|
|
|
|
List<ParameterProvider> parameterList = parameterViewPane.update(); |
|
|
|
|
|
|
|
if (!parameterList.isEmpty()) { |
|
|
|
|
|
|
|
Parameter[] parameters = new Parameter[parameterList.size()]; |
|
|
|
|
|
|
|
parameterList.toArray(parameters); |
|
|
|
|
|
|
|
js.setParameters(parameters); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
exportJavaScript.addJS(js); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
List<SingleJavaScript> javaScripts = otherTemplatePane.editorPane.update(); |
|
|
|
|
|
|
|
for (SingleJavaScript js : javaScripts) { |
|
|
|
|
|
|
|
exportJavaScript.addJS(js); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private String getFileName() { |
|
|
|
private String getFileName() { |
|
|
|