diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java index 0da46965b..25ecfcb34 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java @@ -1,10 +1,13 @@ package com.fr.design.data.datapane.connect; 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.design.border.UITitledBorder; import com.fr.design.gui.ibutton.UIButton; 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.UILabel; 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.EncodeConstants; import com.fr.stable.StringUtils; +import com.fr.third.guava.collect.HashBiMap; +import com.fr.workspace.WorkContext; import javax.swing.BorderFactory; import javax.swing.JFileChooser; @@ -28,6 +33,8 @@ import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; +import javax.swing.plaf.ComboBoxUI; +import javax.swing.plaf.basic.ComboPopup; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; @@ -45,6 +52,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; +import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -101,8 +109,60 @@ public class JDBCDefPane extends JPanel { private JDBCDatabaseConnection jdbcDatabase; 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 nameAndRepresent; public JDBCDefPane() { + initMap(); this.setBorder(UITitledBorder.createBorderWithTitle("JDBC" + ":")); this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); JPanel innerthis = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); @@ -115,7 +175,15 @@ public class JDBCDefPane extends JPanel { } dbtypeComboBox.addActionListener(dbtypeActionListener); 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.setEditable(true); driverComboBox.addActionListener(driverListener); @@ -163,9 +231,33 @@ public class JDBCDefPane extends JPanel { 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()); - 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); JPanel hostPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); @@ -225,7 +317,71 @@ public class JDBCDefPane extends JPanel { innerthis.add(centerPanel); } + private void refreshDriverLoader() { + Set 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 driverLoaders = DriverLoaderConfig.getInstance().getDriverLoaders(); + nameAndRepresent = getDriverLoaderAndRepresent(driverLoaders); + } + + private HashBiMap getDriverLoaderAndRepresent(Map driverLoaders) { + HashBiMap 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) { + // 单例对象,重新打开的时候并不会新建,但是由于driverloaderbox里面需要是动态内容,因此需要进行刷新动作 + initMap(); + refreshDriverLoader(); needRefresh = false; if (jdbcDatabase == null) { jdbcDatabase = new JDBCDatabaseConnection(); @@ -255,7 +411,24 @@ public class JDBCDefPane extends JPanel { this.dbtypeComboBox.setSelectedItem(OTHER_DB); } } - this.driverComboBox.setSelectedItem(jdbcDatabase.getDriver()); + // 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()); + } 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.userNameTextField.setText(jdbcDatabase.getUser()); this.passwordTextField.setText(jdbcDatabase.getPassword()); @@ -268,31 +441,10 @@ public class JDBCDefPane extends JPanel { 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() { if (jdbcDatabase == null) { jdbcDatabase = new JDBCDatabaseConnection(); } - Object driveItem = this.driverComboBox.getSelectedItem(); - jdbcDatabase.setDriver(driveItem == null ? null : driveItem.toString().trim()); jdbcDatabase.setURL(this.urlTextField.getText().trim()); jdbcDatabase.setUser(this.userNameTextField.getText().trim()); jdbcDatabase.setPassword(new String(this.passwordTextField.getPassword()).trim()); @@ -304,36 +456,30 @@ public class JDBCDefPane extends JPanel { jdbcDatabase.setNewCharsetName(EncodeConstants.ENCODING_GBK); jdbcDatabase.setOriginalCharsetName(((String) this.charSetComboBox.getSelectedItem())); } - return jdbcDatabase; - } - - ActionListener dbtypeActionListener = new ActionListener() { - public void actionPerformed(ActionEvent evt) { - - urlTextField.setText(StringUtils.EMPTY); - driverComboBox.removeAllItems(); - 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()); + String driverLoader = (String) this.driverLoaderBox.getSelectedItem(); + if (driverLoader == null) { + driverLoader = StringUtils.EMPTY; + } + if (isSelfDefine()) { + String[] split = driverLoader.split("\\("); + if (split.length > 1) { + String name = split[1]; + if (name.length() > 0) { + jdbcDatabase.setDriverSource(name.substring(0, name.length() - 1)); + } else { + jdbcDatabase.setDriverSource(StringUtils.EMPTY); } + } else { + jdbcDatabase.setDriverSource(StringUtils.EMPTY); } - // 更改数据库类型后 数据库名称置空和之前逻辑保持一致 - if (needRefresh) { - jdbcDatabase.setDatabase(StringUtils.EMPTY); - } - changePane(dbtypeComboBox.getSelectedItem()); - JDBCConnectionDef.getInstance().setConnection((String) dbtypeComboBox.getSelectedItem(), jdbcDatabase); - DatabaseConnectionPane.JDBC.getAdvancedAttrPane().populate(jdbcDatabase); + jdbcDatabase.setDriver(split[0]); + } else { + Object driveItem = this.driverComboBox.getSelectedItem(); + jdbcDatabase.setDriver(driveItem == null ? null : driveItem.toString().trim()); + jdbcDatabase.setDriverSource(StringUtils.EMPTY); } - }; + return jdbcDatabase; + } ActionListener driverListener = new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -579,4 +725,22 @@ public class JDBCDefPane extends JPanel { private String driver; 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(); + } + + } + } diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index 52fb1bcfa..667592552 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/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.JTemplate; import com.fr.design.mainframe.JVirtualTemplate; -import com.fr.design.module.DesignModuleFactory; import com.fr.design.ui.util.UIUtil; import com.fr.file.FILE; import com.fr.file.FileNodeFILE; @@ -361,22 +360,30 @@ public class HistoryTemplateListCache implements CallbackEvent { int size = historyList.size(); for (int i = 0; i < size; i++) { JTemplate template = historyList.get(i); - FILE file = template.getEditingFILE(); - try { - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - BaseBook target = template.getTarget(); - if (target != null) { - target.export(outputStream); - stashFILEMap.put(i, new StashedFILE(file, outputStream.toByteArray())); - } - // 如果 target == null 那么这个模板是被模板内存优化功能处理过的,不用处理 - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); + 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(); + try { + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + BaseBook target = template.getTarget(); + if (target != null) { + target.export(outputStream); + return new StashedFILE(file, outputStream.toByteArray(), template.suffix()); + } + // 如果 target == null 那么这个模板是被模板内存优化功能处理过的,不用处理 + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + return null; + } + private boolean checkStash() { try { return stashWorker.get(); @@ -458,18 +465,10 @@ public class HistoryTemplateListCache implements CallbackEvent { FILE file = template.getEditingFILE(); boolean needReload = context == null || needReloadTemplate(context, template); if (needReload) { - try { - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - BaseBook target = template.getTarget(); - if (target != null) { - FineLoggerFactory.getLogger().info("{} is being reloaded", file.getName()); - target.export(outputStream); - FILE stashedFile = new StashedFILE(file, outputStream.toByteArray()); - template.refreshResource(stashedFile); - } - // 如果 target == null 那么这个模板是被模板内存优化功能处理过的,不用处理 - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); + FILE stashFile = templateToStashFile(template); + if (stashFile != null) { + FineLoggerFactory.getLogger().info("{} is being reloaded", file.getName()); + template.refreshResource(stashFile); } } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index f09b9ebb7..c9b223c52 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -466,8 +466,11 @@ public abstract class JTemplate> } private void setTargetByFile(FILE file) { - this.template = JTemplateFactory.asIOFile(file, this.suffix()); - setTarget(this.template); + T newTemplate = JTemplateFactory.asIOFile(file, this.suffix()); + if (newTemplate != null) { + this.template = newTemplate; + setTarget(this.template); + } } private void addCenterPane() { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ReportThemePreviewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ReportThemePreviewPane.java index 4ceec636d..2033e7072 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ReportThemePreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ReportThemePreviewPane.java @@ -41,7 +41,7 @@ public class ReportThemePreviewPane extends TemplateThemePreviewPane headerCellList = new ArrayList<>(); private final List contentCellList = new ArrayList<>(); private final List highLightCellList = new ArrayList<>(); + private final List assistCellList = new ArrayList<>(); private static final int COL_COUNT = 5; private static final int CONTENT_ROW_COUNT = 2; public ECPreviewPane() { - this.setPreferredSize(new Dimension(517, 147)); + this.setPreferredSize(new Dimension(517, 158)); this.setBorder(BorderFactory.createEmptyBorder(0, 1, 2, 1)); this.setLayout(FRGUIPaneFactory.createBorderLayout()); 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++) { PreviewCell cell = new PreviewCell(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Header")); cell.setPreferredSize(new Dimension(103, 36)); @@ -40,22 +43,29 @@ public class ECPreviewPane extends AbstractECPreviewPane { headerCellList.add(cell); } 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++) { 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); contentCellList.add(cell); } JPanel endPane = new UINoOpaquePanel(new GridLayout()); - this.add(endPane, BorderLayout.SOUTH); + extCenterPane.add(endPane, BorderLayout.SOUTH); for (int i = 0; i < COL_COUNT; i++) { 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); 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 @@ -64,6 +74,8 @@ public class ECPreviewPane extends AbstractECPreviewPane { refresh(headerCellList, getReportHeaderStyle(cellStyleConfig)); refresh(contentCellList, getMainContentStyle(cellStyleConfig)); refresh(highLightCellList, getHighLightStyle(cellStyleConfig)); + refresh(highLightCellList, getHighLightStyle(cellStyleConfig)); + refresh(assistCellList, getAssistMsgStyle(cellStyleConfig)); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECReportPreviewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECReportPreviewPane.java index 885f480b7..432c8b49c 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECReportPreviewPane.java +++ b/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 titleCellList = new ArrayList<>(); private final List contentCellList = new ArrayList<>(); private final List highLightCellList = new ArrayList<>(); + private final List assistCellList = new ArrayList<>(); private static final int CONTENT_ROW_COUNT = 3; private static final int COL_COUNT = 5; @@ -54,8 +55,10 @@ public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreview this.setLayout(FRGUIPaneFactory.createBorderLayout()); JPanel northPane = createNorthPane(); JPanel centerPane = createCenterPane(); + JPanel southPane = createSouthPane(); this.add(northPane, BorderLayout.NORTH); this.add(centerPane, BorderLayout.CENTER); + this.add(southPane, BorderLayout.SOUTH); } private JPanel createNorthPane() { @@ -126,6 +129,15 @@ public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreview 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 public void refresh(TemplateTheme theme) { ThemedCellStyleList cellStyleConfig = theme.getCellStyleList(); @@ -134,6 +146,7 @@ public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreview refresh(contentCellList, getMainContentStyle(cellStyleConfig)); refresh(titleCellList, getSmallTitleStyle(cellStyleConfig)); refresh(highLightCellList, getHighLightStyle(cellStyleConfig)); + refresh(assistCellList, getAssistMsgStyle(cellStyleConfig)); } } } diff --git a/designer-base/src/main/java/com/fr/file/StashedFILE.java b/designer-base/src/main/java/com/fr/file/StashedFILE.java index 454433874..48f00f95b 100644 --- a/designer-base/src/main/java/com/fr/file/StashedFILE.java +++ b/designer-base/src/main/java/com/fr/file/StashedFILE.java @@ -1,5 +1,9 @@ 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 java.io.ByteArrayInputStream; import java.io.InputStream; @@ -11,10 +15,16 @@ public class StashedFILE extends AbstractFILE { private FILE file; private byte[] content; + private String suffix; public StashedFILE(FILE file, byte[] content) { + this(file, content, null); + } + + public StashedFILE(FILE file, byte[] content, String suffix) { this.file = file; this.content = content; + this.suffix = suffix; } @Override @@ -54,7 +64,12 @@ public class StashedFILE extends AbstractFILE { @Override 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 diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java b/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java index 748a64069..ffa1d5002 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java +++ b/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) { - //主题中有的属性 不跟随属性 全部设置成自定义 + //主题中有的属性 界面上屏蔽不跟随主题 属性全部设置成自定义 ((VanChart) chart4Update).setThemeCustom(); - //主题中没有的 根据主题深浅色自动 的属性 全部设置成自定义 - ((VanChart) chart4Update).setAutoThemeCustom(); +// //主题中没有的 根据主题深浅色自动 的属性 默认自动 +// ((VanChart) chart4Update).setAutoThemeCustom(); } update(chart4Update); diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index 7260fe581..cadf577eb 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/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.mainframe.chart.gui.ChartTypePane.ComboBoxPane; import com.fr.design.mainframe.chart.info.ChartInfoCollector; +import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.vanchart.VanChart; @@ -154,6 +155,12 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen addButton.addActionListener((e) -> { String name = getNewChartName(); ChartProvider chart = getChangeStateNewChart(); + if (!ChartEditContext.supportTheme() && chart instanceof VanChart) { + //主题中有的属性 界面上屏蔽不跟随主题 属性全部设置成自定义 + ((VanChart) chart).setThemeCustom(); +// //主题中没有的 根据主题深浅色自动 的属性 默认自动 +// ((VanChart) chart4Update).setAutoThemeCustom(); + } checkInForm(chart); addNewChart(chart, name, editingCollection.getChartCount()); }); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java index 3456dd0be..a486174ae 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java @@ -152,6 +152,12 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane