|
|
|
@ -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,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
|
|
|
|
|
private FormulaEditor fileNameFormulaEditor; |
|
|
|
|
private UICheckBox extendParametersCheckBox; |
|
|
|
|
private ReportletParameterViewPane parameterViewPane; |
|
|
|
|
private UIComboBox exportTypeComboBox; |
|
|
|
|
|
|
|
|
|
public CurrentTemplatePane() { |
|
|
|
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
|
|
@ -196,6 +196,55 @@ 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); |
|
|
|
|
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() { |
|
|
|
@ -221,6 +270,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() { |
|
|
|
@ -729,17 +784,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 +824,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 +841,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() { |
|
|
|
|