|
|
|
@ -72,7 +72,6 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
|
|
|
|
|
private ExportRadioGroup templateRadioGroup; |
|
|
|
|
private UIRadioButton currentTemplateRadio; |
|
|
|
|
private UIRadioButton otherTemplateRadio; |
|
|
|
|
private UIComboBox exportTypeComboBox; |
|
|
|
|
private CardLayout card; |
|
|
|
|
private JPanel templatePanel; |
|
|
|
|
private CurrentTemplatePane currentTemplatePane; |
|
|
|
@ -110,6 +109,8 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
|
|
|
|
|
private FormulaEditor fileNameFormulaEditor; |
|
|
|
|
private UICheckBox extendParametersCheckBox; |
|
|
|
|
private ReportletParameterViewPane parameterViewPane; |
|
|
|
|
private UIComboBox exportTypeComboBox; |
|
|
|
|
private UILabel fileNameTipLabel; |
|
|
|
|
|
|
|
|
|
public CurrentTemplatePane() { |
|
|
|
|
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.setVisible(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); |
|
|
|
|
fileNameRadioGroup.addActionListener(new ActionListener() { |
|
|
|
|
@Override |
|
|
|
@ -196,6 +197,56 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
|
|
|
|
|
fileNamePane.setBorder(BorderFactory.createEmptyBorder(5, 2, 5, 2)); |
|
|
|
|
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 |
|
|
|
|
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"))); |
|
|
|
|
|
|
|
|
|
editorPane = new UITableEditorPane<>(new ExportJSTableModel()); |
|
|
|
|
editorPane.setHeaderResizing(false); |
|
|
|
|
|
|
|
|
|
this.add(editorPane, BorderLayout.CENTER); |
|
|
|
|
} |
|
|
|
@ -221,6 +273,12 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
|
|
|
|
|
public void reset() { |
|
|
|
|
editorPane.populate(new SingleJavaScript[0]); |
|
|
|
|
} |
|
|
|
|
public void updateExportJavaScript(ExportJavaScript exportJavaScript){ |
|
|
|
|
List<SingleJavaScript> javaScripts = editorPane.update(); |
|
|
|
|
for (SingleJavaScript js : javaScripts) { |
|
|
|
|
exportJavaScript.addOtherTemplateJS(js); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected String title4PopupWindow() { |
|
|
|
@ -433,7 +491,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { |
|
|
|
|
exportTypeComboBox.setSelectedItem(value); |
|
|
|
|
exportTypeComboBox.setSelectedItem(getList().get(row).getExportType()); |
|
|
|
|
return exportTypeComboBox; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -489,7 +547,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
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; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -588,7 +646,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
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; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -729,17 +787,6 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
|
|
|
|
|
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() { |
|
|
|
|
UILabel templateLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template") + ":"); |
|
|
|
|
templateRadioGroup = new ExportRadioGroup(); |
|
|
|
@ -780,30 +827,10 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
|
|
|
|
|
otherTemplatePane.reset(); |
|
|
|
|
} |
|
|
|
|
this.templateRadioGroup.selectIndexButton(ob.isCurrentTemplate() ? 0 : 1); |
|
|
|
|
if (ob.isCurrentTemplate()) { |
|
|
|
|
SingleJavaScript js = ob.getJavaScript(); |
|
|
|
|
exportTypeComboBox.setSelectedItem(js.getExportType()); |
|
|
|
|
currentTemplatePane.fileNameRadioGroup.selectIndexButton(js.isDefaultFileName() ? 0 : 1); |
|
|
|
|
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()])); |
|
|
|
|
} |
|
|
|
|
currentTemplatePane.populateSingleJavaScript(ob.getCurrentTemplateJavaScript()); |
|
|
|
|
|
|
|
|
|
OtherTemplatePane pane = (OtherTemplatePane) this.templatePanel.getComponent(1); |
|
|
|
|
pane.editorPane.populate(ob.getJsListForOtherTemplates().toArray(new SingleJavaScript[ob.getJsListForOtherTemplates().size()])); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -817,33 +844,12 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
|
|
|
|
|
public void updateBean(ExportJavaScript exportJavaScript) { |
|
|
|
|
boolean selected = currentTemplateRadio.isSelected(); |
|
|
|
|
exportJavaScript.setCurrentTemplate(selected); |
|
|
|
|
if (selected) { |
|
|
|
|
SingleJavaScript js = new SingleJavaScript(); |
|
|
|
|
js.setCurrentTemplate(true); |
|
|
|
|
js.setTemplatePath(DEFAULT); |
|
|
|
|
js.setExportType(GeneralUtils.objectToString(exportTypeComboBox.getSelectedItem())); |
|
|
|
|
js.setDefaultFileName(currentTemplatePane.defaultNameRadio.isSelected()); |
|
|
|
|
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); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
SingleJavaScript js = new SingleJavaScript(); |
|
|
|
|
js.setCurrentTemplate(selected); |
|
|
|
|
currentTemplatePane.updateSingleJavaScript(js); |
|
|
|
|
exportJavaScript.addCurrentTemplateJS(js); |
|
|
|
|
|
|
|
|
|
otherTemplatePane.updateExportJavaScript(exportJavaScript); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private String getFileName() { |
|
|
|
|