From f6078b1742d8f7a944c5c8c404f008f132e04476 Mon Sep 17 00:00:00 2001 From: shine Date: Fri, 23 Apr 2021 14:33:55 +0800 Subject: [PATCH 01/29] refactor: center region 4 designer Frame --- .../mainframe/CenterRegionContainerPane.java | 230 ++++++++++++++++++ .../fr/design/mainframe/DesignerFrame.java | 163 ++----------- 2 files changed, 245 insertions(+), 148 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java diff --git a/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java new file mode 100644 index 000000000..cb04a942e --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java @@ -0,0 +1,230 @@ +package com.fr.design.mainframe; + +import com.fr.design.DesignState; +import com.fr.design.base.mode.DesignModeContext; +import com.fr.design.constants.UIConstants; +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.file.MutilTempalteTabPane; +import com.fr.design.file.NewTemplatePane; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.imenu.UIMenuHighLight; +import com.fr.design.gui.itoolbar.UIToolbar; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.toolbar.ToolBarMenuDock; +import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; +import org.jetbrains.annotations.Nullable; + +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.border.MatteBorder; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Insets; +import java.util.ArrayList; + +/** + * @author shine + * @version 10.0 + * Created by shine on 2021/4/6 + */ +public class CenterRegionContainerPane extends JPanel { + + private static volatile CenterRegionContainerPane THIS; + + private static final int LEFT_ALIGN_GAP = -5; + + private DesktopCardPane centerTemplateCardPane; + + private JPanel toolbarPane;//撤销重做 等工具栏 + 模板tab标签 + maybe have cpt 字体 + + private JComponent toolbarComponent;//cpt 字体 等工具栏 + + private JPanel eastCenterPane; + + private UIToolbar combineUp;//撤销重做 等工具栏 + + private NewTemplatePane newWorkBookPane;//模板tab标签 + + + public static CenterRegionContainerPane getInstance() { + if (THIS == null) { + synchronized (CenterRegionContainerPane.class) { + if (THIS == null) { + THIS = new CenterRegionContainerPane(); + } + } + } + return THIS; + } + + public CenterRegionContainerPane() { + + toolbarPane = new JPanel() { + + @Override + public Dimension getPreferredSize() { + + Dimension dim = super.getPreferredSize(); + // dim.height = TOOLBAR_HEIGHT; + return dim; + } + }; + toolbarPane.setLayout(FRGUIPaneFactory.createBorderLayout()); + JPanel eastPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + eastPane.add(getToolBarMenuDock().createLargeToolbar(), BorderLayout.WEST); + eastCenterPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + combineUpTooBar(); + eastCenterPane.add(combineUp, BorderLayout.NORTH); + JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + panel.add(newWorkBookPane = getToolBarMenuDock().getNewTemplatePane(), BorderLayout.WEST); + panel.add(MutilTempalteTabPane.getInstance(), BorderLayout.CENTER); + eastCenterPane.add(panel, BorderLayout.CENTER); + + eastPane.add(eastCenterPane, BorderLayout.CENTER); + toolbarPane.add(eastPane, BorderLayout.NORTH); + toolbarPane.add(new UIMenuHighLight(), BorderLayout.SOUTH); + + this.setLayout(new BorderLayout()); + this.add(centerTemplateCardPane = new DesktopCardPane(), BorderLayout.CENTER); + this.add(toolbarPane, BorderLayout.NORTH); + + } + + private ToolBarMenuDock getToolBarMenuDock() { + return DesignerContext.getDesignerFrame().getToolBarMenuDock(); + } + + /** + * 创建上工具栏 + */ + private void combineUpTooBar() { + combineUp = new UIToolbar(FlowLayout.LEFT); + combineUp.setBorder(new MatteBorder(new Insets(0, LEFT_ALIGN_GAP, 1, 0), UIConstants.LINE_COLOR)); + combineUp.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 2)); + setUpUpToolBar(null); + + } + + + /** + * 重置上工具栏 + */ + private void resetCombineUpTooBar(JComponent[] toolbar4Form) { + combineUp.removeAll(); + setUpUpToolBar(toolbar4Form); + } + + + /** + * 填充上工具栏的中的工具 + * + * @param toolbar4Form 目标组件 + */ + private void setUpUpToolBar(@Nullable JComponent[] toolbar4Form) { + UIButton[] fixButtons = getToolBarMenuDock().createUp(); + for (UIButton fixButton : fixButtons) { + combineUp.add(fixButton); + } + if (!DesignModeContext.isAuthorityEditing()) { + combineUp.addSeparator(new Dimension(2, 16)); + if (toolbar4Form != null) { + for (JComponent jComponent : toolbar4Form) { + combineUp.add(jComponent); + } + } + } + //添加分享按钮 + addShareButton(); + //添加插件中的按钮 + addExtraButtons(); + } + + + private void addExtraButtons() { + + JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + if (jt == null) { + return; + } + + + UIButton[] extraButtons = jt.createExtraButtons(); + for (UIButton extraButton : extraButtons) { + combineUp.add(extraButton); + } + if (extraButtons.length > 0) { + combineUp.addSeparator(new Dimension(2, 16)); + } + } + + private void addShareButton() { + + JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + if (jt == null) { + return; + } + + combineUp.addSeparator(new Dimension(2, 16)); + UIButton[] shareButtons = jt.createShareButton(); + for (UIButton shareButton : shareButtons) { + combineUp.add(shareButton); + } + } + + /** + * 检查 + * + * @param flag 组件是否可见 + * @param al 组件名称 + */ + protected void checkCombineUp(boolean flag, ArrayList al) { + //Yvan: 检查当前是否为WORK_SHEET状态,因为只有WORK_SHEET中含有格式刷组件,此时是不需要进行checkComponentsByNames的 + JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + if (jTemplate != null) { + // 第一个条件满足后还需要添加一重判断,判断是编辑报表块还是参数面板,编辑报表块时则直接return + if (jTemplate.getMenuState() == DesignState.WORK_SHEET && !jTemplate.isUpMode()) { + return; + } + combineUp.checkComponentsByNames(flag, al); + } + } + + + /** + * 重置相关的工具条. + * + * @param plus 工具条中相关信息 + */ + protected void resetToolkitByPlus(ToolBarMenuDockPlus plus, ToolBarMenuDock ad) { + + resetCombineUpTooBar(ad.resetUpToolBar(plus)); + + if (toolbarComponent != null) { + toolbarPane.remove(toolbarComponent); + } + + // 颜色,字体那些按钮的工具栏 + toolbarPane.add(toolbarComponent = ad.resetToolBar(toolbarComponent, plus), BorderLayout.CENTER); + } + + JComponent getToolbarComponent() { + + return this.toolbarComponent; + } + + /** + * 判断是否在权限编辑状态,若是在权限编辑状态,则需要有虚线框和关闭突变 + */ + protected void needToAddAuhtorityPaint() { + newWorkBookPane.setButtonGray(DesignModeContext.isAuthorityEditing()); + + } + + + protected DesktopCardPane getCenterTemplateCardPane() { + + return centerTemplateCardPane; + } + +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index b826931b6..8c5cc8901 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -21,17 +21,14 @@ import com.fr.design.event.TargetModifiedListener; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.MutilTempalteTabPane; -import com.fr.design.file.NewTemplatePane; import com.fr.design.file.SaveSomeTemplatePane; import com.fr.design.file.TemplateTreePane; import com.fr.design.fun.OemProcessor; import com.fr.design.fun.TitlePlaceProcessor; import com.fr.design.fun.impl.AbstractTemplateTreeShortCutProvider; -import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.imenu.UIMenuHighLight; import com.fr.design.gui.iprogressbar.ProgressDialog; import com.fr.design.gui.iscrollbar.UIScrollBar; -import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.loghandler.LogMessageBar; @@ -70,7 +67,6 @@ import com.fr.start.OemHandler; import com.fr.workspace.WorkContext; import com.fr.workspace.Workspace; import com.fr.workspace.connect.WorkspaceConnectionInfo; -import org.jetbrains.annotations.Nullable; import javax.swing.Icon; import javax.swing.JComponent; @@ -82,15 +78,13 @@ import javax.swing.JPanel; import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.WindowConstants; -import javax.swing.border.MatteBorder; import java.awt.BorderLayout; +import java.awt.Component; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Graphics; -import java.awt.Insets; import java.awt.Point; import java.awt.Rectangle; -import java.awt.Component; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.dnd.DnDConstants; @@ -123,8 +117,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta private static final long serialVersionUID = -8732559571067484460L; - private static final int LEFT_ALIGN_GAP = -5; - private static final int MENU_HEIGHT = 26; private static final Integer SECOND_LAYER = 100; @@ -135,22 +127,10 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta private ToolBarMenuDock ad; - private DesktopCardPane centerTemplateCardPane; - - private JPanel toolbarPane; - - private JComponent toolbarComponent; - private JPanel menuPane; private JMenuBar menuBar; - private JPanel eastCenterPane; - - private UIToolbar combineUp; - - private NewTemplatePane newWorkBookPane; - private Icon closeMode; private JLayeredPane layeredPane = this.getLayeredPane(); @@ -268,37 +248,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta // the content pane basePane.setLayout(new BorderLayout()); - toolbarPane = new JPanel() { - - @Override - public Dimension getPreferredSize() { - Dimension dim = super.getPreferredSize(); - // dim.height = TOOLBAR_HEIGHT; - return dim; - } - }; - toolbarPane.setLayout(FRGUIPaneFactory.createBorderLayout()); - JPanel eastPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - eastPane.add(ad.createLargeToolbar(), BorderLayout.WEST); - eastCenterPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - combineUpTooBar(); - eastCenterPane.add(combineUp, BorderLayout.NORTH); - JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - panel.add(newWorkBookPane = ad.getNewTemplatePane(), BorderLayout.WEST); - panel.add(MutilTempalteTabPane.getInstance(), BorderLayout.CENTER); - eastCenterPane.add(panel, BorderLayout.CENTER); - - eastPane.add(eastCenterPane, BorderLayout.CENTER); - toolbarPane.add(eastPane, BorderLayout.NORTH); - toolbarPane.add(new UIMenuHighLight(), BorderLayout.SOUTH); - - JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - centerPane.add(centerTemplateCardPane = new DesktopCardPane(), BorderLayout.CENTER); - centerPane.add(toolbarPane, BorderLayout.NORTH); - - - basePane.add(centerPane, BorderLayout.CENTER); + basePane.add(CenterRegionContainerPane.getInstance(), BorderLayout.CENTER); laoyoutWestPane(); basePane.add(EastRegionContainerPane.getInstance(), BorderLayout.EAST); basePane.setBounds(0, 0, contentWidth, contentHeight); @@ -406,7 +357,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta protected DesktopCardPane getCenterTemplateCardPane() { - return centerTemplateCardPane; + return CenterRegionContainerPane.getInstance().getCenterTemplateCardPane(); } /** @@ -664,80 +615,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta this.closeMode = closeMode; } - /** - * 创建上工具栏 - */ - private void combineUpTooBar() { - combineUp = new UIToolbar(FlowLayout.LEFT); - combineUp.setBorder(new MatteBorder(new Insets(0, LEFT_ALIGN_GAP, 1, 0), UIConstants.LINE_COLOR)); - combineUp.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 2)); - setUpUpToolBar(null); - - } - - /** - * 重置上工具栏 - */ - private void resetCombineUpTooBar(JComponent[] toolbar4Form) { - combineUp.removeAll(); - setUpUpToolBar(toolbar4Form); - } - - /** - * 填充上工具栏的中的工具 - * - * @param toolbar4Form 目标组件 - */ - private void setUpUpToolBar(@Nullable JComponent[] toolbar4Form) { - UIButton[] fixButtons = ad.createUp(); - for (UIButton fixButton : fixButtons) { - combineUp.add(fixButton); - } - if (!DesignModeContext.isAuthorityEditing()) { - combineUp.addSeparator(new Dimension(2, 16)); - if (toolbar4Form != null) { - for (JComponent jComponent : toolbar4Form) { - combineUp.add(jComponent); - } - } - } - //添加分享按钮 - addShareButton(); - //添加插件中的按钮 - addExtraButtons(); - } - - private void addExtraButtons() { - - JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - if (jt == null) { - return; - } - - - UIButton[] extraButtons = jt.createExtraButtons(); - for (UIButton extraButton : extraButtons) { - combineUp.add(extraButton); - } - if (extraButtons.length > 0) { - combineUp.addSeparator(new Dimension(2, 16)); - } - } - - private void addShareButton() { - - JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - if (jt == null) { - return; - } - - combineUp.addSeparator(new Dimension(2, 16)); - UIButton[] shareButtons = jt.createShareButton(); - for (UIButton shareButton : shareButtons) { - combineUp.add(shareButton); - } - } - /** * 检查 * @@ -745,17 +622,10 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * @param al 组件名称 */ public void checkCombineUp(boolean flag, ArrayList al) { - //Yvan: 检查当前是否为WORK_SHEET状态,因为只有WORK_SHEET中含有格式刷组件,此时是不需要进行checkComponentsByNames的 - JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - if (jTemplate != null) { - // 第一个条件满足后还需要添加一重判断,判断是编辑报表块还是参数面板,编辑报表块时则直接return - if (jTemplate.getMenuState() == DesignState.WORK_SHEET && !jTemplate.isUpMode()) { - return; - } - combineUp.checkComponentsByNames(flag, al); - } + CenterRegionContainerPane.getInstance().checkCombineUp(flag, al); } + /** * 刷新工具条. */ @@ -764,6 +634,10 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta this.ad.updateToolBarDef(); } + public ToolBarMenuDock getToolBarMenuDock() { + return this.ad; + } + /** * 重置相关的工具条. * @@ -783,14 +657,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta ad.resetJMenuBar(menuBar, plus); } - resetCombineUpTooBar(ad.resetUpToolBar(plus)); - - if (toolbarComponent != null) { - toolbarPane.remove(toolbarComponent); - } - - // 颜色,字体那些按钮的工具栏 - toolbarPane.add(toolbarComponent = ad.resetToolBar(toolbarComponent, plus), BorderLayout.CENTER); + CenterRegionContainerPane.getInstance().resetToolkitByPlus(plus, ad); this.checkToolbarMenuEnable(); this.validate(); @@ -799,7 +666,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta public JComponent getToolbarComponent() { - return this.toolbarComponent; + return CenterRegionContainerPane.getInstance().getToolbarComponent(); } /** @@ -807,7 +674,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta */ public void needToAddAuhtorityPaint() { - newWorkBookPane.setButtonGray(DesignModeContext.isAuthorityEditing()); + CenterRegionContainerPane.getInstance().needToAddAuhtorityPaint(); // 进入或退出权限编辑模式,通知插件 Set extraShortCuts = ExtraDesignClassManager.getInstance().getExtraShortCuts(); @@ -923,7 +790,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta */ public JTemplate getSelectedJTemplate() { - return this.centerTemplateCardPane.getSelectedJTemplate(); + return getCenterTemplateCardPane().getSelectedJTemplate(); } /** @@ -991,7 +858,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta jt.addJTemplateActionListener(this); jt.addTargetModifiedListener(this); jt.addJTemplateActionListener(VcsHelper.getInstance()); - centerTemplateCardPane.showJTemplate(jt); + getCenterTemplateCardPane().showJTemplate(jt); setTitle(); layeredPane.repaint(); } @@ -1009,7 +876,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta if (jt == null || jt.getEditingFILE() == null) { return; } - centerTemplateCardPane.showJTemplate(jt); + getCenterTemplateCardPane().showJTemplate(jt); setTitle(); layeredPane.repaint(); } From f57d523e14dd52fc454b12ccfd90ec1dafc3a05b Mon Sep 17 00:00:00 2001 From: shine Date: Fri, 23 Apr 2021 15:00:20 +0800 Subject: [PATCH 02/29] refactor: north region 4 designer Frame --- .../fr/design/mainframe/DesignerFrame.java | 100 +----------- .../mainframe/NorthRegionContainerPane.java | 142 ++++++++++++++++++ 2 files changed, 146 insertions(+), 96 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 8c5cc8901..0b20a191a 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -24,14 +24,10 @@ import com.fr.design.file.MutilTempalteTabPane; import com.fr.design.file.SaveSomeTemplatePane; import com.fr.design.file.TemplateTreePane; import com.fr.design.fun.OemProcessor; -import com.fr.design.fun.TitlePlaceProcessor; import com.fr.design.fun.impl.AbstractTemplateTreeShortCutProvider; -import com.fr.design.gui.imenu.UIMenuHighLight; import com.fr.design.gui.iprogressbar.ProgressDialog; import com.fr.design.gui.iscrollbar.UIScrollBar; import com.fr.design.i18n.Toolkit; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.mainframe.loghandler.LogMessageBar; import com.fr.design.mainframe.toolbar.ToolBarMenuDock; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.vcs.common.VcsHelper; @@ -47,20 +43,13 @@ import com.fr.file.FILE; import com.fr.file.FILEFactory; import com.fr.file.FileFILE; import com.fr.general.ComparatorUtils; -import com.fr.general.GeneralContext; import com.fr.general.IOUtils; import com.fr.invoke.Reflect; import com.fr.log.FineLoggerFactory; -import com.fr.plugin.context.PluginContext; -import com.fr.plugin.injectable.PluginModule; -import com.fr.plugin.manage.PluginFilter; -import com.fr.plugin.observer.PluginEvent; -import com.fr.plugin.observer.PluginEventListener; import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; import com.fr.stable.image4j.codec.ico.ICODecoder; import com.fr.stable.os.OperatingSystem; -import com.fr.stable.os.support.OSBasedAction; import com.fr.stable.os.support.OSSupportCenter; import com.fr.stable.project.ProjectConstants; import com.fr.start.OemHandler; @@ -72,16 +61,12 @@ import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JLayeredPane; -import javax.swing.JMenuBar; import javax.swing.JOptionPane; import javax.swing.JPanel; -import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.WindowConstants; import java.awt.BorderLayout; -import java.awt.Component; import java.awt.Dimension; -import java.awt.FlowLayout; import java.awt.Graphics; import java.awt.Point; import java.awt.Rectangle; @@ -127,10 +112,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta private ToolBarMenuDock ad; - private JPanel menuPane; - - private JMenuBar menuBar; - private Icon closeMode; private JLayeredPane layeredPane = this.getLayeredPane(); @@ -365,80 +346,10 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta */ protected void initMenuPane() { - menuPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - menuPane.add(new UIMenuHighLight(), BorderLayout.SOUTH); - menuPane.add(initNorthEastPane(ad), BorderLayout.EAST); - basePane.add(menuPane, BorderLayout.NORTH); + basePane.add(NorthRegionContainerPane.getInstance(), BorderLayout.NORTH); this.resetToolkitByPlus(null); } - /** - * @param ad 菜单栏 - * @return panel - */ - protected JPanel initNorthEastPane(final ToolBarMenuDock ad) { - //hugh: private修改为protected方便oem的时候修改右上的组件构成 - //顶部日志+登陆按钮 - final JPanel northEastPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - //优先级为-1,保证最后全面刷新一次 - GeneralContext.listenPluginRunningChanged(new PluginEventListener(-1) { - - @Override - public void on(PluginEvent event) { - - refreshNorthEastPane(northEastPane, ad); - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - if (DesignerContext.getDesignerFrame() == null) { - return; - } - DesignerContext.getDesignerFrame().refresh(); - DesignerContext.getDesignerFrame().repaint(); - } - }); - } - }, new PluginFilter() { - - @Override - public boolean accept(PluginContext context) { - - return context.contain(PluginModule.ExtraDesign); - } - }); - refreshNorthEastPane(northEastPane, ad); - return northEastPane; - } - - private void refreshNorthEastPane(final JPanel northEastPane, final ToolBarMenuDock ad) { - - northEastPane.removeAll(); - northEastPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0)); - northEastPane.add(LogMessageBar.getInstance()); - TitlePlaceProcessor processor = ExtraDesignClassManager.getInstance().getSingle(TitlePlaceProcessor.MARK_STRING); - if (processor != null) { - final Component[] bbsLoginPane = {null}; - OSSupportCenter.buildAction(new OSBasedAction() { - @Override - public void execute(Object... objects) { - bbsLoginPane[0] = ad.createBBSLoginPane(); - } - }, SupportOSImpl.USERINFOPANE); - processor.hold(northEastPane, LogMessageBar.getInstance(), bbsLoginPane[0]); - } - northEastPane.add(ad.createAlphaFinePane()); - if (!DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isEnabled()) { - ad.createAlphaFinePane().setVisible(false); - } - OSSupportCenter.buildAction(new OSBasedAction() { - @Override - public void execute(Object... objects) { - northEastPane.add(ad.createBBSLoginPane()); - } - }, SupportOSImpl.USERINFOPANE); - - } - public void initTitleIcon() { try { @@ -634,7 +545,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta this.ad.updateToolBarDef(); } - public ToolBarMenuDock getToolBarMenuDock() { + ToolBarMenuDock getToolBarMenuDock() { return this.ad; } @@ -651,11 +562,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta DesignState designState = new DesignState(plus); MenuManager.getInstance().setMenus4Designer(designState); - if (menuBar == null) { - menuPane.add(menuBar = ad.createJMenuBar(plus), BorderLayout.CENTER); - } else { - ad.resetJMenuBar(menuBar, plus); - } + + NorthRegionContainerPane.getInstance().resetToolkitByPlus(plus, ad); CenterRegionContainerPane.getInstance().resetToolkitByPlus(plus, ad); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java new file mode 100644 index 000000000..dcc274eed --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java @@ -0,0 +1,142 @@ +package com.fr.design.mainframe; + +import com.fr.design.DesignState; +import com.fr.design.DesignerEnvManager; +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.fun.TitlePlaceProcessor; +import com.fr.design.gui.imenu.UIMenuHighLight; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.loghandler.LogMessageBar; +import com.fr.design.mainframe.toolbar.ToolBarMenuDock; +import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; +import com.fr.design.menu.MenuManager; +import com.fr.design.os.impl.SupportOSImpl; +import com.fr.general.GeneralContext; +import com.fr.plugin.context.PluginContext; +import com.fr.plugin.injectable.PluginModule; +import com.fr.plugin.manage.PluginFilter; +import com.fr.plugin.observer.PluginEvent; +import com.fr.plugin.observer.PluginEventListener; +import com.fr.stable.os.support.OSBasedAction; +import com.fr.stable.os.support.OSSupportCenter; + +import javax.swing.JMenuBar; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.FlowLayout; + +/** + * @author shine + * @version 10.0 + * Created by shine on 2021/4/6 + */ +public class NorthRegionContainerPane extends JPanel { + + private static volatile NorthRegionContainerPane THIS; + + private JMenuBar menuBar; + + public static NorthRegionContainerPane getInstance() { + if (THIS == null) { + synchronized (NorthRegionContainerPane.class) { + if (THIS == null) { + THIS = new NorthRegionContainerPane(); + } + } + } + return THIS; + } + + public NorthRegionContainerPane() { + + ToolBarMenuDock ad = DesignerContext.getDesignerFrame().getToolBarMenuDock(); + + this.setLayout(new BorderLayout()); + this.add(new UIMenuHighLight(), BorderLayout.SOUTH); + this.add(initNorthEastPane(ad), BorderLayout.EAST); + } + + /** + * @param ad 菜单栏 + * @return panel + */ + protected JPanel initNorthEastPane(final ToolBarMenuDock ad) { + //hugh: private修改为protected方便oem的时候修改右上的组件构成 + //顶部日志+登陆按钮 + final JPanel northEastPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + //优先级为-1,保证最后全面刷新一次 + GeneralContext.listenPluginRunningChanged(new PluginEventListener(-1) { + + @Override + public void on(PluginEvent event) { + + refreshNorthEastPane(northEastPane, ad); + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + if (DesignerContext.getDesignerFrame() == null) { + return; + } + DesignerContext.getDesignerFrame().refresh(); + DesignerContext.getDesignerFrame().repaint(); + } + }); + } + }, new PluginFilter() { + + @Override + public boolean accept(PluginContext context) { + + return context.contain(PluginModule.ExtraDesign); + } + }); + refreshNorthEastPane(northEastPane, ad); + return northEastPane; + } + + private void refreshNorthEastPane(final JPanel northEastPane, final ToolBarMenuDock ad) { + + northEastPane.removeAll(); + northEastPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0)); + northEastPane.add(LogMessageBar.getInstance()); + TitlePlaceProcessor processor = ExtraDesignClassManager.getInstance().getSingle(TitlePlaceProcessor.MARK_STRING); + if (processor != null) { + final Component[] bbsLoginPane = {null}; + OSSupportCenter.buildAction(new OSBasedAction() { + @Override + public void execute(Object... objects) { + bbsLoginPane[0] = ad.createBBSLoginPane(); + } + }, SupportOSImpl.USERINFOPANE); + processor.hold(northEastPane, LogMessageBar.getInstance(), bbsLoginPane[0]); + } + northEastPane.add(ad.createAlphaFinePane()); + if (!DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isEnabled()) { + ad.createAlphaFinePane().setVisible(false); + } + OSSupportCenter.buildAction(new OSBasedAction() { + @Override + public void execute(Object... objects) { + northEastPane.add(ad.createBBSLoginPane()); + } + }, SupportOSImpl.USERINFOPANE); + + } + + /** + * 重置相关的工具条. + * + * @param plus 工具条中相关信息 + */ + void resetToolkitByPlus(ToolBarMenuDockPlus plus, ToolBarMenuDock ad) { + DesignState designState = new DesignState(plus); + MenuManager.getInstance().setMenus4Designer(designState); + if (menuBar == null) { + this.add(menuBar = ad.createJMenuBar(plus), BorderLayout.CENTER); + } else { + ad.resetJMenuBar(menuBar, plus); + } + } +} From ba88eedb2754a7ee19818e8921b1622576264fa7 Mon Sep 17 00:00:00 2001 From: shine Date: Sun, 25 Apr 2021 09:57:13 +0800 Subject: [PATCH 03/29] =?UTF-8?q?feature:=20JTemplate=E6=96=B0=E5=A2=9E=20?= =?UTF-8?q?=E5=81=9C=E7=94=A8=E6=A8=A1=E6=9D=BF+=E6=8C=87=E5=AE=9A?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E6=89=80=E9=9C=80=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/DesignerFrame.java | 52 ++++++++++++++-- .../com/fr/design/mainframe/JTemplate.java | 61 ++++++++++++++++--- .../mainframe/toolbar/ToolBarMenuDock.java | 24 ++++---- .../toolbar/ToolBarMenuDockPlus.java | 11 +--- 4 files changed, 113 insertions(+), 35 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 0b20a191a..76a0e3ad3 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -5,7 +5,6 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.design.DesignModelAdapter; -import com.fr.design.DesignState; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.core.ActionFactory; @@ -31,7 +30,6 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.toolbar.ToolBarMenuDock; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.vcs.common.VcsHelper; -import com.fr.design.menu.MenuManager; import com.fr.design.menu.ShortCut; import com.fr.design.os.impl.MacOsAddListenerAction; import com.fr.design.os.impl.SupportOSImpl; @@ -560,9 +558,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta plus = ToolBarMenuDock.NULLAVOID; } - DesignState designState = new DesignState(plus); - MenuManager.getInstance().setMenus4Designer(designState); - NorthRegionContainerPane.getInstance().resetToolkitByPlus(plus, ad); CenterRegionContainerPane.getInstance().resetToolkitByPlus(plus, ad); @@ -763,10 +758,14 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta if (jt == null || jt.getEditingFILE() == null) { return; } + if (currentTemplateDeactivateFail()) { + return; + } jt.addJTemplateActionListener(this); jt.addTargetModifiedListener(this); jt.addJTemplateActionListener(VcsHelper.getInstance()); getCenterTemplateCardPane().showJTemplate(jt); + refreshBaseContentPane(jt); setTitle(); layeredPane.repaint(); } @@ -784,11 +783,54 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta if (jt == null || jt.getEditingFILE() == null) { return; } + if (currentTemplateDeactivateFail()) { + return; + } getCenterTemplateCardPane().showJTemplate(jt); + refreshBaseContentPane(jt); setTitle(); layeredPane.repaint(); } + /** + * 当前模板 停用失败 + * + * @return 是否停用失败 + */ + private boolean currentTemplateDeactivateFail() { + JTemplate currentEditingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + return currentEditingTemplate != null && !currentEditingTemplate.deactivateTemplate(); + } + + + /** + * 根据模板刷新 设计器整个界面 + * + * @param jTemplate 当前模板 + */ + private void refreshBaseContentPane(JTemplate jTemplate) { + + JComponent north = jTemplate.north4DesignerFrame(), + center = jTemplate.center4DesignerFrame(), + west = jTemplate.west4DesignerFrame(), + east = jTemplate.east4DesignerFrame(); + + basePane.removeAll(); + + if (north != null) { + basePane.add(north, BorderLayout.NORTH); + } + if (center != null) { + basePane.add(center, BorderLayout.CENTER); + } + if (west != null) { + basePane.add(west, BorderLayout.WEST); + } + if (east != null) { + basePane.add(east, BorderLayout.EAST); + } + } + /** * 对象侦听 * 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 483e74d9d..1cad5ed85 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 @@ -82,11 +82,11 @@ import javax.swing.JComponent; import javax.swing.JOptionPane; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.undo.UndoManager; +import java.awt.BorderLayout; import java.util.ArrayList; import java.util.Arrays; import java.util.Set; import java.util.regex.Pattern; -import java.awt.BorderLayout; /** * 报表设计和表单设计的编辑区域(设计器编辑的IO文件) @@ -1125,6 +1125,16 @@ public abstract class JTemplate> DesignerContext.getDesignerFrame().addAndActivateJTemplate(this); } + /** + * 将要激活打开其他模板,使当前模板灭活 + * 默认 do nothing 返回true + * + * @return true:成功停用当前模板 + */ + public boolean deactivateTemplate() { + return true; + } + /** * 返回当前支持的超链界面pane @@ -1237,15 +1247,6 @@ public abstract class JTemplate> */ public abstract Icon getIcon(); - /** - * 导出菜单项 - * - * @return 菜单项 - */ - @Override - public ShortCut[] shortcut4ExportMenu() { - return new ShortCut[0]; - } /** * 复制JS代码 @@ -1359,4 +1360,44 @@ public abstract class JTemplate> return StringUtils.EMPTY; } + /** + * 设计器界面是BorderLayout,指定NORTH组件 + * 默认是 菜单区域 + * + * @return NORTH组件 + */ + public JComponent north4DesignerFrame() { + return NorthRegionContainerPane.getInstance(); + } + + /** + * 设计器界面是BorderLayout,指定CENTER组件 + * 默认是 模板对应的工具栏区域+模板设计区域 + * + * @return CENTER组件 + */ + public JComponent center4DesignerFrame() { + return CenterRegionContainerPane.getInstance(); + } + + /** + * 设计器界面是BorderLayout,指定WEST组件 + * 默认是 模板目录树+数据集编辑区域 + * + * @return WEST组件 + */ + public JComponent west4DesignerFrame() { + return WestRegionContainerPane.getInstance(); + } + + /** + * 设计器界面是BorderLayout,指定EAST组件 + * 默认是 属性配置界面 + * + * @return EAST组件 + */ + public JComponent east4DesignerFrame() { + return EastRegionContainerPane.getInstance(); + } + } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index aca9bcc36..fa9835492 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -9,7 +9,18 @@ import com.fr.design.DesignState; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.UpdateAction; -import com.fr.design.actions.community.*; +import com.fr.design.actions.community.BBSAction; +import com.fr.design.actions.community.BugAction; +import com.fr.design.actions.community.BugNeedAction; +import com.fr.design.actions.community.CenterAction; +import com.fr.design.actions.community.FacebookFansAction; +import com.fr.design.actions.community.NeedAction; +import com.fr.design.actions.community.QuestionAction; +import com.fr.design.actions.community.SignAction; +import com.fr.design.actions.community.TechSolutionAction; +import com.fr.design.actions.community.TechSupportAction; +import com.fr.design.actions.community.VideoAction; +import com.fr.design.actions.community.WorkOrderCenterAction; import com.fr.design.actions.file.CloseCurrentTemplateAction; import com.fr.design.actions.file.ExitDesignerAction; import com.fr.design.actions.file.OpenRecentReportMenuDef; @@ -64,7 +75,6 @@ import com.fr.plugin.observer.PluginEventType; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; import com.fr.stable.bridge.ObjectHolder; -import com.fr.stable.os.support.OSBasedAction; import com.fr.stable.os.support.OSSupportCenter; import com.fr.start.OemHandler; import com.fr.workspace.WorkContext; @@ -141,16 +151,6 @@ public abstract class ToolBarMenuDock { return PANLE_HEIGNT; } - /** - * 导出菜单的子菜单 ,目前用于图表设计器 - * - * @return 子菜单 - */ - @Override - public ShortCut[] shortcut4ExportMenu() { - return new ShortCut[0]; - } - }; private static final int MENUBAR_HEIGHT = 22; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDockPlus.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDockPlus.java index ada075aeb..ed9b9d787 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDockPlus.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDockPlus.java @@ -1,11 +1,12 @@ package com.fr.design.mainframe.toolbar; -import javax.swing.*; - import com.fr.design.menu.MenuDef; import com.fr.design.menu.ShortCut; import com.fr.design.menu.ToolBarDef; +import javax.swing.JComponent; +import javax.swing.JPanel; + public interface ToolBarMenuDockPlus { /** * 模板的工具 @@ -53,11 +54,5 @@ public interface ToolBarMenuDockPlus { int getToolBarHeight(); - /** - * 导出菜单的子菜单 ,目前用于图表设计器 - * - * @return 子菜单 - */ - ShortCut[] shortcut4ExportMenu(); } \ No newline at end of file From 8487a0ce987cef0b772138d31124f40a8568f0a6 Mon Sep 17 00:00:00 2001 From: shine Date: Sun, 25 Apr 2021 10:03:36 +0800 Subject: [PATCH 04/29] update --- .../src/main/java/com/fr/design/mainframe/JTemplate.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 1cad5ed85..5ecf4ae82 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 @@ -1361,7 +1361,7 @@ public abstract class JTemplate> } /** - * 设计器界面是BorderLayout,指定NORTH组件 + * 指定 设计器界面 NORTH组件 * 默认是 菜单区域 * * @return NORTH组件 @@ -1371,7 +1371,7 @@ public abstract class JTemplate> } /** - * 设计器界面是BorderLayout,指定CENTER组件 + * 指定 设计器界面 CENTER组件 * 默认是 模板对应的工具栏区域+模板设计区域 * * @return CENTER组件 @@ -1381,7 +1381,7 @@ public abstract class JTemplate> } /** - * 设计器界面是BorderLayout,指定WEST组件 + * 指定 设计器界面 WEST组件 * 默认是 模板目录树+数据集编辑区域 * * @return WEST组件 @@ -1391,7 +1391,7 @@ public abstract class JTemplate> } /** - * 设计器界面是BorderLayout,指定EAST组件 + * 指定 设计器界面 EAST组件 * 默认是 属性配置界面 * * @return EAST组件 From 823755386c9bf2ab880ab853218e49e1b3af7537 Mon Sep 17 00:00:00 2001 From: shine Date: Fri, 7 May 2021 15:54:14 +0800 Subject: [PATCH 05/29] CHART-18790 design new template name --- .../fr/design/mainframe/DesignerFrame.java | 3 + .../com/fr/design/mainframe/JTemplate.java | 43 +-------------- .../design/mainframe/JTemplateNameHelper.java | 55 +++++++++++++++++++ 3 files changed, 59 insertions(+), 42 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 76a0e3ad3..0c6d0d7cf 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -829,6 +829,9 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta if (east != null) { basePane.add(east, BorderLayout.EAST); } + + layeredPane.repaint(); + layeredPane.revalidate(); } /** 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 5ecf4ae82..4e026a859 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 @@ -24,7 +24,6 @@ import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.InformationWarnPane; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.TemplateResourceManager; -import com.fr.design.file.TemplateTreePane; import com.fr.design.fun.DesignerFrameUpButtonProvider; import com.fr.design.fun.MenuHandler; import com.fr.design.fun.PreviewProvider; @@ -34,7 +33,6 @@ import com.fr.design.gui.frpane.HyperlinkGroupPane; import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.imenu.UIMenuItem; -import com.fr.design.gui.itree.filetree.TemplateFileTree; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.chart.info.ChartInfoCollector; @@ -80,20 +78,15 @@ import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JOptionPane; -import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.undo.UndoManager; import java.awt.BorderLayout; -import java.util.ArrayList; -import java.util.Arrays; import java.util.Set; -import java.util.regex.Pattern; /** * 报表设计和表单设计的编辑区域(设计器编辑的IO文件) */ public abstract class JTemplate> extends TargetComponent implements ToolBarMenuDockPlus, DesignerProxy { // TODO ALEX_SEP editingFILE这个属性一定要吗?如果非要不可,有没有可能保证不为null - private static final int PREFIX_NUM = 3000; private FILE editingFILE = null; // alex:初始状态为saved,这样不管是新建模板,还是打开模板,如果未做任何操作直接关闭,不提示保存 private boolean saved = true; @@ -105,7 +98,6 @@ public abstract class JTemplate> protected T template; // 当前模板 protected TemplateProcessInfo processInfo; // 模板过程的相关信息 private JComponent centerPane; - private static short currentIndex = 0;// 此变量用于多次新建模板时,让名字不重复 private DesignModelAdapter designModel; private PreviewProvider previewType; protected TimeConsumeTimer consumeTimer = new TimeConsumeTimer(); @@ -117,7 +109,7 @@ public abstract class JTemplate> } public JTemplate(T t, String defaultFileName) { - this(t, new MemFILE(newTemplateNameByIndex(defaultFileName)), true); + this(t, new MemFILE(JTemplateNameHelper.newTemplateNameByIndex(defaultFileName)), true); } public JTemplate(T t, FILE file) { @@ -840,39 +832,6 @@ public abstract class JTemplate> return true; } - private static String newTemplateNameByIndex(String prefix) { - // 用于获取左侧模板的文件名,如左侧已包含"WorkBook1.cpt, WorkBook12.cpt, WorkBook177.cpt" - // 那么新建的文件名将被命名为"WorkBook178.cpt",即取最大数+1 - TemplateFileTree tt = TemplateTreePane.getInstance().getTemplateFileTree(); - DefaultMutableTreeNode gen = (DefaultMutableTreeNode) tt.getModel().getRoot(); - String[] str = new String[gen.getChildCount()]; - ArrayList al = new ArrayList(); - for (int j = 0; j < gen.getChildCount(); j++) { - str[j] = gen.getChildAt(j).toString(); - if (str[j].contains(prefix) && str[j].contains(".")) { - for (int i = 0; i < PREFIX_NUM; i++) { - if (ComparatorUtils.equals(str[j].split("[.]")[0], (prefix + i))) { - al.add(str[j]); - } - - } - } - } - - int[] reportNum = new int[al.size()]; - for (int i = 0; i < al.size(); i++) { - Pattern pattern = Pattern.compile("[" + prefix + ".]+"); - String[] strs = pattern.split(al.get(i).toString()); - reportNum[i] = Integer.parseInt(strs[1]); - } - - Arrays.sort(reportNum); - int idx = reportNum.length > 0 ? reportNum[reportNum.length - 1] + 1 : 1; - idx = idx + currentIndex; - currentIndex++; - return prefix + idx; - } - // /////////////////////////////toolbarMenuDock////////////////////////////////// /** diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java new file mode 100644 index 000000000..bd1b869b0 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java @@ -0,0 +1,55 @@ +package com.fr.design.mainframe; + +import com.fr.design.file.TemplateTreePane; +import com.fr.design.gui.itree.filetree.TemplateFileTree; +import com.fr.general.ComparatorUtils; + +import javax.swing.tree.DefaultMutableTreeNode; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.regex.Pattern; + +/** + * @author shine + * @version 10.0 + * Created by shine on 2021/5/7 + */ +public class JTemplateNameHelper { + + private static final int PREFIX_NUM = 3000; + + private static short currentIndex = 0;// 此变量用于多次新建模板时,让名字不重复 + + public static String newTemplateNameByIndex(String prefix) { + // 用于获取左侧模板的文件名,如左侧已包含"WorkBook1.cpt, WorkBook12.cpt, WorkBook177.cpt" + // 那么新建的文件名将被命名为"WorkBook178.cpt",即取最大数+1 + TemplateFileTree tt = TemplateTreePane.getInstance().getTemplateFileTree(); + DefaultMutableTreeNode gen = (DefaultMutableTreeNode) tt.getModel().getRoot(); + String[] str = new String[gen.getChildCount()]; + ArrayList al = new ArrayList(); + for (int j = 0; j < gen.getChildCount(); j++) { + str[j] = gen.getChildAt(j).toString(); + if (str[j].contains(prefix) && str[j].contains(".")) { + for (int i = 0; i < PREFIX_NUM; i++) { + if (ComparatorUtils.equals(str[j].split("[.]")[0], (prefix + i))) { + al.add(str[j]); + } + + } + } + } + + int[] reportNum = new int[al.size()]; + for (int i = 0; i < al.size(); i++) { + Pattern pattern = Pattern.compile("[" + prefix + ".]+"); + String[] strs = pattern.split(al.get(i).toString()); + reportNum[i] = Integer.parseInt(strs[1]); + } + + Arrays.sort(reportNum); + int idx = reportNum.length > 0 ? reportNum[reportNum.length - 1] + 1 : 1; + idx = idx + currentIndex; + currentIndex++; + return prefix + idx; + } +} From 752e500a649ad3b10633acd4ffdf6d3dd2402943 Mon Sep 17 00:00:00 2001 From: shine Date: Sat, 8 May 2021 10:05:01 +0800 Subject: [PATCH 06/29] test --- .../mainframe/JTemplateNameHelperTest.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 designer-base/src/test/java/com/fr/design/mainframe/JTemplateNameHelperTest.java diff --git a/designer-base/src/test/java/com/fr/design/mainframe/JTemplateNameHelperTest.java b/designer-base/src/test/java/com/fr/design/mainframe/JTemplateNameHelperTest.java new file mode 100644 index 000000000..032e715f6 --- /dev/null +++ b/designer-base/src/test/java/com/fr/design/mainframe/JTemplateNameHelperTest.java @@ -0,0 +1,23 @@ +package com.fr.design.mainframe; + +import junit.framework.TestCase; + +/** + * @author shine + * @version 10.0 + * Created by shine on 2021/5/8 + */ +public class JTemplateNameHelperTest extends TestCase { + + public void testNewTemplateNameByIndex() { + + String name = JTemplateNameHelper.newTemplateNameByIndex("TEST"); + + assertEquals("TEST1", name); + + String name1 = JTemplateNameHelper.newTemplateNameByIndex("TEST"); + + assertEquals("TEST2", name1); + + } +} From 0dee08f9197f5c702f9cbc16ed60ee7f44908b41 Mon Sep 17 00:00:00 2001 From: shine Date: Tue, 25 May 2021 15:50:26 +0800 Subject: [PATCH 07/29] =?UTF-8?q?CHART-18788=20=E6=A8=A1=E6=9D=BF=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E5=BC=80=E9=87=8D=E5=86=99=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/mainframe/JTemplate.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 4e026a859..f9e75528c 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 @@ -818,7 +818,7 @@ public abstract class JTemplate> return false; } try { - this.getTarget().export(TemplateResourceManager.getResource().saveTemplate(editingFILE)); + export(); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage(), "Save Error", JOptionPane.ERROR_MESSAGE); @@ -832,6 +832,10 @@ public abstract class JTemplate> return true; } + protected boolean export() throws Exception { + return this.getTarget().export(TemplateResourceManager.getResource().saveTemplate(editingFILE)); + } + // /////////////////////////////toolbarMenuDock////////////////////////////////// /** From db03f46adfa11505e510dbe539befdeaa93186fa Mon Sep 17 00:00:00 2001 From: shine Date: Tue, 25 May 2021 19:52:00 +0800 Subject: [PATCH 08/29] =?UTF-8?q?CHART-18787=20design=20refactor:=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8=E7=B1=BB=E5=9E=8B=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/ChartTypeInterfaceManager.java | 213 +++++------------- .../chart/gui/ChartTypeButtonPane.java | 10 +- .../mainframe/chart/gui/ChartTypePane.java | 58 +++-- 3 files changed, 110 insertions(+), 171 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java index b50c740a3..eb3520852 100644 --- a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java @@ -8,7 +8,6 @@ import com.fr.chart.fun.ChartTypeProvider; import com.fr.chartx.attr.ChartProvider; import com.fr.common.annotations.Compatible; import com.fr.design.beans.BasicBeanPane; -import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.chart.fun.ChartTypeUIProvider; import com.fr.design.chart.gui.ChartWidgetOption; import com.fr.design.condition.ConditionAttributesPane; @@ -46,7 +45,6 @@ import com.fr.general.GeneralContext; import com.fr.general.IOUtils; import com.fr.invoke.Reflect; import com.fr.locale.InterProviderFactory; -import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.PiePlot4VanChart; import com.fr.plugin.chart.area.VanChartAreaPlot; import com.fr.plugin.chart.box.VanChartBoxPlot; @@ -75,7 +73,6 @@ import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; import com.fr.plugin.solution.closeable.CloseableContainedMap; import com.fr.stable.ArrayUtils; -import com.fr.stable.AssistUtils; import com.fr.stable.StringUtils; import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; import com.fr.van.chart.area.AreaIndependentVanChartInterface; @@ -100,17 +97,7 @@ import com.fr.van.chart.treemap.TreeMapIndependentVanChartInterface; import com.fr.van.chart.wordcloud.designer.WordCloudIndependentVanChartInterface; import javax.swing.Icon; -import java.util.ArrayList; import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.awt.event.ActionListener; - -import static com.fr.chart.charttypes.ChartTypeManager.DEFAULT_PRIORITY; -import static com.fr.chart.charttypes.ChartTypeManager.DEPRECATED_CHART_PRIORITY; -import static com.fr.chart.charttypes.ChartTypeManager.VAN_CHART_PRIORITY; /** * Created by eason on 14/12/29. @@ -120,10 +107,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr private static ChartTypeInterfaceManager classManager = new ChartTypeInterfaceManager(); - private static LinkedHashMap> chartTypeInterfaces = - new LinkedHashMap>(); - - private static Map idAndPriorityMap = new HashMap(); + private static CloseableContainedMap chartTypeUIs = new CloseableContainedMap<>(HashMap.class); public static final String TYPE_PANE_DEFAULT_TITLE = "DEFAULT_NAME"; @@ -185,127 +169,69 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr private static void readVanChart() { - addChartTypeInterface(VAN_CHART_PRIORITY, PiePlot4VanChart.VAN_CHART_PIE_PLOT, new PieIndependentVanChartInterface()); - addChartTypeInterface(VAN_CHART_PRIORITY, VanChartColumnPlot.VAN_CHART_COLUMN_PLOT_ID, new VanColumnChartTypeUI()); - addChartTypeInterface(VAN_CHART_PRIORITY, VanChartColumnPlot.VAN_CHART_BAR_PLOT_ID, new BarIndependentVanChartInterface()); - addChartTypeInterface(VAN_CHART_PRIORITY, VanChartLinePlot.VAN_CHART_LINE_PLOT, new LineIndependentVanChartInterface()); - addChartTypeInterface(VAN_CHART_PRIORITY, VanChartAreaPlot.VAN_CHART_AREA_PLOT_ID, new AreaIndependentVanChartInterface()); - addChartTypeInterface(VAN_CHART_PRIORITY, VanChartGaugePlot.VAN_CHART_GAUGE_PLOT, new GaugeIndependentVanChartInterface()); - addChartTypeInterface(VAN_CHART_PRIORITY, VanChartRadarPlot.VAN_CHART_RADAR_PLOT, new RadarIndependentVanChartInterface()); - addChartTypeInterface(VAN_CHART_PRIORITY, VanChartScatterPlot.VAN_CHART_SCATTER_PLOT_ID, new ScatterIndependentVanChartInterface()); - addChartTypeInterface(VAN_CHART_PRIORITY, VanChartBubblePlot.VAN_CHART_BUBBLE_PLOT_ID, new BubbleIndependentVanChartInterface()); - addChartTypeInterface(VAN_CHART_PRIORITY, VanChartCustomPlot.VAN_CHART_CUSTOM_PLOT_ID, new CustomIndependentVanChartInterface()); - addChartTypeInterface(VAN_CHART_PRIORITY, VanChartMultiPiePlot.VAN_CHART_MULTILAYER_PLOT_ID, new MultiPieIndependentVanChartInterface()); - addChartTypeInterface(VAN_CHART_PRIORITY, VanChartMapPlot.VAN_CHART_MAP_ID, new VanMapChartTypeUI()); - addChartTypeInterface(VAN_CHART_PRIORITY, VanChartDrillMapPlot.VAN_CHART_DRILL_MAP_ID, new VanDrillMapChartTypeUI()); - addChartTypeInterface(VAN_CHART_PRIORITY, VanChartTreeMapPlot.VAN_CHART_TREE_MAP_PLOT_ID, new TreeMapIndependentVanChartInterface()); - addChartTypeInterface(VAN_CHART_PRIORITY, VanChartFunnelPlot.VAN_CHART_FUNNEL_PLOT_ID, new FunnelIndependentVanChartInterface()); - addChartTypeInterface(VAN_CHART_PRIORITY, VanChartHeatMapPlot.VAN_CHART_HEAT_MAP_ID, new VanHeatMapChartTypeUI()); - addChartTypeInterface(VAN_CHART_PRIORITY, VanChartWordCloudPlot.WORD_CLOUD_PLOT_ID, new WordCloudIndependentVanChartInterface()); - addChartTypeInterface(VAN_CHART_PRIORITY, VanChartGanttPlot.VAN_CHART_GANTT_PLOT_ID, new GanttIndependentVanChartInterface()); - addChartTypeInterface(VAN_CHART_PRIORITY, VanChartStructurePlot.STRUCTURE_PLOT_ID, new VanStructureChartTypeUI()); - addChartTypeInterface(VAN_CHART_PRIORITY, VanChartBoxPlot.VAN_CHART_BOX_PLOT_ID, new BoxIndependentVanChartInterface()); + addChartTypeInterface(PiePlot4VanChart.VAN_CHART_PIE_PLOT, new PieIndependentVanChartInterface()); + addChartTypeInterface(VanChartColumnPlot.VAN_CHART_COLUMN_PLOT_ID, new VanColumnChartTypeUI()); + addChartTypeInterface(VanChartColumnPlot.VAN_CHART_BAR_PLOT_ID, new BarIndependentVanChartInterface()); + addChartTypeInterface(VanChartLinePlot.VAN_CHART_LINE_PLOT, new LineIndependentVanChartInterface()); + addChartTypeInterface(VanChartAreaPlot.VAN_CHART_AREA_PLOT_ID, new AreaIndependentVanChartInterface()); + addChartTypeInterface(VanChartGaugePlot.VAN_CHART_GAUGE_PLOT, new GaugeIndependentVanChartInterface()); + addChartTypeInterface(VanChartRadarPlot.VAN_CHART_RADAR_PLOT, new RadarIndependentVanChartInterface()); + addChartTypeInterface(VanChartScatterPlot.VAN_CHART_SCATTER_PLOT_ID, new ScatterIndependentVanChartInterface()); + addChartTypeInterface(VanChartBubblePlot.VAN_CHART_BUBBLE_PLOT_ID, new BubbleIndependentVanChartInterface()); + addChartTypeInterface(VanChartCustomPlot.VAN_CHART_CUSTOM_PLOT_ID, new CustomIndependentVanChartInterface()); + addChartTypeInterface(VanChartMultiPiePlot.VAN_CHART_MULTILAYER_PLOT_ID, new MultiPieIndependentVanChartInterface()); + addChartTypeInterface(VanChartMapPlot.VAN_CHART_MAP_ID, new VanMapChartTypeUI()); + addChartTypeInterface(VanChartDrillMapPlot.VAN_CHART_DRILL_MAP_ID, new VanDrillMapChartTypeUI()); + addChartTypeInterface(VanChartTreeMapPlot.VAN_CHART_TREE_MAP_PLOT_ID, new TreeMapIndependentVanChartInterface()); + addChartTypeInterface(VanChartFunnelPlot.VAN_CHART_FUNNEL_PLOT_ID, new FunnelIndependentVanChartInterface()); + addChartTypeInterface(VanChartHeatMapPlot.VAN_CHART_HEAT_MAP_ID, new VanHeatMapChartTypeUI()); + addChartTypeInterface(VanChartWordCloudPlot.WORD_CLOUD_PLOT_ID, new WordCloudIndependentVanChartInterface()); + addChartTypeInterface(VanChartGanttPlot.VAN_CHART_GANTT_PLOT_ID, new GanttIndependentVanChartInterface()); + addChartTypeInterface(VanChartStructurePlot.STRUCTURE_PLOT_ID, new VanStructureChartTypeUI()); + addChartTypeInterface(VanChartBoxPlot.VAN_CHART_BOX_PLOT_ID, new BoxIndependentVanChartInterface()); } private static void readDefault() { - addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.COLUMN_CHART, new ColumnChartTypeUI()); - addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.LINE_CHART, new LineChartTypeUI()); - addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.BAR_CHART, new BarChartTypeUI()); - addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.PIE_CHART, new PieChartTypeUI()); - addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.AREA_CHART, new AreaChartTypeUI()); - addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.SCATTER_CHART, new XYScatterChartTypeUI()); - addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.BUBBLE_CHART, new BubbleChartTypeUI()); - addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.RADAR_CHART, new RadarChartTypeUI()); - addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.STOCK_CHART, new StockChartTypeUI()); - addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.METER_CHART, new MeterChartTypeUI()); - addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.RANGE_CHART, new RangeChartTypeUI()); - addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.CUSTOM_CHART, new CustomChartTypeUI()); - addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.GANTT_CHART, new GanttChartTypeUI()); - addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.DONUT_CHART, new DonutChartTypeUI()); - addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.MAP_CHART, new MapChartTypeUI()); - addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.GIS_CHAER, new GisMapChartTypeUI()); - addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.FUNNEL_CHART, new FunnelChartTypeUI()); - } - - private static void addChartTypeInterface(String priority, String plotID, ChartTypeUIProvider provider) { - - if (chartTypeInterfaces != null) { - if (!chartTypeInterfaces.containsKey(priority)) { - //新建一个具体图表列表 - CloseableContainedMap chartUIList - = new CloseableContainedMap(LinkedHashMap.class); - chartUIList.put(plotID, provider); - chartTypeInterfaces.put(priority, chartUIList); - } else { - Map chartUIList = chartTypeInterfaces.get(priority); - if (!chartUIList.containsKey(plotID)) { - chartUIList.put(plotID, provider); - } - } - idAndPriorityMap.put(plotID, priority); + addChartTypeInterface(ChartConstants.COLUMN_CHART, new ColumnChartTypeUI()); + addChartTypeInterface(ChartConstants.LINE_CHART, new LineChartTypeUI()); + addChartTypeInterface(ChartConstants.BAR_CHART, new BarChartTypeUI()); + addChartTypeInterface(ChartConstants.PIE_CHART, new PieChartTypeUI()); + addChartTypeInterface(ChartConstants.AREA_CHART, new AreaChartTypeUI()); + addChartTypeInterface(ChartConstants.SCATTER_CHART, new XYScatterChartTypeUI()); + addChartTypeInterface(ChartConstants.BUBBLE_CHART, new BubbleChartTypeUI()); + addChartTypeInterface(ChartConstants.RADAR_CHART, new RadarChartTypeUI()); + addChartTypeInterface(ChartConstants.STOCK_CHART, new StockChartTypeUI()); + addChartTypeInterface(ChartConstants.METER_CHART, new MeterChartTypeUI()); + addChartTypeInterface(ChartConstants.RANGE_CHART, new RangeChartTypeUI()); + addChartTypeInterface(ChartConstants.CUSTOM_CHART, new CustomChartTypeUI()); + addChartTypeInterface(ChartConstants.GANTT_CHART, new GanttChartTypeUI()); + addChartTypeInterface(ChartConstants.DONUT_CHART, new DonutChartTypeUI()); + addChartTypeInterface(ChartConstants.MAP_CHART, new MapChartTypeUI()); + addChartTypeInterface(ChartConstants.GIS_CHAER, new GisMapChartTypeUI()); + addChartTypeInterface(ChartConstants.FUNNEL_CHART, new FunnelChartTypeUI()); + } + + private static void addChartTypeInterface(String id, ChartTypeUIProvider provider) { + + if (chartTypeUIs != null) { + chartTypeUIs.put(id, provider); } } - private ChartTypeUIProvider getChartTypeInterface(String plotID) { - if (idAndPriorityMap.containsKey(plotID)) { - String priority = idAndPriorityMap.get(plotID); - if (chartTypeInterfaces.containsKey(priority)) { - return chartTypeInterfaces.get(priority).get(plotID); - } + private ChartTypeUIProvider getChartTypeInterface(String id) { + if (chartTypeUIs.containsKey(id)) { + return chartTypeUIs.get(id); } return null; } - /** - * 把所有的pane加到list里 - * - * @param paneList pane容器 - */ - public void addPlotTypePaneList(List> paneList, - Map>> allChartTypePane, - ActionListener autoButtonListener) { - - List priorityList = getPriorityInOrder(); - for (Integer aPriorityList : priorityList) { - String priority = String.valueOf(aPriorityList); - addPlotTypePaneList(priority, paneList, allChartTypePane, autoButtonListener); - } - } - - - public void addPlotTypePaneList(String priority, List> paneList, - Map>> allChartTypePane, - ActionListener autoButtonListener) { - - if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority)) { - - Map chartUIList = chartTypeInterfaces.get(priority); - - Iterator> iterator = chartUIList.entrySet().iterator(); - while (iterator.hasNext()) { - try { - Map.Entry entry = iterator.next(); - String plotID = entry.getKey(); - - AbstractChartTypePane pane = entry.getValue().getPlotTypePane(); - if (AssistUtils.equals(pane.title4PopupWindow(), TYPE_PANE_DEFAULT_TITLE)) { - continue; - } - pane.reLayout(plotID); - pane.registerButtonListener(autoButtonListener); - paneList.add(pane); - - if (allChartTypePane.get(priority) == null) { - allChartTypePane.put(priority, new LinkedHashMap>()); - } - allChartTypePane.get(priority).put(plotID, pane); - } catch (Throwable e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } + public AbstractChartTypePane getPlotTypePane(String id) { + if (chartTypeUIs.containsKey(id)) { + return chartTypeUIs.get(id).getPlotTypePane(); } + return null; } @Compatible @@ -313,23 +239,9 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr return getName(plotID); } - private List getPriorityInOrder() { - - List priorityList = new ArrayList(); - if (chartTypeInterfaces != null) { - Iterator iterator = chartTypeInterfaces.entrySet().iterator(); - while (iterator.hasNext()) { - Map.Entry entry = (Map.Entry) iterator.next(); - String priority = (String) entry.getKey(); - priorityList.add(Integer.valueOf(priority)); - } - } - return ChartTypeManager.orderInPriority(priorityList); - } - public String getIconPath(String plotID) { - if (chartTypeInterfaces != null) { + if (chartTypeUIs != null) { ChartTypeUIProvider provider = getChartTypeInterface(plotID); if (provider != null) { return provider.getIconPath(); @@ -340,7 +252,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr public String[] getDemoImagePath(String chartID) { - if (chartTypeInterfaces != null) { + if (chartTypeUIs != null) { ChartTypeUIProvider provider = getChartTypeInterface(chartID); if (provider != null) { String[] result = null; @@ -396,7 +308,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr } public String[] getSubName(String chartID) { - if (chartTypeInterfaces != null) { + if (chartTypeUIs != null) { ChartTypeUIProvider provider = getChartTypeInterface(chartID); if (provider != null) { String[] subNames = null; @@ -429,7 +341,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr } public String getName(String chartID) { - if (chartTypeInterfaces != null) { + if (chartTypeUIs != null) { ChartTypeUIProvider provider = getChartTypeInterface(chartID); if (provider != null) { String name = null; @@ -574,9 +486,8 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr if (StringUtils.isEmpty(id)) { id = injection.getAttribute("plotID"); } - String priority = injection.getAttribute("priority", DEFAULT_PRIORITY); ChartTypeUIProvider instance = (ChartTypeUIProvider) injection.getObject(); - addChartTypeInterface(priority, id, instance); + addChartTypeInterface(id, instance); } } @@ -585,22 +496,18 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr public void demount(PluginSingleInjection injection) { if (isChartTypeUIProvider(injection)) { - String priority = injection.getAttribute("priority", DEFAULT_PRIORITY); String id = injection.getAttribute("chartID"); if (StringUtils.isEmpty(id)) { id = injection.getAttribute("plotID"); } - removeChartTypeInterface(priority, id); + removeChartTypeInterface(id); } } - private void removeChartTypeInterface(String priority, String plotID) { + private void removeChartTypeInterface(String id) { - if (chartTypeInterfaces != null) { - if (chartTypeInterfaces.containsKey(priority)) { - Map chartUIList = chartTypeInterfaces.get(priority); - chartUIList.remove(plotID); - } + if (chartTypeUIs != null) { + chartTypeUIs.remove(id); } } 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 4d7673b3e..34778a73b 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 @@ -6,7 +6,6 @@ import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.charttypes.ChartTypeManager; import com.fr.chartx.attr.ChartProvider; import com.fr.design.beans.BasicBeanPane; -import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.design.dialog.DialogActionListener; import com.fr.design.dialog.UIDialog; import com.fr.design.event.UIObserver; @@ -17,6 +16,7 @@ import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.imenutable.UIMenuNameableCreator; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.mainframe.chart.gui.ChartTypePane.ComboBoxPane; +import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.vanchart.VanChart; @@ -26,9 +26,6 @@ import javax.swing.BorderFactory; import javax.swing.BoxLayout; import javax.swing.JPanel; import javax.swing.SwingUtilities; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Set; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.FlowLayout; @@ -45,6 +42,9 @@ import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Set; /** * 图表 类型 增删 控制按钮界面. @@ -180,7 +180,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen public ChartProvider getChangeStateNewChart() { ChartProvider chart = editingCollection.getSelectedChartProvider(ChartProvider.class); String chartID = chart.getID(); - String priority = ChartTypeManager.getInstanceWithCheck().getPriority(chartID); + int priority = ChartTypeManager.getInstanceWithCheck().getPriority(chartID); return ChartTypeManager.getInstanceWithCheck().getFirstChart(priority); } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java index 1fa61298a..553895a18 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java @@ -20,20 +20,21 @@ import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.design.module.DesignModuleFactory; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; +import com.fr.stable.AssistUtils; import com.fr.stable.StringUtils; import javax.swing.JPanel; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; /** * 图表 属性表, 类型选择 界面. @@ -138,14 +139,45 @@ public class ChartTypePane extends AbstractChartAttrPane { } } + /** + * 把所有的pane加到list里 + * + * @param paneList pane容器 + */ + private static void addPlotTypePaneList(List> paneList, + Map>> allChartTypePane, + ActionListener autoButtonListener) { + + + String[] chartIDs = ChartTypeManager.getInstance().getAllChartIDs(); + + for (String id : chartIDs) { + + AbstractChartTypePane pane = ChartTypeInterfaceManager.getInstance().getPlotTypePane(id); + if (AssistUtils.equals(pane.title4PopupWindow(), ChartTypeInterfaceManager.TYPE_PANE_DEFAULT_TITLE)) { + continue; + } + pane.reLayout(id); + pane.registerButtonListener(autoButtonListener); + paneList.add(pane); + + Integer priority = ChartTypeManager.getInstance().getPriority(id); + if (allChartTypePane.get(priority) == null) { + allChartTypePane.put(priority, new LinkedHashMap>()); + } + allChartTypePane.get(priority).put(id, pane); + } + } + class ComboBoxPane extends UIComboBoxPane { - private Map>> allChartTypePane; + //todo:refactor 图表切换过滤不应该根据优先级priority,应该给旧版本图表和新特性图表的图表类型信息分别增加一个switchID之类的 + private Map>> allChartTypePane; @Override protected List> initPaneList() { List> paneList = new ArrayList>(); - allChartTypePane = new LinkedHashMap>>(); - ChartTypeInterfaceManager.getInstance().addPlotTypePaneList(paneList, allChartTypePane, autoButtonListener); + allChartTypePane = new LinkedHashMap>>(); + addPlotTypePaneList(paneList, allChartTypePane, autoButtonListener); return paneList; } @@ -205,18 +237,18 @@ public class ChartTypePane extends AbstractChartAttrPane { } private void addAllCards() { - Iterator iterator = allChartTypePane.keySet().iterator(); + Iterator iterator = allChartTypePane.keySet().iterator(); while (iterator.hasNext()) { addOnePriorityCards(iterator.next(), false); } } - private void addOnePriorityCards(String priority) { + private void addOnePriorityCards(int priority) { addOnePriorityCards(priority, true); } - private void addOnePriorityCards(String priority, boolean ignore) { + private void addOnePriorityCards(int priority, boolean ignore) { Map> map = allChartTypePane.get(priority); @@ -232,7 +264,7 @@ public class ChartTypePane extends AbstractChartAttrPane { } - private void addOnePlotIDCards(String priority, String plotID) { + private void addOnePlotIDCards(int priority, String plotID) { cards.add(allChartTypePane.get(priority).get(plotID)); } @@ -242,7 +274,7 @@ public class ChartTypePane extends AbstractChartAttrPane { //重构需要重构下拉框选项和cardNames ChartProvider chart = collection.getSelectedChartProvider(ChartProvider.class); String chartID = chart.getID(); - String priority = ChartTypeManager.getInstanceWithCheck().getPriority(chartID); + int priority = ChartTypeManager.getInstanceWithCheck().getPriority(chartID); boolean enabledChart = ChartTypeManager.enabledChart(chartID); String item = ChartTypeInterfaceManager.getInstance().getName(chartID); From de6236770fa3be847f34f0c4350221b3ccc1159a Mon Sep 17 00:00:00 2001 From: shine Date: Wed, 26 May 2021 14:45:21 +0800 Subject: [PATCH 09/29] =?UTF-8?q?=E5=A4=84=E7=90=86=E5=86=B2=E7=AA=81?= =?UTF-8?q?=E9=94=99=E4=BA=86=20=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/JTemplate.java | 37 ---------- .../design/mainframe/JTemplateNameHelper.java | 68 +++++++++++++------ 2 files changed, 48 insertions(+), 57 deletions(-) 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 dd7eb1aec..e92fffab9 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 @@ -844,43 +844,6 @@ public abstract class JTemplate> return this.getTarget().export(TemplateResourceManager.getResource().saveTemplate(editingFILE)); } - /** - * @Description 返回文件名中的index - * @param: prefix 前缀 - * @param: fileName 文件名称全名 - * @return java.lang.Integer WorkBook11.cpt则返回11,如果没有找到index返回null - * @Author Henry.Wang - * @Date 2021/4/9 11:13 - **/ - private static Integer getFileNameIndex(String prefix, String fileName) { - char[] chars = new char[fileName.length()]; - int i = 0; - for (; i < fileName.length(); i++) { - char c = fileName.charAt(i); - //匹配前缀 - if (i < prefix.length()) { - if (c != prefix.charAt(i)) { - return null; - } - } else { - if (c == '.') { - break; - } else { - //匹配0~9 - if (c < 48 || c > 57) { - return null; - } - chars[i - prefix.length()] = c; - } - } - } - String s = new String(chars).substring(0, i - prefix.length()); - if (StringUtils.isBlank(s)) { - return null; - } - return Integer.valueOf(s); - } - // /////////////////////////////toolbarMenuDock////////////////////////////////// /** diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java index bd1b869b0..4e201a5ef 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java @@ -2,12 +2,12 @@ package com.fr.design.mainframe; import com.fr.design.file.TemplateTreePane; import com.fr.design.gui.itree.filetree.TemplateFileTree; -import com.fr.general.ComparatorUtils; +import com.fr.stable.StringUtils; import javax.swing.tree.DefaultMutableTreeNode; import java.util.ArrayList; -import java.util.Arrays; -import java.util.regex.Pattern; +import java.util.Collections; +import java.util.List; /** * @author shine @@ -26,30 +26,58 @@ public class JTemplateNameHelper { TemplateFileTree tt = TemplateTreePane.getInstance().getTemplateFileTree(); DefaultMutableTreeNode gen = (DefaultMutableTreeNode) tt.getModel().getRoot(); String[] str = new String[gen.getChildCount()]; - ArrayList al = new ArrayList(); + + List reportNum = new ArrayList<>(); for (int j = 0; j < gen.getChildCount(); j++) { str[j] = gen.getChildAt(j).toString(); - if (str[j].contains(prefix) && str[j].contains(".")) { - for (int i = 0; i < PREFIX_NUM; i++) { - if (ComparatorUtils.equals(str[j].split("[.]")[0], (prefix + i))) { - al.add(str[j]); - } - - } + //返回文件名中的index(算法中没有再匹配文件后缀了,因为DefaultMutableTreeNode中已经匹配过了) + Integer index = getFileNameIndex(prefix, str[j]); + if (index != null) { + reportNum.add(index); } } + Collections.sort(reportNum); + int idx = reportNum.size() > 0 ? reportNum.get(reportNum.size() - 1) + 1 : 1; - int[] reportNum = new int[al.size()]; - for (int i = 0; i < al.size(); i++) { - Pattern pattern = Pattern.compile("[" + prefix + ".]+"); - String[] strs = pattern.split(al.get(i).toString()); - reportNum[i] = Integer.parseInt(strs[1]); - } - - Arrays.sort(reportNum); - int idx = reportNum.length > 0 ? reportNum[reportNum.length - 1] + 1 : 1; idx = idx + currentIndex; currentIndex++; return prefix + idx; } + + /** + * @return java.lang.Integer WorkBook11.cpt则返回11,如果没有找到index返回null + * @Description 返回文件名中的index + * @param: prefix 前缀 + * @param: fileName 文件名称全名 + * @Author Henry.Wang + * @Date 2021/4/9 11:13 + **/ + private static Integer getFileNameIndex(String prefix, String fileName) { + char[] chars = new char[fileName.length()]; + int i = 0; + for (; i < fileName.length(); i++) { + char c = fileName.charAt(i); + //匹配前缀 + if (i < prefix.length()) { + if (c != prefix.charAt(i)) { + return null; + } + } else { + if (c == '.') { + break; + } else { + //匹配0~9 + if (c < 48 || c > 57) { + return null; + } + chars[i - prefix.length()] = c; + } + } + } + String s = new String(chars).substring(0, i - prefix.length()); + if (StringUtils.isBlank(s)) { + return null; + } + return Integer.valueOf(s); + } } From 4f34fc2697c3b57882f552746f15645e585b3aaf Mon Sep 17 00:00:00 2001 From: shine Date: Thu, 27 May 2021 10:37:52 +0800 Subject: [PATCH 10/29] omport --- .../java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index b79ba23b1..709426817 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -19,6 +19,7 @@ import com.fr.design.actions.community.QuestionAction; import com.fr.design.actions.community.SignAction; import com.fr.design.actions.community.TechSolutionAction; import com.fr.design.actions.community.TechSupportAction; +import com.fr.design.actions.community.TemplateStoreAction; import com.fr.design.actions.community.VideoAction; import com.fr.design.actions.community.WorkOrderCenterAction; import com.fr.design.actions.file.CloseCurrentTemplateAction; From b15fa9dbbd66242b300376c6c68ad2f9163f0b04 Mon Sep 17 00:00:00 2001 From: shine Date: Thu, 27 May 2021 11:20:45 +0800 Subject: [PATCH 11/29] =?UTF-8?q?REPORT-52490=20=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=95=8C=E9=9D=A2=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E6=94=B9=E5=8F=98=E4=BA=8B=E4=BB=B6=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/ChartEditPaneActionListener.java | 16 +++ .../gui/chart/ChartEditPaneProvider.java | 6 + .../design/mainframe/ChartPropertyPane.java | 13 +- .../com/fr/design/mainframe/MapEditPane.java | 112 ------------------ .../design/mainframe/chart/ChartEditPane.java | 33 +++++- 5 files changed, 63 insertions(+), 117 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/gui/chart/ChartEditPaneActionListener.java delete mode 100644 designer-chart/src/main/java/com/fr/design/mainframe/MapEditPane.java diff --git a/designer-base/src/main/java/com/fr/design/gui/chart/ChartEditPaneActionListener.java b/designer-base/src/main/java/com/fr/design/gui/chart/ChartEditPaneActionListener.java new file mode 100644 index 000000000..f7678475f --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/chart/ChartEditPaneActionListener.java @@ -0,0 +1,16 @@ +package com.fr.design.gui.chart; + +import com.fr.chart.chartattr.ChartCollection; + +import java.util.EventListener; + +/** + * @author shine + * @version 10.0 + * Created by shine on 2021/5/26 + */ +public interface ChartEditPaneActionListener extends EventListener { + + void attributeChange(ChartCollection chartCollection); + +} diff --git a/designer-base/src/main/java/com/fr/design/gui/chart/ChartEditPaneProvider.java b/designer-base/src/main/java/com/fr/design/gui/chart/ChartEditPaneProvider.java index 3d4119ab7..300380036 100644 --- a/designer-base/src/main/java/com/fr/design/gui/chart/ChartEditPaneProvider.java +++ b/designer-base/src/main/java/com/fr/design/gui/chart/ChartEditPaneProvider.java @@ -10,4 +10,10 @@ public interface ChartEditPaneProvider { void fire(); + default void addChartEditPaneActionListener(ChartEditPaneActionListener l) { + } + + default void removeChartEditPaneActionListener(ChartEditPaneActionListener l) { + } + } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java index 4efe977ff..90b0e8805 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java @@ -16,6 +16,7 @@ import com.fr.design.gui.chart.ChartEditPaneProvider; import com.fr.design.gui.frpane.UITitlePanel; import com.fr.design.mainframe.chart.ChartEditPane; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.stable.AssistUtils; import javax.swing.BorderFactory; import javax.swing.Icon; @@ -35,6 +36,9 @@ public class ChartPropertyPane extends BaseChartPropertyPane { protected ChartEditPane chartEditPane; + //ID一样的话 不用新建chartEditPane + private String currentID; + private ChartPropertyPane() { initComponent(); } @@ -46,9 +50,12 @@ public class ChartPropertyPane extends BaseChartPropertyPane { @Override public void updateChartEditPane(String plotID) { - chartEditPane = ChartTypeInterfaceManager.getInstance().getChartEditPane(plotID); - chartEditPane.setContainer(container); - resetChartEditPane(); + if (!AssistUtils.equals(currentID, plotID)) { + chartEditPane = ChartTypeInterfaceManager.getInstance().getChartEditPane(plotID); + chartEditPane.setContainer(container); + currentID = plotID; + resetChartEditPane(); + } } @Override diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/MapEditPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/MapEditPane.java deleted file mode 100644 index 307d457cf..000000000 --- a/designer-chart/src/main/java/com/fr/design/mainframe/MapEditPane.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.fr.design.mainframe; - -import com.fr.chart.base.MapSvgAttr; -import com.fr.chart.base.MapSvgXMLHelper; -import com.fr.chart.chartglyph.MapShapeValue; -import com.fr.design.beans.BasicBeanPane; -import com.fr.design.chart.series.PlotSeries.AbstrctMapAttrEditPane; -import com.fr.design.chart.series.PlotSeries.MapCustomPane; -import com.fr.design.chart.series.PlotSeries.MapDefiAreaNamePane; -import com.fr.design.gui.frpane.UITabbedPane; - -import com.fr.stable.CoreConstants; -import com.fr.stable.StringUtils; - -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import java.awt.*; - -/** - * Created by IntelliJ IDEA. - * Author : daisy - * Version: 7.1.1 - * Date: 14/12/2 - * Time: 下午7:17 - */ -public class MapEditPane extends BasicBeanPane{ - - private UITabbedPane tabbedPane; - private MapCustomPane areaPane ; -// private MapCustomPane pointPane; - private MapDefiAreaNamePane namedPane; - private String currentMapName; - private AbstrctMapAttrEditPane editingPane; - - private ChangeListener tabbedChangeListener = new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - switch ( tabbedPane.getSelectedIndex()){ - case 1: - namedPane.populateMapAttr(editingPane.updateCurrentAttr()); - editingPane = namedPane; - break; - default: - areaPane.populateMapAttr(editingPane.updateCurrentAttr()); - editingPane = areaPane; - } - } - } ; - - public MapEditPane(){ - initTabbedPane(); - this.setLayout(new BorderLayout()); - this.add(tabbedPane,BorderLayout.CENTER); - } - - private void initTabbedPane(){ - tabbedPane = new UITabbedPane(); - areaPane = new MapCustomPane(false); -// pointPane = new MapCustomPane(false); - namedPane= new MapDefiAreaNamePane(false); - areaPane.setImageSelectType(MapShapeValue.AREA); -// pointPane.setImageSelectType(MapShapeValue.POINT); - tabbedPane.add(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Map_Image_Area"),areaPane); -// tabbedPane.add(com.fr.design.i18n.Toolkit.i18nText("FR-Chart-Map_ImagePoint"),pointPane); - tabbedPane.add(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Map_Corresponding_Fields"),namedPane); - editingPane = areaPane; - } - - @Override - protected String title4PopupWindow() { - return null; - } - - @Override - public void populateBean(MapSvgAttr ob) { - if(!StringUtils.isEmpty(ob.getName()) && !MapSvgXMLHelper.getInstance().containsMapName(ob.getName())){ - MapSvgAttr mapSvgAttr = new MapSvgAttr(); - mapSvgAttr.setFilePath(MapSvgXMLHelper.customMapPath()+ CoreConstants.SEPARATOR+ob.getName()+".svg"); - MapSvgXMLHelper.getInstance().addNewSvgMaps(ob.getName(), mapSvgAttr); - } - - currentMapName = ob.getName(); - if(editingPane == null){ - editingPane = areaPane; - } - editingPane.populateMapAttr(ob); - tabbedPane.addChangeListener(tabbedChangeListener); - } - - public String getCurrentMapName(){ - return currentMapName; - } - - public void setCurrentMapName(String currentMapName){ - this.currentMapName = currentMapName; - - } - - @Override - public MapSvgAttr updateBean() { - MapSvgAttr currentAttr = editingPane.updateCurrentAttr(); - currentMapName =currentAttr != null ? currentAttr.getName() : currentMapName; - MapSvgAttr attr = MapSvgXMLHelper.getInstance().getMapAttr(currentMapName); - if(attr != null ){ - MapSvgXMLHelper.getInstance().removeNewMapAttr(currentMapName); - MapSvgXMLHelper.getInstance().pushMapAttr(currentMapName,currentAttr); - return currentAttr; - }else{ - return MapSvgXMLHelper.getInstance().getNewMapAttr(currentMapName); - } - } -} \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java index 3dc90d3a3..4537c6a6c 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java @@ -9,6 +9,7 @@ import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.tabledata.Prepare4DataSourceChange; import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.chart.ChartEditPaneActionListener; import com.fr.design.gui.chart.ChartEditPaneProvider; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.ibutton.UIHeadGroup; @@ -27,11 +28,11 @@ import com.fr.plugin.chart.vanchart.VanChart; import javax.swing.JPanel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; +import java.awt.BorderLayout; +import java.awt.CardLayout; import java.util.ArrayList; import java.util.Calendar; import java.util.List; -import java.awt.BorderLayout; -import java.awt.CardLayout; public class ChartEditPane extends BasicPane implements AttributeChange, Prepare4DataSourceChange, ChartEditPaneProvider { @@ -101,6 +102,33 @@ public class ChartEditPane extends BasicPane implements AttributeChange, Prepare this.add(center, BorderLayout.CENTER); } + /** + * 增加面板Listener + */ + public void addChartEditPaneActionListener(ChartEditPaneActionListener l) { + this.listenerList.add(ChartEditPaneActionListener.class, l); + } + + /** + * 移除面板Listener + */ + public void removeChartEditPaneActionListener(ChartEditPaneActionListener l) { + this.listenerList.remove(ChartEditPaneActionListener.class, l); + } + + private void fireAttributeChange(ChartCollection chartCollection) { + // Guaranteed to return a non-null array + Object[] listeners = listenerList.getListenerList(); + + // Process the listeners last to first, notifying + // those that are interested in this event + for (int i = listeners.length - 1; i >= 0; i -= 1) { + if (listeners[i] == ChartEditPaneActionListener.class) { + ((ChartEditPaneActionListener) listeners[i + 1]).attributeChange(chartCollection); + } + } + } + AttributeChangeListener listener = new AttributeChangeListener() { @Override public void attributeChange() { @@ -130,6 +158,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange, Prepare } fire(); + fireAttributeChange(collection); } } }; From 4774ad05f04f6bbe561b181e744fe8d0a605c51d Mon Sep 17 00:00:00 2001 From: shine Date: Mon, 7 Jun 2021 09:58:06 +0800 Subject: [PATCH 12/29] =?UTF-8?q?feat:=E7=BC=96=E8=BE=91=E5=99=A8=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=20=E6=B2=A1=E6=9C=89=E5=8D=95=E5=85=83=E6=A0=BC?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=BA=90=20=E5=9B=BE=E8=A1=A8=E5=88=87?= =?UTF-8?q?=E6=8D=A2=20=E7=9B=91=E6=8E=A7=E5=88=B7=E6=96=B0=E7=AD=89?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/chart/gui/ChartTypePane.java | 12 +++++++-- .../chart/gui/data/NormalChartDataPane.java | 9 ++++--- .../chart/mode/ChartEditContext.java | 26 +++++++++++++++++++ .../mainframe/chart/mode/ChartEditMode.java | 12 +++++++++ .../other/VanChartCustomInteractivePane.java | 4 ++- .../other/VanChartInteractivePane.java | 15 +++++++++-- .../VanChartDrillMapInteractivePane.java | 8 +++++- .../other/VanChartMapInteractivePane.java | 3 +++ 8 files changed, 80 insertions(+), 9 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditContext.java create mode 100644 designer-chart/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditMode.java diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java index 553895a18..5137901ee 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java @@ -17,6 +17,7 @@ import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.gui.item.FlexibleComboBox; import com.fr.design.mainframe.chart.gui.item.ItemEventType; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.design.module.DesignModuleFactory; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; @@ -60,7 +61,14 @@ public class ChartTypePane extends AbstractChartAttrPane { if (editingCollection != null) { relayoutChartTypePane(editingCollection); } else { - chartTypeComBox = new ComboBoxPane(); + chartTypeComBox = new ComboBoxPane() { + @Override + protected void initLayout() { + super.initLayout(); + jcb.setVisible(ChartEditContext.normalMode()); + } + }; + } BasicScrollPane scrollPane = new BasicScrollPane() { @@ -388,7 +396,7 @@ public class ChartTypePane extends AbstractChartAttrPane { buttonPane.populateBean(collection); chartTypeComBox.populateBean(chart); - buttonPane.setVisible(ChartTypeInterfaceManager.getInstance().needChartChangePane(chart)); + buttonPane.setVisible(ChartTypeInterfaceManager.getInstance().needChartChangePane(chart) && ChartEditContext.normalMode()); this.initAllListeners(); } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java index 42cf782c3..86f7e4da8 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java @@ -7,16 +7,17 @@ import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.frpane.UIComboBoxPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.van.chart.designer.AbstractVanChartScrollPane; import javax.swing.BorderFactory; import javax.swing.JPanel; -import java.util.ArrayList; -import java.util.List; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; +import java.util.ArrayList; +import java.util.List; /** * 一般数据界面 @@ -67,7 +68,9 @@ public class NormalChartDataPane extends DataContentsPane { label1.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH,ChartDataPane.LABEL_HEIGHT)); northPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{jcb, null, null, label1, null})); northPane.setBorder(BorderFactory.createEmptyBorder(0,5,0,8)); - this.add(northPane, BorderLayout.NORTH); + if (ChartEditContext.normalMode()) { + this.add(northPane, BorderLayout.NORTH); + } this.add(cardPane, BorderLayout.CENTER); } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditContext.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditContext.java new file mode 100644 index 000000000..23616a482 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditContext.java @@ -0,0 +1,26 @@ +package com.fr.design.mainframe.chart.mode; + +import com.fr.common.annotations.Open; + +/** + * @author shine + * @version 10.0 + * Created by shine on 2021/6/4 + */ +@Open +public class ChartEditContext { + + private static ChartEditMode current = ChartEditMode.NORMAL; + + public static void switchTo(ChartEditMode mode) { + current = mode; + } + + public static boolean duchampMode() { + return current == ChartEditMode.DUCHAMP; + } + + public static boolean normalMode() { + return current == ChartEditMode.NORMAL; + } +} diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditMode.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditMode.java new file mode 100644 index 000000000..c5cc9da48 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditMode.java @@ -0,0 +1,12 @@ +package com.fr.design.mainframe.chart.mode; + +/** + * @author shine + * @version 10.0 + * Created by shine on 2021/6/4 + */ +//todo:refactor 弹出框图表没有单元格数据源,就不用一层层传下去了 +public enum ChartEditMode { + NORMAL, + DUCHAMP +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomInteractivePane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomInteractivePane.java index f399d90e8..8aab51b3f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomInteractivePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomInteractivePane.java @@ -1,7 +1,6 @@ package com.fr.van.chart.custom.other; import com.fr.chart.chartattr.Plot; - import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.custom.VanChartCustomPlot; import com.fr.plugin.chart.custom.type.CustomStyle; @@ -37,6 +36,9 @@ public class VanChartCustomInteractivePane extends VanChartInteractivePane { @Override protected void populateHyperlink(Plot plot) { + if (hyperlinkPane == null) { + return; + } hyperlinkPane.populateBean(chart); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java index 885931cb9..8e487a690 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java @@ -17,6 +17,7 @@ import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; @@ -120,7 +121,7 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { double[] rowSize = {p, p, p, p, p, p, p}; - Component[][] components = new Component[][]{ + Component[][] components = ChartEditContext.normalMode() ? new Component[][]{ new Component[]{createToolBarPane(getToolBarRowSize(), columnSize), null}, //大数据模式 恢复用注释。取消注释。 //new Component[]{createLargeDataModePane(), null}, @@ -129,6 +130,11 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { new Component[]{createZoomPane(new double[]{p, p, p}, columnSize, plot), null}, new Component[]{createAutoRefreshPane(plot), null}, new Component[]{createHyperlinkPane(), null} + } : new Component[][]{ + new Component[]{createToolBarPane(getToolBarRowSize(), columnSize), null}, + new Component[]{createAnimationPane(), null}, + new Component[]{createAxisRotationPane(new double[]{p, p}, columnSize, plot), null}, + new Component[]{createZoomPane(new double[]{p, p, p}, columnSize, plot), null} }; return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); @@ -487,6 +493,9 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { protected void populateHyperlink(Plot plot) { + if (superLink == null) { + return; + } superLink.populate(plot); } @@ -526,7 +535,9 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { } protected void populateAutoRefresh(VanChart chart) { - VanChartPlot plot = chart.getPlot(); + if (autoRefreshPane == null) { + return; + } RefreshMoreLabel refreshMoreLabel = chart.getRefreshMoreLabel(); if (refreshMoreLabel == null) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java index 1c8c98f42..0122b529b 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java @@ -7,6 +7,7 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; +import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.drillmap.VanChartDrillMapPlot; import com.fr.plugin.chart.vanchart.VanChart; @@ -39,13 +40,18 @@ public class VanChartDrillMapInteractivePane extends VanChartInteractivePaneWith double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double[] columnSize = {f, e}; double[] rowSize = {p, p, p, p, p, p, p, p, p, p, p}; - Component[][] components = new Component[][]{ + Component[][] components = ChartEditContext.normalMode() ? new Component[][]{ new Component[]{createToolBarPane(new double[]{p, p, p}, columnSize), null}, new Component[]{createAnimationPane(), null}, new Component[]{createZoomPane(new double[]{p, p, p}, columnSize, plot), null}, new Component[]{createDrillToolsPane(), null}, new Component[]{createAutoRefreshPane(plot), null}, new Component[]{createHyperlinkPane(), null} + } : new Component[][]{ + new Component[]{createToolBarPane(new double[]{p, p, p}, columnSize), null}, + new Component[]{createAnimationPane(), null}, + new Component[]{createZoomPane(new double[]{p, p, p}, columnSize, plot), null}, + new Component[]{createDrillToolsPane(), null} }; return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/VanChartMapInteractivePane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/VanChartMapInteractivePane.java index 0f89fed69..a6ede0df7 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/VanChartMapInteractivePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/VanChartMapInteractivePane.java @@ -27,6 +27,9 @@ public class VanChartMapInteractivePane extends VanChartInteractivePaneWithMapZo @Override protected void populateHyperlink(Plot plot) { + if (hyperlinkPane == null) { + return; + } hyperlinkPane.populateBean(plot); } From 65d5e8179b44118b44a52a4569168d38625b4e02 Mon Sep 17 00:00:00 2001 From: shine Date: Tue, 8 Jun 2021 19:47:52 +0800 Subject: [PATCH 13/29] api level --- .../fr/extended/chart/AbstractExtendedChartUIProvider.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartUIProvider.java b/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartUIProvider.java index a1a088020..64b480853 100644 --- a/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartUIProvider.java +++ b/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartUIProvider.java @@ -14,10 +14,14 @@ import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPa import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.stable.fun.impl.AbstractProvider; +import com.fr.stable.fun.mark.API; + +import static com.fr.design.chart.fun.ChartTypeUIProvider.CURRENT_API_LEVEL; /** * Created by shine on 2018/3/2. */ +@API(level = CURRENT_API_LEVEL) public abstract class AbstractExtendedChartUIProvider extends AbstractProvider implements ChartTypeUIProvider { protected abstract AbstractExtendedChartTableDataPane getTableDataSourcePane(); From 1a2d4acb6394e34efb6eac330ff6ef35e6e96e47 Mon Sep 17 00:00:00 2001 From: shine Date: Tue, 22 Jun 2021 19:03:03 +0800 Subject: [PATCH 14/29] =?UTF-8?q?feat:=E5=AF=B9=E6=8E=A5=E6=89=A9=E5=B1=95?= =?UTF-8?q?=E5=9B=BE=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/chart/fun/ChartTypeUIProvider.java | 32 +++++++--- .../chart/fun/IndependentChartUIProvider.java | 1 + .../chart/fun/impl/AbstractChartTypeUI.java | 58 ++----------------- ...bstractIndependentChartUIWithAPILevel.java | 1 + .../chart/fun/impl/DefaultChartTypePane.java | 38 ++++++++++++ .../design/chartx/impl/AbstractDataPane.java | 13 ++++- .../design/chartx/impl/AbstractOtherPane.java | 5 ++ 7 files changed, 85 insertions(+), 63 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/design/chart/fun/impl/DefaultChartTypePane.java diff --git a/designer-chart/src/main/java/com/fr/design/chart/fun/ChartTypeUIProvider.java b/designer-chart/src/main/java/com/fr/design/chart/fun/ChartTypeUIProvider.java index 9db47e431..d3adcc3a3 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/fun/ChartTypeUIProvider.java +++ b/designer-chart/src/main/java/com/fr/design/chart/fun/ChartTypeUIProvider.java @@ -89,7 +89,9 @@ public interface ChartTypeUIProvider extends Level { //todo:把下面这些接口删除 @Deprecated - boolean needChartChangePane(); + default boolean needChartChangePane() { + return false; + } /** * 数据集数据源的界面 @@ -97,7 +99,9 @@ public interface ChartTypeUIProvider extends Level { * @return 数据集数据源的界面 */ @Deprecated - AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent); + default AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) { + return null; + } /** @@ -106,7 +110,9 @@ public interface ChartTypeUIProvider extends Level { * @return 单元格数据源的界面 */ @Deprecated - AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent); + default AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent) { + return null; + } /** * 条件属性界面 @@ -114,7 +120,9 @@ public interface ChartTypeUIProvider extends Level { * @return 条件属性界面 */ @Deprecated - ConditionAttributesPane getPlotConditionPane(Plot plot); + default ConditionAttributesPane getPlotConditionPane(Plot plot) { + return null; + } /** * 系列界面 @@ -122,7 +130,9 @@ public interface ChartTypeUIProvider extends Level { * @return 系列界面 */ @Deprecated - BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot); + default BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot) { + return null; + } /** * 是否使用默认的界面,为了避免界面来回切换 @@ -130,12 +140,18 @@ public interface ChartTypeUIProvider extends Level { * @return 是否使用默认的界面 */ @Deprecated - boolean isUseDefaultPane(); + default boolean isUseDefaultPane() { + return false; + } @Deprecated - ChartEditPane getChartEditPane(String plotID); + default ChartEditPane getChartEditPane(String plotID) { + return new ChartEditPane(); + } @Deprecated - ChartsConfigPane getChartConfigPane(String plotID); + default ChartsConfigPane getChartConfigPane(String plotID) { + return null; + } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/chart/fun/IndependentChartUIProvider.java b/designer-chart/src/main/java/com/fr/design/chart/fun/IndependentChartUIProvider.java index 88a14c090..d9005788f 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/fun/IndependentChartUIProvider.java +++ b/designer-chart/src/main/java/com/fr/design/chart/fun/IndependentChartUIProvider.java @@ -6,6 +6,7 @@ import com.fr.common.annotations.Compatible; * Created by shine on 2019/09/05. */ @Compatible +@Deprecated public interface IndependentChartUIProvider extends ChartTypeUIProvider { } diff --git a/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractChartTypeUI.java b/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractChartTypeUI.java index c37ff939d..d1546653b 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractChartTypeUI.java +++ b/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractChartTypeUI.java @@ -1,18 +1,9 @@ package com.fr.design.chart.fun.impl; -import com.fr.chart.chartattr.Plot; -import com.fr.design.beans.BasicBeanPane; import com.fr.design.chart.fun.ChartTypeUIProvider; import com.fr.design.chartx.impl.AbstractDataPane; -import com.fr.design.chartx.impl.AbstractOtherPane; -import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.gui.frpane.AttributeChangeListener; -import com.fr.design.mainframe.chart.ChartEditPane; -import com.fr.design.mainframe.chart.ChartsConfigPane; -import com.fr.design.mainframe.chart.gui.ChartDataPane; -import com.fr.design.mainframe.chart.gui.ChartStylePane; -import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; -import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; +import com.fr.design.mainframe.chart.AbstractChartAttrPane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.stable.fun.impl.AbstractProvider; import com.fr.stable.fun.mark.API; @@ -24,13 +15,15 @@ import com.fr.stable.fun.mark.API; public abstract class AbstractChartTypeUI extends AbstractProvider implements ChartTypeUIProvider { @Override - public abstract AbstractChartTypePane getPlotTypePane(); + public AbstractChartTypePane getPlotTypePane() { + return new DefaultChartTypePane(); + } @Override public abstract AbstractDataPane getChartDataPane(AttributeChangeListener listener); @Override - public abstract AbstractOtherPane[] getAttrPaneArray(AttributeChangeListener listener); + public abstract AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener); @Override public String[] getSubName() { @@ -46,45 +39,4 @@ public abstract class AbstractChartTypeUI extends AbstractProvider implements Ch public String mark4Provider() { return getClass().getName(); } - - @Override - public boolean needChartChangePane() { - return false; - } - - @Override - public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) { - return null; - } - - @Override - public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent) { - return null; - } - - @Override - public boolean isUseDefaultPane() { - return false; - } - - @Override - public ChartEditPane getChartEditPane(String plotID) { - return new ChartEditPane(); - } - - @Override - public ConditionAttributesPane getPlotConditionPane(Plot plot) { - return null; - } - - @Override - public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot) { - return null; - } - - @Override - public ChartsConfigPane getChartConfigPane(String plotID) { - return null; - } - } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java b/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java index f6a1b20fc..8fa0f34dc 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java +++ b/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java @@ -17,6 +17,7 @@ import com.fr.stable.StableUtils; /** * Created by Mitisky on 16/3/7. */ +@Deprecated public abstract class AbstractIndependentChartUIWithAPILevel implements ChartTypeUIProvider { //这个不能改,是做兼容用的 //2016.10.14-11.24号的8.0jar因为改了这个为3,不会提示5.26号之前的插件更新 diff --git a/designer-chart/src/main/java/com/fr/design/chart/fun/impl/DefaultChartTypePane.java b/designer-chart/src/main/java/com/fr/design/chart/fun/impl/DefaultChartTypePane.java new file mode 100644 index 000000000..9d6b6fdf7 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chart/fun/impl/DefaultChartTypePane.java @@ -0,0 +1,38 @@ +package com.fr.design.chart.fun.impl; + +import com.fr.chart.charttypes.ChartTypeManager; +import com.fr.chartx.attr.ChartProvider; +import com.fr.design.ChartTypeInterfaceManager; +import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; + +/** + * @author shine + * @version 10.0 + * Created by shine on 2020/7/8 + */ +public class DefaultChartTypePane extends AbstractChartTypePane { + + @Override + protected String[] getTypeIconPath() { + return ChartTypeInterfaceManager.getInstance().getDemoImagePath(this.getPlotID()); + } + + @Override + protected String[] getTypeTipName() { + return ChartTypeInterfaceManager.getInstance().getSubName(this.getPlotID()); + } + + public ChartProvider getDefaultChart() { + return ChartTypeManager.getInstance().getChartTypes(this.getPlotID())[0]; + } + + public String title4PopupWindow() { + return ChartTypeInterfaceManager.getInstance().getName(this.getPlotID()); + } + + @Override + public void populateBean(T ob) { + } + + +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/impl/AbstractDataPane.java b/designer-chart/src/main/java/com/fr/design/chartx/impl/AbstractDataPane.java index 4641332e3..92864c87f 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/impl/AbstractDataPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/impl/AbstractDataPane.java @@ -45,12 +45,16 @@ public abstract class AbstractDataPane extends ChartDataPane { ChartDataDefinitionProvider dataDefinition = chart.getChartDataDefinition(); - singleDataPane.populateBean((AbstractDataDefinition) dataDefinition); + populate(dataDefinition); this.initAllListeners(); this.validate(); } + protected void populate(ChartDataDefinitionProvider dataDefinition) { + singleDataPane.populateBean((AbstractDataDefinition) dataDefinition); + } + @Override public void update(ChartCollection collection) { @@ -62,6 +66,11 @@ public abstract class AbstractDataPane extends ChartDataPane { return; } - chart.setChartDataDefinition(singleDataPane.updateBean()); + chart.setChartDataDefinition(update()); } + + protected ChartDataDefinitionProvider update() { + return singleDataPane.updateBean(); + } + } diff --git a/designer-chart/src/main/java/com/fr/design/chartx/impl/AbstractOtherPane.java b/designer-chart/src/main/java/com/fr/design/chartx/impl/AbstractOtherPane.java index 0f0138ba7..a35074288 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/impl/AbstractOtherPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/impl/AbstractOtherPane.java @@ -3,6 +3,7 @@ package com.fr.design.chartx.impl; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.impl.AbstractChartWithData; import com.fr.design.mainframe.chart.AbstractChartAttrPane; +import com.fr.design.mainframe.chart.PaneTitleConstants; /** * Created by shine on 2019/09/04. @@ -13,6 +14,10 @@ public abstract class AbstractOtherPane extends protected abstract void update(T chart); + public String title4PopupWindow() { + return PaneTitleConstants.CHART_OTHER_TITLE; + } + @Override public void populate(ChartCollection collection) { if (collection == null) { From 6a225d293da1ff723297595f7d9f756cf707796f Mon Sep 17 00:00:00 2001 From: shine Date: Tue, 22 Jun 2021 19:30:48 +0800 Subject: [PATCH 15/29] =?UTF-8?q?merge:=E5=85=88=E6=8A=8A=E6=88=91?= =?UTF-8?q?=E8=87=AA=E5=B7=B1=E7=9A=84=E6=94=B9=E5=9B=9E=E5=8E=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/DesignerFrame.java | 399 +++++------------- 1 file changed, 106 insertions(+), 293 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 25948b62c..3638b85f3 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -4,9 +4,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; -import com.fr.base.chart.exception.ChartNotFoundException; import com.fr.design.DesignModelAdapter; -import com.fr.design.DesignState; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.core.ActionFactory; @@ -22,24 +20,16 @@ import com.fr.design.event.TargetModifiedListener; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.MutilTempalteTabPane; -import com.fr.design.file.NewTemplatePane; import com.fr.design.file.SaveSomeTemplatePane; import com.fr.design.file.TemplateTreePane; import com.fr.design.fun.OemProcessor; -import com.fr.design.fun.TitlePlaceProcessor; import com.fr.design.fun.impl.AbstractTemplateTreeShortCutProvider; -import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.gui.imenu.UIMenuHighLight; import com.fr.design.gui.iprogressbar.ProgressDialog; import com.fr.design.gui.iscrollbar.UIScrollBar; -import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.i18n.Toolkit; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.mainframe.loghandler.LogMessageBar; import com.fr.design.mainframe.toolbar.ToolBarMenuDock; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.vcs.common.VcsHelper; -import com.fr.design.menu.MenuManager; import com.fr.design.menu.ShortCut; import com.fr.design.os.impl.MacOsAddListenerAction; import com.fr.design.os.impl.SupportOSImpl; @@ -51,47 +41,31 @@ import com.fr.file.FILE; import com.fr.file.FILEFactory; import com.fr.file.FileFILE; import com.fr.general.ComparatorUtils; -import com.fr.general.GeneralContext; -import com.fr.general.GeneralUtils; import com.fr.general.IOUtils; import com.fr.invoke.Reflect; import com.fr.log.FineLoggerFactory; -import com.fr.plugin.context.PluginContext; -import com.fr.plugin.injectable.PluginModule; -import com.fr.plugin.manage.PluginFilter; -import com.fr.plugin.observer.PluginEvent; -import com.fr.plugin.observer.PluginEventListener; import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; import com.fr.stable.image4j.codec.ico.ICODecoder; import com.fr.stable.os.OperatingSystem; -import com.fr.stable.os.support.OSBasedAction; import com.fr.stable.os.support.OSSupportCenter; import com.fr.stable.project.ProjectConstants; import com.fr.start.OemHandler; import com.fr.workspace.WorkContext; import com.fr.workspace.Workspace; import com.fr.workspace.connect.WorkspaceConnectionInfo; -import java.util.concurrent.CopyOnWriteArrayList; -import org.jetbrains.annotations.Nullable; import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JLayeredPane; -import javax.swing.JMenuBar; import javax.swing.JOptionPane; import javax.swing.JPanel; -import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.WindowConstants; -import javax.swing.border.MatteBorder; import java.awt.BorderLayout; -import java.awt.Component; import java.awt.Dimension; -import java.awt.FlowLayout; import java.awt.Graphics; -import java.awt.Insets; import java.awt.Point; import java.awt.Rectangle; import java.awt.datatransfer.DataFlavor; @@ -126,34 +100,16 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta private static final long serialVersionUID = -8732559571067484460L; - private static final int LEFT_ALIGN_GAP = -5; - private static final int MENU_HEIGHT = 26; private static final Integer SECOND_LAYER = 100; private static final Integer TOP_LAYER = 200; - private List designerOpenedListenerList = new CopyOnWriteArrayList<>(); + private List designerOpenedListenerList = new ArrayList<>(); private ToolBarMenuDock ad; - private DesktopCardPane centerTemplateCardPane; - - private JPanel toolbarPane; - - private JComponent toolbarComponent; - - private JPanel menuPane; - - private JMenuBar menuBar; - - private JPanel eastCenterPane; - - private UIToolbar combineUp; - - private NewTemplatePane newWorkBookPane; - private Icon closeMode; private JLayeredPane layeredPane = this.getLayeredPane(); @@ -188,10 +144,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta @Override public void windowClosing(WindowEvent e) { - // 关闭前check - if (!TemplateSavingChecker.check()) { - return; - } //关闭前当前模板 停止编辑 HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().stopEditing(); SaveSomeTemplatePane saveSomeTempaltePane = new SaveSomeTemplatePane(true); @@ -275,37 +227,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta // the content pane basePane.setLayout(new BorderLayout()); - toolbarPane = new JPanel() { - @Override - public Dimension getPreferredSize() { - - Dimension dim = super.getPreferredSize(); - // dim.height = TOOLBAR_HEIGHT; - return dim; - } - }; - toolbarPane.setLayout(FRGUIPaneFactory.createBorderLayout()); - JPanel eastPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - eastPane.add(ad.createLargeToolbar(), BorderLayout.WEST); - eastCenterPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - combineUpTooBar(); - eastCenterPane.add(combineUp, BorderLayout.NORTH); - JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - panel.add(newWorkBookPane = ad.getNewTemplatePane(), BorderLayout.WEST); - panel.add(MutilTempalteTabPane.getInstance(), BorderLayout.CENTER); - eastCenterPane.add(panel, BorderLayout.CENTER); - - eastPane.add(eastCenterPane, BorderLayout.CENTER); - toolbarPane.add(eastPane, BorderLayout.NORTH); - toolbarPane.add(new UIMenuHighLight(), BorderLayout.SOUTH); - - JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - centerPane.add(centerTemplateCardPane = new DesktopCardPane(), BorderLayout.CENTER); - centerPane.add(toolbarPane, BorderLayout.NORTH); - - - basePane.add(centerPane, BorderLayout.CENTER); + basePane.add(CenterRegionContainerPane.getInstance(), BorderLayout.CENTER); laoyoutWestPane(); basePane.add(EastRegionContainerPane.getInstance(), BorderLayout.EAST); basePane.setBounds(0, 0, contentWidth, contentHeight); @@ -411,9 +334,9 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta designerOpenedListenerList.clear(); } - public DesktopCardPane getCenterTemplateCardPane() { + protected DesktopCardPane getCenterTemplateCardPane() { - return centerTemplateCardPane; + return CenterRegionContainerPane.getInstance().getCenterTemplateCardPane(); } /** @@ -421,82 +344,10 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta */ protected void initMenuPane() { - menuPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - menuPane.add(new UIMenuHighLight(), BorderLayout.SOUTH); - menuPane.add(initNorthEastPane(ad), BorderLayout.EAST); - basePane.add(menuPane, BorderLayout.NORTH); + basePane.add(NorthRegionContainerPane.getInstance(), BorderLayout.NORTH); this.resetToolkitByPlus(null); } - /** - * @param ad 菜单栏 - * @return panel - */ - protected JPanel initNorthEastPane(final ToolBarMenuDock ad) { - //hugh: private修改为protected方便oem的时候修改右上的组件构成 - //顶部日志+登陆按钮 - final JPanel northEastPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - //优先级为-1,保证最后全面刷新一次 - GeneralContext.listenPluginRunningChanged(new PluginEventListener(-1) { - - @Override - public void on(PluginEvent event) { - - refreshNorthEastPane(northEastPane, ad); - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - if (DesignerContext.getDesignerFrame() == null) { - return; - } - DesignerContext.getDesignerFrame().refresh(); - DesignerContext.getDesignerFrame().repaint(); - } - }); - } - }, new PluginFilter() { - - @Override - public boolean accept(PluginContext context) { - - return context.contain(PluginModule.ExtraDesign); - } - }); - refreshNorthEastPane(northEastPane, ad); - return northEastPane; - } - - private void refreshNorthEastPane(final JPanel northEastPane, final ToolBarMenuDock ad) { - - northEastPane.removeAll(); - northEastPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0)); - northEastPane.add(LogMessageBar.getInstance()); - TitlePlaceProcessor processor = ExtraDesignClassManager.getInstance().getSingle(TitlePlaceProcessor.MARK_STRING); - if (processor != null) { - final Component[] bbsLoginPane = {null}; - OSSupportCenter.buildAction(new OSBasedAction() { - @Override - public void execute(Object... objects) { - bbsLoginPane[0] = ad.createBBSLoginPane(); - } - }, SupportOSImpl.USERINFOPANE); - processor.hold(northEastPane, LogMessageBar.getInstance(), bbsLoginPane[0]); - } - northEastPane.add(ad.createAlphaFinePane()); - if (!DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isEnabled()) { - ad.createAlphaFinePane().setVisible(false); - } - northEastPane.add(ad.createNotificationCenterPane()); - - OSSupportCenter.buildAction(new OSBasedAction() { - @Override - public void execute(Object... objects) { - northEastPane.add(ad.createBBSLoginPane()); - } - }, SupportOSImpl.USERINFOPANE); - - } - public void initTitleIcon() { try { @@ -673,94 +524,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta this.closeMode = closeMode; } - /** - * 创建上工具栏 - */ - private void combineUpTooBar() { - combineUp = new UIToolbar(FlowLayout.LEFT); - combineUp.setBorder(new MatteBorder(new Insets(0, LEFT_ALIGN_GAP, 1, 0), UIConstants.LINE_COLOR)); - combineUp.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 2)); - setUpUpToolBar(null); - - } - - /** - * 重置上工具栏 - */ - private void resetCombineUpTooBar(JComponent[] toolbar4Form) { - combineUp.removeAll(); - setUpUpToolBar(toolbar4Form); - } - - /** - * 填充上工具栏的中的工具 - * - * @param toolbar4Form 目标组件 - */ - private void setUpUpToolBar(@Nullable JComponent[] toolbar4Form) { - UIButton[] fixButtons = ad.createUp(); - for (UIButton fixButton : fixButtons) { - combineUp.add(fixButton); - } - if (!DesignModeContext.isAuthorityEditing()) { - combineUp.addSeparator(new Dimension(2, 16)); - if (toolbar4Form != null) { - for (JComponent jComponent : toolbar4Form) { - combineUp.add(jComponent); - } - } - //添加检测按钮 - addCheckButton(); - } - //添加分享按钮 - addShareButton(); - //添加插件中的按钮 - addExtraButtons(); - } - - private void addExtraButtons() { - - JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - if (jt == null) { - return; - } - - - UIButton[] extraButtons = jt.createExtraButtons(); - for (UIButton extraButton : extraButtons) { - combineUp.add(extraButton); - } - if (extraButtons.length > 0) { - combineUp.addSeparator(new Dimension(2, 16)); - } - } - - private void addCheckButton() { - JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - if (jt == null) { - return; - } - combineUp.addSeparator(new Dimension(2, 16)); - UIButton[] checkButtons = jt.createCheckButton(); - for (UIButton checkButton : checkButtons) { - combineUp.add(checkButton); - } - } - - private void addShareButton() { - - JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - if (jt == null) { - return; - } - - combineUp.addSeparator(new Dimension(2, 16)); - UIButton[] shareButtons = jt.createShareButton(); - for (UIButton shareButton : shareButtons) { - combineUp.add(shareButton); - } - } - /** * 检查 * @@ -768,17 +531,10 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * @param al 组件名称 */ public void checkCombineUp(boolean flag, ArrayList al) { - //Yvan: 检查当前是否为WORK_SHEET状态,因为只有WORK_SHEET中含有格式刷组件,此时是不需要进行checkComponentsByNames的 - JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - if (jTemplate != null) { - // 第一个条件满足后还需要添加一重判断,判断是编辑报表块还是参数面板,编辑报表块时则直接return - if (jTemplate.getMenuState() == DesignState.WORK_SHEET && !jTemplate.isUpMode()) { - return; - } - combineUp.checkComponentsByNames(flag, al); - } + CenterRegionContainerPane.getInstance().checkCombineUp(flag, al); } + /** * 刷新工具条. */ @@ -787,6 +543,10 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta this.ad.updateToolBarDef(); } + ToolBarMenuDock getToolBarMenuDock() { + return this.ad; + } + /** * 重置相关的工具条. * @@ -798,39 +558,18 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta plus = ToolBarMenuDock.NULLAVOID; } - DesignState designState = new DesignState(plus); - MenuManager.getInstance().setMenus4Designer(designState); - if (menuBar == null) { - menuPane.add(menuBar = ad.createJMenuBar(plus), BorderLayout.CENTER); - } else { - ad.resetJMenuBar(menuBar, plus); - } - - resetCombineUpTooBar(ad.resetUpToolBar(plus)); + NorthRegionContainerPane.getInstance().resetToolkitByPlus(plus, ad); - if (toolbarComponent != null) { - toolbarPane.remove(toolbarComponent); - } - - // 颜色,字体那些按钮的工具栏 - toolbarPane.add(toolbarComponent = ad.resetToolBar(toolbarComponent, plus), BorderLayout.CENTER); + CenterRegionContainerPane.getInstance().resetToolkitByPlus(plus, ad); this.checkToolbarMenuEnable(); this.validate(); layeredPane.repaint(); } - public void refreshUIToolBar() { - if (toolbarComponent instanceof UIToolbar) { - ((UIToolbar ) toolbarComponent).refreshUIToolBar(); - } - combineUp.refreshUIToolBar(); - this.ad.updateEnable(); - } - public JComponent getToolbarComponent() { - return this.toolbarComponent; + return CenterRegionContainerPane.getInstance().getToolbarComponent(); } /** @@ -838,7 +577,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta */ public void needToAddAuhtorityPaint() { - newWorkBookPane.setButtonGray(DesignModeContext.isAuthorityEditing()); + CenterRegionContainerPane.getInstance().needToAddAuhtorityPaint(); // 进入或退出权限编辑模式,通知插件 Set extraShortCuts = ExtraDesignClassManager.getInstance().getExtraShortCuts(); @@ -867,9 +606,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta JTemplate editingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); StringBuilder defaultTitleSB = new StringBuilder(); - defaultTitleSB.append(ProductConstants.APP_NAME); - defaultTitleSB.append(" "); - defaultTitleSB.append(GeneralUtils.getVersion()); + defaultTitleSB.append(ProductConstants.PRODUCT_NAME); defaultTitleSB.append(" "); defaultTitleSB.append(ProductConstants.BRANCH); defaultTitleSB.append(" "); @@ -956,7 +693,43 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta */ public JTemplate getSelectedJTemplate() { - return this.centerTemplateCardPane.getSelectedJTemplate(); + return getCenterTemplateCardPane().getSelectedJTemplate(); + } + + /** + * 保存当前编辑的模板 + */ + + public void saveCurrentEditingTemplate() { + + JTemplate editingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + if (editingTemplate == null) { + return; + } + if (editingTemplate.isSaved()) {// isSaved == true表示已经保存过,或者新建的一张模板 + if (editingTemplate.getEditingFILE().exists()) {// 表示磁盘上的某一张已经保存过的模板,要添加到历史中 + // HistoryTemplateListPane.getInstance().addHistory(); + } + } else { + editingTemplate.stopEditing(); + if (!editingTemplate.getEditingFILE().exists()) { + int returnVal = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save") + " \"" + editingTemplate.getEditingFILE() + + "\" ?", Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.YES_NO_OPTION, + JOptionPane.QUESTION_MESSAGE); + if (returnVal == JOptionPane.YES_OPTION && editingTemplate.saveTemplate()) { + editingTemplate.saveTemplate(); + FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", + editingTemplate.getEditingFILE().getName())); + } + } else { + if (editingTemplate.saveTemplate()) { + editingTemplate.saveTemplate(); + FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", + editingTemplate.getEditingFILE().getName())); + } + } + } } /** @@ -985,10 +758,14 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta if (jt == null || jt.getEditingFILE() == null) { return; } + if (currentTemplateDeactivateFail()) { + return; + } jt.addJTemplateActionListener(this); jt.addTargetModifiedListener(this); jt.addJTemplateActionListener(VcsHelper.getInstance()); - centerTemplateCardPane.showJTemplate(jt); + getCenterTemplateCardPane().showJTemplate(jt); + refreshBaseContentPane(jt); setTitle(); layeredPane.repaint(); } @@ -1006,11 +783,57 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta if (jt == null || jt.getEditingFILE() == null) { return; } - centerTemplateCardPane.showJTemplate(jt); + if (currentTemplateDeactivateFail()) { + return; + } + getCenterTemplateCardPane().showJTemplate(jt); + refreshBaseContentPane(jt); setTitle(); layeredPane.repaint(); } + /** + * 当前模板 停用失败 + * + * @return 是否停用失败 + */ + private boolean currentTemplateDeactivateFail() { + JTemplate currentEditingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + return currentEditingTemplate != null && !currentEditingTemplate.deactivateTemplate(); + } + + + /** + * 根据模板刷新 设计器整个界面 + * + * @param jTemplate 当前模板 + */ + private void refreshBaseContentPane(JTemplate jTemplate) { + + JComponent north = jTemplate.north4DesignerFrame(), + center = jTemplate.center4DesignerFrame(), + west = jTemplate.west4DesignerFrame(), + east = jTemplate.east4DesignerFrame(); + + basePane.removeAll(); + + if (north != null) { + basePane.add(north, BorderLayout.NORTH); + } + if (center != null) { + basePane.add(center, BorderLayout.CENTER); + } + if (west != null) { + basePane.add(west, BorderLayout.WEST); + } + if (east != null) { + basePane.add(east, BorderLayout.EAST); + } + + layeredPane.repaint(); + layeredPane.revalidate(); + } + /** * 对象侦听 * @@ -1082,16 +905,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta JOptionPane.WARNING_MESSAGE, UIManager.getIcon("OptionPane.errorIcon") ); - if (this.getSelectedJTemplate() == null) { - addAndActivateJTemplate(); - } - } catch (ChartNotFoundException e) { - FineJOptionPane.showMessageDialog(this, - Toolkit.i18nText("Fine-Design_Chart_Not_Found_Exception"), - Toolkit.i18nText("Fine-Design_Basic_Error"), - JOptionPane.ERROR_MESSAGE, - UIManager.getIcon("OptionPane.errorIcon")); - if (this.getSelectedJTemplate() == null) { addAndActivateJTemplate(); } @@ -1314,4 +1127,4 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta return designerOpened; } -} +} \ No newline at end of file From 4a82c11cd468f51df4619071d524258eec2c9f6f Mon Sep 17 00:00:00 2001 From: shine Date: Tue, 22 Jun 2021 19:33:49 +0800 Subject: [PATCH 16/29] =?UTF-8?q?merge:REPORT-51442=20=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E6=A0=8F=E5=92=8C=E6=95=B0=E6=8D=AE=E9=9B=86=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E7=81=B0=E5=8C=96=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/CenterRegionContainerPane.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java index d610b9862..d6e55cd64 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java @@ -246,6 +246,7 @@ public class CenterRegionContainerPane extends JPanel { ((UIToolbar ) toolbarComponent).refreshUIToolBar(); } combineUp.refreshUIToolBar(); + getToolBarMenuDock().updateEnable(); } } From 18f0772ada25e494235c7da83e6e8d692321a6ec Mon Sep 17 00:00:00 2001 From: shine Date: Tue, 22 Jun 2021 19:35:46 +0800 Subject: [PATCH 17/29] =?UTF-8?q?merge:REPORT-53229=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E9=A1=B6=E9=83=A8=E7=89=88=E6=9C=AC=E5=8F=B7=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E6=94=B9=E4=B8=BA=E5=B0=8F=E7=89=88=E6=9C=AC=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/mainframe/DesignerFrame.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 3638b85f3..94042aef6 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -41,6 +41,7 @@ import com.fr.file.FILE; import com.fr.file.FILEFactory; import com.fr.file.FileFILE; import com.fr.general.ComparatorUtils; +import com.fr.general.GeneralUtils; import com.fr.general.IOUtils; import com.fr.invoke.Reflect; import com.fr.log.FineLoggerFactory; @@ -606,7 +607,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta JTemplate editingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); StringBuilder defaultTitleSB = new StringBuilder(); - defaultTitleSB.append(ProductConstants.PRODUCT_NAME); + defaultTitleSB.append(ProductConstants.APP_NAME); + defaultTitleSB.append(GeneralUtils.getVersion()); defaultTitleSB.append(" "); defaultTitleSB.append(ProductConstants.BRANCH); defaultTitleSB.append(" "); From c180a3dc62cffe6579da657aefbf5cbe00fb4b29 Mon Sep 17 00:00:00 2001 From: shine Date: Tue, 22 Jun 2021 19:36:31 +0800 Subject: [PATCH 18/29] =?UTF-8?q?merge:REPORT-53229=20=E8=A1=A5=E4=B8=8A?= =?UTF-8?q?=E7=A9=BA=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/mainframe/DesignerFrame.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 94042aef6..8e88a54c9 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -608,6 +608,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta JTemplate editingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); StringBuilder defaultTitleSB = new StringBuilder(); defaultTitleSB.append(ProductConstants.APP_NAME); + defaultTitleSB.append(" "); defaultTitleSB.append(GeneralUtils.getVersion()); defaultTitleSB.append(" "); defaultTitleSB.append(ProductConstants.BRANCH); From ef1c2c74c91b47e9859fb53e826e6ae5d616de0d Mon Sep 17 00:00:00 2001 From: shine Date: Tue, 22 Jun 2021 19:37:38 +0800 Subject: [PATCH 19/29] =?UTF-8?q?merge:REPORT-53626=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=90=AF=E5=8A=A8=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/mainframe/DesignerFrame.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 8e88a54c9..8fe481099 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -92,6 +92,7 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Set; +import java.util.concurrent.CopyOnWriteArrayList; public class DesignerFrame extends JFrame implements JTemplateActionListener, TargetModifiedListener { @@ -107,7 +108,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta private static final Integer TOP_LAYER = 200; - private List designerOpenedListenerList = new ArrayList<>(); + private List designerOpenedListenerList = new CopyOnWriteArrayList<>(); private ToolBarMenuDock ad; From f262525148487672fee949bf4f009b031aadefe5 Mon Sep 17 00:00:00 2001 From: shine Date: Tue, 22 Jun 2021 19:39:31 +0800 Subject: [PATCH 20/29] =?UTF-8?q?merge:REPORT-51958=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E6=A3=80=E6=B5=8B=E5=8F=8A=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/NorthRegionContainerPane.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java index dcc274eed..b07071057 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java @@ -116,6 +116,8 @@ public class NorthRegionContainerPane extends JPanel { if (!DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isEnabled()) { ad.createAlphaFinePane().setVisible(false); } + northEastPane.add(ad.createNotificationCenterPane()); + OSSupportCenter.buildAction(new OSBasedAction() { @Override public void execute(Object... objects) { From 33f83219cc9cb42a1b1e159474f15ea8cbf96a64 Mon Sep 17 00:00:00 2001 From: shine Date: Tue, 22 Jun 2021 19:45:34 +0800 Subject: [PATCH 21/29] =?UTF-8?q?merge:REPORT-49986=20=E3=80=9010.0.16?= =?UTF-8?q?=E3=80=91=E6=80=A7=E8=83=BD=E4=BC=98=E5=8C=96=E4=B9=8B=E9=98=BB?= =?UTF-8?q?=E5=A1=9EEDT=E7=BA=BF=E7=A8=8B=E6=97=B6=E4=BC=98=E5=8C=96=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/mainframe/DesignerFrame.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 8fe481099..820fcfc76 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -146,6 +146,10 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta @Override public void windowClosing(WindowEvent e) { + // 关闭前check + if (!TemplateSavingChecker.check()) { + return; + } //关闭前当前模板 停止编辑 HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().stopEditing(); SaveSomeTemplatePane saveSomeTempaltePane = new SaveSomeTemplatePane(true); From 7ae9d5554d0f8af2d6ab26aa6506d6cdc895820a Mon Sep 17 00:00:00 2001 From: shine Date: Tue, 22 Jun 2021 19:49:10 +0800 Subject: [PATCH 22/29] merge --- .../main/java/com/fr/design/mainframe/DesignerFrame.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 820fcfc76..e5d88ee8c 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -340,11 +340,15 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta designerOpenedListenerList.clear(); } - protected DesktopCardPane getCenterTemplateCardPane() { + public DesktopCardPane getCenterTemplateCardPane() { return CenterRegionContainerPane.getInstance().getCenterTemplateCardPane(); } + public void refreshUIToolBar() { + CenterRegionContainerPane.getInstance().refreshUIToolBar(); + } + /** * 初始menuPane的方法 方便OEM时修改该组件 */ From 4885d330f06d153248745850d8621aa2c6b204d0 Mon Sep 17 00:00:00 2001 From: shine Date: Mon, 28 Jun 2021 16:59:06 +0800 Subject: [PATCH 23/29] =?UTF-8?q?feat:=E7=B1=BB=E5=9E=8B=E5=92=8C=E7=89=B9?= =?UTF-8?q?=E6=80=A7=E9=9D=A2=E6=9D=BF=E5=A6=82=E6=9E=9C=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E5=85=B6=E4=BB=96=E8=AE=BE=E7=BD=AE=E9=A1=B9=20=E5=88=99?= =?UTF-8?q?=E6=8B=BF=E6=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/fun/impl/AbstractChartTypeUI.java | 3 ++- .../chart/fun/impl/InvisibleChartTypePane.java | 15 +++++++++++++++ .../fr/design/mainframe/chart/ChartEditPane.java | 14 +++++++++----- .../mainframe/chart/ChartHyperEditPane.java | 2 +- .../area/AreaIndependentVanChartInterface.java | 4 +++- .../bar/BarIndependentVanChartInterface.java | 4 +++- .../box/BoxIndependentVanChartInterface.java | 4 +++- .../BubbleIndependentVanChartInterface.java | 4 +++- .../fr/van/chart/column/VanColumnChartTypeUI.java | 4 +++- .../van/chart/custom/VanChartCustomDataPane.java | 4 +++- .../van/chart/custom/VanChartCustomPlotPane.java | 14 +++++++++++--- .../FunnelIndependentVanChartInterface.java | 4 +++- .../GanttIndependentVanChartInterface.java | 4 +++- .../gauge/GaugeIndependentVanChartInterface.java | 4 +++- .../line/LineIndependentVanChartInterface.java | 4 +++- .../map/designer/type/VanChartMapPlotPane.java | 7 +++++-- .../MultiPieIndependentVanChartInterface.java | 4 +++- .../pie/PieIndependentVanChartInterface.java | 4 +++- .../radar/RadarIndependentVanChartInterface.java | 4 +++- .../ScatterIndependentVanChartInterface.java | 4 +++- .../desinger/VanStructureChartTypeUI.java | 4 +++- .../TreeMapIndependentVanChartInterface.java | 4 +++- .../WordCloudIndependentVanChartInterface.java | 4 +++- 23 files changed, 94 insertions(+), 29 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/design/chart/fun/impl/InvisibleChartTypePane.java diff --git a/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractChartTypeUI.java b/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractChartTypeUI.java index d1546653b..445355928 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractChartTypeUI.java +++ b/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractChartTypeUI.java @@ -5,6 +5,7 @@ import com.fr.design.chartx.impl.AbstractDataPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.mainframe.chart.AbstractChartAttrPane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.stable.fun.impl.AbstractProvider; import com.fr.stable.fun.mark.API; @@ -16,7 +17,7 @@ public abstract class AbstractChartTypeUI extends AbstractProvider implements Ch @Override public AbstractChartTypePane getPlotTypePane() { - return new DefaultChartTypePane(); + return ChartEditContext.duchampMode() ? new InvisibleChartTypePane() : new DefaultChartTypePane(); } @Override diff --git a/designer-chart/src/main/java/com/fr/design/chart/fun/impl/InvisibleChartTypePane.java b/designer-chart/src/main/java/com/fr/design/chart/fun/impl/InvisibleChartTypePane.java new file mode 100644 index 000000000..6bc927b17 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chart/fun/impl/InvisibleChartTypePane.java @@ -0,0 +1,15 @@ +package com.fr.design.chart.fun.impl; + +import com.fr.design.ChartTypeInterfaceManager; + +/** + * @author shine + * @version 10.0 + * Created by shine on 2021/6/25 + */ +public class InvisibleChartTypePane extends DefaultChartTypePane { + @Override + public String title4PopupWindow() { + return ChartTypeInterfaceManager.TYPE_PANE_DEFAULT_TITLE; + } +} diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java index 4537c6a6c..c60f1abbd 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java @@ -20,6 +20,7 @@ import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartOtherPane; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.ChartTypePane; +import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; @@ -175,13 +176,13 @@ public class ChartEditPane extends BasicPane implements AttributeChange, Prepare */ public void reLayout(ChartProvider currentChart) { if (currentChart != null) { - int chartIndex = getSelectedChartIndex(currentChart); this.removeAll(); this.setLayout(new BorderLayout()); paneList = new ArrayList(); - addTypePane(); - String chartID = currentChart.getID(); + + addTypePane(chartID); + boolean isDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(chartID); if (isDefault) { @@ -214,8 +215,11 @@ public class ChartEditPane extends BasicPane implements AttributeChange, Prepare return chartDataPane; } - protected void addTypePane() { - paneList.add(typePane); + protected void addTypePane(String id) { + AbstractChartTypePane pane = ChartTypeInterfaceManager.getInstance().getPlotTypePane(id); + if (pane != null && !ChartTypeInterfaceManager.TYPE_PANE_DEFAULT_TITLE.equals(pane.title4PopupWindow())) { + paneList.add(typePane); + } } protected void setSelectedTab() { diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartHyperEditPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartHyperEditPane.java index bae6e20bc..fcad48088 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartHyperEditPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartHyperEditPane.java @@ -48,7 +48,7 @@ public class ChartHyperEditPane extends ChartEditPane { return dataPane; } - protected void addTypePane() { + protected void addTypePane(String id) { paneList.add(attrPane); paneList.add(typePane); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/area/AreaIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/area/AreaIndependentVanChartInterface.java index 23bd47004..4fe84a35e 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/area/AreaIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/area/AreaIndependentVanChartInterface.java @@ -2,10 +2,12 @@ package com.fr.van.chart.area; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.fun.impl.InvisibleChartTypePane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.van.chart.vanchart.AbstractMultiCategoryVanChartUI; /** @@ -47,7 +49,7 @@ public class AreaIndependentVanChartInterface extends AbstractMultiCategoryVanCh @Override public AbstractChartTypePane getPlotTypePane() { - return new VanChartAreaPlotPane(); + return ChartEditContext.duchampMode() ? new InvisibleChartTypePane() : new VanChartAreaPlotPane(); } public ConditionAttributesPane getPlotConditionPane(Plot plot){ diff --git a/designer-chart/src/main/java/com/fr/van/chart/bar/BarIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/bar/BarIndependentVanChartInterface.java index 63a8e7640..542be966c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/bar/BarIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/bar/BarIndependentVanChartInterface.java @@ -3,12 +3,14 @@ package com.fr.van.chart.bar; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.fun.impl.InvisibleChartTypePane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.AbstractChartAttrPane; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.van.chart.column.VanChartColumnConditionPane; import com.fr.van.chart.column.VanChartColumnSeriesPane; import com.fr.van.chart.designer.other.VanChartInteractivePane; @@ -57,7 +59,7 @@ public class BarIndependentVanChartInterface extends AbstractMultiCategoryVanCha @Override public AbstractChartTypePane getPlotTypePane() { - return new VanChartBarPlotPane(); + return ChartEditContext.duchampMode() ? new InvisibleChartTypePane() : new VanChartBarPlotPane(); } public ConditionAttributesPane getPlotConditionPane(Plot plot) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/box/BoxIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/box/BoxIndependentVanChartInterface.java index e4906b625..6e1d3d971 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/box/BoxIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/box/BoxIndependentVanChartInterface.java @@ -3,6 +3,7 @@ package com.fr.van.chart.box; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.fun.impl.InvisibleChartTypePane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.i18n.Toolkit; @@ -12,6 +13,7 @@ import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.van.chart.box.data.report.BoxPlotReportDataContentPane; import com.fr.van.chart.box.data.table.BoxPlotTableDataContentPane; @@ -56,7 +58,7 @@ public class BoxIndependentVanChartInterface extends AbstractIndependentVanChart } public AbstractChartTypePane getPlotTypePane() { - return new VanChartBoxPlotPane(); + return ChartEditContext.duchampMode() ? new InvisibleChartTypePane() : new VanChartBoxPlotPane(); } public ConditionAttributesPane getPlotConditionPane(Plot plot) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/bubble/BubbleIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/bubble/BubbleIndependentVanChartInterface.java index 985e811ac..cc344d4f4 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/bubble/BubbleIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/bubble/BubbleIndependentVanChartInterface.java @@ -3,6 +3,7 @@ package com.fr.van.chart.bubble; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.fun.impl.InvisibleChartTypePane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.i18n.Toolkit; @@ -13,6 +14,7 @@ import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPa import com.fr.design.mainframe.chart.gui.data.report.BubblePlotReportDataContentPane; import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.plugin.chart.base.VanChartConstants; import com.fr.plugin.chart.bubble.VanChartBubblePlot; import com.fr.van.chart.bubble.data.VanChartBubblePlotTableDataContentPane; @@ -54,7 +56,7 @@ public class BubbleIndependentVanChartInterface extends AbstractIndependentVanCh */ @Override public AbstractChartTypePane getPlotTypePane() { - return new VanChartBubblePlotPane(); + return ChartEditContext.duchampMode() ? new InvisibleChartTypePane() : new VanChartBubblePlotPane(); } /** diff --git a/designer-chart/src/main/java/com/fr/van/chart/column/VanColumnChartTypeUI.java b/designer-chart/src/main/java/com/fr/van/chart/column/VanColumnChartTypeUI.java index 0d491f904..a971a98a9 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/column/VanColumnChartTypeUI.java +++ b/designer-chart/src/main/java/com/fr/van/chart/column/VanColumnChartTypeUI.java @@ -2,10 +2,12 @@ package com.fr.van.chart.column; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.fun.impl.InvisibleChartTypePane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.van.chart.vanchart.AbstractMultiCategoryVanChartUI; /** @@ -48,7 +50,7 @@ public class VanColumnChartTypeUI extends AbstractMultiCategoryVanChartUI { @Override public AbstractChartTypePane getPlotTypePane() { - return new VanChartColumnPlotPane(); + return ChartEditContext.duchampMode() ? new InvisibleChartTypePane() : new VanChartColumnPlotPane(); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomDataPane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomDataPane.java index 47e6488fd..dc5552740 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomDataPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomDataPane.java @@ -60,7 +60,9 @@ public class VanChartCustomDataPane extends ChartDataPane { */ public void addAttributeChangeListener(AttributeChangeListener listener) { super.addAttributeChangeListener(listener); - contentsTabPane.addAttributeChangeListener(listener); + if (contentsTabPane != null) { + contentsTabPane.addAttributeChangeListener(listener); + } } @Override diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotPane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotPane.java index ff0147652..b69813d67 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotPane.java @@ -9,9 +9,11 @@ import com.fr.chart.chartglyph.ConditionCollection; import com.fr.chartx.data.AbstractDataDefinition; import com.fr.chartx.data.ChartDataDefinitionProvider; import com.fr.chartx.data.CustomChartDataDefinition; +import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.type.ChartImagePane; +import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.base.VanChartAttrLine; @@ -28,12 +30,12 @@ import com.fr.van.chart.designer.type.AbstractVanChartTypePane; import javax.swing.JPanel; import javax.swing.JSeparator; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map; import java.awt.CardLayout; import java.awt.Component; import java.awt.Dimension; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; /** * Created by Mitisky on 16/2/16. @@ -54,6 +56,12 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane { //自定义和自动版面的容器,cardLayOut布局 private JPanel contentPane; + public String title4PopupWindow() { + //todo:check下组合图类 + return ChartEditContext.duchampMode() ? ChartTypeInterfaceManager.TYPE_PANE_DEFAULT_TITLE : super.title4PopupWindow(); + } + + protected Component[][] getPaneComponents(JPanel typePane) { initContent(); diff --git a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/FunnelIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/FunnelIndependentVanChartInterface.java index 2899a9e11..b76f9047d 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/FunnelIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/FunnelIndependentVanChartInterface.java @@ -3,6 +3,7 @@ package com.fr.van.chart.funnel.designer; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.fun.impl.InvisibleChartTypePane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.i18n.Toolkit; @@ -13,6 +14,7 @@ import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPa import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; import com.fr.design.mainframe.chart.gui.data.table.PiePlotTableDataContentPane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.van.chart.designer.data.OneDimensionalPlotReportDataContentPane; import com.fr.van.chart.designer.other.VanChartInteractivePaneWithOutSort; import com.fr.van.chart.designer.other.VanChartOtherPane; @@ -45,7 +47,7 @@ public class FunnelIndependentVanChartInterface extends AbstractIndependentVanCh */ @Override public AbstractChartTypePane getPlotTypePane() { - return new VanChartFunnelTypePane(); + return ChartEditContext.duchampMode() ? new InvisibleChartTypePane() : new VanChartFunnelTypePane(); } public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent){ diff --git a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/GanttIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/GanttIndependentVanChartInterface.java index 9bc3ce123..839e049dd 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/GanttIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/GanttIndependentVanChartInterface.java @@ -3,6 +3,7 @@ package com.fr.van.chart.gantt.designer; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.fun.impl.InvisibleChartTypePane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.i18n.Toolkit; @@ -12,6 +13,7 @@ import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.van.chart.designer.other.VanChartOtherPane; import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.gantt.designer.data.VanChartGanttDataPane; @@ -42,7 +44,7 @@ public class GanttIndependentVanChartInterface extends AbstractIndependentVanCha @Override public AbstractChartTypePane getPlotTypePane() { - return new VanChartGanttPlotPane(); + return ChartEditContext.duchampMode() ? new InvisibleChartTypePane() : new VanChartGanttPlotPane(); } @Override diff --git a/designer-chart/src/main/java/com/fr/van/chart/gauge/GaugeIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/gauge/GaugeIndependentVanChartInterface.java index 1e7a6fb32..7c424aa55 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gauge/GaugeIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gauge/GaugeIndependentVanChartInterface.java @@ -2,6 +2,7 @@ package com.fr.van.chart.gauge; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.fun.impl.InvisibleChartTypePane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.AbstractChartAttrPane; @@ -14,6 +15,7 @@ import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane import com.fr.design.mainframe.chart.gui.data.table.CategoryPlotTableDataContentPane; import com.fr.design.mainframe.chart.gui.data.table.MeterPlotTableDataContentPane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.plugin.chart.gauge.VanChartGaugePlot; import com.fr.van.chart.custom.component.CategoryCustomPlotTableDataContentPane; import com.fr.van.chart.custom.component.MeterCustomPlotReportDataContentPane; @@ -61,7 +63,7 @@ public class GaugeIndependentVanChartInterface extends AbstractIndependentVanCha @Override public AbstractChartTypePane getPlotTypePane() { - return new VanChartGaugePlotPane(); + return ChartEditContext.duchampMode() ? new InvisibleChartTypePane() : new VanChartGaugePlotPane(); } public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/line/LineIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/line/LineIndependentVanChartInterface.java index 739e87f14..58252a74b 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/line/LineIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/line/LineIndependentVanChartInterface.java @@ -2,10 +2,12 @@ package com.fr.van.chart.line; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.fun.impl.InvisibleChartTypePane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.van.chart.vanchart.AbstractMultiCategoryVanChartUI; /** @@ -42,7 +44,7 @@ public class LineIndependentVanChartInterface extends AbstractMultiCategoryVanCh @Override public AbstractChartTypePane getPlotTypePane() { - return new VanChartLinePlotPane(); + return ChartEditContext.duchampMode() ? new InvisibleChartTypePane() : new VanChartLinePlotPane(); } public ConditionAttributesPane getPlotConditionPane(Plot plot){ diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java index 9b5636e40..1bdb8d36c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java @@ -7,6 +7,7 @@ import com.fr.chartx.data.ChartDataDefinitionProvider; import com.fr.chartx.data.MapChartDataDefinition; import com.fr.design.mainframe.chart.gui.type.ChartImagePane; import com.fr.design.mainframe.chart.info.ChartInfoCollector; +import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.attr.plot.VanChartPlot; @@ -21,9 +22,9 @@ import com.fr.plugin.chart.vanchart.VanChart; import com.fr.van.chart.designer.type.AbstractVanChartTypePane; import javax.swing.JPanel; +import java.awt.Component; import java.util.HashSet; import java.util.Set; -import java.awt.Component; /** * Created by Mitisky on 16/5/4. @@ -55,7 +56,9 @@ public class VanChartMapPlotPane extends AbstractVanChartTypePane { } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } - return new Component[][]{ + return ChartEditContext.duchampMode() ? new Component[][]{ + new Component[]{sourceChoosePane} + } : new Component[][]{ new Component[]{typePane}, new Component[]{buttonPane}, new Component[]{sourceChoosePane} diff --git a/designer-chart/src/main/java/com/fr/van/chart/multilayer/MultiPieIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/multilayer/MultiPieIndependentVanChartInterface.java index 1cc66a2bf..a5da06312 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/multilayer/MultiPieIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/multilayer/MultiPieIndependentVanChartInterface.java @@ -2,6 +2,7 @@ package com.fr.van.chart.multilayer; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.fun.impl.InvisibleChartTypePane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.gui.ChartDataPane; @@ -9,6 +10,7 @@ import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.van.chart.multilayer.data.MultiPiePlotReportDataContentPane; import com.fr.van.chart.multilayer.data.MultiPiePlotTableDataContentPane; import com.fr.van.chart.multilayer.other.VanChartMultiPieConditionPane; @@ -21,7 +23,7 @@ import com.fr.van.chart.vanchart.AbstractIndependentVanChartUI; public class MultiPieIndependentVanChartInterface extends AbstractIndependentVanChartUI { @Override public AbstractChartTypePane getPlotTypePane() { - return new VanChartMultiPiePlotPane(); + return ChartEditContext.duchampMode() ? new InvisibleChartTypePane() : new VanChartMultiPiePlotPane(); } @Override diff --git a/designer-chart/src/main/java/com/fr/van/chart/pie/PieIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/pie/PieIndependentVanChartInterface.java index 06841c0c9..7ede0ad46 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/pie/PieIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/pie/PieIndependentVanChartInterface.java @@ -2,6 +2,7 @@ package com.fr.van.chart.pie; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.fun.impl.InvisibleChartTypePane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.gui.ChartDataPane; @@ -9,6 +10,7 @@ import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; import com.fr.design.mainframe.chart.gui.data.table.CategoryPlotTableDataContentPane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.van.chart.custom.component.CategoryCustomPlotTableDataContentPane; import com.fr.van.chart.custom.component.VanChartDataPane; import com.fr.van.chart.vanchart.AbstractIndependentVanChartUI; @@ -50,7 +52,7 @@ public class PieIndependentVanChartInterface extends AbstractIndependentVanChart @Override public AbstractChartTypePane getPlotTypePane() { - return new VanChartPiePlotPane(); + return ChartEditContext.duchampMode() ? new InvisibleChartTypePane() : new VanChartPiePlotPane(); } public ConditionAttributesPane getPlotConditionPane(Plot plot){ diff --git a/designer-chart/src/main/java/com/fr/van/chart/radar/RadarIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/radar/RadarIndependentVanChartInterface.java index 21784c522..3f13cef0e 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/radar/RadarIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/radar/RadarIndependentVanChartInterface.java @@ -2,10 +2,12 @@ package com.fr.van.chart.radar; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.fun.impl.InvisibleChartTypePane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.van.chart.vanchart.AbstractIndependentVanChartUI; /** @@ -40,7 +42,7 @@ public class RadarIndependentVanChartInterface extends AbstractIndependentVanCha @Override public AbstractChartTypePane getPlotTypePane() { - return new VanChartRadarPlotPane(); + return ChartEditContext.duchampMode() ? new InvisibleChartTypePane() : new VanChartRadarPlotPane(); } public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ diff --git a/designer-chart/src/main/java/com/fr/van/chart/scatter/ScatterIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/scatter/ScatterIndependentVanChartInterface.java index 1b7063af4..444a36ae5 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/scatter/ScatterIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/scatter/ScatterIndependentVanChartInterface.java @@ -4,6 +4,7 @@ package com.fr.van.chart.scatter; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.fun.impl.InvisibleChartTypePane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.i18n.Toolkit; @@ -14,6 +15,7 @@ import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPa import com.fr.design.mainframe.chart.gui.data.report.BubblePlotReportDataContentPane; import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.van.chart.designer.other.VanChartInteractivePaneWithOutSort; import com.fr.van.chart.designer.other.VanChartOtherPane; import com.fr.van.chart.designer.other.zoom.ZoomPane; @@ -33,7 +35,7 @@ public class ScatterIndependentVanChartInterface extends AbstractIndependentVanC */ @Override public AbstractChartTypePane getPlotTypePane() { - return new VanChartScatterPlotPane(); + return ChartEditContext.duchampMode() ? new InvisibleChartTypePane() : new VanChartScatterPlotPane(); } @Override diff --git a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/VanStructureChartTypeUI.java b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/VanStructureChartTypeUI.java index 8109adeb0..6733b8dbd 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/VanStructureChartTypeUI.java +++ b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/VanStructureChartTypeUI.java @@ -3,6 +3,7 @@ package com.fr.van.chart.structure.desinger; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.fun.impl.InvisibleChartTypePane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.i18n.Toolkit; @@ -12,6 +13,7 @@ import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.plugin.chart.base.VanChartConstants; import com.fr.van.chart.designer.other.VanChartInteractivePaneWithOutSort; import com.fr.van.chart.designer.other.VanChartOtherPane; @@ -31,7 +33,7 @@ import com.fr.van.chart.vanchart.AbstractIndependentVanChartUI; public class VanStructureChartTypeUI extends AbstractIndependentVanChartUI { @Override public AbstractChartTypePane getPlotTypePane() { - return new VanChartStructureTypePane(); + return ChartEditContext.duchampMode() ? new InvisibleChartTypePane() : new VanChartStructureTypePane(); } @Override diff --git a/designer-chart/src/main/java/com/fr/van/chart/treemap/TreeMapIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/treemap/TreeMapIndependentVanChartInterface.java index 2b6589ed8..390a03919 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/treemap/TreeMapIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/treemap/TreeMapIndependentVanChartInterface.java @@ -3,11 +3,13 @@ package com.fr.van.chart.treemap; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.fun.impl.InvisibleChartTypePane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.AbstractChartAttrPane; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.van.chart.designer.other.VanChartInteractivePaneWithOutSort; import com.fr.van.chart.designer.other.VanChartOtherPane; import com.fr.van.chart.designer.style.VanChartStylePane; @@ -20,7 +22,7 @@ import com.fr.van.chart.treemap.style.VanChartTreeMapSeriesPane; public class TreeMapIndependentVanChartInterface extends MultiPieIndependentVanChartInterface { @Override public AbstractChartTypePane getPlotTypePane() { - return new VanChartTreeMapPlotPane(); + return ChartEditContext.duchampMode() ? new InvisibleChartTypePane() : new VanChartTreeMapPlotPane(); } @Override diff --git a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/WordCloudIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/WordCloudIndependentVanChartInterface.java index 5ff077a4b..290c6a43f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/WordCloudIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/WordCloudIndependentVanChartInterface.java @@ -3,6 +3,7 @@ package com.fr.van.chart.wordcloud.designer; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.fun.impl.InvisibleChartTypePane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.frpane.AttributeChangeListener; @@ -13,6 +14,7 @@ import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.plugin.chart.base.VanChartConstants; import com.fr.van.chart.designer.other.VanChartInteractivePaneWithOutSort; import com.fr.van.chart.designer.other.VanChartOtherPane; @@ -39,7 +41,7 @@ public class WordCloudIndependentVanChartInterface extends AbstractIndependentVa */ @Override public AbstractChartTypePane getPlotTypePane() { - return new VanChartWordCloudTypePane(); + return ChartEditContext.duchampMode() ? new InvisibleChartTypePane() : new VanChartWordCloudTypePane(); } @Override From 367eb6e1351192aa586cda53995d2dc999612973 Mon Sep 17 00:00:00 2001 From: shine Date: Tue, 29 Jun 2021 16:14:30 +0800 Subject: [PATCH 24/29] refactor:plugin use 10.0 not compatible xxx copy from 10.0 code --- .../LineMapAreaLngLatPaneWithComboBox.java | 25 ++++++++++--------- .../PointMapAreaLngLatPaneWithComboBox.java | 16 ++++++------ ...ractCellDataFieldsWithSeriesValuePane.java | 2 +- ...tractDataSetFieldsWithSeriesValuePane.java | 15 ++++++++--- 4 files changed, 33 insertions(+), 25 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chartx/data/map/LineMapAreaLngLatPaneWithComboBox.java b/designer-chart/src/main/java/com/fr/design/chartx/data/map/LineMapAreaLngLatPaneWithComboBox.java index 5d2f2298a..5c692b292 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/data/map/LineMapAreaLngLatPaneWithComboBox.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/data/map/LineMapAreaLngLatPaneWithComboBox.java @@ -2,7 +2,7 @@ package com.fr.design.chartx.data.map; import com.fr.chartx.data.field.diff.LineMapColumnFieldCollection; import com.fr.design.chartx.fields.AbstractDataSetFieldsPane; -import com.fr.design.chartx.fields.diff.LineMapDataSetFieldsPane; +import com.fr.design.chartx.fields.diff.MapDataSetFieldsPane; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.i18n.Toolkit; @@ -24,15 +24,15 @@ public class LineMapAreaLngLatPaneWithComboBox extends LineMapAreaLngLatPaneWith private UIComboBox toLng_tab1; private UIComboBox toLat_tab1; - private LineMapDataSetFieldsPane lineMapDataSetFieldsPane; + private MapDataSetFieldsPane mapDataSetFieldsPane; - public LineMapAreaLngLatPaneWithComboBox(LineMapDataSetFieldsPane lineMapDataSetFieldsPane) { - this.lineMapDataSetFieldsPane = lineMapDataSetFieldsPane; + public LineMapAreaLngLatPaneWithComboBox(MapDataSetFieldsPane mapDataSetFieldsPane) { + this.mapDataSetFieldsPane = mapDataSetFieldsPane; initComponents(); } protected void initComponents() { - if (lineMapDataSetFieldsPane == null) { + if (mapDataSetFieldsPane == null) { return; } super.initComponents(); @@ -48,7 +48,7 @@ public class LineMapAreaLngLatPaneWithComboBox extends LineMapAreaLngLatPaneWith return createPane( new String[]{Toolkit.i18nText("Fine-Design_Chart_Start_Area_Name"), Toolkit.i18nText("Fine-Design_Chart_End_Area_Name")}, - lineMapDataSetFieldsPane.createAreaPanel(fromArea_tab0), lineMapDataSetFieldsPane.createAreaPanel(toArea_tab0) + mapDataSetFieldsPane.createAreaPanel(fromArea_tab0), mapDataSetFieldsPane.createAreaPanel(toArea_tab0) ); } @@ -64,18 +64,19 @@ public class LineMapAreaLngLatPaneWithComboBox extends LineMapAreaLngLatPaneWith } return createPane( new String[]{ - Toolkit.i18nText("Fine-Design_Chart_Start_Area_Name"), Toolkit.i18nText("Fine-Design_Chart_Start_Longitude"), Toolkit.i18nText("Fine-Design_Chart_Start_Latitude"), - Toolkit.i18nText("Fine-Design_Chart_End_Area_Name"), + Toolkit.i18nText("Fine-Design_Chart_Start_Area_Name"), Toolkit.i18nText("Fine-Design_Chart_End_Longitude"), - Toolkit.i18nText("Fine-Design_Chart_End_Latitude")}, - lineMapDataSetFieldsPane.createAreaPanel(fromArea_tab1), + Toolkit.i18nText("Fine-Design_Chart_End_Latitude"), + Toolkit.i18nText("Fine-Design_Chart_End_Area_Name") + }, fromLng_tab1, fromLat_tab1, - lineMapDataSetFieldsPane.createAreaPanel(toArea_tab1), + fromArea_tab1, toLng_tab1, - toLat_tab1); + toLat_tab1, + toArea_tab1); } protected void populateTab0(LineMapColumnFieldCollection fieldCollection) { diff --git a/designer-chart/src/main/java/com/fr/design/chartx/data/map/PointMapAreaLngLatPaneWithComboBox.java b/designer-chart/src/main/java/com/fr/design/chartx/data/map/PointMapAreaLngLatPaneWithComboBox.java index b3b503ddd..bb519cab6 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/data/map/PointMapAreaLngLatPaneWithComboBox.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/data/map/PointMapAreaLngLatPaneWithComboBox.java @@ -2,7 +2,7 @@ package com.fr.design.chartx.data.map; import com.fr.chartx.data.field.diff.PointMapColumnFieldCollection; import com.fr.design.chartx.fields.AbstractDataSetFieldsPane; -import com.fr.design.chartx.fields.diff.PointMapDataSetFieldsPane; +import com.fr.design.chartx.fields.diff.MapDataSetFieldsPane; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.i18n.Toolkit; @@ -20,15 +20,15 @@ public class PointMapAreaLngLatPaneWithComboBox extends PointMapAreaLngLatPaneWi private UIComboBox lng_tab1; private UIComboBox lat_tab1; - private PointMapDataSetFieldsPane pointMapDataSetFieldsPane; + private MapDataSetFieldsPane mapDataSetFieldsPane; - public PointMapAreaLngLatPaneWithComboBox(PointMapDataSetFieldsPane pointMapDataSetFieldsPane) { - this.pointMapDataSetFieldsPane = pointMapDataSetFieldsPane; + public PointMapAreaLngLatPaneWithComboBox(MapDataSetFieldsPane pointMapDataSetFieldsPane) { + this.mapDataSetFieldsPane = pointMapDataSetFieldsPane; initComponents(); } protected void initComponents() { - if (pointMapDataSetFieldsPane == null) { + if (mapDataSetFieldsPane == null) { return; } super.initComponents(); @@ -41,7 +41,7 @@ public class PointMapAreaLngLatPaneWithComboBox extends PointMapAreaLngLatPaneWi } return createPane( new String[]{Toolkit.i18nText("Fine-Design_Chart_Area_Name")}, - pointMapDataSetFieldsPane.createAreaPanel(area_tab0) + mapDataSetFieldsPane.createAreaPanel(area_tab0) ); } @@ -53,8 +53,8 @@ public class PointMapAreaLngLatPaneWithComboBox extends PointMapAreaLngLatPaneWi lat_tab1 = new UIComboBox(); } return createPane( - new String[]{Toolkit.i18nText("Fine-Design_Chart_Area_Name"), Toolkit.i18nText("Fine-Design_Chart_Longitude"), Toolkit.i18nText("Fine-Design_Chart_Latitude")}, - pointMapDataSetFieldsPane.createAreaPanel(area_tab1), lng_tab1, lat_tab1 + new String[]{Toolkit.i18nText("Fine-Design_Chart_Longitude"), Toolkit.i18nText("Fine-Design_Chart_Latitude"), Toolkit.i18nText("Fine-Design_Chart_Area_Name")}, + lng_tab1, lat_tab1, area_tab1 ); } diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/AbstractCellDataFieldsWithSeriesValuePane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/AbstractCellDataFieldsWithSeriesValuePane.java index f6975d3d9..597bac520 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/AbstractCellDataFieldsWithSeriesValuePane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/AbstractCellDataFieldsWithSeriesValuePane.java @@ -21,7 +21,7 @@ public abstract class AbstractCellDataFieldsWithSeriesValuePane Date: Tue, 29 Jun 2021 17:42:07 +0800 Subject: [PATCH 25/29] =?UTF-8?q?feat:=E5=85=B6=E4=BB=96=E7=BB=84=E5=90=88?= =?UTF-8?q?=E5=9B=BE=E4=B8=8D=E9=9C=80=E8=A6=81=E7=B1=BB=E5=9E=8B=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=EF=BC=8C=E8=87=AA=E5=AE=9A=E4=B9=89=E7=BB=84=E5=90=88?= =?UTF-8?q?=E5=9B=BE=E9=9C=80=E8=A6=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/chart/ChartEditPane.java | 14 ++++++++---- .../mainframe/chart/ChartHyperEditPane.java | 3 ++- .../mainframe/chart/gui/ChartTypePane.java | 2 +- .../chart/gui/type/AbstractChartTypePane.java | 4 ++++ .../chart/custom/VanChartCustomPlotPane.java | 22 ++++++++++++++----- 5 files changed, 34 insertions(+), 11 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java index c60f1abbd..f51755f87 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java @@ -181,7 +181,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange, Prepare paneList = new ArrayList(); String chartID = currentChart.getID(); - addTypePane(chartID); + addTypePane(currentChart); boolean isDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(chartID); @@ -215,13 +215,19 @@ public class ChartEditPane extends BasicPane implements AttributeChange, Prepare return chartDataPane; } - protected void addTypePane(String id) { - AbstractChartTypePane pane = ChartTypeInterfaceManager.getInstance().getPlotTypePane(id); - if (pane != null && !ChartTypeInterfaceManager.TYPE_PANE_DEFAULT_TITLE.equals(pane.title4PopupWindow())) { + protected void addTypePane(ChartProvider chart) { + if (visibleTypePane(chart)) { paneList.add(typePane); } } + private boolean visibleTypePane(ChartProvider chart) { + AbstractChartTypePane pane = ChartTypeInterfaceManager.getInstance().getPlotTypePane(chart.getID()); + return pane != null + && !ChartTypeInterfaceManager.TYPE_PANE_DEFAULT_TITLE.equals(pane.title4PopupWindow()) + && pane.visible(chart); + } + protected void setSelectedTab() { } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartHyperEditPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartHyperEditPane.java index fcad48088..fdfa6a3c3 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartHyperEditPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartHyperEditPane.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe.chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.web.ChartHyperPoplink; +import com.fr.chartx.attr.ChartProvider; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.chart.gui.ChartComponent; import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperPopAttrPane; @@ -48,7 +49,7 @@ public class ChartHyperEditPane extends ChartEditPane { return dataPane; } - protected void addTypePane(String id) { + protected void addTypePane(ChartProvider chart) { paneList.add(attrPane); paneList.add(typePane); } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java index 5137901ee..cbbae3022 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java @@ -162,7 +162,7 @@ public class ChartTypePane extends AbstractChartAttrPane { for (String id : chartIDs) { AbstractChartTypePane pane = ChartTypeInterfaceManager.getInstance().getPlotTypePane(id); - if (AssistUtils.equals(pane.title4PopupWindow(), ChartTypeInterfaceManager.TYPE_PANE_DEFAULT_TITLE)) { + if (pane == null || AssistUtils.equals(pane.title4PopupWindow(), ChartTypeInterfaceManager.TYPE_PANE_DEFAULT_TITLE)) { continue; } pane.reLayout(id); diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java index 4f3f02510..cde6e8fd6 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java @@ -217,6 +217,10 @@ public abstract class AbstractChartTypePane extends Fur return plotID; } + public boolean visible(ChartProvider chart) { + return true; + } + /** * @param ob 对象 * @return diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotPane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotPane.java index b69813d67..c3dcf7390 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotPane.java @@ -3,9 +3,11 @@ package com.fr.van.chart.custom; import com.fr.base.chart.chartdata.TopDefinitionProvider; import com.fr.chart.base.DataSeriesCondition; import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionAttr; import com.fr.chart.chartglyph.ConditionCollection; +import com.fr.chartx.attr.ChartProvider; import com.fr.chartx.data.AbstractDataDefinition; import com.fr.chartx.data.ChartDataDefinitionProvider; import com.fr.chartx.data.CustomChartDataDefinition; @@ -56,17 +58,27 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane { //自定义和自动版面的容器,cardLayOut布局 private JPanel contentPane; - public String title4PopupWindow() { - //todo:check下组合图类 - return ChartEditContext.duchampMode() ? ChartTypeInterfaceManager.TYPE_PANE_DEFAULT_TITLE : super.title4PopupWindow(); - } + @Override + public boolean visible(ChartProvider chart) { + if (ChartEditContext.duchampMode() && chart instanceof VanChart) { + Plot plot = ((VanChart) chart).getPlot(); + if (plot instanceof VanChartCustomPlot) { + CustomStyle customStyle = ((VanChartCustomPlot) plot).getCustomStyle(); + return customStyle == CustomStyle.CUSTOM; + } + } + return super.visible(chart); + } protected Component[][] getPaneComponents(JPanel typePane) { initContent(); - return new Component[][]{ + return ChartEditContext.duchampMode() ? new Component[][]{ + new Component[]{contentPane}, + new Component[]{buttonPane}, + }: new Component[][]{ new Component[]{typePane}, new Component[]{stylePane}, new Component[]{contentPane}, From cb189d681a672b401c4090dbe4268aa713912255 Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 2 Jul 2021 10:57:31 +0800 Subject: [PATCH 26/29] =?UTF-8?q?=E6=97=A0jira=20=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E5=86=B2=E7=AA=81=20update?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/mainframe/DesignerFrame.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 93080e727..6cb6bdd3e 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -57,7 +57,6 @@ import com.fr.workspace.Workspace; import com.fr.workspace.connect.WorkspaceConnectionInfo; import java.util.HashMap; import java.util.Map; -import java.util.concurrent.CopyOnWriteArrayList; import org.jetbrains.annotations.Nullable; import javax.swing.Icon; From 81215bca457e60c8d1b47276fee7e6682dd8acce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Mon, 5 Jul 2021 10:53:37 +0800 Subject: [PATCH 27/29] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/other/VanChartDrillMapInteractivePane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java index 44a566065..c439c4d4d 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java @@ -50,7 +50,7 @@ public class VanChartDrillMapInteractivePane extends VanChartInteractivePaneWith } : new Component[][]{ new Component[]{createToolBarPane(new double[]{p, p, p}, columnSize), null}, new Component[]{createAnimationPane(), null}, - new Component[]{createZoomPane(new double[]{p, p, p}, columnSize, plot), null}, + new Component[]{createZoomPane(plot), null}, new Component[]{createDrillToolsPane(), null} }; From 71a48f098d05f5652b4c00e817c9cf037d63a91a Mon Sep 17 00:00:00 2001 From: shine Date: Wed, 14 Jul 2021 16:56:13 +0800 Subject: [PATCH 28/29] =?UTF-8?q?CHART-18786=20feat:=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/base/mode/DesignModeContext.java | 4 ++ .../com/fr/design/base/mode/DesignerMode.java | 3 +- .../mainframe/CenterRegionContainerPane.java | 46 +++++++++++++++---- .../fr/design/mainframe/DesignerFrame.java | 2 +- .../fr/design/mainframe/DesktopCardPane.java | 7 ++- .../mainframe/EastRegionContainerPane.java | 14 +++--- .../com/fr/design/mainframe/JTemplate.java | 4 +- .../toolbar/ToolBarMenuDockPlus.java | 16 +++++++ .../fr/design/module/ChartHyperlinkGroup.java | 5 +- .../utils/DeprecatedActionManager.java | 15 +++--- .../fr/design/mainframe/ElementCasePane.java | 6 +-- .../mainframe/ElementCasePaneDelegate.java | 11 ++++- .../com/fr/design/mainframe/JWorkBook.java | 9 ++-- .../mainframe/ReportComponentComposite.java | 5 +- .../cell/settingpane/CellOtherSetPane.java | 13 +++--- .../com/fr/grid/selection/CellSelection.java | 1 - 16 files changed, 113 insertions(+), 48 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/base/mode/DesignModeContext.java b/designer-base/src/main/java/com/fr/design/base/mode/DesignModeContext.java index 9c43f7f50..1352833e6 100644 --- a/designer-base/src/main/java/com/fr/design/base/mode/DesignModeContext.java +++ b/designer-base/src/main/java/com/fr/design/base/mode/DesignModeContext.java @@ -3,6 +3,7 @@ package com.fr.design.base.mode; import com.fr.design.designer.TargetComponent; import static com.fr.design.base.mode.DesignerMode.AUTHORITY; +import static com.fr.design.base.mode.DesignerMode.DUCHAMP; public class DesignModeContext { @@ -42,6 +43,9 @@ public class DesignModeContext { return mode == AUTHORITY; } + public static boolean isDuchampMode() { + return mode == DUCHAMP; + } public static void doCopy(TargetComponent principal) { if (isBanCopyAndCut() || principal == null) { diff --git a/designer-base/src/main/java/com/fr/design/base/mode/DesignerMode.java b/designer-base/src/main/java/com/fr/design/base/mode/DesignerMode.java index b0dd4baaf..d3dc1e5f4 100644 --- a/designer-base/src/main/java/com/fr/design/base/mode/DesignerMode.java +++ b/designer-base/src/main/java/com/fr/design/base/mode/DesignerMode.java @@ -4,5 +4,6 @@ public enum DesignerMode { NORMAL, BAN_COPY_AND_CUT, VCS, - AUTHORITY + AUTHORITY, + DUCHAMP } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java index d6e55cd64..36507cf37 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java @@ -8,6 +8,7 @@ import com.fr.design.file.MutilTempalteTabPane; import com.fr.design.file.NewTemplatePane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.imenu.UIMenuHighLight; +import com.fr.design.gui.itoolbar.UILargeToolbar; import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.toolbar.ToolBarMenuDock; @@ -40,11 +41,15 @@ public class CenterRegionContainerPane extends JPanel { private JComponent toolbarComponent;//cpt 字体 等工具栏 - private JPanel eastCenterPane; + private JPanel eastPane;//=largeToolbar+eastCenterPane + private UILargeToolbar largeToolbar;//预览 + + private JPanel eastCenterPane;//=combineUp + templateTabPane private UIToolbar combineUp;//撤销重做 等工具栏 - private NewTemplatePane newWorkBookPane;//模板tab标签 + private JPanel templateTabPane;//新建模板 + 模板tab标签 + private NewTemplatePane newWorkBookPane;//新建模板button public static CenterRegionContainerPane getInstance() { @@ -71,15 +76,15 @@ public class CenterRegionContainerPane extends JPanel { } }; toolbarPane.setLayout(FRGUIPaneFactory.createBorderLayout()); - JPanel eastPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - eastPane.add(getToolBarMenuDock().createLargeToolbar(), BorderLayout.WEST); + eastPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + eastPane.add(largeToolbar = getToolBarMenuDock().createLargeToolbar(), BorderLayout.WEST); eastCenterPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); combineUpTooBar(); eastCenterPane.add(combineUp, BorderLayout.NORTH); - JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - panel.add(newWorkBookPane = getToolBarMenuDock().getNewTemplatePane(), BorderLayout.WEST); - panel.add(MutilTempalteTabPane.getInstance(), BorderLayout.CENTER); - eastCenterPane.add(panel, BorderLayout.CENTER); + templateTabPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + templateTabPane.add(newWorkBookPane = getToolBarMenuDock().getNewTemplatePane(), BorderLayout.WEST); + templateTabPane.add(MutilTempalteTabPane.getInstance(), BorderLayout.CENTER); + eastCenterPane.add(templateTabPane, BorderLayout.CENTER); eastPane.add(eastCenterPane, BorderLayout.CENTER); toolbarPane.add(eastPane, BorderLayout.NORTH); @@ -110,9 +115,10 @@ public class CenterRegionContainerPane extends JPanel { /** * 重置上工具栏 */ - private void resetCombineUpTooBar(JComponent[] toolbar4Form) { + private void resetCombineUpTooBar(JComponent[] toolbar4Form, ToolBarMenuDockPlus plus) { combineUp.removeAll(); setUpUpToolBar(toolbar4Form); + plus.insertToCombineUpToolbar(combineUp); } @@ -212,7 +218,7 @@ public class CenterRegionContainerPane extends JPanel { */ protected void resetToolkitByPlus(ToolBarMenuDockPlus plus, ToolBarMenuDock ad) { - resetCombineUpTooBar(ad.resetUpToolBar(plus)); + resetCombineUpTooBar(ad.resetUpToolBar(plus), plus); if (toolbarComponent != null) { toolbarPane.remove(toolbarComponent); @@ -220,6 +226,26 @@ public class CenterRegionContainerPane extends JPanel { // 颜色,字体那些按钮的工具栏 toolbarPane.add(toolbarComponent = ad.resetToolBar(toolbarComponent, plus), BorderLayout.CENTER); + + if (plus.hasToolBarPane()) { + this.add(toolbarPane, BorderLayout.NORTH); + } else { + this.remove(toolbarPane); + } + + resetByDesignMode(); + } + + private void resetByDesignMode() { + if (DesignModeContext.isDuchampMode()) { + eastPane.remove(largeToolbar); + eastCenterPane.remove(templateTabPane); + centerTemplateCardPane.refresh(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate()); + } else { + eastPane.add(largeToolbar, BorderLayout.WEST); + eastCenterPane.add(templateTabPane, BorderLayout.CENTER); + } + } JComponent getToolbarComponent() { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index e5d88ee8c..3cc4fba62 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -820,7 +820,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * * @param jTemplate 当前模板 */ - private void refreshBaseContentPane(JTemplate jTemplate) { + public void refreshBaseContentPane(JTemplate jTemplate) { JComponent north = jTemplate.north4DesignerFrame(), center = jTemplate.center4DesignerFrame(), diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java index f540832d0..abd5f6c6f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java @@ -53,10 +53,15 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener // 判断是否切换设计器状态到禁止拷贝剪切 if (jt.getTarget().getAttrMark(DesignBanCopyAttrMark.XML_TAG) != null) { DesignModeContext.switchTo(DesignerMode.BAN_COPY_AND_CUT); - } else if (!DesignModeContext.isVcsMode() && !DesignModeContext.isAuthorityEditing()) { + } else if (!DesignModeContext.isVcsMode() && !DesignModeContext.isAuthorityEditing() && !DesignModeContext.isDuchampMode()) { DesignModeContext.switchTo(DesignerMode.NORMAL); } DesignerFrameFileDealerPane.getInstance().setCurrentEditingTemplate(jt); + + refresh(jt); + } + + protected void refresh(final JTemplate jt) { if (component != null) { layeredPane.remove(component); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index 847a2dcba..84993411e 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -16,7 +16,6 @@ import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.mainframe.reuse.ReuseGuideDialog; import com.fr.design.mainframe.reuse.SnapChatKeys; import com.fr.design.mainframe.share.collect.ComponentCollector; -import com.fr.design.menu.SnapChatUtil; import com.fr.design.notification.SnapChat; import com.fr.design.notification.SnapChatFactory; import com.fr.design.ui.util.UIUtil; @@ -114,7 +113,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer { POLY_REPORT, // 聚合报表-报表块 POLY_CHART(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Settings")), // 聚合报表-图表块 AUTHORITY_EDITION, // 权限编辑 - AUTHORITY_EDITION_DISABLED; // 权限编辑 + AUTHORITY_EDITION_DISABLED, // 权限编辑 + DUCHAMP_REPORT; private String title; @@ -280,15 +280,15 @@ public class EastRegionContainerPane extends UIEastResizableContainer { // 单元格元素 PropertyItem cellElement = new PropertyItem(KEY_CELL_ELEMENT, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cell_Element"), "cellelement", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, - new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT}); + new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT, PropertyMode.DUCHAMP_REPORT}); // 单元格属性 PropertyItem cellAttr = new PropertyItem(KEY_CELL_ATTR, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cell_Attributes"), "cellattr", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, - new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT}); + new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT, PropertyMode.DUCHAMP_REPORT}); // 悬浮元素 PropertyItem floatElement = new PropertyItem(KEY_FLOAT_ELEMENT, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Float_Element"), "floatelement", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, - new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_FLOAT, PropertyMode.POLY_REPORT}); + new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_FLOAT, PropertyMode.POLY_REPORT, PropertyMode.DUCHAMP_REPORT}); // 控件设置 PropertyItem widgetSettings = new PropertyItem(KEY_WIDGET_SETTINGS, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Settings"), "widgetsettings", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.FORM, PropertyMode.POLY}, @@ -296,11 +296,11 @@ public class EastRegionContainerPane extends UIEastResizableContainer { // 条件属性 PropertyItem conditionAttr = new PropertyItem(KEY_CONDITION_ATTR, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Condition_Attributes"), "conditionattr", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, - new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT}); + new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT, PropertyMode.DUCHAMP_REPORT}); // 超级链接 PropertyItem hyperlink = new PropertyItem(KEY_HYPERLINK, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Hyperlink"), "hyperlink", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, - new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_FLOAT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT}); + new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_FLOAT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT, PropertyMode.DUCHAMP_REPORT}); // 组件库 widgetLibSnapChat = SnapChatFactory.createSnapChat(false, SnapChatKeys.COMPONENT); PropertyItem widgetLib = new PropertyItem( 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 24c0195bc..c70bf22b8 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 @@ -156,7 +156,7 @@ public abstract class JTemplate> // 判断是否切换设计器状态到禁止拷贝剪切 if (t.getAttrMark(DesignBanCopyAttrMark.XML_TAG) != null) { DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.BAN_COPY_AND_CUT); - } else if (!DesignModeContext.isVcsMode() && !DesignModeContext.isAuthorityEditing()) { + } else if (!DesignModeContext.isVcsMode() && !DesignModeContext.isAuthorityEditing() && !DesignModeContext.isDuchampMode()) { DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.NORMAL); } this.template = t; @@ -640,8 +640,6 @@ public abstract class JTemplate> /** * 添加图片到格子中 - * - * @return 返回图片URI */ public void setPictureElem(Elem elem, CellImage cellImage) { // 子类实现 diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDockPlus.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDockPlus.java index ed9b9d787..4de9018ac 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDockPlus.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDockPlus.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.toolbar; +import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.menu.MenuDef; import com.fr.design.menu.ShortCut; import com.fr.design.menu.ToolBarDef; @@ -54,5 +55,20 @@ public interface ToolBarMenuDockPlus { int getToolBarHeight(); + /** + * 是否含有工具栏 包含:预览按钮 复制粘贴那一行 模板标签页那一行 字体颜色那一行 + * + * @return 默认返回true + */ + default boolean hasToolBarPane() { + return true; + } + + /** + * 往 复制粘贴那一行工具栏 插入 工具栏按钮 + */ + default void insertToCombineUpToolbar(UIToolbar combineUp) { + } + } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/module/ChartHyperlinkGroup.java b/designer-chart/src/main/java/com/fr/design/module/ChartHyperlinkGroup.java index 1c4d92752..728ebbe05 100644 --- a/designer-chart/src/main/java/com/fr/design/module/ChartHyperlinkGroup.java +++ b/designer-chart/src/main/java/com/fr/design/module/ChartHyperlinkGroup.java @@ -3,6 +3,7 @@ package com.fr.design.module; import com.fr.chart.web.ChartHyperPoplink; import com.fr.chart.web.ChartHyperRelateCellLink; import com.fr.chart.web.ChartHyperRelateFloatLink; +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperPoplinkPane; import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperRelateCellLinkPane; import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperRelateFloatLinkPane; @@ -58,7 +59,7 @@ public class ChartHyperlinkGroup extends BaseHyperlinkGroup { return false; } - if (template.isJWorkBook()) { + if (template.isJWorkBook() || DesignModeContext.isDuchampMode()) { // 如果是普通报表单元格,那么没有 FormHyperlink 选项 FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class); //返回true表示可用,返回false表示不可用 @@ -93,7 +94,7 @@ public class ChartHyperlinkGroup extends BaseHyperlinkGroup { if (template == null) { return false; } - if (template.isJWorkBook()) { + if (template.isJWorkBook() || DesignModeContext.isDuchampMode()) { // 如果是普通报表单元格,那么没有 FormHyperlink 选项 FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class); //返回true表示可用,返回false表示不可用 diff --git a/designer-realize/src/main/java/com/fr/design/actions/utils/DeprecatedActionManager.java b/designer-realize/src/main/java/com/fr/design/actions/utils/DeprecatedActionManager.java index 47d19a3a7..d12e88cf5 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/utils/DeprecatedActionManager.java +++ b/designer-realize/src/main/java/com/fr/design/actions/utils/DeprecatedActionManager.java @@ -7,24 +7,27 @@ import com.fr.base.present.FormulaPresent; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.UpdateAction; import com.fr.design.actions.cell.NewPresentAction; -import com.fr.design.actions.core.ActionFactory; -import com.fr.design.actions.edit.clear.*; import com.fr.design.actions.columnrow.DeleteColumnAction; import com.fr.design.actions.columnrow.DeleteRowAction; import com.fr.design.actions.columnrow.InsertColumnAction; import com.fr.design.actions.columnrow.InsertRowAction; +import com.fr.design.actions.core.ActionFactory; +import com.fr.design.actions.edit.clear.ClearAction; +import com.fr.design.actions.edit.clear.ClearAllAction; +import com.fr.design.actions.edit.clear.ClearContentsAction; +import com.fr.design.actions.edit.clear.ClearFormatsAction; +import com.fr.design.actions.edit.clear.ClearWidgetAction; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.fun.PresentKindProvider; import com.fr.design.gui.imenu.UIMenu; +import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.JTemplate; import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.MenuDef; - -import com.fr.design.mainframe.ElementCasePane; -import com.fr.grid.selection.CellSelection; -import com.fr.grid.selection.Selection; import com.fr.design.selection.SelectionEvent; import com.fr.design.selection.SelectionListener; +import com.fr.grid.selection.CellSelection; +import com.fr.grid.selection.Selection; import com.fr.report.cell.cellattr.BarcodePresent; import com.fr.report.cell.cellattr.CurrencyLinePresent; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java index 324c21ed4..306aaf4ed 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java @@ -118,8 +118,6 @@ import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JScrollBar; import javax.swing.KeyStroke; -import java.lang.reflect.Constructor; -import java.util.Set; import java.awt.AWTEvent; import java.awt.Adjustable; import java.awt.Dimension; @@ -133,6 +131,8 @@ import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.lang.reflect.Constructor; +import java.util.Set; import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; @@ -181,7 +181,7 @@ public abstract class ElementCasePane extends Tar DesignerContext.setFormatState(DesignerContext.FORMAT_STATE_ONCE); DesignerContext.setReferencedElementCasePane(ElementCasePane.this); DesignerContext.setReferencedIndex( - ((JWorkBook) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()).getEditingReportIndex()); + HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getEditingReportIndex()); formatBrush.setSelected(true); formatBrushAction.executeActionReturnUndoRecordNeeded(); } else { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneDelegate.java b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneDelegate.java index 44992a84b..79b5c8dc5 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneDelegate.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneDelegate.java @@ -15,6 +15,7 @@ import com.fr.design.actions.edit.HyperlinkAction; import com.fr.design.actions.edit.merge.MergeCellAction; import com.fr.design.actions.edit.merge.UnmergeCellAction; import com.fr.design.actions.utils.DeprecatedActionManager; +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; import com.fr.design.file.HistoryTemplateListPane; @@ -101,7 +102,9 @@ public class ElementCasePaneDelegate extends ElementCasePane { conditionAttributesGroupPane.populate(ElementCasePaneDelegate.this); EastRegionContainerPane.getInstance().replaceFloatElementPane(ReportFloatPane.getInstance()); - EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT); + EastRegionContainerPane.getInstance().switchMode(DesignModeContext.isDuchampMode() ? + EastRegionContainerPane.PropertyMode.DUCHAMP_REPORT : + EastRegionContainerPane.PropertyMode.REPORT); EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance()); EastRegionContainerPane.getInstance().replaceCellElementPane(QuickEditorRegion.getInstance()); EastRegionContainerPane.getInstance().replaceConditionAttrPane(conditionAttributesGroupPane); @@ -201,7 +204,11 @@ public class ElementCasePaneDelegate extends ElementCasePane { menuDef.addShortCut(new GlobalStyleMenuDef(this)); // 单元格形态 menuDef.addShortCut(DeprecatedActionManager.getPresentMenu(this)); - menuDef.addShortCut(new CellWidgetAttrAction()); + + if (!DesignModeContext.isDuchampMode()) { + menuDef.addShortCut(new CellWidgetAttrAction()); + } + menuDef.addShortCut(new ConditionAttributesAction()); menuDef.addShortCut(new HyperlinkAction()); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java index 0f1ced379..c7497636b 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java @@ -193,7 +193,7 @@ public class JWorkBook extends JTemplate { } @Override - protected UIModeControlContainer createCenterPane() { + protected JComponent createCenterPane() { parameterPane = ModuleContext.isModuleStarted(Module.FORM_MODULE) ? new ParameterDefinitePane() : null; centerPane = new UIModeControlContainer(parameterPane, reportComposite = new ReportComponentComposite(this)) { @Override @@ -213,7 +213,7 @@ public class JWorkBook extends JTemplate { reportComposite.addTargetModifiedListener(e -> JWorkBook.this.fireTargetModified()); reportComposite.setParentContainer(centerPane); - return centerPane; + return DesignModeContext.isDuchampMode() ? reportComposite : centerPane; } @Override @@ -312,7 +312,7 @@ public class JWorkBook extends JTemplate { } private boolean hasParameterPane() { - return parameterPane != null; + return parameterPane != null && !DesignModeContext.isDuchampMode(); } /** @@ -579,7 +579,8 @@ public class JWorkBook extends JTemplate { super.setTarget(book); } - private TargetComponent delegate4ToolbarMenuAdapter() { + + public ReportComponent delegate4ToolbarMenuAdapter() { return this.reportComposite.getEditingReportComponent(); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ReportComponentComposite.java b/designer-realize/src/main/java/com/fr/design/mainframe/ReportComponentComposite.java index 9377c619a..b412d724d 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ReportComponentComposite.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ReportComponentComposite.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe; import com.fr.base.ScreenResolution; import com.fr.common.inputevent.InputEventBaseOnOS; +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.designer.EditingState; import com.fr.design.event.RemoveListener; import com.fr.design.event.TargetModifiedListener; @@ -215,7 +216,9 @@ public class ReportComponentComposite extends JComponent implements RemoveListen jSliderContainer = JFormSliderPane.getInstance(); } southPane.add(hbarContainer, BorderLayout.NORTH); - southPane.add(sheetNameTab, BorderLayout.CENTER); + if (!DesignModeContext.isDuchampMode()) { + southPane.add(sheetNameTab, BorderLayout.CENTER); + } southPane.add(jSliderContainer, BorderLayout.EAST); return southPane; } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java index cbe37764d..1f0ebd779 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java @@ -361,10 +361,11 @@ public class CellOtherSetPane extends AbstractCellAttrPane { cellGUIAttr = CellGUIAttr.DEFAULT_CELLGUIATTR; } - // 是否在编辑表单中的报表块 - boolean isInForm = EastRegionContainerPane.getInstance().getCurrentMode().equals(EastRegionContainerPane.PropertyMode.FORM_REPORT); + // 支持 跟随页面设置 选项 = 不在编辑表单中的报表块 && 不在大屏模板cpt组件中 + boolean supportFollowTplDefine = !EastRegionContainerPane.getInstance().getCurrentMode().equals(EastRegionContainerPane.PropertyMode.FORM_REPORT) + && !EastRegionContainerPane.getInstance().getCurrentMode().equals(EastRegionContainerPane.PropertyMode.DUCHAMP_REPORT); - defaultAutoRadioButton.setVisible(!isInForm); + defaultAutoRadioButton.setVisible(supportFollowTplDefine); switch (cellGUIAttr.getAdjustMode()) { case CellGUIAttr.ADJUST_MODE_NO_AUTO: noAutoRadioButton.setSelected(true); @@ -376,10 +377,10 @@ public class CellOtherSetPane extends AbstractCellAttrPane { autoWidthRadioButton.setSelected(true); break; case CellGUIAttr.ADJUST_MODE_DEFAULT: - if (isInForm) { - autoHeightRadioButton.setSelected(true); - } else { + if (supportFollowTplDefine) { defaultAutoRadioButton.setSelected(true); + } else { + autoHeightRadioButton.setSelected(true); } break; default: diff --git a/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java b/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java index fe24109ad..4abab05ef 100644 --- a/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java +++ b/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java @@ -39,7 +39,6 @@ import com.fr.design.mainframe.JTemplate; import com.fr.design.menu.KeySetUtils; import com.fr.design.report.RowColumnPane; import com.fr.design.selection.QuickEditor; - import com.fr.grid.GridUtils; import com.fr.report.cell.CellElement; import com.fr.report.cell.DefaultTemplateCellElement; From 2fe05ed614374604b9ea7527d90bc6b57d329983 Mon Sep 17 00:00:00 2001 From: shine Date: Wed, 4 Aug 2021 11:18:03 +0800 Subject: [PATCH 29/29] =?UTF-8?q?CHART-20142=20=E6=89=80=E6=9C=89=E6=8A=BD?= =?UTF-8?q?=E5=87=BA=E5=8E=BB=E7=9A=84protected=20public=E6=96=B9=E6=B3=95?= =?UTF-8?q?=20=E9=83=BD=E4=BF=9D=E7=95=99=20=E5=9B=A0=E4=B8=BA=E5=8F=AF?= =?UTF-8?q?=E8=83=BD=E8=A2=AB=E6=8F=92=E4=BB=B6=E6=88=96=E8=80=85oem?= =?UTF-8?q?=E4=BB=80=E4=B9=88=E7=9A=84=E7=94=A8=E5=88=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/mainframe/DesignerFrame.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index c37b08228..39cdbb930 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -55,9 +55,6 @@ import com.fr.start.OemHandler; import com.fr.workspace.WorkContext; import com.fr.workspace.Workspace; import com.fr.workspace.connect.WorkspaceConnectionInfo; -import java.util.HashMap; -import java.util.Map; -import org.jetbrains.annotations.Nullable; import javax.swing.Icon; import javax.swing.JComponent; @@ -92,8 +89,10 @@ import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.Set; import java.util.concurrent.CopyOnWriteArrayList; @@ -369,6 +368,10 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta this.resetToolkitByPlus(null); } + protected JPanel initNorthEastPane(final ToolBarMenuDock ad) { + return NorthRegionContainerPane.getInstance().initNorthEastPane(ad); + } + public void initTitleIcon() { try {