Browse Source

Merge pull request #6624 in DESIGN/design from release/11.0 to feature/x

* commit '7e10626753568d628977653e6298eb912d67c4a5':
  CHART-21829 fix:fvs.cpt.chart 图表切换 也要重置图表属性
  CHART-21786:不限制图片标记点大小
  REPORT-62437 安装大数据集导出excel插件后,远程和本地互相切换时保存失败问题
  REPORT-62142 fix 解密条件 关注内置的两种模板类型即可
  REPORT-62142 加密模板在json数据集插件禁用启用后的模板数据集无法正常显示
  REPORT-61422【主题切换】cpt主题编辑的预览图增加辅助文本的图示
  REPORT-53615   重新添加驱动管理功能
  CHART-21570 fix:fvs.cpt.chart 默认自动
  CHART-21570 fix:fvs.cpt.chart 默认自动
  CHART-21570 fix:fvs.cpt.chart 默认自动
  CHART-21805 fix:cpt组件中的图表 主题中有的属性 不跟随属性 全部设置成自定义
  update
  CHART-21570 大屏模板中的图表默认自定义
  CHART-21570 大屏模板 cpt组件中的图表也不支持跟随主题
  CHART-21570 适配11.0 大屏模板中的cpt组件 不支持跟随主题
  CHART-21737 fix:大屏模板中的图表组件 设置第一个配色不生效
  REPORT-61736 release/11.0->final/11.0
  REPORT-61410 数据集预览时可复制-表头复制问题 && REPORT-61409 数据集预览时可复制-赋值空值时显示成Null
feature/x
superman 3 years ago
parent
commit
61685b87c1
  1. 260
      designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java
  2. 29
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  3. 5
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  4. 2
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ReportThemePreviewPane.java
  5. 4
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/AbstractECPreviewPane.java
  6. 24
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECPreviewPane.java
  7. 13
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECReportPreviewPane.java
  8. 17
      designer-base/src/main/java/com/fr/file/StashedFILE.java
  9. 6
      designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java
  10. 7
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java
  11. 6
      designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java
  12. 18
      designer-chart/src/main/java/com/fr/van/chart/map/designer/type/GisLayerPane.java

260
designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java

