Browse Source

Merge branch 'release/11.0' of https://code.fineres.com/scm/~henry.wang/design into release/11.0

bugfix/11.0
Henry.Wang 3 years ago
parent
commit
71fa1c8dc0
  1. 16
      designer-base/src/main/java/com/fr/design/gui/icombobox/ColorSchemeComboBox.java
  2. 828
      designer-base/src/main/java/com/fr/design/javascript/ExportJavaScriptPane.java
  3. 9
      designer-base/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditContext.java
  4. 0
      designer-base/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditMode.java
  5. 6
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java
  6. 15
      designer-base/src/main/java/com/fr/design/mainframe/toast/DesignerToastMsgUtil.java
  7. 6
      designer-base/src/main/java/com/fr/design/mainframe/toast/ToastMsgDialog.java
  8. 20
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ColorSelectBoxWithThemeStyle.java
  9. 5
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLabelContentPane.java
  10. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java
  11. 6
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java
  12. 14
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java
  13. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java
  14. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAreaBackgroundPane.java
  15. 5
      designer-chart/src/main/java/com/fr/van/chart/designer/style/datasheet/VanChartDataSheetPane.java
  16. 4
      designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterLabelContentPane.java
  17. 50
      designer-form/src/main/java/com/fr/design/mainframe/share/util/InstallComponentHelper.java
  18. 58
      designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java

16
designer-base/src/main/java/com/fr/design/gui/icombobox/ColorSchemeComboBox.java

