|
|
@ -1,9 +1,10 @@ |
|
|
|
package com.fr.design.javascript; |
|
|
|
package com.fr.design.javascript; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.fine.theme.utils.FineUIScale; |
|
|
|
import com.fr.base.BaseFormula; |
|
|
|
import com.fr.base.BaseFormula; |
|
|
|
import com.fr.base.Parameter; |
|
|
|
import com.fr.base.Parameter; |
|
|
|
import com.fr.base.extension.FileExtension; |
|
|
|
import com.fr.base.extension.FileExtension; |
|
|
|
import com.fr.design.border.UITitledBorder; |
|
|
|
import com.fr.design.constants.LayoutConstants; |
|
|
|
import com.fr.design.dialog.BasicDialog; |
|
|
|
import com.fr.design.dialog.BasicDialog; |
|
|
|
import com.fr.design.dialog.BasicPane; |
|
|
|
import com.fr.design.dialog.BasicPane; |
|
|
|
import com.fr.design.dialog.DialogActionAdapter; |
|
|
|
import com.fr.design.dialog.DialogActionAdapter; |
|
|
@ -35,9 +36,12 @@ import com.fr.js.SingleJavaScript; |
|
|
|
import com.fr.stable.ParameterProvider; |
|
|
|
import com.fr.stable.ParameterProvider; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.awt.BorderLayout; |
|
|
|
|
|
|
|
import java.awt.Dimension; |
|
|
|
|
|
|
|
import java.awt.CardLayout; |
|
|
|
|
|
|
|
import java.awt.Component; |
|
|
|
import javax.swing.AbstractButton; |
|
|
|
import javax.swing.AbstractButton; |
|
|
|
import javax.swing.AbstractCellEditor; |
|
|
|
import javax.swing.AbstractCellEditor; |
|
|
|
import javax.swing.BorderFactory; |
|
|
|
|
|
|
|
import javax.swing.ButtonGroup; |
|
|
|
import javax.swing.ButtonGroup; |
|
|
|
import javax.swing.DefaultComboBoxModel; |
|
|
|
import javax.swing.DefaultComboBoxModel; |
|
|
|
import javax.swing.JList; |
|
|
|
import javax.swing.JList; |
|
|
@ -51,9 +55,6 @@ import javax.swing.event.TableModelEvent; |
|
|
|
import javax.swing.event.TableModelListener; |
|
|
|
import javax.swing.event.TableModelListener; |
|
|
|
import javax.swing.table.TableCellEditor; |
|
|
|
import javax.swing.table.TableCellEditor; |
|
|
|
import javax.swing.table.TableCellRenderer; |
|
|
|
import javax.swing.table.TableCellRenderer; |
|
|
|
import java.awt.BorderLayout; |
|
|
|
|
|
|
|
import java.awt.CardLayout; |
|
|
|
|
|
|
|
import java.awt.Component; |
|
|
|
|
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
import java.awt.event.ActionListener; |
|
|
|
import java.awt.event.ActionListener; |
|
|
|
import java.awt.event.ItemEvent; |
|
|
|
import java.awt.event.ItemEvent; |
|
|
@ -67,6 +68,12 @@ import java.util.HashSet; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import static com.fine.swing.ui.layout.Layouts.cell; |
|
|
|
|
|
|
|
import static com.fine.swing.ui.layout.Layouts.column; |
|
|
|
|
|
|
|
import static com.fine.swing.ui.layout.Layouts.row; |
|
|
|
|
|
|
|
import static com.fine.swing.ui.layout.Layouts.flex; |
|
|
|
|
|
|
|
import static com.fine.theme.utils.FineUIUtils.wrapComponentWithTitle; |
|
|
|
|
|
|
|
|
|
|
|
public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript> { |
|
|
|
public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript> { |
|
|
|
|
|
|
|
|
|
|
|
private ExportRadioGroup templateRadioGroup; |
|
|
|
private ExportRadioGroup templateRadioGroup; |
|
|
@ -114,31 +121,22 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript |
|
|
|
|
|
|
|
|
|
|
|
public CurrentTemplatePane() { |
|
|
|
public CurrentTemplatePane() { |
|
|
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
|
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
|
|
this.setBorder(UITitledBorder.createBorderWithTitle(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template_Current"))); |
|
|
|
this.add(column(LayoutConstants.VERTICAL_GAP, |
|
|
|
|
|
|
|
|
|
|
|
JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
|
|
|
|
//导出方式
|
|
|
|
//导出方式
|
|
|
|
JPanel exportTypePane = initExportTypePane(); |
|
|
|
cell(initExportTypePane()), |
|
|
|
northPane.add(exportTypePane, BorderLayout.CENTER); |
|
|
|
//命名方式
|
|
|
|
|
|
|
|
cell(initFileNamePane()), |
|
|
|
//导出文件名
|
|
|
|
|
|
|
|
JPanel fileNamePane = initFileNamePane(); |
|
|
|
|
|
|
|
northPane.add(fileNamePane, BorderLayout.SOUTH); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//参数
|
|
|
|
//参数
|
|
|
|
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
cell(initParamsPane()) |
|
|
|
JPanel paramsPane = initParamsPane(); |
|
|
|
).getComponent()); |
|
|
|
centerPane.add(paramsPane); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.add(northPane, BorderLayout.NORTH); |
|
|
|
|
|
|
|
this.add(centerPane, BorderLayout.CENTER); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private JPanel initParamsPane() { |
|
|
|
private JPanel initParamsPane() { |
|
|
|
UILabel parameterLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Parameters_Setting") + ':'); |
|
|
|
UILabel parameterLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Parameters_Setting")); |
|
|
|
extendParametersCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Extend_Parameters")); |
|
|
|
extendParametersCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Extend_Parameters")); |
|
|
|
extendParametersCheckBox.setSelected(true); |
|
|
|
extendParametersCheckBox.setSelected(true); |
|
|
|
parameterViewPane = new ReportletParameterViewPane(getChartParaType(), getValueEditorPane(), getValueEditorPane()); |
|
|
|
parameterViewPane = new ReportletParameterViewPane(getChartParaType(), getValueEditorPane(), getValueEditorPane()); |
|
|
|
|
|
|
|
parameterViewPane.setPreferredSize(FineUIScale.scale(new Dimension(-1, 200))); |
|
|
|
parameterViewPane.setVisible(false); |
|
|
|
parameterViewPane.setVisible(false); |
|
|
|
addListener(parameterViewPane); |
|
|
|
addListener(parameterViewPane); |
|
|
|
extendParametersCheckBox.addItemListener(new ItemListener() { |
|
|
|
extendParametersCheckBox.addItemListener(new ItemListener() { |
|
|
@ -147,19 +145,14 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript |
|
|
|
parameterViewPane.setVisible(e.getStateChange() == ItemEvent.DESELECTED); |
|
|
|
parameterViewPane.setVisible(e.getStateChange() == ItemEvent.DESELECTED); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
JPanel paramsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
return column(LayoutConstants.VERTICAL_GAP, |
|
|
|
Component[][] components = new Component[][]{{parameterLabel, extendParametersCheckBox}}; |
|
|
|
row(cell(parameterLabel).weight(0.1), cell(extendParametersCheckBox).weight(0.2), flex(0.7)), |
|
|
|
JPanel paramsCheckPane = TableLayoutHelper.createTableLayoutPane(components, new double[]{p}, new double[]{p, p}); |
|
|
|
cell(parameterViewPane) |
|
|
|
paramsCheckPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 5, 2)); |
|
|
|
).getComponent(); |
|
|
|
JPanel dynamicPaneWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
|
|
|
|
dynamicPaneWrapper.add(parameterViewPane); |
|
|
|
|
|
|
|
paramsPane.add(paramsCheckPane, BorderLayout.NORTH); |
|
|
|
|
|
|
|
paramsPane.add(dynamicPaneWrapper, BorderLayout.CENTER); |
|
|
|
|
|
|
|
return paramsPane; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private JPanel initFileNamePane() { |
|
|
|
private JPanel initFileNamePane() { |
|
|
|
UILabel nameLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Filename") + ":"); |
|
|
|
UILabel nameLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Filename")); |
|
|
|
fileNameRadioGroup = new ExportRadioGroup(); |
|
|
|
fileNameRadioGroup = new ExportRadioGroup(); |
|
|
|
defaultNameRadio = new UIRadioButton(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Filename_Default")); |
|
|
|
defaultNameRadio = new UIRadioButton(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Filename_Default")); |
|
|
|
defaultNameRadio.setSelected(true); |
|
|
|
defaultNameRadio.setSelected(true); |
|
|
@ -184,18 +177,14 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
Component[][] components = new Component[][]{{nameLabel, defaultNameRadio, customNameRadio, fileNameFormulaEditor}}; |
|
|
|
return column(LayoutConstants.HORIZONTAL_GAP, |
|
|
|
JPanel fileNameRadioPane = TableLayoutHelper.createTableLayoutPane(components, new double[]{p}, new double[]{p, p, p, p}); |
|
|
|
row( |
|
|
|
|
|
|
|
cell(nameLabel).weight(0.1), |
|
|
|
JPanel fileNameTipPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
cell(defaultNameRadio).weight(0.15), |
|
|
|
fileNameTipPane.add(fileNameTipLabel); |
|
|
|
row(LayoutConstants.HGAP_LARGE, cell(customNameRadio), cell(fileNameFormulaEditor)).weight(0.75) |
|
|
|
|
|
|
|
), |
|
|
|
JPanel fileNamePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
cell(fileNameTipLabel) |
|
|
|
fileNamePane.add(fileNameRadioPane, BorderLayout.NORTH); |
|
|
|
).getComponent(); |
|
|
|
fileNamePane.add(fileNameTipPane, BorderLayout.CENTER); |
|
|
|
|
|
|
|
fileNameTipPane.setBorder(BorderFactory.createEmptyBorder(5, 2, 5, 2)); |
|
|
|
|
|
|
|
fileNamePane.setBorder(BorderFactory.createEmptyBorder(5, 2, 5, 2)); |
|
|
|
|
|
|
|
return fileNamePane; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
public void updateSingleJavaScript(SingleJavaScript js){ |
|
|
|
public void updateSingleJavaScript(SingleJavaScript js){ |
|
|
|
js.setTemplatePath(DEFAULT); |
|
|
|
js.setTemplatePath(DEFAULT); |
|
|
@ -241,14 +230,10 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
private JPanel initExportTypePane() { |
|
|
|
private JPanel initExportTypePane() { |
|
|
|
UILabel typeLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Type") + ":"); |
|
|
|
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} |
|
|
|
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); |
|
|
|
, EXPORT_TYPES_MAP); |
|
|
|
Component[][] components = new Component[][]{{typeLabel, exportTypeComboBox}}; |
|
|
|
return row(cell(typeLabel).weight(0.1), cell(exportTypeComboBox).weight(0.5), flex(0.4)).getComponent(); |
|
|
|
|
|
|
|
|
|
|
|
JPanel exportTypePane = TableLayoutHelper.createTableLayoutPane(components, new double[]{p}, new double[]{p, p}); |
|
|
|
|
|
|
|
exportTypePane.setBorder(BorderFactory.createEmptyBorder(5, 2, 5, 2)); |
|
|
|
|
|
|
|
return exportTypePane; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -265,12 +250,10 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript |
|
|
|
|
|
|
|
|
|
|
|
public OtherTemplatePane() { |
|
|
|
public OtherTemplatePane() { |
|
|
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
|
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
|
|
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); |
|
|
|
editorPane.setHeaderResizing(false); |
|
|
|
|
|
|
|
editorPane.setPreferredSize(FineUIScale.scale(new Dimension(-1,300))); |
|
|
|
this.add(editorPane, BorderLayout.CENTER); |
|
|
|
this.add(wrapComponentWithTitle(editorPane, Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template_Other"))); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void reset() { |
|
|
|
public void reset() { |
|
|
@ -769,14 +752,6 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void initComponents() { |
|
|
|
private void initComponents() { |
|
|
|
JPanel totalPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
|
|
|
|
totalPanel.setBorder(UITitledBorder.createBorderWithTitle(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Setting"))); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 导出模板
|
|
|
|
|
|
|
|
JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
|
|
|
|
JPanel chooseTemplatePane = initChooseTemplatePane(); |
|
|
|
|
|
|
|
northPane.add(chooseTemplatePane, BorderLayout.NORTH); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 默认当前模板
|
|
|
|
// 默认当前模板
|
|
|
|
currentTemplatePane = new CurrentTemplatePane(); |
|
|
|
currentTemplatePane = new CurrentTemplatePane(); |
|
|
|
otherTemplatePane = new OtherTemplatePane(); |
|
|
|
otherTemplatePane = new OtherTemplatePane(); |
|
|
@ -785,16 +760,18 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript |
|
|
|
templatePanel.setLayout(card); |
|
|
|
templatePanel.setLayout(card); |
|
|
|
templatePanel.add(CURRENT_TEMPLATE, currentTemplatePane); |
|
|
|
templatePanel.add(CURRENT_TEMPLATE, currentTemplatePane); |
|
|
|
templatePanel.add(OTHER_TEMPLATE, otherTemplatePane); |
|
|
|
templatePanel.add(OTHER_TEMPLATE, otherTemplatePane); |
|
|
|
|
|
|
|
|
|
|
|
totalPanel.add(northPane, BorderLayout.NORTH); |
|
|
|
|
|
|
|
totalPanel.add(templatePanel, BorderLayout.CENTER); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
|
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
|
|
this.add(totalPanel); |
|
|
|
JPanel exportPanel = new JPanel(new BorderLayout()); |
|
|
|
|
|
|
|
exportPanel.add(column(LayoutConstants.VERTICAL_GAP, cell(initChooseTemplatePane()), cell(templatePanel)).getComponent()); |
|
|
|
|
|
|
|
this.add(wrapComponentWithTitle(exportPanel, Toolkit.i18nText("Fine-Design_Basic_Export_JS_Setting")), BorderLayout.CENTER); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 导出模板 |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
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(); |
|
|
|
currentTemplateRadio = new UIRadioButton(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template_Current")); |
|
|
|
currentTemplateRadio = new UIRadioButton(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template_Current")); |
|
|
|
currentTemplateRadio.setSelected(true); |
|
|
|
currentTemplateRadio.setSelected(true); |
|
|
@ -816,14 +793,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
Component[][] components = new Component[][]{{templateLabel, currentTemplateRadio, otherTemplateRadio}}; |
|
|
|
return row(cell(templateLabel).weight(0.1), cell(currentTemplateRadio).weight(0.15), cell(otherTemplateRadio).weight(0.15), flex(0.6)).getComponent(); |
|
|
|
JPanel reportletRadioPane = TableLayoutHelper.createTableLayoutPane(components, new double[]{p}, new double[]{p, p, p}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JPanel chooseTemplatePane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); |
|
|
|
|
|
|
|
chooseTemplatePane.add(reportletRadioPane, BorderLayout.NORTH); |
|
|
|
|
|
|
|
chooseTemplatePane.setBorder(BorderFactory.createEmptyBorder(0, 7, 5, 2)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return chooseTemplatePane; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|