@ -1,10 +1,13 @@
package com.fr.design.data.datapane.connect; package com.fr.design.data.datapane.connect;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.data.driver.DriverLoader;
import com.fr.data.driver.config.DriverLoaderConfig;
import com.fr.data.impl.JDBCDatabaseConnection; import com.fr.data.impl.JDBCDatabaseConnection;
import com.fr.design.border.UITitledBorder; import com.fr.design.border.UITitledBorder;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIComboBoxUI;
import com.fr.design.gui.ilable.ActionLabel; import com.fr.design.gui.ilable.ActionLabel;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ipasswordfield.UIPasswordFieldWithFixedLength; import com.fr.design.gui.ipasswordfield.UIPasswordFieldWithFixedLength;
@ -21,6 +24,8 @@ import com.fr.general.ComparatorUtils;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.EncodeConstants; import com.fr.stable.EncodeConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.third.guava.collect.HashBiMap;
import com.fr.workspace.WorkContext;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JFileChooser; import javax.swing.JFileChooser;
@ -28,6 +33,8 @@ import javax.swing.JPanel;
import javax.swing.JPasswordField; import javax.swing.JPasswordField;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import javax.swing.plaf.ComboBoxUI;
import javax.swing.plaf.basic.ComboPopup;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
@ -45,6 +52,7 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -101,8 +109,60 @@ public class JDBCDefPane extends JPanel {
private JDBCDatabaseConnection jdbcDatabase; private JDBCDatabaseConnection jdbcDatabase;
private boolean needRefresh = true; private boolean needRefresh = true;
private UIComboBox driverManageBox;
private ActionLabel driverManageLabel;
private UIComboBox driverLoaderBox;
ActionListener driverManageListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
boolean selectSelfDefine = isSelfDefine();
driverManageLabel.setVisible(selectSelfDefine);
driverLoaderBox.setVisible(selectSelfDefine);
driverComboBox.setVisible(!selectSelfDefine);
// 选中自定义的话,将odbc的屏蔽,选中默认的话,重新触发一次driverComboBox的事件
if (selectSelfDefine) {
odbcTipsLink.setVisible(false);
} else {
driverComboBox.setSelectedItem(driverComboBox.getSelectedItem());
}
}
};
ActionListener dbtypeActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
urlTextField.setText(StringUtils.EMPTY);
driverComboBox.removeAllItems();
driverManageBox.setSelectedItem(Toolkit.i18nText("Fine-Design_Driver_Manage_Default"));
if (driverLoaderBox.getItemCount() > 0) {
driverLoaderBox.setSelectedIndex(0);
}
if (ComparatorUtils.equals(dbtypeComboBox.getSelectedItem(), StringUtils.EMPTY)) {
driverComboBox.setSelectedItem(StringUtils.EMPTY);
return;
}
DriverURLName[] dus = jdbcMap.get(dbtypeComboBox.getSelectedItem());
for (int i = 0, len = dus.length; i < len; i++) {
driverComboBox.addItem(dus[i].getDriver());
if (i == 0) {
driverComboBox.setSelectedItem(dus[i].getDriver());
urlTextField.setText(dus[i].getURL());
}
}
// 更改数据库类型后 数据库名称置空和之前逻辑保持一致
if (needRefresh) {
jdbcDatabase.setDatabase(StringUtils.EMPTY);
}
changePane(dbtypeComboBox.getSelectedItem());
JDBCConnectionDef.getInstance().setConnection((String) dbtypeComboBox.getSelectedItem(), jdbcDatabase);
DatabaseConnectionPane.JDBC.getAdvancedAttrPane().populate(jdbcDatabase);
}
};
private HashBiMap<String, String> nameAndRepresent;
public JDBCDefPane() { public JDBCDefPane() {
initMap();
this.setBorder(UITitledBorder.createBorderWithTitle("JDBC" + ":")); this.setBorder(UITitledBorder.createBorderWithTitle("JDBC" + ":"));
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); this.setLayout(FRGUIPaneFactory.createLabelFlowLayout());
JPanel innerthis = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); JPanel innerthis = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane();
@ -115,7 +175,15 @@ public class JDBCDefPane extends JPanel {
} }
dbtypeComboBox.addActionListener(dbtypeActionListener); dbtypeComboBox.addActionListener(dbtypeActionListener);
dbtypeComboBox.setMaximumRowCount(10); dbtypeComboBox.setMaximumRowCount(10);
driverLoaderBox = new SpecialUIComboBox();
refreshDriverLoader();
driverLoaderBox.setPreferredSize(new Dimension(200, driverLoaderBox.getPreferredSize().height));
driverLoaderBox.setEditable(false);
driverManageBox = new UIComboBox();
refreshDriverManage(true);
driverManageBox.setEditable(false);
driverManageBox.addActionListener(driverManageListener);
driverLoaderBox.setVisible(isSelfDefine());
driverComboBox = new UIComboBox(); driverComboBox = new UIComboBox();
driverComboBox.setEditable(true); driverComboBox.setEditable(true);
driverComboBox.addActionListener(driverListener); driverComboBox.addActionListener(driverListener);
@ -163,9 +231,33 @@ public class JDBCDefPane extends JPanel {
BrowseUtils.browser(url); BrowseUtils.browser(url);
} }
}); });
driverManageLabel = new ActionLabel(Toolkit.i18nText("Fine-Design_Driver_Manage_Add_Driver")) {
@Override
public void paintComponent(Graphics _gfx) {
super.paintComponent(_gfx);
_gfx.setColor(Color.blue);
_gfx.drawLine(0, this.getHeight() - 1, GraphHelper.getWidth(this.getText()), this.getHeight() - 1);
}
};
driverManageLabel.setPreferredSize(new Dimension(GraphHelper.getWidth(Toolkit.i18nText("Fine-Design_Driver_Manage_Add_Driver")), driverManageLabel.getPreferredSize().height));
driverManageLabel.setVisible(isSelfDefine());
driverManageLabel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
String url = CloudCenter.getInstance().acquireUrlByKind("driver.add.help");
BrowseUtils.browser(url);
}
});
odbcTipsPane.add(driverManageLabel);
odbcTipsPane.add(odbcTipsLink);
JPanel driverComboBoxAndTips = new JPanel(new BorderLayout()); JPanel driverComboBoxAndTips = new JPanel(new BorderLayout());
driverComboBoxAndTips.add(driverComboBox, BorderLayout.WEST); JPanel normalFlowInnerContainer_s_pane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(0, 5, 0);
normalFlowInnerContainer_s_pane.add(driverManageBox);
normalFlowInnerContainer_s_pane.add(driverComboBox);
normalFlowInnerContainer_s_pane.add(driverLoaderBox);
driverComboBoxAndTips.add(normalFlowInnerContainer_s_pane, BorderLayout.WEST);
driverComboBoxAndTips.add(odbcTipsPane, BorderLayout.CENTER); driverComboBoxAndTips.add(odbcTipsPane, BorderLayout.CENTER);
JPanel hostPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); JPanel hostPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane();
@ -225,7 +317,71 @@ public class JDBCDefPane extends JPanel {
innerthis.add(centerPanel); innerthis.add(centerPanel);
} }
private void refreshDriverLoader() {
Set<String> representSet = nameAndRepresent.values();
driverLoaderBox.clearBoxItems();
for (String represent : representSet) {
driverLoaderBox.addItem(represent);
}
}
private String getRepresent(String driverClass, String driverName) {
return driverClass + "(" + driverName + ")";
}
private boolean isSelfDefine() {
return ComparatorUtils.equals(Toolkit.i18nText("Fine-Design_Driver_Manage_Self_Define"), driverManageBox.getSelectedItem());
}
private void refreshDriverManage(boolean addSelfDefine) {
driverManageBox.clearBoxItems();
driverManageBox.addItem(Toolkit.i18nText("Fine-Design_Driver_Manage_Default"));
if (addSelfDefine) {
driverManageBox.addItem(Toolkit.i18nText("Fine-Design_Driver_Manage_Self_Define"));
}
}
private void initMap() {
Map<String, DriverLoader> driverLoaders = DriverLoaderConfig.getInstance().getDriverLoaders();
nameAndRepresent = getDriverLoaderAndRepresent(driverLoaders);
}
private HashBiMap<String, String> getDriverLoaderAndRepresent(Map<String, DriverLoader> driverLoaders) {
HashBiMap<String, String> driverHashBiMap = HashBiMap.create();
if (WorkContext.getCurrent().isWarDeploy()) {
return driverHashBiMap;
}
// name 是唯一的,name+driver自然也是唯一的
for (DriverLoader driverLoader : driverLoaders.values()) {
driverHashBiMap.put(driverLoader.getName(), getRepresent(driverLoader.getDriverClass(), driverLoader.getName()));
}
return driverHashBiMap;
}
protected JDBCDatabaseConnection getJDBCDatabase() {
return this.jdbcDatabase;
}
private void changePane(Object dbType) {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {p, f, 22};
if (ComparatorUtils.equals(dbType, OTHER_DB) || ComparatorUtils.equals(dbType, "Access") || ComparatorUtils.equals(dbType, "SQLite")) {
if (this.centerPanel.getComponentCount() != partComponents.length * 2) {
centerPanel.removeAll();
TableLayoutHelper.addComponent2ResultPane(partComponents, new double[]{p, p, p, p, p}, columnSize, centerPanel);
}
} else if (this.centerPanel.getComponentCount() != allComponents.length * 2) {
centerPanel.removeAll();
TableLayoutHelper.addComponent2ResultPane(allComponents, new double[]{p, p, p, p, p, p, p, p}, columnSize, centerPanel);
}
}
public void populate(JDBCDatabaseConnection jdbcDatabase) { public void populate(JDBCDatabaseConnection jdbcDatabase) {
// 单例对象,重新打开的时候并不会新建,但是由于driverloaderbox里面需要是动态内容,因此需要进行刷新动作
initMap();
refreshDriverLoader();
needRefresh = false; needRefresh = false;
if (jdbcDatabase == null) { if (jdbcDatabase == null) {
jdbcDatabase = new JDBCDatabaseConnection(); jdbcDatabase = new JDBCDatabaseConnection();
@ -255,7 +411,24 @@ public class JDBCDefPane extends JPanel {
this.dbtypeComboBox.setSelectedItem(OTHER_DB); this.dbtypeComboBox.setSelectedItem(OTHER_DB);
} }
} }
// jdbcDatabase.getDriverSource() 只会是空或者是有值,但是为了保险起见,还是应该做个处理
String driverSource = jdbcDatabase.getDriverSource();
if (driverSource == null) {
driverSource = StringUtils.EMPTY;
}
if (driverSource.isEmpty()) {
refreshDriverManage(!nameAndRepresent.isEmpty());
this.driverManageBox.setSelectedItem(Toolkit.i18nText("Fine-Design_Driver_Manage_Default"));
this.driverComboBox.setSelectedItem(jdbcDatabase.getDriver()); this.driverComboBox.setSelectedItem(jdbcDatabase.getDriver());
} else {
refreshDriverManage(true);
this.driverManageBox.setSelectedItem(Toolkit.i18nText("Fine-Design_Driver_Manage_Self_Define"));
String represent = getRepresent(jdbcDatabase.getDriver(), jdbcDatabase.getDriverSource());
if (!nameAndRepresent.containsValue(represent)) {
this.driverLoaderBox.addItem(represent);
}
this.driverLoaderBox.setSelectedItem(represent);
}
this.urlTextField.setText(jdbcDatabase.getURL()); this.urlTextField.setText(jdbcDatabase.getURL());
this.userNameTextField.setText(jdbcDatabase.getUser()); this.userNameTextField.setText(jdbcDatabase.getUser());
this.passwordTextField.setText(jdbcDatabase.getPassword()); this.passwordTextField.setText(jdbcDatabase.getPassword());
@ -268,31 +441,10 @@ public class JDBCDefPane extends JPanel {
needRefresh = false; needRefresh = false;
} }
protected JDBCDatabaseConnection getJDBCDatabase() {
return this.jdbcDatabase;
}
private void changePane(Object dbType) {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {p, f, 22};
if (ComparatorUtils.equals(dbType, OTHER_DB) || ComparatorUtils.equals(dbType, "Access") || ComparatorUtils.equals(dbType, "SQLite")) {
if (this.centerPanel.getComponentCount() != partComponents.length * 2) {
centerPanel.removeAll();
TableLayoutHelper.addComponent2ResultPane(partComponents, new double[]{p, p, p, p, p}, columnSize, centerPanel);
}
} else if (this.centerPanel.getComponentCount() != allComponents.length * 2) {
centerPanel.removeAll();
TableLayoutHelper.addComponent2ResultPane(allComponents, new double[]{p, p, p, p, p, p, p, p}, columnSize, centerPanel);
}
}
public JDBCDatabaseConnection update() { public JDBCDatabaseConnection update() {
if (jdbcDatabase == null) { if (jdbcDatabase == null) {
jdbcDatabase = new JDBCDatabaseConnection(); jdbcDatabase = new JDBCDatabaseConnection();
} }
Object driveItem = this.driverComboBox.getSelectedItem();
jdbcDatabase.setDriver(driveItem == null ? null : driveItem.toString().trim());
jdbcDatabase.setURL(this.urlTextField.getText().trim()); jdbcDatabase.setURL(this.urlTextField.getText().trim());
jdbcDatabase.setUser(this.userNameTextField.getText().trim()); jdbcDatabase.setUser(this.userNameTextField.getText().trim());
jdbcDatabase.setPassword(new String(this.passwordTextField.getPassword()).trim()); jdbcDatabase.setPassword(new String(this.passwordTextField.getPassword()).trim());
@ -304,36 +456,30 @@ public class JDBCDefPane extends JPanel {
jdbcDatabase.setNewCharsetName(EncodeConstants.ENCODING_GBK); jdbcDatabase.setNewCharsetName(EncodeConstants.ENCODING_GBK);
jdbcDatabase.setOriginalCharsetName(((String) this.charSetComboBox.getSelectedItem())); jdbcDatabase.setOriginalCharsetName(((String) this.charSetComboBox.getSelectedItem()));
} }
return jdbcDatabase; String driverLoader = (String) this.driverLoaderBox.getSelectedItem();
if (driverLoader == null) {
driverLoader = StringUtils.EMPTY;
} }
if (isSelfDefine()) {
ActionListener dbtypeActionListener = new ActionListener() { String[] split = driverLoader.split("\\(");
public void actionPerformed(ActionEvent evt) { if (split.length > 1) {
String name = split[1];
urlTextField.setText(StringUtils.EMPTY); if (name.length() > 0) {
driverComboBox.removeAllItems(); jdbcDatabase.setDriverSource(name.substring(0, name.length() - 1));
if (ComparatorUtils.equals(dbtypeComboBox.getSelectedItem(), StringUtils.EMPTY)) { } else {
driverComboBox.setSelectedItem(StringUtils.EMPTY); jdbcDatabase.setDriverSource(StringUtils.EMPTY);
return;
}
DriverURLName[] dus = jdbcMap.get(dbtypeComboBox.getSelectedItem());
for (int i = 0, len = dus.length; i < len; i++) {
driverComboBox.addItem(dus[i].getDriver());
if (i == 0) {
driverComboBox.setSelectedItem(dus[i].getDriver());
urlTextField.setText(dus[i].getURL());
} }
} else {
jdbcDatabase.setDriverSource(StringUtils.EMPTY);
} }
// 更改数据库类型后 数据库名称置空和之前逻辑保持一致 jdbcDatabase.setDriver(split[0]);
if (needRefresh) { } else {
jdbcDatabase.setDatabase(StringUtils.EMPTY); Object driveItem = this.driverComboBox.getSelectedItem();
jdbcDatabase.setDriver(driveItem == null ? null : driveItem.toString().trim());
jdbcDatabase.setDriverSource(StringUtils.EMPTY);
} }
changePane(dbtypeComboBox.getSelectedItem()); return jdbcDatabase;
JDBCConnectionDef.getInstance().setConnection((String) dbtypeComboBox.getSelectedItem(), jdbcDatabase);
DatabaseConnectionPane.JDBC.getAdvancedAttrPane().populate(jdbcDatabase);
} }
};
ActionListener driverListener = new ActionListener() { ActionListener driverListener = new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -579,4 +725,22 @@ public class JDBCDefPane extends JPanel {
private String driver; private String driver;
private String url; private String url;
} }
private static class SpecialUIComboBox extends UIComboBox {
@Override
public ComboBoxUI getUIComboBoxUI() {
return new SpecialUIComboBoxUI();
}
}
private static class SpecialUIComboBoxUI extends UIComboBoxUI {
@Override
public ComboPopup createPopup() {
return createHorizontalNeverUIComboPopUp();
}
}
} }