@ -8,17 +8,12 @@ import com.fr.cert.token.lang.Collections;
import com.fr.chart.base.ChartConstants; import com.fr.chart.base.ChartConstants;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import javax.swing.DefaultComboBoxModel; import javax.swing.DefaultComboBoxModel;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JList; import javax.swing.JList;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
@ -27,6 +22,12 @@ import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.LinearGradientPaint; import java.awt.LinearGradientPaint;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
/** /**
* @author Bjorn * @author Bjorn
@ -69,6 +70,7 @@ public class ColorSchemeComboBox extends UIComboBox {
Iterator names = config.names(); Iterator names = config.names();
if (preDefined) { if (preDefined) {
if (ChartEditContext.supportTheme()) {
ColorInfo colorInfo = new ColorInfo(); ColorInfo colorInfo = new ColorInfo();
List<Color> list = new ArrayList<>(); List<Color> list = new ArrayList<>();
colorInfo.setColors(list); colorInfo.setColors(list);
@ -83,7 +85,7 @@ public class ColorSchemeComboBox extends UIComboBox {
list.add(themedChartSeriesColor.getEndColor()); list.add(themedChartSeriesColor.getEndColor());
} }
colorSchemes.put(Toolkit.i18nText("Fine-Design_Chart_Follow_Theme"), colorInfo); colorSchemes.put(Toolkit.i18nText("Fine-Design_Chart_Follow_Theme"), colorInfo);
}
} else { } else {
//添加默认的方案和第一个方案 //添加默认的方案和第一个方案
String defaultName = config.getCurrentStyle(); String defaultName = config.getCurrentStyle();

828
designer-base/src/main/java/com/fr/design/javascript/ExportJavaScriptPane.java

@ -3,6 +3,7 @@ package com.fr.design.javascript;
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.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;
@ -15,6 +16,10 @@ import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIComboBoxRenderer; import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itableeditorpane.ParameterTableModel;
import com.fr.design.gui.itableeditorpane.UITableEditAction;
import com.fr.design.gui.itableeditorpane.UITableEditorPane;
import com.fr.design.gui.itableeditorpane.UITableModelAdapter;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.gui.itree.filetree.TemplateFileTree; import com.fr.design.gui.itree.filetree.TemplateFileTree;
import com.fr.design.hyperlink.AbstractHyperLinkPane; import com.fr.design.hyperlink.AbstractHyperLinkPane;
@ -23,32 +28,40 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.scrollruler.ModLineBorder;
import com.fr.file.filetree.IOFileNodeFilter; import com.fr.file.filetree.IOFileNodeFilter;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.js.ExportJavaScript; import com.fr.js.ExportJavaScript;
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 javax.swing.AbstractButton; import javax.swing.AbstractButton;
import javax.swing.AbstractCellEditor;
import javax.swing.BorderFactory; 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;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.event.CellEditorListener;
import javax.swing.event.ChangeEvent;
import javax.swing.event.TableModelEvent; import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener; import javax.swing.event.TableModelListener;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.CardLayout; import java.awt.CardLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension;
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;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
@ -59,21 +72,20 @@ 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 UITextField reportPathTextField; private CardLayout card;
private UIButton browserButton; private JPanel templatePanel;
private UIComboBox exportTypeComboBox; private CurrentTemplatePane currentTemplatePane;
private ExportRadioGroup fileNameRadioGroup; private OtherTemplatePane otherTemplatePane;
private UIRadioButton defaultNameRadio;
private UIRadioButton customNameRadio;
private FormulaEditor fileNameFormulaEditor;
private UICheckBox extendParametersCheckBox;
private ReportletParameterViewPane parameterViewPane;
private static final double p = TableLayout.PREFERRED; private static final double p = TableLayout.PREFERRED;
private static final Map<String, String> EXPORT_TYPES_MAP = new HashMap<>(); private static final Map<String, String> EXPORT_TYPES_MAP = new HashMap<>();
private static final String CURRENT_TEMPLATE = "current"; private static final Map<String, String> FILENAME_TYPE_MAP = new HashMap<>();
private static final String DEFAULT_FILENAME = "default"; private static final Map<String, String> PARAMETER_TYPE_MAP = new HashMap<>();
private static final String DEFAULT = "default";
private static final String CUSTOM = "custom";
private static final String CURRENT_TEMPLATE = "cur";
private static final String OTHER_TEMPLATE = "other";
private static final UILabel EMPTY_LABEL = new UILabel();
static { static {
EXPORT_TYPES_MAP.put(ExportJavaScript.EXPORT_PDF, Toolkit.i18nText("Fine-Design_Basic_Export_JS_PDF")); EXPORT_TYPES_MAP.put(ExportJavaScript.EXPORT_PDF, Toolkit.i18nText("Fine-Design_Basic_Export_JS_PDF"));
@ -82,23 +94,29 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
EXPORT_TYPES_MAP.put(ExportJavaScript.EXPORT_EXCEL_SHEET, Toolkit.i18nText("Fine-Design_Basic_Export_JS_Excel_Sheet")); EXPORT_TYPES_MAP.put(ExportJavaScript.EXPORT_EXCEL_SHEET, Toolkit.i18nText("Fine-Design_Basic_Export_JS_Excel_Sheet"));
EXPORT_TYPES_MAP.put(ExportJavaScript.EXPORT_WORD, Toolkit.i18nText("Fine-Design_Basic_Export_JS_Word")); EXPORT_TYPES_MAP.put(ExportJavaScript.EXPORT_WORD, Toolkit.i18nText("Fine-Design_Basic_Export_JS_Word"));
EXPORT_TYPES_MAP.put(ExportJavaScript.EXPORT_IMAGE, Toolkit.i18nText("Fine-Design_Basic_Export_JS_Image")); EXPORT_TYPES_MAP.put(ExportJavaScript.EXPORT_IMAGE, Toolkit.i18nText("Fine-Design_Basic_Export_JS_Image"));
FILENAME_TYPE_MAP.put(DEFAULT, Toolkit.i18nText("Fine-Design_Basic_Export_JS_Filename_Default"));
FILENAME_TYPE_MAP.put(CUSTOM, Toolkit.i18nText("Fine-Design_Basic_Export_JS_Custom"));
PARAMETER_TYPE_MAP.put(DEFAULT, Toolkit.i18nText("Fine-Design_Basic_Export_JS_Extend_Parameters"));
PARAMETER_TYPE_MAP.put(CUSTOM, Toolkit.i18nText("Fine-Design_Basic_Export_JS_Custom"));
} }
public ExportJavaScriptPane() { // 当前模板
initComponents(); class CurrentTemplatePane extends BasicPane {
}
private void initComponents() { private ExportRadioGroup fileNameRadioGroup;
private UIRadioButton defaultNameRadio;
private UIRadioButton customNameRadio;
private FormulaEditor fileNameFormulaEditor;
private UICheckBox extendParametersCheckBox;
private ReportletParameterViewPane parameterViewPane;
private UIComboBox exportTypeComboBox;
private UILabel fileNameTipLabel;
public CurrentTemplatePane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createTitledBorder(new ModLineBorder(ModLineBorder.TOP), Toolkit.i18nText("Fine-Design_Basic_Export_JS_Setting"))); this.setBorder(UITitledBorder.createBorderWithTitle(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template_Current")));
//导出模板+导出方式+导出文件名
JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
//导出模板
JPanel chooseTemplatePane = initChooseTemplatePane();
northPane.add(chooseTemplatePane, BorderLayout.NORTH);
//导出方式 //导出方式
JPanel exportTypePane = initExportTypePane(); JPanel exportTypePane = initExportTypePane();
northPane.add(exportTypePane, BorderLayout.CENTER); northPane.add(exportTypePane, BorderLayout.CENTER);
@ -117,27 +135,12 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
} }
private JPanel initParamsPane() { private JPanel initParamsPane() {
extendParametersCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Extends_Report_Parameters")); 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.setSelected(true); extendParametersCheckBox.setSelected(true);
parameterViewPane = new ReportletParameterViewPane(getChartParaType(), getValueEditorPane(), getValueEditorPane()); parameterViewPane = new ReportletParameterViewPane(getChartParaType(), getValueEditorPane(), getValueEditorPane());
parameterViewPane.setVisible(false); parameterViewPane.setVisible(false);
parameterViewPane.addTableEditorListener(new TableModelListener() { addListener(parameterViewPane);
public void tableChanged(TableModelEvent e) {
List<ParameterProvider> list = parameterViewPane.update();
HashSet<String> tempSet = new HashSet<>();
for (int i = 0; i < list.size(); i++) {
if (StringUtils.isEmpty(list.get(i).getName())) {
continue;
}
if (tempSet.contains(list.get(i).toString())) {
list.remove(i);
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameter_Duplicate_Name") + "!");
return;
}
tempSet.add(list.get(i).toString());
}
}
});
extendParametersCheckBox.addItemListener(new ItemListener() { extendParametersCheckBox.addItemListener(new ItemListener() {
@Override @Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
@ -145,10 +148,12 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
} }
}); });
JPanel paramsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel paramsPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
paramsPane.setBorder(BorderFactory.createTitledBorder(new ModLineBorder(ModLineBorder.TOP), Toolkit.i18nText("Fine-Design_Basic_Parameters"))); Component[][] components = new Component[][]{{parameterLabel, extendParametersCheckBox}};
paramsPane.add(extendParametersCheckBox, BorderLayout.NORTH); JPanel paramsCheckPane = TableLayoutHelper.createTableLayoutPane(components, new double[]{p}, new double[]{p, p});
paramsCheckPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 5, 2));
JPanel dynamicPaneWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel dynamicPaneWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane();
dynamicPaneWrapper.add(parameterViewPane); dynamicPaneWrapper.add(parameterViewPane);
paramsPane.add(paramsCheckPane, BorderLayout.NORTH);
paramsPane.add(dynamicPaneWrapper, BorderLayout.CENTER); paramsPane.add(dynamicPaneWrapper, BorderLayout.CENTER);
return paramsPane; return paramsPane;
} }
@ -158,17 +163,24 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
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);
customNameRadio = new UIRadioButton(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Filename_Custom")); customNameRadio = new UIRadioButton(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Custom"));
addRadioToGroup(fileNameRadioGroup, defaultNameRadio, customNameRadio); addRadioToGroup(fileNameRadioGroup, defaultNameRadio, customNameRadio);
fileNameFormulaEditor = new FormulaEditor(Toolkit.i18nText("Fine-Design_Report_Parameter_Formula")); fileNameFormulaEditor = new FormulaEditor(Toolkit.i18nText("Fine-Design_Report_Parameter_Formula"));
fileNameFormulaEditor.setVisible(false);
fileNameFormulaEditor.setEnabled(false); fileNameFormulaEditor.setEnabled(false);
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() { fileNameRadioGroup.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (defaultNameRadio.isSelected()) { if (defaultNameRadio.isSelected()) {
fileNameFormulaEditor.setVisible(false);
fileNameFormulaEditor.setEnabled(false); fileNameFormulaEditor.setEnabled(false);
fileNameTipLabel.setVisible(false);
} else { } else {
fileNameFormulaEditor.setVisible(true);
fileNameFormulaEditor.setEnabled(true); fileNameFormulaEditor.setEnabled(true);
fileNameTipLabel.setVisible(true);
} }
} }
}); });
@ -176,74 +188,221 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
JPanel fileNameRadioPane = TableLayoutHelper.createTableLayoutPane(components, new double[]{p}, new double[]{p, p, p, p}); JPanel fileNameRadioPane = TableLayoutHelper.createTableLayoutPane(components, new double[]{p}, new double[]{p, p, p, p});
JPanel fileNameTipPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel fileNameTipPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
UILabel fileNameTipLabel = new UILabel("<html><body style=\"color:red\">" + Toolkit.i18nText("Fine-Design_Basic_Export_JS_Title_Tip_Front") + "\\/:*?\"<>|" + Toolkit.i18nText("Fine-Design_Basic_Export_JS_Title_Tip_Back") + "</html>");
fileNameTipPane.add(fileNameTipLabel); fileNameTipPane.add(fileNameTipLabel);
JPanel fileNamePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel fileNamePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
fileNamePane.add(fileNameRadioPane, BorderLayout.NORTH); fileNamePane.add(fileNameRadioPane, BorderLayout.NORTH);
fileNamePane.add(fileNameTipPane, BorderLayout.CENTER); fileNamePane.add(fileNameTipPane, BorderLayout.CENTER);
fileNameTipPane.setBorder(BorderFactory.createEmptyBorder(5,2,5,2)); fileNameTipPane.setBorder(BorderFactory.createEmptyBorder(5, 2, 5, 2));
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()));
} else {
fileNameFormulaEditor.setVisible(false);
fileNameFormulaEditor.setValue(BaseFormula.createFormulaBuilder().build());
}
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() { 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 = new UIComboBox(new DefaultComboBoxModel<String>()); 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}
DefaultComboBoxModel<String> comboBoxModel = (DefaultComboBoxModel<String>) exportTypeComboBox.getModel(); , EXPORT_TYPES_MAP);
String[] allExportTypes = new String[]{ExportJavaScript.EXPORT_PDF, ExportJavaScript.EXPORT_EXCEL_PAGE, ExportJavaScript.EXPORT_EXCEL_SIMPLE, ExportJavaScript.EXPORT_EXCEL_SHEET, ExportJavaScript.EXPORT_WORD, ExportJavaScript.EXPORT_IMAGE}; Component[][] components = new Component[][]{{typeLabel, exportTypeComboBox}};
for (int i = 0; i < allExportTypes.length; i++) {
comboBoxModel.addElement(allExportTypes[i]); JPanel exportTypePane = TableLayoutHelper.createTableLayoutPane(components, new double[]{p}, new double[]{p, p});
exportTypePane.setBorder(BorderFactory.createEmptyBorder(5, 2, 5, 2));
return exportTypePane;
} }
this.exportTypeComboBox.setRenderer(new UIComboBoxRenderer() {
@Override @Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { protected String title4PopupWindow() {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); return Toolkit.i18nText("Fine-Design_Basic_Export_JS_Setting");
if (value instanceof String) {
this.setText(EXPORT_TYPES_MAP.get(value));
} }
return this;
}
// 其他模板
class OtherTemplatePane extends BasicPane {
private UITableEditorPane<SingleJavaScript> editorPane;
public OtherTemplatePane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
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);
}
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() {
return Toolkit.i18nText("Fine-Design_Basic_Export_JS_Setting");
}
} }
class ExportJSTableModel extends UITableModelAdapter<SingleJavaScript> {
private static final long serialVersionUID = -3697206557955735642L;
public ExportJSTableModel() {
super(new String[]{
Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template_File"),
Toolkit.i18nText("Fine-Design_Basic_Export_JS_Type"),
Toolkit.i18nText("Fine-Design_Basic_Export_JS_Filename"),
Toolkit.i18nText("Fine-Design_Basic_Export_JS_Filename_Custom"),
Toolkit.i18nText("Fine-Design_Basic_Export_JS_Parameters_Setting"),
StringUtils.EMPTY});
this.setColumnClass(new Class[]{
ExportTemplateChooser.class,
ExportTypeCombobox.class,
FileNameCombobox.class,
FileNameFormulaEditor.class,
ParameterCombobox.class,
ParameterSettingButton.class
}); });
Component[][] components = new Component[][]{{typeLabel, exportTypeComboBox}}; this.setDefaultEditor(ExportTemplateChooser.class, new ExportTemplateChooser());
this.setDefaultRenderer(ExportTemplateChooser.class, new ExportTemplateChooser());
this.setDefaultEditor(ExportTypeCombobox.class, new ExportTypeCombobox());
this.setDefaultEditor(FileNameCombobox.class, new FileNameCombobox());
this.setDefaultEditor(FileNameFormulaEditor.class, new FileNameFormulaEditor());
this.setDefaultEditor(ParameterCombobox.class, new ParameterCombobox());
this.setDefaultEditor(ParameterSettingButton.class, new ParameterSettingButton());
this.setDefaultRenderer(ParameterSettingButton.class, new ParameterSettingButton());
this.createTable().getColumnModel().getColumn(2).setMaxWidth(60);
this.createTable().getColumnModel().getColumn(4).setMaxWidth(60);
this.createTable().getColumnModel().getColumn(5).setMaxWidth(50);
}
@Override
public UITableEditAction[] createAction() {
return new UITableEditAction[]{new AddJSAction(), new DeleteAction()};
}
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
SingleJavaScript js = this.getList().get(rowIndex);
switch (columnIndex) {
case 0:
return js.getTemplatePath();
case 1:
return EXPORT_TYPES_MAP.get(js.getExportType());
case 2:
return js.isDefaultFileName() ? Toolkit.i18nText("Fine-Design_Basic_Export_JS_Filename_Default") : Toolkit.i18nText("Fine-Design_Basic_Export_JS_Custom");
case 3:
return js.getFileName();
case 4:
return js.isExtendParameters() ? Toolkit.i18nText("Fine-Design_Basic_Export_JS_Extend_Parameters") : Toolkit.i18nText("Fine-Design_Basic_Export_JS_Custom");
case 5:
return js.getParameters();
}
return null;
}
@Override
public boolean isCellEditable(int row, int col) {
if (col == 3) {
// 命名详情
return this.getList().get(row) != null && !this.getList().get(row).isDefaultFileName();
}
return true;
}
private class AddJSAction extends AddTableRowAction {
public AddJSAction() {
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();
currentTemplateRadio = new UIRadioButton(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template_Current"));
currentTemplateRadio.setSelected(true);
otherTemplateRadio = new UIRadioButton(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template_Other"));
addRadioToGroup(templateRadioGroup, currentTemplateRadio, otherTemplateRadio);
templateRadioGroup.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (currentTemplateRadio.isSelected()) { super.actionPerformed(e);
browserButton.setEnabled(false); if (otherTemplatePane.editorPane.getTableModel().getList().size() <= 50) {
addJS();
} else { } else {
browserButton.setEnabled(true); FineJOptionPane.showMessageDialog(otherTemplatePane, Toolkit.i18nText("Fine-Design_Basic_Export_JS_Batch_Export_Limit"));
}
} }
} }
});
Component[][] components = new Component[][]{{templateLabel, currentTemplateRadio, otherTemplateRadio}};
JPanel reportletRadioPane = TableLayoutHelper.createTableLayoutPane(components, new double[]{p}, new double[]{p, p, p});
JPanel reportletNamePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); private void addJS() {
SingleJavaScript js = new SingleJavaScript();
addRow(js);
fireTableDataChanged();
table.getSelectionModel().setSelectionInterval(table.getRowCount() - 1, table.getRowCount() - 1);
}
// 导出文件选择
class ExportTemplateChooser extends AbstractCellEditor implements TableCellEditor, TableCellRenderer {
private static final long serialVersionUID = -9112506131272704717L;
private JPanel reportletNamePane;
private UITextField reportPathTextField;
private UIButton browserButton;
public ExportTemplateChooser() {
// 路径输入框 // 路径输入框
reportPathTextField = new UITextField(20); reportPathTextField = new UITextField(8);
reportPathTextField.setEnabled(false); reportPathTextField.setEnabled(false);
reportletNamePane.add(reportPathTextField, BorderLayout.CENTER);
// 选择路径按钮 // 选择路径按钮
browserButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Select")); browserButton = new UIButton("...");
browserButton.setPreferredSize(new Dimension(browserButton.getPreferredSize().width, 20)); browserButton.setVisible(true);
browserButton.setEnabled(false);
reportletNamePane.add(browserButton, BorderLayout.EAST); Component[][] templateChooserComponent = {{reportPathTextField, browserButton}};
double[] rowSize = {TableLayout.PREFERRED};
double[] columnSize = {TableLayout.FILL, 22};
reportletNamePane = TableLayoutHelper.createCommonTableLayoutPane(templateChooserComponent, rowSize, columnSize, 0);
browserButton.addActionListener(new ActionListener() { browserButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
@ -260,11 +419,409 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
reportletDialog.setVisible(true); reportletDialog.setVisible(true);
} }
}); });
this.addCellEditorListener(new CellEditorListener() {
@Override
public void editingCanceled(ChangeEvent e) {
}
@Override
public void editingStopped(ChangeEvent e) {
if (table.getSelectedRow() == -1) {
return;
}
SingleJavaScript js = getList().get(table.getSelectedRow());
String value = StringUtils.trimToNull(reportPathTextField.getText());
js.setTemplatePath(value);
js.setCurrentTemplate(false);
fireTableDataChanged();
}
});
}
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
reportPathTextField.setText((String) value);
return reportletNamePane;
}
@Override
public Object getCellEditorValue() {
return reportPathTextField.getText();
}
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
reportPathTextField.setText((String) value);
return reportletNamePane;
}
}
// 导出方式下拉框
class ExportTypeCombobox extends AbstractCellEditor implements TableCellEditor {
private static final long serialVersionUID = -6564079764032351372L;
private UIComboBox exportTypeComboBox;
public ExportTypeCombobox() {
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);
this.addCellEditorListener(new CellEditorListener() {
@Override
public void editingCanceled(ChangeEvent e) {
}
@Override
public void editingStopped(ChangeEvent e) {
if (table.getSelectedRow() == -1) {
return;
}
SingleJavaScript js = getList().get(table.getSelectedRow());
Object ob = exportTypeComboBox.getSelectedItem();
if (ob != null) {
String value = ob.toString();
js.setExportType(value);
}
fireTableDataChanged();
}
});
}
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
exportTypeComboBox.setSelectedItem(getList().get(row).getExportType());
return exportTypeComboBox;
}
@Override
public Object getCellEditorValue() {
Object ob = exportTypeComboBox.getSelectedItem();
if (ob != null) {
return ob.toString();
}
return ExportJavaScript.EXPORT_PDF;
}
}
// 命名方式下拉框
class FileNameCombobox extends AbstractCellEditor implements TableCellEditor {
private static final long serialVersionUID = 1829005772744444269L;
private UIComboBox fileNameComboBox;
public FileNameCombobox() {
fileNameComboBox = getComboBoxWithModel(new String[]{DEFAULT, CUSTOM}, FILENAME_TYPE_MAP);
fileNameComboBox.addItemListener(e -> {
if (e.getStateChange() == ItemEvent.SELECTED) {
final int row = table.getSelectedRow();
if (row == -1) {
return;
}
SingleJavaScript js = getList().get(row);
Object ob = fileNameComboBox.getSelectedItem();
if (ob != null) {
String value = ob.toString();
js.setDefaultFileName(StringUtils.equals(value, DEFAULT));
if (js.isDefaultFileName()) {
js.setFileName(StringUtils.EMPTY);
}
}
table.repaint();
}
});
this.addCellEditorListener(new CellEditorListener() {
@Override
public void editingCanceled(ChangeEvent e) {
}
@Override
public void editingStopped(ChangeEvent e) {
fireTableDataChanged();
}
});
}
JPanel chooseTemplatePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); @Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
fileNameComboBox.setSelectedItem(getList().get(row).isDefaultFileName() ? DEFAULT : CUSTOM);
return fileNameComboBox;
}
@Override
public Object getCellEditorValue() {
return fileNameComboBox.getSelectedItem().toString();
}
}
// 命名方式公式框
class FileNameFormulaEditor extends AbstractCellEditor implements TableCellEditor {
private static final long serialVersionUID = 7120075192535645493L;
private FormulaEditor fileNameFormulaEditor;
public FileNameFormulaEditor() {
fileNameFormulaEditor = new FormulaEditor(Toolkit.i18nText("Fine-Design_Report_Parameter_Formula"));
this.addCellEditorListener(new CellEditorListener() {
@Override
public void editingCanceled(ChangeEvent e) {
}
@Override
public void editingStopped(ChangeEvent e) {
if (table.getSelectedRow() == -1) {
return;
}
SingleJavaScript js = getList().get(table.getSelectedRow());
String value = fileNameFormulaEditor.getUITextField().getText();
js.setFileName(value);
fireTableDataChanged();
}
});
}
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
if (value != null) {
fileNameFormulaEditor.setValue(BaseFormula.createFormulaBuilder().build(value));
} else {
fileNameFormulaEditor.setValue(BaseFormula.createFormulaBuilder().build());
}
return fileNameFormulaEditor;
}
@Override
public Object getCellEditorValue() {
return fileNameFormulaEditor.getUITextField().getText();
}
public FormulaEditor getFileNameEditor() {
return fileNameFormulaEditor;
}
}
//参数设置下拉框
class ParameterCombobox extends AbstractCellEditor implements TableCellEditor {
private static final long serialVersionUID = 2630964402770993584L;
private UIComboBox parameterSetting;
public ParameterCombobox() {
parameterSetting = getComboBoxWithModel(new String[]{DEFAULT, CUSTOM}, PARAMETER_TYPE_MAP);
parameterSetting.addItemListener(e -> {
if (e.getStateChange() == ItemEvent.SELECTED) {
final int row = table.getSelectedRow();
if (row == -1) {
return;
}
SingleJavaScript js = getList().get(row);
Object ob = parameterSetting.getSelectedItem();
if (ob != null) {
String value = ob.toString();
js.setExtendParameters(StringUtils.equals(value, DEFAULT));
}
// 单纯为了刷新表格,使某些联动生效
table.repaint();
}
});
this.addCellEditorListener(new CellEditorListener() {
@Override
public void editingCanceled(ChangeEvent e) {
}
@Override
public void editingStopped(ChangeEvent e) {
// 这里重新触发是为了触发某些编辑后事件
fireTableDataChanged();
}
});
}
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
parameterSetting.setSelectedItem(getList().get(row).isExtendParameters() ? DEFAULT : CUSTOM);
return parameterSetting;
}
@Override
public Object getCellEditorValue() {
return parameterSetting.getSelectedItem().toString();
}
}
// 参数设置按钮
class ParameterSettingButton extends AbstractCellEditor implements TableCellEditor, TableCellRenderer {
private static final long serialVersionUID = 4021592871993049137L;
private UIButton paraButton;
private ParameterSettingPane paraSettingPane;
ParameterProvider[] parameterArr;
public ParameterSettingButton() {
paraSettingPane = new ParameterSettingPane();
paraButton = new UIButton(Toolkit.i18nText("Fine-Design_Report_Set"));
paraButton.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
BasicDialog dialog = paraSettingPane.showWindow(SwingUtilities.getWindowAncestor(ExportJavaScriptPane.this));
dialog.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
List<ParameterProvider> parameterList = paraSettingPane.getParameterList();
parameterArr = parameterList.toArray(new Parameter[parameterList.size()]);
}
});
dialog.setVisible(true);
}
});
this.addCellEditorListener(new CellEditorListener() {
@Override
public void editingCanceled(ChangeEvent e) {
}
@Override
public void editingStopped(ChangeEvent e) {
if (table.getSelectedRow() == -1) {
return;
}
SingleJavaScript js = getList().get(table.getSelectedRow());
if (parameterArr != null) {
js.setParameters(parameterArr);
}
parameterArr = null;
fireTableDataChanged();
}
});
}
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
if (getList().get(row) == null || getList().get(row).isExtendParameters()) {
return EMPTY_LABEL;
}
ParameterProvider[] providers = (ParameterProvider[]) value;
if (providers != null) {
paraSettingPane.refresh(new ArrayList<>(Arrays.asList(providers)));
}
return paraButton;
}
@Override
public Object getCellEditorValue() {
return paraSettingPane.getParameterList();
}
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
if (getList().get(row) == null || getList().get(row).isExtendParameters()) {
return EMPTY_LABEL;
}
return paraButton;
}
}
// 参数设置弹出框
class ParameterSettingPane extends BasicPane {
private ReportletParameterViewPane parameterViewPane;
public ParameterSettingPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
parameterViewPane = new ReportletParameterViewPane(ParameterTableModel.NO_CHART_USE, getValueEditorPane(), getValueEditorPane());
addListener(parameterViewPane);
this.add(parameterViewPane);
}
@Override
protected String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Basic_Export_JS_Parameters_Setting");
}
public List<ParameterProvider> getParameterList() {
return parameterViewPane.update();
}
public void refresh(List list) {
parameterViewPane.update(list);
}
}
}
public ExportJavaScriptPane() {
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();
otherTemplatePane = new OtherTemplatePane();
templatePanel = FRGUIPaneFactory.createCardLayout_S_Pane();
card = new CardLayout();
templatePanel.setLayout(card);
templatePanel.add(CURRENT_TEMPLATE, currentTemplatePane);
templatePanel.add(OTHER_TEMPLATE, otherTemplatePane);
totalPanel.add(northPane, BorderLayout.NORTH);
totalPanel.add(templatePanel, BorderLayout.CENTER);
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.add(totalPanel);
}
private JPanel initChooseTemplatePane() {
UILabel templateLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template") + ":");
templateRadioGroup = new ExportRadioGroup();
currentTemplateRadio = new UIRadioButton(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template_Current"));
currentTemplateRadio.setSelected(true);
otherTemplateRadio = new UIRadioButton(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template_Other"));
addRadioToGroup(templateRadioGroup, currentTemplateRadio, otherTemplateRadio);
currentTemplateRadio.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
card.show(templatePanel, CURRENT_TEMPLATE);
}
}
});
otherTemplateRadio.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
card.show(templatePanel, OTHER_TEMPLATE);
}
}
});
Component[][] components = new Component[][]{{templateLabel, currentTemplateRadio, otherTemplateRadio}};
JPanel reportletRadioPane = TableLayoutHelper.createTableLayoutPane(components, new double[]{p}, new double[]{p, p, p});
JPanel chooseTemplatePane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
chooseTemplatePane.add(reportletRadioPane, BorderLayout.NORTH); chooseTemplatePane.add(reportletRadioPane, BorderLayout.NORTH);
chooseTemplatePane.add(reportletNamePane, BorderLayout.CENTER); chooseTemplatePane.setBorder(BorderFactory.createEmptyBorder(0, 7, 5, 2));
chooseTemplatePane.setBorder(BorderFactory.createEmptyBorder(0,2,5,2));
return chooseTemplatePane; return chooseTemplatePane;
} }
@ -273,31 +830,13 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
public void populateBean(ExportJavaScript ob) { public void populateBean(ExportJavaScript ob) {
if (ob == null) { if (ob == null) {
ob = new ExportJavaScript(); ob = new ExportJavaScript();
otherTemplatePane.reset();
} }
this.templateRadioGroup.selectIndexButton(ob.isCurrentTemplate() ? 0 : 1); this.templateRadioGroup.selectIndexButton(ob.isCurrentTemplate() ? 0 : 1);
if (ob.isCurrentTemplate()) { currentTemplatePane.populateSingleJavaScript(ob.getCurrentTemplateJavaScript());
this.browserButton.setEnabled(false);
} else { OtherTemplatePane pane = (OtherTemplatePane) this.templatePanel.getComponent(1);
this.browserButton.setEnabled(true); pane.editorPane.populate(ob.getJsListForOtherTemplates().toArray(new SingleJavaScript[ob.getJsListForOtherTemplates().size()]));
this.reportPathTextField.setText(ob.getTemplatePath());
}
this.exportTypeComboBox.setSelectedItem(ob.getExportType());
this.fileNameRadioGroup.selectIndexButton(ob.isDefaultFileName() ? 0 : 1);
if (ob.isDefaultFileName()) {
this.fileNameFormulaEditor.setEnabled(false);
} else {
this.fileNameFormulaEditor.setEnabled(true);
this.fileNameFormulaEditor.setValue(BaseFormula.createFormulaBuilder().build(ob.getFileName()));
}
if (ob.isExtendParameters()) {
this.extendParametersCheckBox.setSelected(true);
} else {
this.extendParametersCheckBox.setSelected(false);
List<ParameterProvider> parameterList = this.parameterViewPane.update();
parameterList.clear();
ParameterProvider[] parameters = ob.getParameters();
this.parameterViewPane.populate(parameters);
}
} }
@Override @Override
@ -309,32 +848,59 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
@Override @Override
public void updateBean(ExportJavaScript exportJavaScript) { public void updateBean(ExportJavaScript exportJavaScript) {
exportJavaScript.setCurrentTemplate(this.currentTemplateRadio.isSelected()); boolean selected = currentTemplateRadio.isSelected();
exportJavaScript.setTemplatePath(getTemplatePath()); exportJavaScript.setCurrentTemplate(selected);
exportJavaScript.setExportType(GeneralUtils.objectToString(this.exportTypeComboBox.getSelectedItem())); SingleJavaScript js = new SingleJavaScript();
exportJavaScript.setDefaultFileName(this.defaultNameRadio.isSelected()); js.setCurrentTemplate(selected);
exportJavaScript.setFileName(getFileName()); currentTemplatePane.updateSingleJavaScript(js);
exportJavaScript.setExtendParameters(this.extendParametersCheckBox.isSelected()); exportJavaScript.addCurrentTemplateJS(js);
if (extendParametersCheckBox.isSelected()) {
exportJavaScript.setParameters(null); otherTemplatePane.updateExportJavaScript(exportJavaScript);
} else {
List<ParameterProvider> parameterList = this.parameterViewPane.update();
if (!parameterList.isEmpty()) {
Parameter[] parameters = new Parameter[parameterList.size()];
parameterList.toArray(parameters);
exportJavaScript.setParameters(parameters);
}
} }
private String getFileName() {
return currentTemplatePane.defaultNameRadio.isSelected() ? DEFAULT : currentTemplatePane.fileNameFormulaEditor.getUITextField().getText();
} }
private String getTemplatePath() { private UIComboBox getComboBoxWithModel(String[] itemTextArr, Map<String, String> itemTextDic) {
return currentTemplateRadio.isSelected() ? CURRENT_TEMPLATE : reportPathTextField.getText(); UIComboBox comboBox = new UIComboBox(new DefaultComboBoxModel<String>());
DefaultComboBoxModel<String> comboBoxModel = (DefaultComboBoxModel<String>) comboBox.getModel();
for (int i = 0; i < itemTextArr.length; i++) {
comboBoxModel.addElement(itemTextArr[i]);
} }
comboBox.setRenderer(new UIComboBoxRenderer() {
private String getFileName() { @Override
return defaultNameRadio.isSelected() ? DEFAULT_FILENAME : fileNameFormulaEditor.getUITextField().getText(); public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value instanceof String) {
this.setText(itemTextDic.get(value));
}
return this;
}
});
return comboBox;
} }
private void addListener(ReportletParameterViewPane paraPane) {
paraPane.addTableEditorListener(new TableModelListener() {
public void tableChanged(TableModelEvent e) {
List<ParameterProvider> list = paraPane.update();
HashSet<String> tempSet = new HashSet<>();
for (int i = 0; i < list.size(); i++) {
if (StringUtils.isEmpty(list.get(i).getName())) {
continue;
}
if (tempSet.contains(list.get(i).toString())) {
list.remove(i);
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Parameter_Duplicate_Name") + "!");
return;
}
tempSet.add(list.get(i).toString());
}
}
});
}
@Override @Override
public boolean accept(Object ob) { public boolean accept(Object ob) {

9
designer-chart/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditContext.java → designer-base/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditContext.java

@ -23,4 +23,13 @@ public class ChartEditContext {
public static boolean normalMode() { public static boolean normalMode() {
return current == ChartEditMode.NORMAL; return current == ChartEditMode.NORMAL;
} }
/**
* 是否支持 主题样式 设置
*
* @return duchamp大屏模板模式 不支持
*/
public static boolean supportTheme() {
return !duchampMode();
}
} }

