From f35807fdfe16e20fb5e0235692308d5f3e90925f Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 8 Oct 2021 16:47:40 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-59089=20=E3=80=90=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E3=80=91=E4=B8=BB=E9=A2=98=E6=AF=94=E8=BE=83?= =?UTF-8?q?=E5=A4=9A=E6=9C=89=E6=BB=9A=E5=8A=A8=E6=9D=A1=EF=BC=8C=E5=8F=B3?= =?UTF-8?q?=E4=BE=A7=E4=B8=BB=E9=A2=98=E7=9A=84=E5=8B=BE=E9=80=89=E5=9B=BE?= =?UTF-8?q?=E6=A0=87=E6=9C=89=E7=82=B9=E6=98=BE=E7=A4=BA=E4=B8=8D=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 待定 【改动思路】 绘制单元格样式预览内容前清空画布 --- .../mainframe/theme/TemplateThemeListPane.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeListPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeListPane.java index 768eb3724..00184ffc8 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeListPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeListPane.java @@ -2,7 +2,6 @@ package com.fr.design.mainframe.theme; import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.TemplateThemeConfig; -import com.fr.base.theme.settings.ThemeThumbnail; import com.fr.design.designer.IntervalConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.event.ChangeEvent; @@ -13,6 +12,7 @@ import com.fr.stable.StringUtils; import javax.swing.BorderFactory; import javax.swing.JPanel; +import javax.swing.ScrollPaneConstants; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.GridLayout; @@ -64,14 +64,14 @@ public class TemplateThemeListPane extends BasicPane { setLayout(FRGUIPaneFactory.createBorderLayout()); setPreferredSize(new Dimension(CONTENT_WIDTH, CONTENT_HEIGHT)); - contentListPane.setBorder(BorderFactory.createEmptyBorder(BLOCK_GAP, 0, BLOCK_GAP, 0)); + contentListPane.setBorder(BorderFactory.createEmptyBorder(BLOCK_GAP, 0, BLOCK_GAP, 10)); contentListPane.setLayout(new GridLayout(0, BLOCK_COUNT_ROW_LINE, BLOCK_GAP, BLOCK_GAP)); fillContentListPane(); - JPanel wrapper = FRGUIPaneFactory.createBorderLayout_S_Pane(); - wrapper.add(contentListPane, BorderLayout.NORTH); - - UIScrollPane scrollPane = new UIScrollPane(wrapper); + UIScrollPane scrollPane = new UIScrollPane(contentListPane); + scrollPane.setPreferredSize(new Dimension(CONTENT_WIDTH, CONTENT_HEIGHT)); + scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); + scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setBorder(BorderFactory.createEmptyBorder()); add(scrollPane, BorderLayout.CENTER); From 1ab435281d8a1ce962dd8507e5c098459bcaa93a Mon Sep 17 00:00:00 2001 From: Starryi Date: Sat, 9 Oct 2021 10:20:05 +0800 Subject: [PATCH 2/2] =?UTF-8?q?REPORT-59902=20=E4=B8=BB=E9=A2=98=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E4=BA=A4=E4=BA=92=E6=A1=86=E6=9E=B6=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 主题应用和主题管理使用同一个框展示,并且通过类似面包屑导航条 的方式进行切换 【改动思路】 同上 --- ...java => TemplateThemeGridControlPane.java} | 30 +- .../theme/TemplateThemeGridPagesPane.java | 339 ++++++++++++++++++ ...stPane.java => TemplateThemeGridPane.java} | 4 +- .../theme/dialog/TemplateThemeDialog.java | 64 ++-- .../dialog/TemplateThemeGridPagesDialog.java | 59 +++ .../dialog/TemplateThemeManageDialog.java | 107 +----- .../dialog/TemplateThemeProfileDialog.java | 23 +- .../dialog/TemplateThemeUsingDialog.java | 107 +----- .../mainframe/theme/ui/BreadcrumbBar.java | 114 ++++++ .../java/com/fr/design/mainframe/JForm.java | 3 +- .../actions/DownloadSuitableThemeAction.java | 3 +- .../server/TemplateThemeManagerAction.java | 7 +- .../com/fr/design/mainframe/JWorkBook.java | 3 +- .../guide/creator/theme/ThemeToggleGuide.java | 5 +- 14 files changed, 601 insertions(+), 267 deletions(-) rename designer-base/src/main/java/com/fr/design/mainframe/theme/{TemplateThemeManagePane.java => TemplateThemeGridControlPane.java} (91%) create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java rename designer-base/src/main/java/com/fr/design/mainframe/theme/{TemplateThemeListPane.java => TemplateThemeGridPane.java} (98%) create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeGridPagesDialog.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/theme/ui/BreadcrumbBar.java diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeManagePane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridControlPane.java similarity index 91% rename from designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeManagePane.java rename to designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridControlPane.java index be9dec160..6e04cb06f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeManagePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridControlPane.java @@ -51,34 +51,34 @@ import static com.fr.design.i18n.Toolkit.i18nText; * @version 1.0 * Created by Starryi on 2021/8/13 */ -public class TemplateThemeManagePane extends BasicPane { - public static final int CONTENT_WIDTH = TemplateThemeListPane.CONTENT_WIDTH + 10; - public static final int CONTENT_HEIGHT = TemplateThemeListPane.CONTENT_HEIGHT + 37; +public class TemplateThemeGridControlPane extends BasicPane { + public static final int CONTENT_WIDTH = TemplateThemeGridPane.CONTENT_WIDTH + 10; + public static final int CONTENT_HEIGHT = TemplateThemeGridPane.CONTENT_HEIGHT + 37; private final RemoveThemeAction removeAction; private final UIButton setTheme4NewTemplateButton; private final TemplateThemeConfig config; - private final TemplateThemeListPane themeListPane; + private final TemplateThemeGridPane themeListPane; private final TemplateThemeProfilePane profilePane; private final AsyncThemeFetcher asyncThemeFetcher; - public static TemplateThemeManagePane createFormThemesManagerPane() { + public static TemplateThemeGridControlPane createFormThemesManagerPane() { FormThemeConfig config = FormThemeConfig.getInstance(); FormThemeProfilePane editPane = new FormThemeProfilePane(config); - return new TemplateThemeManagePane<>(config, editPane); + return new TemplateThemeGridControlPane<>(config, editPane); } - public static TemplateThemeManagePane createReportThemesManagerPane() { + public static TemplateThemeGridControlPane createReportThemesManagerPane() { ReportThemeConfig config = ReportThemeConfig.getInstance(); ReportThemeProfilePane editPane = new ReportThemeProfilePane(config); - return new TemplateThemeManagePane<>(config, editPane); + return new TemplateThemeGridControlPane<>(config, editPane); } - public TemplateThemeManagePane(TemplateThemeConfig config, TemplateThemeProfilePane profilePane) { + public TemplateThemeGridControlPane(TemplateThemeConfig config, TemplateThemeProfilePane profilePane) { this.config = config; this.profilePane = profilePane; - this.themeListPane = new TemplateThemeListPane<>(true, config, profilePane); + this.themeListPane = new TemplateThemeGridPane<>(true, config, profilePane); this.removeAction = new RemoveThemeAction(false); this.setTheme4NewTemplateButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Pane_Default_Setting")); this.asyncThemeFetcher = new AsyncThemeFetcher<>(1, config); @@ -179,7 +179,7 @@ public class TemplateThemeManagePane extends BasicPane @Override public void afterRollback() { super.afterRollback(); - FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TemplateThemeManagePane.this), + FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TemplateThemeGridControlPane.this), i18nText("Fine-Design_Basic_Template_Theme_Operation_Failed_Tip"), i18nText("Fine-Design_Basic_Alert"), JOptionPane.WARNING_MESSAGE); @@ -225,11 +225,11 @@ public class TemplateThemeManagePane extends BasicPane @Override public void actionPerformed(ActionEvent e) { - T theme = TemplateThemeManagePane.this.themeListPane.getSelectedTheme(); + T theme = TemplateThemeGridControlPane.this.themeListPane.getSelectedTheme(); if (theme == null) { return; } - int result = FineJOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(TemplateThemeManagePane.this), + int result = FineJOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(TemplateThemeGridControlPane.this), Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Pane_Delete_Tip", theme.getName()), Toolkit.i18nText("Fine-Design_Basic_Delete"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (result == JOptionPane.YES_OPTION) { @@ -237,7 +237,7 @@ public class TemplateThemeManagePane extends BasicPane @Override public void afterRollback() { super.afterRollback(); - FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TemplateThemeManagePane.this), + FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TemplateThemeGridControlPane.this), i18nText("Fine-Design_Basic_Template_Theme_Operation_Failed_Tip"), i18nText("Fine-Design_Basic_Alert"), JOptionPane.WARNING_MESSAGE); @@ -269,7 +269,7 @@ public class TemplateThemeManagePane extends BasicPane } private void createNewTheme(T prototypeTheme) { - Window parent = SwingUtilities.getWindowAncestor(TemplateThemeManagePane.this); + Window parent = SwingUtilities.getWindowAncestor(TemplateThemeGridControlPane.this); TemplateThemeProfileDialog profileDialog = new TemplateThemeProfileDialog<>(parent, profilePane); try { T theme = (T) prototypeTheme.clone(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java new file mode 100644 index 000000000..a76ec12c6 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java @@ -0,0 +1,339 @@ +package com.fr.design.mainframe.theme; + +import com.fr.base.ScreenResolution; +import com.fr.base.theme.FormTheme; +import com.fr.base.theme.FormThemeConfig; +import com.fr.base.theme.ReportTheme; +import com.fr.base.theme.ReportThemeConfig; +import com.fr.base.theme.TemplateTheme; +import com.fr.base.theme.TemplateThemeConfig; +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.dialog.BasicPane; +import com.fr.design.event.ChangeEvent; +import com.fr.design.event.ChangeListener; +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.gui.frpane.UITabbedPane; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.JTemplate; +import com.fr.design.mainframe.theme.dialog.TemplateThemeDialog; +import com.fr.design.mainframe.theme.provider.ThemeManageActionProvider; +import com.fr.design.mainframe.theme.ui.BreadcrumbBar; +import com.fr.stable.ArrayUtils; +import com.fr.stable.unit.FU; +import com.fr.workspace.WorkContext; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.border.CompoundBorder; +import javax.swing.border.LineBorder; +import java.awt.BasicStroke; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.RenderingHints; +import java.awt.Stroke; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2021/10/9 + */ +public class TemplateThemeGridPagesPane extends JPanel { + private BreadcrumbBar breadcrumbBar; + private JPanel contentPane; + private CardLayout cardLayout; + + private TemplateThemeGridPagePane themeUsingPane; + private TemplateThemeGridPagePane themeManagingPane; + + private PageChangeListener pageChangeListener; + private TemplateThemeGridPagePane currentTemplateThemeGridPagePane; + + public TemplateThemeGridPagesPane() { + initializePane(); + } + + private void initializePane() { + setLayout(new BorderLayout()); + setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10)); + + breadcrumbBar = new BreadcrumbBar(); + breadcrumbBar.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); + add(breadcrumbBar, BorderLayout.NORTH); + + contentPane = new JPanel(); + contentPane.setBorder(new CompoundBorder( + new TopLineBorder(new Color(0xE0E0E1), 1), + BorderFactory.createEmptyBorder(10, 0, 0, 0))); + cardLayout = new CardLayout(); + contentPane.setLayout(cardLayout); + add(contentPane, BorderLayout.CENTER); + + + themeUsingPane = new TemplateThemeUsingPane(); + contentPane.add(themeUsingPane, themeUsingPane.getTitle()); + themeManagingPane = new TemplateThemeManagingPane(); + contentPane.add(themeManagingPane, themeManagingPane.getTitle()); + + showThemeUsingPane(); + } + + public void showThemeUsingPane() { + if (currentTemplateThemeGridPagePane != themeUsingPane) { + cardLayout.show(contentPane, themeUsingPane.getTitle()); + currentTemplateThemeGridPagePane = themeUsingPane; + if (pageChangeListener != null) { + pageChangeListener.onPageChangeListener(); + } + breadcrumbBar.clear(); + breadcrumbBar.addCrumb(themeUsingPane.getTitle(), new BreadcrumbBar.BreadcrumbBackListener() { + @Override + public void onBreadcrumbBack(String text) { + cardLayout.show(contentPane, themeUsingPane.getTitle()); + currentTemplateThemeGridPagePane = themeUsingPane; + if (pageChangeListener != null) { + pageChangeListener.onPageChangeListener(); + } + } + }); + } + } + + public void showThemeManagingPane() { + if (currentTemplateThemeGridPagePane != themeManagingPane) { + cardLayout.show(contentPane, themeManagingPane.getTitle()); + currentTemplateThemeGridPagePane = themeManagingPane; + if (pageChangeListener != null) { + pageChangeListener.onPageChangeListener(); + } + breadcrumbBar.addCrumb(themeManagingPane.getTitle(), null); + } + } + + public UIButton[] createLeftButtons() { + UIButton[] buttons = new UIButton[] {}; + if (currentTemplateThemeGridPagePane != themeManagingPane && WorkContext.getCurrent().isRoot()) { + buttons = ArrayUtils.addAll(buttons, createOpenThemeManagerButton()); + } + return buttons; + } + + public UIButton[] createRightButtons() { + UIButton[] buttons = new UIButton[] {}; + buttons = ArrayUtils.addAll(buttons, createExtraButtons()); + buttons = ArrayUtils.addAll(buttons, createCompleteButton()); + return buttons; + } + + private UIButton createOpenThemeManagerButton() { + UIButton button = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Dialog_Title")); + button.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + showThemeManagingPane(); + } + }); + return button; + } + + private UIButton[] createExtraButtons() { + List uiButtonList = new ArrayList<>(); + + Set providers = ExtraDesignClassManager.getInstance().getArray(ThemeManageActionProvider.MARK_STRING); + for (ThemeManageActionProvider provider : providers) { + uiButtonList.add(provider.createButton(new ThemeManageActionProvider.ThemeManageActionContext() { + + @Override + public TemplateThemeDialog getDialog() { + Container container = getRootPane().getParent(); + if (container instanceof TemplateThemeDialog) { + return (TemplateThemeDialog) container; + } + return null; + } + + @Override + public TemplateThemeConfig getConfig() { + return currentTemplateThemeGridPagePane.getConfig(); + } + })); + } + + return uiButtonList.toArray(new UIButton[]{}); + } + + private UIButton createCompleteButton() { + UIButton button = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Dialog_Complete")); + button.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + Container container = getRootPane().getParent(); + if (container instanceof TemplateThemeDialog) { + ((TemplateThemeDialog) container).exit(); + } + } + }); + return button; + } + + public void exit() { + themeUsingPane.exit(); + themeManagingPane.exit(); + } + + public void setPageChangeListener(PageChangeListener changeListener) { + this.pageChangeListener = changeListener; + } + + public interface PageChangeListener { + void onPageChangeListener(); + } + + public static class TopLineBorder extends LineBorder { + private final FU fu; + + private TopLineBorder(Color color, int thickness) { + super(color, thickness); + fu = FU.getInstance(thickness); + } + + @Override + public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { + Graphics2D g2d = (Graphics2D)g; + + Color oldColor = g2d.getColor(); + Stroke oldStroke = g2d.getStroke(); + + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + + g2d.setColor(getLineColor()); + int thickness = Math.max(1, fu.toPixI(ScreenResolution.getScreenResolution())); + g2d.setStroke(new BasicStroke(thickness)); + g2d.drawLine(0, 0, width, thickness); + + g2d.setStroke(oldStroke); + g2d.setColor(oldColor); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); + } + } + + public abstract static class TemplateThemeGridPagePane extends BasicPane { + public abstract TemplateThemeConfig getConfig(); + + public void exit() { } + } + + public static class TemplateThemeUsingPane extends TemplateThemeGridPagePane { + private final JTemplate template; + public final TemplateThemeGridPane themeListPane; + + public TemplateThemeUsingPane() { + super(); + setLayout(new BorderLayout()); + setBorder(new CompoundBorder( + BorderFactory.createLineBorder(new Color(0xE0E0E1)), + BorderFactory.createEmptyBorder(0, 10, 0, 10))); + + template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + TemplateThemeConfig config = template.getUsingTemplateThemeConfig(); + themeListPane = new TemplateThemeGridPane<>(false, config, null); + + themeListPane.startListenThemeConfig(); + + themeListPane.setSelectedChangeListener(new ChangeListener() { + @Override + public void fireChanged(ChangeEvent event) { + TemplateTheme theme = themeListPane.getSelectedTheme(); + if (theme != null) { + template.setTemplateTheme(theme); + themeListPane.repaint(); + } + } + }); + + add(themeListPane, BorderLayout.CENTER); + } + + @Override + public TemplateThemeConfig getConfig() { + return template.getUsingTemplateThemeConfig(); + } + + @Override + public void exit() { + themeListPane.stopListenThemeConfig(); + themeListPane.stopAsyncFetchTheme(); + } + + @Override + protected String title4PopupWindow() { + return Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Using_Dialog_Title"); + } + } + + public static class TemplateThemeManagingPane extends TemplateThemeGridPagePane { + public static final int CONTENT_WIDTH = TemplateThemeGridControlPane.CONTENT_WIDTH + 4; + public static final int CONTENT_HEIGHT = TemplateThemeGridControlPane.CONTENT_HEIGHT + 10; + + private final UITabbedPane tabbedPane; + private final TemplateThemeGridControlPane formThemesManagerPane; + private final TemplateThemeGridControlPane reportThemesManagerPane; + + public TemplateThemeManagingPane() { + setLayout(FRGUIPaneFactory.createBorderLayout()); + setPreferredSize(new Dimension(CONTENT_WIDTH, CONTENT_HEIGHT)); + + tabbedPane = new UITabbedPane(); + add(tabbedPane, BorderLayout.CENTER); + + formThemesManagerPane = TemplateThemeGridControlPane.createFormThemesManagerPane(); + formThemesManagerPane.startListenThemeConfig(); + reportThemesManagerPane = TemplateThemeGridControlPane.createReportThemesManagerPane(); + reportThemesManagerPane.startListenThemeConfig(); + + tabbedPane.addTab(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Dialog_Form_Tab"), formThemesManagerPane); + tabbedPane.addTab(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Dialog_Report_Tab"), reportThemesManagerPane); + + tabbedPane.setSelectedIndex(0); + JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + TemplateThemeConfig config = template.getUsingTemplateThemeConfig(); + if (config == reportThemesManagerPane.getConfig()) { + tabbedPane.setSelectedIndex(1); + } + } + + @Override + public TemplateThemeConfig getConfig() { + if (tabbedPane.getSelectedIndex() == 0) { + return FormThemeConfig.getInstance(); + } else { + return ReportThemeConfig.getInstance(); + } + } + + @Override + public void exit() { + formThemesManagerPane.stopListenThemeConfig(); + formThemesManagerPane.stopAsyncFetchTheme(); + reportThemesManagerPane.stopListenThemeConfig(); + reportThemesManagerPane.stopAsyncFetchTheme(); + } + + @Override + protected String title4PopupWindow() { + return Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Dialog_Title"); + } + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeListPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPane.java similarity index 98% rename from designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeListPane.java rename to designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPane.java index 00184ffc8..3b9cb7bdc 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeListPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPane.java @@ -27,7 +27,7 @@ import java.util.Map; * @version 1.0 * Created by Starryi on 2021/8/13 */ -public class TemplateThemeListPane extends BasicPane { +public class TemplateThemeGridPane extends BasicPane { public static final int BLOCK_COUNT_ROW_LINE = 3; public static final int BLOCK_GAP = IntervalConstants.INTERVAL_L1; public static final int CONTENT_WIDTH = TemplateThemeBlock.CONTENT_WIDTH * BLOCK_COUNT_ROW_LINE + BLOCK_GAP * (BLOCK_COUNT_ROW_LINE - 1) + 10; @@ -51,7 +51,7 @@ public class TemplateThemeListPane extends BasicPane { private ChangeListener changeListener; - public TemplateThemeListPane(boolean displayTheme4NewTemplateMarker, TemplateThemeConfig config, TemplateThemeProfilePane profilePane) { + public TemplateThemeGridPane(boolean displayTheme4NewTemplateMarker, TemplateThemeConfig config, TemplateThemeProfilePane profilePane) { this.displayTheme4NewTemplateMarker = displayTheme4NewTemplateMarker; this.config = config; this.profilePane = profilePane; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeDialog.java index ed2e22d29..875cc6bae 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeDialog.java @@ -26,6 +26,9 @@ public abstract class TemplateThemeDialog extends JDialog { public static final int DIALOG_BOTTOM_ACTION_BUTTON_GAP = 10; public static final int DIALOG_BOTTOM_ACTION_BUTTON_HEIGHT = 20; + private final JPanel contentContainer; + private final JPanel actionContainer; + public TemplateThemeDialog(Window parent, String title, int contentWidth, int contentHeight) { super(parent, ModalityType.APPLICATION_MODAL); @@ -44,25 +47,45 @@ public abstract class TemplateThemeDialog extends JDialog { } }); GUICoreUtils.centerWindow(this); + + contentContainer = FRGUIPaneFactory.createBorderLayout_S_Pane(); + actionContainer = FRGUIPaneFactory.createBorderLayout_S_Pane(); + contentContainer.add(actionContainer, BorderLayout.SOUTH); + setContentPane(contentContainer); } - protected final JPanel createDialogContentPane(JPanel contentPane, UIButton[] rightButtons) { - JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane(); - container.add(contentPane, BorderLayout.CENTER); - container.add(createActionsContainer(rightButtons), BorderLayout.SOUTH); - return container; + protected void setupContentPane() { + contentContainer.add(createContentPane(), BorderLayout.CENTER, 0); } - protected final JPanel createDialogContentPane(JPanel contentPane, UIButton[] leftButtons, UIButton[] rightButtons) { - JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane(); - container.add(contentPane, BorderLayout.CENTER); - container.add(createActionsContainer(leftButtons, rightButtons), BorderLayout.SOUTH); - return container; + protected JPanel createContentPane() { + return new JPanel(); } + protected UIButton[] createLeftButtons() { + return new UIButton[] {}; + } + protected UIButton[] createRightButtons() { + return new UIButton[] {}; + } - private JPanel createActionsContainer(UIButton... buttons) { - return this.createActionsContainer(FlowLayout.RIGHT, buttons); + public void setupActionButtons() { + JPanel leftPane = createActionsContainer(FlowLayout.LEFT, createLeftButtons()); + JPanel rightPane = createActionsContainer(FlowLayout.RIGHT, createRightButtons()); + + actionContainer.removeAll(); + actionContainer.add(leftPane, BorderLayout.WEST); + actionContainer.add(rightPane, BorderLayout.EAST); + + actionContainer.invalidate(); + actionContainer.repaint(); + } + + protected final JPanel createDialogContentPane(JPanel contentPane, UIButton[] rightButtons) { + JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane(); + container.add(contentPane, BorderLayout.CENTER); + container.add(createRightActionsContainer(rightButtons), BorderLayout.SOUTH); + return container; } private JPanel createActionsContainer(int align, UIButton... buttons) { @@ -84,21 +107,12 @@ public abstract class TemplateThemeDialog extends JDialog { return container; } - protected int getPaddingVertical(){ - return (DIALOG_BOTTOM_ACTION_BAR_HEIGHT - DIALOG_BOTTOM_ACTION_BUTTON_HEIGHT) / 2; + private JPanel createRightActionsContainer(UIButton... buttons) { + return createActionsContainer(FlowLayout.RIGHT, buttons); } - - - private JPanel createActionsContainer(UIButton[] leftButtons, UIButton[] rightButtons) { - JPanel leftPane = createActionsContainer(FlowLayout.LEFT, leftButtons); - JPanel rightPane = createActionsContainer(FlowLayout.RIGHT, rightButtons); - - JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane(); - container.add(leftPane, BorderLayout.WEST); - container.add(rightPane, BorderLayout.EAST); - - return container; + private int getPaddingVertical(){ + return (DIALOG_BOTTOM_ACTION_BAR_HEIGHT - DIALOG_BOTTOM_ACTION_BUTTON_HEIGHT) / 2; } public void exit() { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeGridPagesDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeGridPagesDialog.java new file mode 100644 index 000000000..2c43c2a02 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeGridPagesDialog.java @@ -0,0 +1,59 @@ +package com.fr.design.mainframe.theme.dialog; + +import com.fr.base.theme.TemplateTheme; +import com.fr.base.theme.TemplateThemeConfig; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.theme.TemplateThemeGridPagesPane; +import com.fr.design.mainframe.theme.TemplateThemeGridPane; + +import javax.swing.JPanel; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2021/8/13 + */ +public class TemplateThemeGridPagesDialog extends TemplateThemeDialog implements TemplateThemeGridPagesPane.PageChangeListener { + public static final String COMPLETE_BUTTON = "theme_button_complete"; + public static final int CONTENT_WIDTH = TemplateThemeGridPane.CONTENT_WIDTH + 40; + public static final int CONTENT_HEIGHT = TemplateThemeGridPane.CONTENT_HEIGHT + 37; + + protected TemplateThemeGridPagesPane overallPane; + + public TemplateThemeGridPagesDialog() { + super(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Using_Dialog_Title"), CONTENT_WIDTH, CONTENT_HEIGHT); + + setupContentPane(); + setupActionButtons(); + } + + @Override + protected JPanel createContentPane() { + overallPane = new TemplateThemeGridPagesPane(); + overallPane.setPageChangeListener(this); + return overallPane; + } + + @Override + protected UIButton[] createLeftButtons() { + return overallPane.createLeftButtons(); + } + + @Override + protected UIButton[] createRightButtons() { + return overallPane.createRightButtons(); + } + + @Override + public void exit() { + overallPane.exit(); + super.exit(); + } + + @Override + public void onPageChangeListener() { + setupActionButtons(); + } +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeManageDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeManageDialog.java index 0049092a0..93e5b09e6 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeManageDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeManageDialog.java @@ -12,8 +12,9 @@ import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; -import com.fr.design.mainframe.theme.TemplateThemeManagePane; +import com.fr.design.mainframe.theme.TemplateThemeGridControlPane; import com.fr.design.mainframe.theme.provider.ThemeManageActionProvider; import javax.swing.BorderFactory; @@ -32,106 +33,10 @@ import java.util.Set; * @version 1.0 * Created by Starryi on 2021/8/13 */ -public class TemplateThemeManageDialog extends TemplateThemeDialog { +public class TemplateThemeManageDialog extends TemplateThemeGridPagesDialog { - private final TemplateThemeManageDialogContentPane contentPane; - - public TemplateThemeManageDialog(Window parent) { - super(parent, Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Dialog_Title"), - TemplateThemeManageDialogContentPane.CONTENT_WIDTH, TemplateThemeManageDialogContentPane.CONTENT_HEIGHT); - contentPane = new TemplateThemeManageDialogContentPane(); - - setContentPane(createDialogContentPane(contentPane, createActionButtons())); - } - - @Override - public void exit(){ - contentPane.exit(); - super.exit(); - } - - private UIButton[] createActionButtons() { - List uiButtonList = new ArrayList<>(); - - Set providers = ExtraDesignClassManager.getInstance().getArray(ThemeManageActionProvider.MARK_STRING); - for (ThemeManageActionProvider provider : providers) { - uiButtonList.add(provider.createButton(new ThemeManageActionProvider.ThemeManageActionContext() { - - @Override - public TemplateThemeDialog getDialog() { - return TemplateThemeManageDialog.this; - } - - @Override - public TemplateThemeConfig getConfig() { - return contentPane.getConfig(); - } - })); - } - - uiButtonList.add(createCompleteButton()); - - return uiButtonList.toArray(new UIButton[]{}); - } - - private UIButton createCompleteButton() { - UIButton button = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Dialog_Complete")); - button.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - exit(); - } - }); - return button; - } - - public static class TemplateThemeManageDialogContentPane extends JPanel { - public static final int CONTENT_WIDTH = TemplateThemeManagePane.CONTENT_WIDTH + 24; - public static final int CONTENT_HEIGHT = TemplateThemeManagePane.CONTENT_HEIGHT + 40; - - private final UITabbedPane tabbedPane; - private final TemplateThemeManagePane formThemesManagerPane; - private final TemplateThemeManagePane reportThemesManagerPane; - - public TemplateThemeManageDialogContentPane() { - setLayout(FRGUIPaneFactory.createBorderLayout()); - setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10)); - setPreferredSize(new Dimension(CONTENT_WIDTH, CONTENT_HEIGHT)); - - tabbedPane = new UITabbedPane(); - add(tabbedPane, BorderLayout.NORTH); - - formThemesManagerPane = TemplateThemeManagePane.createFormThemesManagerPane(); - formThemesManagerPane.startListenThemeConfig(); - reportThemesManagerPane = TemplateThemeManagePane.createReportThemesManagerPane(); - reportThemesManagerPane.startListenThemeConfig(); - - tabbedPane.addTab(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Dialog_Form_Tab"), formThemesManagerPane); - tabbedPane.addTab(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Dialog_Report_Tab"), reportThemesManagerPane); - - tabbedPane.setSelectedIndex(0); - JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - if (template != null) { - TemplateThemeConfig config = template.getUsingTemplateThemeConfig(); - if (config == reportThemesManagerPane.getConfig()) { - tabbedPane.setSelectedIndex(1); - } - } - } - - public TemplateThemeConfig getConfig() { - if (tabbedPane.getSelectedIndex() == 0) { - return FormThemeConfig.getInstance(); - } else { - return ReportThemeConfig.getInstance(); - } - } - - public void exit() { - formThemesManagerPane.stopListenThemeConfig(); - formThemesManagerPane.stopAsyncFetchTheme(); - reportThemesManagerPane.stopListenThemeConfig(); - reportThemesManagerPane.stopAsyncFetchTheme(); - } + public TemplateThemeManageDialog() { + super(); + overallPane.showThemeManagingPane(); } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeProfileDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeProfileDialog.java index fe31bd13a..a76597f8e 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeProfileDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeProfileDialog.java @@ -25,22 +25,33 @@ import java.util.Set; * Created by Starryi on 2021/8/13 */ public class TemplateThemeProfileDialog extends TemplateThemeDialog { - private static final int PADDING_VERTICAL = 4; public static TemplateThemeProfilePane currentVisibleProfilePane; public static final int CONTENT_WIDTH = 1010; public static final int CONTENT_HEIGHT = 542; + private final TemplateThemeProfilePane profilePane; public TemplateThemeProfileDialog(Window parent, TemplateThemeProfilePane profilePane) { super(parent, profilePane.getTitle(), CONTENT_WIDTH, CONTENT_HEIGHT); + this.profilePane = profilePane; + TemplateThemeProfileDialog.currentVisibleProfilePane = profilePane; + + setupContentPane(); + setupActionButtons(); + } + + @Override + protected JPanel createContentPane() { JPanel content = FRGUIPaneFactory.createBorderLayout_S_Pane(); content.setPreferredSize(new Dimension(CONTENT_WIDTH, CONTENT_HEIGHT)); content.add(profilePane, BorderLayout.CENTER); + return content; + } - setContentPane(createDialogContentPane(content, createActionButtons(profilePane))); - - currentVisibleProfilePane = profilePane; + @Override + protected UIButton[] createRightButtons() { + return createActionButtons(profilePane); } @Override @@ -60,10 +71,6 @@ public class TemplateThemeProfileDialog extends Templat return currentVisibleProfilePane != null; } - protected int getPaddingVertical(){ - return PADDING_VERTICAL; - } - private UIButton[] createActionButtons(final TemplateThemeProfilePane profilePane) { List uiButtonList = new ArrayList<>(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeUsingDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeUsingDialog.java index 9038b097a..420a7ed43 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeUsingDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeUsingDialog.java @@ -1,112 +1,13 @@ package com.fr.design.mainframe.theme.dialog; -import com.fr.base.theme.TemplateTheme; -import com.fr.base.theme.TemplateThemeConfig; -import com.fr.base.theme.ThemedTemplate; -import com.fr.design.event.ChangeEvent; -import com.fr.design.event.ChangeListener; -import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.i18n.Toolkit; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.mainframe.theme.TemplateThemeListPane; -import com.fr.design.mainframe.theme.ui.BorderUtils; -import com.fr.workspace.WorkContext; - -import javax.swing.BorderFactory; -import javax.swing.JPanel; -import javax.swing.border.CompoundBorder; -import java.awt.BorderLayout; -import java.awt.Window; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - /** * @author Starryi * @version 1.0 * Created by Starryi on 2021/8/13 */ -public class TemplateThemeUsingDialog extends TemplateThemeDialog { - public static final String COMPLETE_BUTTON = "theme_button_complete"; - public static final int CONTENT_WIDTH = TemplateThemeListPane.CONTENT_WIDTH + 42; - public static final int CONTENT_HEIGHT = TemplateThemeListPane.CONTENT_HEIGHT + 23; - - private final TemplateThemeListPane themeListPane; - private final ThemedTemplate currentTemplate; - - public TemplateThemeUsingDialog(Window parent, ThemedTemplate template, TemplateThemeConfig config) { - super(parent, Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Using_Dialog_Title"), CONTENT_WIDTH, CONTENT_HEIGHT); - - this.currentTemplate = template; - this.themeListPane = new TemplateThemeListPane<>(false, config, null); - - JPanel content = createContent(); - UIButton openThemeManagerButton = createOpenThemeManagerButton(); - UIButton completeButton = createCompleteButton(); - - setContentPane(createDialogContentPane(content, - new UIButton[]{ openThemeManagerButton }, - new UIButton[]{ completeButton } - )); - - themeListPane.startListenThemeConfig(); - - themeListPane.setSelectedChangeListener(new ChangeListener() { - @Override - public void fireChanged(ChangeEvent event) { - TemplateTheme theme = themeListPane.getSelectedTheme(); - if (theme != null) { - currentTemplate.setTemplateTheme(theme); - themeListPane.repaint(); - } - } - }); - } - - private JPanel createContent() { - JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane(); - container.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10)); - - JPanel themeListPaneContainer = FRGUIPaneFactory.createBorderLayout_S_Pane(); - themeListPaneContainer.setBorder(new CompoundBorder( - BorderUtils.createTitleBorder(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Using_Dialog_Select"), 12), - BorderFactory.createEmptyBorder(0, 10, 0, 10) - )); - themeListPaneContainer.add(themeListPane, BorderLayout.CENTER); - container.add(themeListPaneContainer, BorderLayout.CENTER); - - return container; - } - - private UIButton createOpenThemeManagerButton() { - if (WorkContext.getCurrent().isRoot()) { - UIButton button = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Dialog_Title")); - button.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - TemplateThemeManageDialog dialog = new TemplateThemeManageDialog(TemplateThemeUsingDialog.this); - dialog.setVisible(true); - } - }); - return button; - } - return null; - } - - private UIButton createCompleteButton() { - UIButton button = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Using_Dialog_Complete")); - button.setName(COMPLETE_BUTTON); - button.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - exit(); - } - }); - return button; - } - - public void exit() { - themeListPane.stopListenThemeConfig(); - themeListPane.stopAsyncFetchTheme(); - super.exit(); +public class TemplateThemeUsingDialog extends TemplateThemeGridPagesDialog { + public TemplateThemeUsingDialog() { + super(); + overallPane.showThemeUsingPane(); } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/ui/BreadcrumbBar.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/ui/BreadcrumbBar.java new file mode 100644 index 000000000..bc466972e --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/ui/BreadcrumbBar.java @@ -0,0 +1,114 @@ +package com.fr.design.mainframe.theme.ui; + +import com.fr.design.gui.ilable.UILabel; + +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JPanel; +import javax.swing.plaf.basic.BasicButtonUI; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Insets; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2021/10/9 + */ +public class BreadcrumbBar extends JPanel { + private JButton currentCrumb; + + public BreadcrumbBar() { + setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); + } + + public void addCrumb(final String text, final BreadcrumbBackListener backListener) { + if (currentCrumb != null) { + currentCrumb.setSelected(false); + add(createSeparator()); + } + final JButton breadcrumb = createBreadcrumb(text); + breadcrumb.setSelected(true); + add(breadcrumb); + currentCrumb = breadcrumb; + + final int index = getComponentCount() - 1; + breadcrumb.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + removeTailCrumbs(index + 1); + + breadcrumb.setSelected(true); + currentCrumb = breadcrumb; + if (backListener != null) { + backListener.onBreadcrumbBack(text); + } + } + }); + } + + private void removeTailCrumbs(int from) { + Component[] components = getComponents(); + for (int i = from; i < components.length; i++) { + remove(components[i]); + } + revalidate(); + repaint(); + } + + public void clear() { + removeAll(); + currentCrumb = null; + } + + protected Component createSeparator() { + UILabel separator = new UILabel("/"); + separator.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 8)); + separator.setPreferredSize(new Dimension(separator.getPreferredSize().width, 17)); + + return separator; + } + + protected JButton createBreadcrumb(String text) { + JButton button = new BreadcrumbButton(text); + button.setPreferredSize(new Dimension(button.getPreferredSize().width, 17)); + return button; + } + + public static class BreadcrumbButton extends JButton { + + public BreadcrumbButton(String text) { + super(text); + setMargin(new Insets(0, 0, 0, 0)); + setBorder(BorderFactory.createEmptyBorder()); + setUI(new BasicButtonUI()); + setBorderPainted(false); + setOpaque(false); + setBackground(null); + } + + @Override + public Insets getMargin() { + Insets insets = super.getMargin(); + if (insets != null) { + insets.set(0, 0, 0, 0); + } + return insets; + } + + @Override + public void setSelected(boolean b) { + super.setSelected(b); + setForeground(b ? new Color(0x419BF9) : new Color(0x838384)); + repaint(); + } + } + + public interface BreadcrumbBackListener { + void onBreadcrumbBack(String text); + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index 7379b0a60..a3ea4583f 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -248,8 +248,7 @@ public class JForm extends JTemplate implements BaseJForm dialog = new TemplateThemeUsingDialog<>(designerFrame, JForm.this, FormThemeConfig.getInstance()); + TemplateThemeUsingDialog dialog = new TemplateThemeUsingDialog(); dialog.setVisible(true); } }); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/DownloadSuitableThemeAction.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/DownloadSuitableThemeAction.java index be05db9d6..8eb068fd6 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/DownloadSuitableThemeAction.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/DownloadSuitableThemeAction.java @@ -149,8 +149,7 @@ public class DownloadSuitableThemeAction extends UpdateAction { return; } - Window designerFrame = DesignerContext.getDesignerFrame(); - TemplateThemeUsingDialog dialog = new TemplateThemeUsingDialog<>(designerFrame, currentTemplate, FormThemeConfig.getInstance()); + TemplateThemeUsingDialog dialog = new TemplateThemeUsingDialog(); dialog.addWindowListener(new UsingDialogAdapter(theme)); dialog.setVisible(true); } diff --git a/designer-realize/src/main/java/com/fr/design/actions/server/TemplateThemeManagerAction.java b/designer-realize/src/main/java/com/fr/design/actions/server/TemplateThemeManagerAction.java index f5ed772b0..12779c4d2 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/server/TemplateThemeManagerAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/server/TemplateThemeManagerAction.java @@ -1,8 +1,7 @@ package com.fr.design.actions.server; import com.fr.design.i18n.Toolkit; -import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.predefined.ui.ServerPredefinedStylePane; +import com.fr.design.mainframe.theme.TemplateThemeGridPagesPane; import com.fr.design.mainframe.theme.dialog.TemplateThemeManageDialog; import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.SnapChatUpdateAction; @@ -25,12 +24,12 @@ public class TemplateThemeManagerAction extends SnapChatUpdateAction { this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); this.setSmallIcon(IOUtils.readIcon("/com/fr/design/icon/icon_predefined_style.png")); - this.generateAndSetSearchText(TemplateThemeManageDialog.TemplateThemeManageDialogContentPane.class.getName()); + this.generateAndSetSearchText(TemplateThemeGridPagesPane.class.getName()); } @Override protected void actionPerformed0(ActionEvent e) { - TemplateThemeManageDialog dialog = new TemplateThemeManageDialog(DesignerContext.getDesignerFrame()); + TemplateThemeManageDialog dialog = new TemplateThemeManageDialog(); dialog.setVisible(true); } 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 f2c9524e6..638254226 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 @@ -233,8 +233,7 @@ public class JWorkBook extends JTemplate { button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); - TemplateThemeUsingDialog dialog = new TemplateThemeUsingDialog<>(designerFrame, JWorkBook.this, ReportThemeConfig.getInstance()); + TemplateThemeUsingDialog dialog = new TemplateThemeUsingDialog(); dialog.setVisible(true); } }); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java index 1d573cf2b..1d74237d8 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java @@ -32,7 +32,7 @@ import java.awt.Component; import java.util.TimerTask; public class ThemeToggleGuide { - private static TemplateThemeUsingDialog themeDialog; + private static TemplateThemeUsingDialog themeDialog; private static String TARGET_XCREATOR_NAME = "chart00"; private static String filePath; @@ -190,8 +190,7 @@ public class ThemeToggleGuide { private static void showTemplateThemeUsingDialog() { if (themeDialog == null) { - DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); - themeDialog = new TemplateThemeUsingDialog<>(designerFrame, DesignerContext.getDesignerFrame().getSelectedJTemplate(), FormThemeConfig.getInstance()); + themeDialog = new TemplateThemeUsingDialog(); } GuideCreateUtils.showDialogWithoutModal(themeDialog); }