29
designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java

@ -12,7 +12,6 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.DesignerFrameFileDealerPane;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.JVirtualTemplate; import com.fr.design.mainframe.JVirtualTemplate;
import com.fr.design.module.DesignModuleFactory;
import com.fr.design.ui.util.UIUtil; import com.fr.design.ui.util.UIUtil;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.file.FileNodeFILE; import com.fr.file.FileNodeFILE;
@ -361,20 +360,28 @@ public class HistoryTemplateListCache implements CallbackEvent {
int size = historyList.size(); int size = historyList.size();
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
JTemplate<?, ?> template = historyList.get(i); JTemplate<?, ?> template = historyList.get(i);
FILE file = templateToStashFile(template);
if (file != null) {
stashFILEMap.put(i, file);
}
}
FineLoggerFactory.getLogger().info("Env Change Template Stashed.");
}
private FILE templateToStashFile(JTemplate<?, ?> template) {
FILE file = template.getEditingFILE(); FILE file = template.getEditingFILE();
try { try {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
BaseBook target = template.getTarget(); BaseBook target = template.getTarget();
if (target != null) { if (target != null) {
target.export(outputStream); target.export(outputStream);
stashFILEMap.put(i, new StashedFILE(file, outputStream.toByteArray())); return new StashedFILE(file, outputStream.toByteArray(), template.suffix());
} }
// 如果 target == null 那么这个模板是被模板内存优化功能处理过的,不用处理 // 如果 target == null 那么这个模板是被模板内存优化功能处理过的,不用处理
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} return null;
FineLoggerFactory.getLogger().info("Env Change Template Stashed.");
} }
private boolean checkStash() { private boolean checkStash() {
@ -458,18 +465,10 @@ public class HistoryTemplateListCache implements CallbackEvent {
FILE file = template.getEditingFILE(); FILE file = template.getEditingFILE();
boolean needReload = context == null || needReloadTemplate(context, template); boolean needReload = context == null || needReloadTemplate(context, template);
if (needReload) { if (needReload) {
try { FILE stashFile = templateToStashFile(template);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); if (stashFile != null) {
BaseBook target = template.getTarget();
if (target != null) {
FineLoggerFactory.getLogger().info("{} is being reloaded", file.getName()); FineLoggerFactory.getLogger().info("{} is being reloaded", file.getName());
target.export(outputStream); template.refreshResource(stashFile);
FILE stashedFile = new StashedFILE(file, outputStream.toByteArray());
template.refreshResource(stashedFile);
}
// 如果 target == null 那么这个模板是被模板内存优化功能处理过的,不用处理
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
} }

5
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -468,9 +468,12 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
} }
private void setTargetByFile(FILE file) { private void setTargetByFile(FILE file) {
this.template = JTemplateFactory.asIOFile(file, this.suffix()); T newTemplate = JTemplateFactory.asIOFile(file, this.suffix());
if (newTemplate != null) {
this.template = newTemplate;
setTarget(this.template); setTarget(this.template);
} }
}
private void addCenterPane() { private void addCenterPane() {

2
designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ReportThemePreviewPane.java

@ -41,7 +41,7 @@ public class ReportThemePreviewPane extends TemplateThemePreviewPane<ReportTheme
public ReportThemePreviewPane() { public ReportThemePreviewPane() {
setLayout(FRGUIPaneFactory.createBorderLayout()); setLayout(FRGUIPaneFactory.createBorderLayout());
chartPreviewPane = new ChartPreviewPane(); chartPreviewPane = new ChartPreviewPane();
chartPreviewPane.setPreferredSize(new Dimension(615, 237)); chartPreviewPane.setPreferredSize(new Dimension(615, 207));
chartPreviewPane.populate(initColumnChart()); chartPreviewPane.populate(initColumnChart());
chartPreviewPane.setCallbackEvent(this); chartPreviewPane.setCallbackEvent(this);
reportPreviewPane = new ECReportPreviewPane(); reportPreviewPane = new ECReportPreviewPane();

4
designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/AbstractECPreviewPane.java

@ -30,6 +30,10 @@ public abstract class AbstractECPreviewPane extends UINoOpaquePanel implements T
return getCellStyle(cellStyleList.getUse4SmallTitle()); return getCellStyle(cellStyleList.getUse4SmallTitle());
} }
protected Style getAssistMsgStyle(ThemedCellStyleList cellStyleList) {
return getCellStyle(cellStyleList.getUse4SupportInfo());
}
private Style getCellStyle(ThemedCellStyle themedCellStyle) { private Style getCellStyle(ThemedCellStyle themedCellStyle) {
if (themedCellStyle == null) { if (themedCellStyle == null) {
return Style.DEFAULT_STYLE; return Style.DEFAULT_STYLE;

24
designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECPreviewPane.java

@ -24,15 +24,18 @@ public class ECPreviewPane extends AbstractECPreviewPane {
private final List<AbstractPreviewCell> headerCellList = new ArrayList<>(); private final List<AbstractPreviewCell> headerCellList = new ArrayList<>();
private final List<AbstractPreviewCell> contentCellList = new ArrayList<>(); private final List<AbstractPreviewCell> contentCellList = new ArrayList<>();
private final List<AbstractPreviewCell> highLightCellList = new ArrayList<>(); private final List<AbstractPreviewCell> highLightCellList = new ArrayList<>();
private final List<AbstractPreviewCell> assistCellList = new ArrayList<>();
private static final int COL_COUNT = 5; private static final int COL_COUNT = 5;
private static final int CONTENT_ROW_COUNT = 2; private static final int CONTENT_ROW_COUNT = 2;
public ECPreviewPane() { public ECPreviewPane() {
this.setPreferredSize(new Dimension(517, 147)); this.setPreferredSize(new Dimension(517, 158));
this.setBorder(BorderFactory.createEmptyBorder(0, 1, 2, 1)); this.setBorder(BorderFactory.createEmptyBorder(0, 1, 2, 1));
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel titlePane = new UINoOpaquePanel(new GridLayout()); JPanel titlePane = new UINoOpaquePanel(new GridLayout());
this.add(titlePane, BorderLayout.NORTH); JPanel extCenterPane = FRGUIPaneFactory.createBorderLayout_NO_Opaque_Pane();
this.add(extCenterPane, BorderLayout.CENTER);
extCenterPane.add(titlePane, BorderLayout.NORTH);
for (int i = 0; i < COL_COUNT; i++) { for (int i = 0; i < COL_COUNT; i++) {
PreviewCell cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Header")); PreviewCell cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Header"));
cell.setPreferredSize(new Dimension(103, 36)); cell.setPreferredSize(new Dimension(103, 36));
@ -40,22 +43,29 @@ public class ECPreviewPane extends AbstractECPreviewPane {
headerCellList.add(cell); headerCellList.add(cell);
} }
JPanel contentPane = new UINoOpaquePanel(new GridLayout(2, 5, 0, 0)); JPanel contentPane = new UINoOpaquePanel(new GridLayout(2, 5, 0, 0));
this.add(contentPane, BorderLayout.CENTER); extCenterPane.add(contentPane, BorderLayout.CENTER);
for (int i = 0; i < COL_COUNT * CONTENT_ROW_COUNT; i++) { for (int i = 0; i < COL_COUNT * CONTENT_ROW_COUNT; i++) {
PreviewCell cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Main_Text")); PreviewCell cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Main_Text"));
cell.setPreferredSize(new Dimension(103, 33)); cell.setPreferredSize(new Dimension(103, 30));
contentPane.add(cell); contentPane.add(cell);
contentCellList.add(cell); contentCellList.add(cell);
} }
JPanel endPane = new UINoOpaquePanel(new GridLayout()); JPanel endPane = new UINoOpaquePanel(new GridLayout());
this.add(endPane, BorderLayout.SOUTH); extCenterPane.add(endPane, BorderLayout.SOUTH);
for (int i = 0; i < COL_COUNT; i++) { for (int i = 0; i < COL_COUNT; i++) {
PreviewCell cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Highlight_Text")); PreviewCell cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Highlight_Text"));
cell.setPreferredSize(new Dimension(103, 33)); cell.setPreferredSize(new Dimension(103, 30));
endPane.add(cell); endPane.add(cell);
highLightCellList.add(cell); highLightCellList.add(cell);
} }
JPanel extSouthPane = FRGUIPaneFactory.createBorderLayout_NO_Opaque_Pane();
PreviewCell assistCell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Assist_Text"));
assistCell.setPreferredSize(new Dimension(123, 30));
assistCellList.add(assistCell);
extSouthPane.add(assistCell);
this.add(extSouthPane, BorderLayout.SOUTH);
} }
@Override @Override
@ -64,6 +74,8 @@ public class ECPreviewPane extends AbstractECPreviewPane {
refresh(headerCellList, getReportHeaderStyle(cellStyleConfig)); refresh(headerCellList, getReportHeaderStyle(cellStyleConfig));
refresh(contentCellList, getMainContentStyle(cellStyleConfig)); refresh(contentCellList, getMainContentStyle(cellStyleConfig));
refresh(highLightCellList, getHighLightStyle(cellStyleConfig)); refresh(highLightCellList, getHighLightStyle(cellStyleConfig));
refresh(highLightCellList, getHighLightStyle(cellStyleConfig));
refresh(assistCellList, getAssistMsgStyle(cellStyleConfig));
} }

13
designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECReportPreviewPane.java

@ -27,6 +27,7 @@ public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreview
private final List<AbstractPreviewCell> titleCellList = new ArrayList<>(); private final List<AbstractPreviewCell> titleCellList = new ArrayList<>();
private final List<AbstractPreviewCell> contentCellList = new ArrayList<>(); private final List<AbstractPreviewCell> contentCellList = new ArrayList<>();
private final List<AbstractPreviewCell> highLightCellList = new ArrayList<>(); private final List<AbstractPreviewCell> highLightCellList = new ArrayList<>();
private final List<AbstractPreviewCell> assistCellList = new ArrayList<>();
private static final int CONTENT_ROW_COUNT = 3; private static final int CONTENT_ROW_COUNT = 3;
private static final int COL_COUNT = 5; private static final int COL_COUNT = 5;
@ -54,8 +55,10 @@ public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreview
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel northPane = createNorthPane(); JPanel northPane = createNorthPane();
JPanel centerPane = createCenterPane(); JPanel centerPane = createCenterPane();
JPanel southPane = createSouthPane();
this.add(northPane, BorderLayout.NORTH); this.add(northPane, BorderLayout.NORTH);
this.add(centerPane, BorderLayout.CENTER); this.add(centerPane, BorderLayout.CENTER);
this.add(southPane, BorderLayout.SOUTH);
} }
private JPanel createNorthPane() { private JPanel createNorthPane() {
@ -126,6 +129,15 @@ public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreview
return centerPane; return centerPane;
} }
private JPanel createSouthPane(){
JPanel southPane = FRGUIPaneFactory.createBorderLayout_NO_Opaque_Pane();
PreviewCell assistCell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Assist_Text"));
assistCell.setPreferredSize(new Dimension(123, 30));
assistCellList.add(assistCell);
southPane.add(assistCell, BorderLayout.CENTER);
return southPane;
}
@Override @Override
public void refresh(TemplateTheme theme) { public void refresh(TemplateTheme theme) {
ThemedCellStyleList cellStyleConfig = theme.getCellStyleList(); ThemedCellStyleList cellStyleConfig = theme.getCellStyleList();
@ -134,6 +146,7 @@ public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreview
refresh(contentCellList, getMainContentStyle(cellStyleConfig)); refresh(contentCellList, getMainContentStyle(cellStyleConfig));
refresh(titleCellList, getSmallTitleStyle(cellStyleConfig)); refresh(titleCellList, getSmallTitleStyle(cellStyleConfig));
refresh(highLightCellList, getHighLightStyle(cellStyleConfig)); refresh(highLightCellList, getHighLightStyle(cellStyleConfig));
refresh(assistCellList, getAssistMsgStyle(cellStyleConfig));
} }
} }
} }