0
designer-chart/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditMode.java → designer-base/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditMode.java

6
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java

@ -139,7 +139,7 @@ public class TemplateThemeGridPagesPane extends JPanel {
public UIButton[] createRightButtons() { public UIButton[] createRightButtons() {
UIButton[] buttons = new UIButton[] {}; UIButton[] buttons = new UIButton[] {};
buttons = ArrayUtils.addAll(buttons, createExtraButtons()); buttons = ArrayUtils.addAll(buttons, createExtraButtons());
buttons = ArrayUtils.addAll(buttons, createCompleteButton()); buttons = ArrayUtils.addAll(buttons, createCloseButton());
return buttons; return buttons;
} }
@ -180,8 +180,8 @@ public class TemplateThemeGridPagesPane extends JPanel {
return uiButtonList.toArray(new UIButton[]{}); return uiButtonList.toArray(new UIButton[]{});
} }
private UIButton createCompleteButton() { private UIButton createCloseButton() {
UIButton button = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Dialog_Complete")); UIButton button = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Dialog_Close"));
button.setName(COMPLETE_BUTTON); button.setName(COMPLETE_BUTTON);
button.addActionListener(new ActionListener() { button.addActionListener(new ActionListener() {
@Override @Override

15
designer-base/src/main/java/com/fr/design/mainframe/toast/DesignerToastMsgUtil.java

@ -31,14 +31,6 @@ public class DesignerToastMsgUtil {
} }
public static ToastMsgDialog createPromptDialog(String text) {
return createDialog(PROMPT_ICON, toastPane(text), DesignerContext.getDesignerFrame());
}
public static ToastMsgDialog createPromptDialog(JPanel contentPane) {
return createDialog(PROMPT_ICON, contentPane, DesignerContext.getDesignerFrame());
}
public static void toastPrompt(JPanel contendPane) { public static void toastPrompt(JPanel contendPane) {
toastPane(PROMPT_ICON, contendPane, DesignerContext.getDesignerFrame()); toastPane(PROMPT_ICON, contendPane, DesignerContext.getDesignerFrame());
} }
@ -76,11 +68,6 @@ public class DesignerToastMsgUtil {
} }
private static void toastPane(Icon icon, JPanel contendPane, Window parent) { private static void toastPane(Icon icon, JPanel contendPane, Window parent) {
ToastMsgDialog dialog = createDialog(icon, contendPane, parent);
dialog.setVisible(true);
}
private static ToastMsgDialog createDialog(Icon icon, JPanel contendPane, Window parent) {
JPanel pane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel pane = FRGUIPaneFactory.createBorderLayout_S_Pane();
UILabel uiLabel = new UILabel(icon); UILabel uiLabel = new UILabel(icon);
uiLabel.setVerticalAlignment(SwingConstants.TOP); uiLabel.setVerticalAlignment(SwingConstants.TOP);
@ -95,7 +82,7 @@ public class DesignerToastMsgUtil {
} else { } else {
dialog = new ToastMsgDialog((Frame) parent, pane); dialog = new ToastMsgDialog((Frame) parent, pane);
} }
return dialog; dialog.setVisible(true);
} }

6
designer-base/src/main/java/com/fr/design/mainframe/toast/ToastMsgDialog.java

@ -24,7 +24,6 @@ public class ToastMsgDialog extends UIDialog {
private ScheduledExecutorService TIMER; private ScheduledExecutorService TIMER;
private int hide_height = 0; private int hide_height = 0;
private JPanel contentPane; private JPanel contentPane;
private boolean show = false;
public ToastMsgDialog(Frame parent, JPanel panel) { public ToastMsgDialog(Frame parent, JPanel panel) {
super(parent); super(parent);
@ -66,7 +65,6 @@ public class ToastMsgDialog extends UIDialog {
public void display(JPanel outerJPanel) { public void display(JPanel outerJPanel) {
show = true;
outerJPanel.setLocation(0, -hide_height); outerJPanel.setLocation(0, -hide_height);
ScheduledExecutorService TIP_TOOL_TIMER = createToastScheduleExecutorService(); ScheduledExecutorService TIP_TOOL_TIMER = createToastScheduleExecutorService();
TIP_TOOL_TIMER.scheduleAtFixedRate(new Runnable() { TIP_TOOL_TIMER.scheduleAtFixedRate(new Runnable() {
@ -100,7 +98,6 @@ public class ToastMsgDialog extends UIDialog {
TIP_TOOL_TIMER.shutdown(); TIP_TOOL_TIMER.shutdown();
ToastMsgDialog.this.setVisible(false); ToastMsgDialog.this.setVisible(false);
ToastMsgDialog.this.dispose(); ToastMsgDialog.this.dispose();
ToastMsgDialog.this.show = false;
} }
outerJPanel.setLocation(point.x, point.y - 5); outerJPanel.setLocation(point.x, point.y - 5);
Dimension dimension = ToastMsgDialog.this.getSize(); Dimension dimension = ToastMsgDialog.this.getSize();
@ -162,7 +159,4 @@ public class ToastMsgDialog extends UIDialog {
super.dispose(); super.dispose();
} }
public boolean isShow() {
return show;
}
} }

20
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ColorSelectBoxWithThemeStyle.java

@ -5,7 +5,7 @@ import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.design.style.color.ColorSelectBox; import com.fr.design.style.color.ColorSelectBox;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
@ -39,18 +39,16 @@ public class ColorSelectBoxWithThemeStyle extends BasicPane {
} }
private void initContent() { private void initContent() {
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p};
UILabel text = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color"), SwingConstants.LEFT); UILabel text = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color"), SwingConstants.LEFT);
Component[][] components = { Component[][] components = ChartEditContext.supportTheme() ? new Component[][]{
new Component[]{text, preButton}, new Component[]{text, preButton},
new Component[]{null, colorSelectBox}, new Component[]{null, colorSelectBox},
} : new Component[][]{
new Component[]{text, colorSelectBox}
}; };
JPanel gapTableLayoutPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
JPanel gapTableLayoutPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(gapTableLayoutPane, BorderLayout.CENTER); this.add(gapTableLayoutPane, BorderLayout.CENTER);
} }
@ -66,7 +64,7 @@ public class ColorSelectBoxWithThemeStyle extends BasicPane {
private void checkPreButton() { private void checkPreButton() {
colorSelectBox.setVisible(preButton.getSelectedIndex() == CUSTOM); colorSelectBox.setVisible(preButton.getSelectedIndex() == CUSTOM);
this.setPreferredSize(preButton.getSelectedIndex() == CUSTOM ? new Dimension(0, 55) : new Dimension(0, 23)); this.setPreferredSize(ChartEditContext.supportTheme() && preButton.getSelectedIndex() == CUSTOM ? new Dimension(0, 55) : new Dimension(0, 23));
} }
public String title4PopupWindow() { public String title4PopupWindow() {
@ -74,14 +72,14 @@ public class ColorSelectBoxWithThemeStyle extends BasicPane {
} }
public void populate(ColorWithThemeStyle colorWithPreStyle) { public void populate(ColorWithThemeStyle colorWithPreStyle) {
preButton.setSelectedIndex(colorWithPreStyle.isThemed() ? PREDEFINED_STYLE : CUSTOM); preButton.setSelectedIndex(ChartEditContext.supportTheme() && colorWithPreStyle.isThemed() ? PREDEFINED_STYLE : CUSTOM);
colorSelectBox.setSelectObject(colorWithPreStyle.getColor()); colorSelectBox.setSelectObject(colorWithPreStyle.getColor());
checkPreButton(); checkPreButton();
} }
public ColorWithThemeStyle update() { public ColorWithThemeStyle update() {
ColorWithThemeStyle colorWithPreStyle = new ColorWithThemeStyle(); ColorWithThemeStyle colorWithPreStyle = new ColorWithThemeStyle();
colorWithPreStyle.setThemed(preButton.getSelectedIndex() == PREDEFINED_STYLE); colorWithPreStyle.setThemed(ChartEditContext.supportTheme() && preButton.getSelectedIndex() == PREDEFINED_STYLE);
colorWithPreStyle.setColor(colorSelectBox.getSelectObject()); colorWithPreStyle.setColor(colorSelectBox.getSelectObject());
return colorWithPreStyle; return colorWithPreStyle;
} }

5
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLabelContentPane.java

@ -1,6 +1,7 @@
package com.fr.van.chart.designer.component; package com.fr.van.chart.designer.component;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithThemeStyle; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithThemeStyle;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.type.TextAlign; import com.fr.plugin.chart.type.TextAlign;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
@ -25,7 +26,7 @@ public class VanChartLabelContentPane extends VanChartTooltipContentPane {
} }
public JPanel createCommonStylePane() { public JPanel createCommonStylePane() {
if (isInCondition()) { if (isInCondition() || !ChartEditContext.supportTheme()) {
return super.createCommonStylePane(); return super.createCommonStylePane();
} }
setTextAttrPane(new ChartTextAttrPaneWithThemeStyle()); setTextAttrPane(new ChartTextAttrPaneWithThemeStyle());
@ -37,7 +38,7 @@ public class VanChartLabelContentPane extends VanChartTooltipContentPane {
} }
public void updateTextAttr(AttrTooltipContent attrTooltipContent) { public void updateTextAttr(AttrTooltipContent attrTooltipContent) {
if (isInCondition()) { if (isInCondition() || !ChartEditContext.supportTheme()) {
super.updateTextAttr(attrTooltipContent); super.updateTextAttr(attrTooltipContent);
return; return;
} }

3
designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java

@ -16,6 +16,7 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithThemeStyle; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithThemeStyle;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.plugin.chart.attr.VanChartLegend; import com.fr.plugin.chart.attr.VanChartLegend;
import com.fr.plugin.chart.type.LayoutType; import com.fr.plugin.chart.type.LayoutType;
@ -288,7 +289,7 @@ public class VanChartPlotLegendPane extends BasicPane {
} }
private JPanel createTitleStylePane() { private JPanel createTitleStylePane() {
textAttrPane = new ChartTextAttrPaneWithThemeStyle(); textAttrPane = ChartEditContext.supportTheme() ? new ChartTextAttrPaneWithThemeStyle() : new ChartTextAttrPane();
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), textAttrPane); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), textAttrPane);
} }

6
designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java

@ -17,8 +17,10 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithThemeStyle; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithThemeStyle;
import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.design.mainframe.chart.info.ChartInfoCollector;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.plugin.chart.attr.VanChartTitle; import com.fr.plugin.chart.attr.VanChartTitle;
import com.fr.plugin.chart.vanchart.VanChart; import com.fr.plugin.chart.vanchart.VanChart;
@ -57,7 +59,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
private JPanel titlePane; private JPanel titlePane;
private TinyFormulaPane titleContent; private TinyFormulaPane titleContent;
private ChartTextAttrPaneWithThemeStyle textAttrPane; private ChartTextAttrPane textAttrPane;
private UIButtonGroup<Integer> alignmentPane; private UIButtonGroup<Integer> alignmentPane;
private VanChartBackgroundWithOutShadowWithRadiusPane backgroundPane; private VanChartBackgroundWithOutShadowWithRadiusPane backgroundPane;
private UIToggleButton useHtml; private UIToggleButton useHtml;
@ -188,7 +190,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
} }
private JPanel createTitleStylePane() { private JPanel createTitleStylePane() {
textAttrPane = new ChartTextAttrPaneWithThemeStyle(); textAttrPane = ChartEditContext.supportTheme() ? new ChartTextAttrPaneWithThemeStyle() : new ChartTextAttrPane();
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), textAttrPane); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), textAttrPane);
} }

14
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java

@ -22,6 +22,7 @@ import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithThemeStyle; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithThemeStyle;
import com.fr.design.mainframe.chart.gui.style.ColorSelectBoxWithThemeStyle; import com.fr.design.mainframe.chart.gui.style.ColorSelectBoxWithThemeStyle;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory; import com.fr.design.widget.FRWidgetFactory;
import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.axis.VanChartAxis;
@ -380,10 +381,21 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
} }
protected ChartTextAttrPane getChartTextAttrPane() { protected ChartTextAttrPane getChartTextAttrPane() {
return new ChartTextAttrPaneWithThemeStyle() { return ChartEditContext.supportTheme() ? new ChartTextAttrPaneWithThemeStyle() {
protected double getEdithAreaWidth() { protected double getEdithAreaWidth() {
return TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH; return TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH;
} }
} : new ChartTextAttrPane() {
@Override
protected JPanel getContentPane(JPanel buttonPane) {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double[] rowSize = {p, p, p};
return TableLayout4VanChartHelper.createGapTableLayoutPane(getComponents(buttonPane), rowSize, columnSize);
}
}; };
} }

3
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java

@ -9,6 +9,7 @@ import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithAuto; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithAuto;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithThemeStyle; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithThemeStyle;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.design.style.color.ColorSelectBox; import com.fr.design.style.color.ColorSelectBox;
import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.attr.axis.VanChartGaugeAxis; import com.fr.plugin.chart.attr.axis.VanChartGaugeAxis;
@ -103,7 +104,7 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane {
if (isMulti(gaugeStyle)) { if (isMulti(gaugeStyle)) {
return new ChartTextAttrPaneWithAuto(FontAutoType.SIZE_AND_COLOR); return new ChartTextAttrPaneWithAuto(FontAutoType.SIZE_AND_COLOR);
} else { } else {
return new ChartTextAttrPaneWithThemeStyle(); return ChartEditContext.supportTheme() ? new ChartTextAttrPaneWithThemeStyle() : new ChartTextAttrPane();
} }
} }