17
designer-base/src/main/java/com/fr/file/StashedFILE.java

@ -1,5 +1,9 @@
package com.fr.file; package com.fr.file;
import com.fr.base.io.XMLEncryptUtils;
import com.fr.io.EncryptUtils;
import com.fr.io.FineEncryptUtils;
import com.fr.stable.StringUtils;
import javax.swing.Icon; import javax.swing.Icon;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.InputStream; import java.io.InputStream;
@ -11,10 +15,16 @@ public class StashedFILE extends AbstractFILE {
private FILE file; private FILE file;
private byte[] content; private byte[] content;
private String suffix;
public StashedFILE(FILE file, byte[] content) { public StashedFILE(FILE file, byte[] content) {
this(file, content, null);
}
public StashedFILE(FILE file, byte[] content, String suffix) {
this.file = file; this.file = file;
this.content = content; this.content = content;
this.suffix = suffix;
} }
@Override @Override
@ -54,7 +64,12 @@ public class StashedFILE extends AbstractFILE {
@Override @Override
public InputStream asInputStream() throws Exception { public InputStream asInputStream() throws Exception {
return new ByteArrayInputStream(content); ByteArrayInputStream in = new ByteArrayInputStream(content);
return needDecode() ? XMLEncryptUtils.decodeInputStream(EncryptUtils.decodeInputStream(FineEncryptUtils.decode(in))) : in;
}
private boolean needDecode() {
return StringUtils.isNotEmpty(suffix) && (suffix.endsWith(".cpt") || suffix.endsWith(".frm"));
} }
@Override @Override

6
designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java

@ -156,10 +156,10 @@ public class ChartTypePane extends ChartCommonWizardPane implements CallbackEven
} }
if (!ChartEditContext.supportTheme() && chart4Update instanceof VanChart) { if (!ChartEditContext.supportTheme() && chart4Update instanceof VanChart) {
//主题中有的属性 不跟随属性 全部设置成自定义 //主题中有的属性 界面上屏蔽不跟随主题 属性全部设置成自定义
((VanChart) chart4Update).setThemeCustom(); ((VanChart) chart4Update).setThemeCustom();
//主题中没有的 根据主题深浅色自动 的属性 全部设置成自定义 // //主题中没有的 根据主题深浅色自动 的属性 默认自动
((VanChart) chart4Update).setAutoThemeCustom(); // ((VanChart) chart4Update).setAutoThemeCustom();
} }
update(chart4Update); update(chart4Update);