3
designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAreaBackgroundPane.java

@ -8,6 +8,7 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.van.chart.designer.AbstractVanChartScrollPane; import com.fr.van.chart.designer.AbstractVanChartScrollPane;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.background.VanChartBackgroundPane; import com.fr.van.chart.designer.component.background.VanChartBackgroundPane;
@ -49,7 +50,7 @@ public class VanChartAreaBackgroundPane extends AbstractVanChartScrollPane<Chart
if(isPlot) { if(isPlot) {
chartBackgroundPane = new VanChartBackgroundPane(); chartBackgroundPane = new VanChartBackgroundPane();
} else { } else {
chartBackgroundPane = new VanChartBackgroundPaneWithThemeStyle(); chartBackgroundPane = ChartEditContext.supportTheme() ? new VanChartBackgroundPaneWithThemeStyle() : new VanChartBackgroundPane();
} }
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;

5
designer-chart/src/main/java/com/fr/van/chart/designer/style/datasheet/VanChartDataSheetPane.java

@ -12,6 +12,7 @@ import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithThemeStyle; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithThemeStyle;
import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.design.mainframe.chart.info.ChartInfoCollector;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.VanChartAttrHelper; import com.fr.plugin.chart.VanChartAttrHelper;
import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot;
@ -106,11 +107,11 @@ public class VanChartDataSheetPane extends AbstractVanChartScrollPane<Chart> {
} }
protected VanChartBorderPane createBorderPanePane() { protected VanChartBorderPane createBorderPanePane() {
return new VanChartBorderPaneWithPreStyle(); return ChartEditContext.supportTheme() ? new VanChartBorderPaneWithPreStyle() : new VanChartBorderPane();
} }
protected ChartTextAttrPane createChartTextAttrPane() { protected ChartTextAttrPane createChartTextAttrPane() {
return new ChartTextAttrPaneWithThemeStyle(); return ChartEditContext.supportTheme() ? new ChartTextAttrPaneWithThemeStyle() : new ChartTextAttrPane();
} }
@Override @Override

4
designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterLabelContentPane.java

@ -1,6 +1,8 @@
package com.fr.van.chart.scatter; package com.fr.van.chart.scatter;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithThemeStyle; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithThemeStyle;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.van.chart.designer.component.VanChartHtmlLabelPane; import com.fr.van.chart.designer.component.VanChartHtmlLabelPane;
import com.fr.van.chart.designer.component.VanChartHtmlLabelPaneWithBackGroundLabel; import com.fr.van.chart.designer.component.VanChartHtmlLabelPaneWithBackGroundLabel;
@ -28,7 +30,7 @@ public class VanChartScatterLabelContentPane extends VanChartScatterTooltipCont
if (isInCondition()) { if (isInCondition()) {
return super.createCommonStylePane(); return super.createCommonStylePane();
} }
setTextAttrPane(new ChartTextAttrPaneWithThemeStyle()); setTextAttrPane(ChartEditContext.supportTheme() ? new ChartTextAttrPaneWithThemeStyle() : new ChartTextAttrPane());
JPanel stylePanel = new JPanel(new BorderLayout()); JPanel stylePanel = new JPanel(new BorderLayout());
stylePanel.add(getTextAttrPane(), BorderLayout.CENTER); stylePanel.add(getTextAttrPane(), BorderLayout.CENTER);