7
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java

@ -18,6 +18,7 @@ import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.ChartTypePane.ComboBoxPane; import com.fr.design.mainframe.chart.gui.ChartTypePane.ComboBoxPane;
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.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.vanchart.VanChart; import com.fr.plugin.chart.vanchart.VanChart;
@ -154,6 +155,12 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
addButton.addActionListener((e) -> { addButton.addActionListener((e) -> {
String name = getNewChartName(); String name = getNewChartName();
ChartProvider chart = getChangeStateNewChart(); ChartProvider chart = getChangeStateNewChart();
if (!ChartEditContext.supportTheme() && chart instanceof VanChart) {
//主题中有的属性 界面上屏蔽不跟随主题 属性全部设置成自定义
((VanChart) chart).setThemeCustom();
// //主题中没有的 根据主题深浅色自动 的属性 默认自动
// ((VanChart) chart4Update).setAutoThemeCustom();
}
checkInForm(chart); checkInForm(chart);
addNewChart(chart, name, editingCollection.getChartCount()); addNewChart(chart, name, editingCollection.getChartCount());
}); });

6
designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java

@ -152,6 +152,12 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<Van
newPlot.setCategoryNum(oldPlot.getCategoryNum()); newPlot.setCategoryNum(oldPlot.getCategoryNum());
//切换类型埋点 //切换类型埋点
ChartInfoCollector.getInstance().updateChartTypeTime(chart, oldPlot.getPlotID()); ChartInfoCollector.getInstance().updateChartTypeTime(chart, oldPlot.getPlotID());
if (!ChartEditContext.supportTheme()) {
//主题中有的属性 界面上屏蔽不跟随主题 属性全部设置成自定义
chart.setThemeCustom();
// //主题中没有的 根据主题深浅色自动 的属性 默认自动
// ((VanChart) chart4Update).setAutoThemeCustom();
}
} }
if (!ChartEditContext.supportTheme()) { if (!ChartEditContext.supportTheme()) {
chart.setAutoThemeCustom(); chart.setAutoThemeCustom();

18
designer-chart/src/main/java/com/fr/van/chart/map/designer/type/GisLayerPane.java

@ -238,18 +238,18 @@ public class GisLayerPane extends JPanel implements UIObserver {
public void resetGisLayer(VanChartMapPlot mapPlot) { public void resetGisLayer(VanChartMapPlot mapPlot) {
if (ChartEditContext.supportTheme()) { // if (ChartEditContext.supportTheme()) {
GisLayer defaultGisLayer = mapPlot.getDefaultGisLayer(); GisLayer defaultGisLayer = mapPlot.getDefaultGisLayer();
mapPlot.setGisLayer(defaultGisLayer); mapPlot.setGisLayer(defaultGisLayer);
populate(defaultGisLayer); populate(defaultGisLayer);
} else { // } else {
GaoDeGisType gaoDeGisType = mapPlot.getDefaultGisLayerType(); // GaoDeGisType gaoDeGisType = mapPlot.getDefaultGisLayerType();
//
mapPlot.getGisLayer().setGisLayerType(GISLayerType.GAO_DE_API); // mapPlot.getGisLayer().setGisLayerType(GISLayerType.GAO_DE_API);
mapPlot.getGisLayer().setLayerName(gaoDeGisType.getTypeName()); // mapPlot.getGisLayer().setLayerName(gaoDeGisType.getTypeName());
mapPlot.getGisLayer().setGaoDeGisType(gaoDeGisType); // mapPlot.getGisLayer().setGaoDeGisType(gaoDeGisType);
populate(mapPlot.getGisLayer()); // populate(mapPlot.getGisLayer());
} // }
} }
public void populate(GisLayer layer) { public void populate(GisLayer layer) {

Loading…
Cancel
Save