50
designer-form/src/main/java/com/fr/design/mainframe/share/util/InstallComponentHelper.java

@ -19,9 +19,10 @@ import java.io.InputStream;
* @Date: 2020/12/4 * @Date: 2020/12/4
*/ */
public class InstallComponentHelper { public class InstallComponentHelper {
private static final String PRE_INSTALL_PATH = "/com/fr/form/share/components"; private static final String PRE_INSTALL_PATH = "/com/fr/form/share/components";
private static final String[] PRE_INSTALL_COMPONENTS = new String[]{ private static String sharePath = ComponentPath.SHARE_PATH.path();
private static final String[] OLD_PRE_INSTALL_COMPONENTS = new String[]{
"单行指标卡.f3df58b3-4302-4cab-ab77-caaf225de60a.reu", "单行指标卡.f3df58b3-4302-4cab-ab77-caaf225de60a.reu",
"分层雷达图-深色.49f8397c-e6a6-482a-acc7-46d8cec353a4.reu", "分层雷达图-深色.49f8397c-e6a6-482a-acc7-46d8cec353a4.reu",
"红绿灯表格-浅色.d0466992-328a-4ccf-ad67-6cbc844d669c.reu", "红绿灯表格-浅色.d0466992-328a-4ccf-ad67-6cbc844d669c.reu",
@ -29,12 +30,24 @@ public class InstallComponentHelper {
"三列指标卡.61a83d18-a162-4dc3-aa57-3b954edaf82e.reu", "三列指标卡.61a83d18-a162-4dc3-aa57-3b954edaf82e.reu",
"透明按钮切换图表.e373e13a-3da0-4c29-91bc-9ae804241023.reu" "透明按钮切换图表.e373e13a-3da0-4c29-91bc-9ae804241023.reu"
}; };
private static final String[] PRE_INSTALL_COMPONENTS = new String[]{
"三色指标卡-酷炫蓝.d96f451f-c74c-45df-b056-0906b42870c7.reu",
"刻度槽型仪表盘-酷炫蓝.982ba9a3-f38b-48df-a7ae-80fcce0d74d1.reu",
"大屏标题-酷炫蓝.35f08184-2339-4a7d-9a6a-ea5bacc6829a.reu",
"柱形折线组合图-酷炫蓝.b7d66ba1-2a51-4640-a50e-2869694b748a.reu",
"渐变柱形图-酷炫蓝.786a4e7a-22d5-4f55-a857-42e3ddd54b70.reu",
"环形饼图-酷炫蓝.c9258ee9-7dee-4f56-aa2e-31b9fd7de818.reu"
};
public static void installPreComponent() { public static void installPreComponent() {
if (needPreInstallComponent()) { String[] components = WorkContext.getWorkResource().list(sharePath, new ReuFilter());
String[] dirs = WorkContext.getWorkResource().list(sharePath, new DirFilter());
if (needPreInstallComponent(components, dirs)) {
installShareComponents(PRE_INSTALL_PATH, PRE_INSTALL_COMPONENTS);
} else if (needReplaceOldComponent(components, dirs)) {
clearOldComponent(OLD_PRE_INSTALL_COMPONENTS);
installShareComponents(PRE_INSTALL_PATH, PRE_INSTALL_COMPONENTS); installShareComponents(PRE_INSTALL_PATH, PRE_INSTALL_COMPONENTS);
} }
} }
public static void installShareComponents(String resourcePath, String[] components) { public static void installShareComponents(String resourcePath, String[] components) {
@ -42,18 +55,36 @@ public class InstallComponentHelper {
try { try {
InputStream inputStream = InstallComponentHelper.class.getResourceAsStream(StableUtils.pathJoin(resourcePath, componentPath)); InputStream inputStream = InstallComponentHelper.class.getResourceAsStream(StableUtils.pathJoin(resourcePath, componentPath));
byte[] data = ResourceIOUtils.inputStream2Bytes(inputStream); byte[] data = ResourceIOUtils.inputStream2Bytes(inputStream);
WorkContext.getWorkResource().write(StableUtils.pathJoin(ComponentPath.SHARE_PATH.path(), componentPath), data); WorkContext.getWorkResource().write(StableUtils.pathJoin(sharePath, componentPath), data);
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error("install Component filed" + e.getMessage(), e); FineLoggerFactory.getLogger().error("install Component filed" + e.getMessage(), e);
} }
} }
} }
private static boolean needPreInstallComponent() { private static boolean needReplaceOldComponent(String[] components, String[] dirs) {
if ((dirs != null && ArrayUtils.isNotEmpty(dirs)) || (components != null && components.length != 6)) {
return false;
}
for (String componentPath : components) {
if (!ArrayUtils.contains(OLD_PRE_INSTALL_COMPONENTS, componentPath)) {
return false;
}
}
return true;
}
private static void clearOldComponent(String[] components) {
for(String componentPath : components) {
WorkContext.getWorkResource().delete(StableUtils.pathJoin(sharePath, componentPath));
}
}
private static boolean needPreInstallComponent(String[] components, String[] dirs) {
try { try {
//老用户或者组件库里已有组件,不预装组件 //老用户或者组件库里已有组件,不预装组件
SnapChat snapChat = SnapChatFactory.createSnapChat(false, SnapChatKeys.COMPONENT); SnapChat snapChat = SnapChatFactory.createSnapChat(false, SnapChatKeys.COMPONENT);
return !snapChat.hasRead() && !hasComponentInstalled(); return !snapChat.hasRead() && !hasComponentInstalled(components, dirs);
} catch (Throwable e) { } catch (Throwable e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
@ -63,10 +94,7 @@ public class InstallComponentHelper {
/** /**
* 判断是否已有组件被安装 * 判断是否已有组件被安装
*/ */
private static boolean hasComponentInstalled() { private static boolean hasComponentInstalled(String[] components, String[] dirs) {
String sharePath = ComponentPath.SHARE_PATH.path();
String[] components = WorkContext.getWorkResource().list(sharePath, new ReuFilter());
String[] dirs = WorkContext.getWorkResource().list(sharePath, new DirFilter());
return components != null && ArrayUtils.isNotEmpty(components) return components != null && ArrayUtils.isNotEmpty(components)
|| (dirs != null && ArrayUtils.isNotEmpty(dirs)); || (dirs != null && ArrayUtils.isNotEmpty(dirs));
} }

58
designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java

@ -3,19 +3,15 @@ package com.fr.design.mainframe.socketio;
import com.fr.config.RemoteConfigEvent; import com.fr.config.RemoteConfigEvent;
import com.fr.decision.webservice.utils.DecisionServiceConstants; import com.fr.decision.webservice.utils.DecisionServiceConstants;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.EnvChangeEntrance;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.DesignerWorkspaceInfoContext; import com.fr.design.env.DesignerWorkspaceInfoContext;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.loghandler.DesignerLogger; import com.fr.design.mainframe.loghandler.DesignerLogger;
import com.fr.design.mainframe.share.ui.base.MouseClickListener;
import com.fr.design.mainframe.toast.DesignerToastMsgUtil;
import com.fr.design.mainframe.toast.ToastMsgDialog;
import com.fr.design.ui.util.UIUtil; import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.BrowseUtils;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.report.RemoteDesignConstants; import com.fr.report.RemoteDesignConstants;
@ -33,24 +29,20 @@ import com.fr.workspace.Workspace;
import com.fr.workspace.base.WorkspaceConstants; import com.fr.workspace.base.WorkspaceConstants;
import com.fr.workspace.connect.WorkspaceConnection; import com.fr.workspace.connect.WorkspaceConnection;
import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.server.socket.SocketInfoOperator;
import io.socket.client.IO; import io.socket.client.IO;
import io.socket.client.Socket; import io.socket.client.Socket;
import io.socket.emitter.Emitter; import io.socket.emitter.Emitter;
import javax.net.ssl.SSLContext;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.event.MouseEvent;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.security.KeyStore;
import java.util.Arrays;
import javax.net.ssl.SSLContext;
import javax.swing.*;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.net.URL; import java.net.URL;
import java.security.KeyStore;
import java.util.Arrays;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
@ -62,7 +54,6 @@ public class DesignerSocketIO {
Disconnecting Disconnecting
} }
private static final String WEBSOCKET_HELP_DOC = CloudCenter.getInstance().acquireUrlByKind("websocketConnect", "https://help.fanruan.com/finereport/doc-view-2512.html");
private static final String HTTPS = "https"; private static final String HTTPS = "https";
private static final String HTTP = "http"; private static final String HTTP = "http";
private static Socket socket = null; private static Socket socket = null;
@ -75,7 +66,6 @@ public class DesignerSocketIO {
private static int count; private static int count;
// 当前webSocket选择的协议 // 当前webSocket选择的协议
private static String currentProtocol; private static String currentProtocol;
private static ToastMsgDialog dialog = null;
public static void close() { public static void close() {
@ -196,7 +186,6 @@ public class DesignerSocketIO {
private static final Emitter.Listener failRetry = new Emitter.Listener() { private static final Emitter.Listener failRetry = new Emitter.Listener() {
@Override @Override
public void call(Object... args) { public void call(Object... args) {
showConnectionLostDialog();
printLog(args, PrintEventLogImpl.WARN, "failed args: {}"); printLog(args, PrintEventLogImpl.WARN, "failed args: {}");
status = Status.Disconnecting; status = Status.Disconnecting;
socket.close(); socket.close();
@ -263,13 +252,13 @@ public class DesignerSocketIO {
UIUtil.invokeLaterIfNeeded(new Runnable() { UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override @Override
public void run() { public void run() {
if (dialog == null) { FineJOptionPane.showMessageDialog(
dialog = DesignerToastMsgUtil.createPromptDialog(createDialogContent()); DesignerContext.getDesignerFrame(),
} Toolkit.i18nText("Fine-Design_Basic_Remote_Disconnected"),
UIManager.getString("OptionPane.messageDialogTitle"),
if (!dialog.isShow()) { JOptionPane.ERROR_MESSAGE,
dialog.setVisible(true); UIManager.getIcon("OptionPane.errorIcon"));
} EnvChangeEntrance.getInstance().chooseEnv();
} }
}); });
} catch (Exception e) { } catch (Exception e) {
@ -277,23 +266,6 @@ public class DesignerSocketIO {
} }
} }
private static JPanel createDialogContent() {
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
jPanel.add(new UILabel(Toolkit.i18nText("Fine-Design_WebSocket_Lost_Tip")), BorderLayout.WEST);
UILabel hyperLinkLabel = new UILabel(Toolkit.i18nText("Fine-Design_WebSocket_Lost_Tip_HyperLink_Text"));
hyperLinkLabel.addMouseListener(new MouseClickListener() {
@Override
public void mouseClicked(MouseEvent e) {
BrowseUtils.browser(WEBSOCKET_HELP_DOC);
}
});
hyperLinkLabel.setBorder(BorderFactory.createEmptyBorder(0, 3, 0, 0));
hyperLinkLabel.setForeground(Color.BLUE);
hyperLinkLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
jPanel.add(hyperLinkLabel, BorderLayout.CENTER);
return jPanel;
}
//配置变更监听器 //配置变更监听器
private static final Emitter.Listener modifyConfig = new Emitter.Listener() { private static final Emitter.Listener modifyConfig = new Emitter.Listener() {
@Override @Override

Loading…
Cancel
Save