Browse Source

REPORT-59902 主题切换交互框架优化

【问题原因】
主题应用和主题管理使用同一个框展示,并且通过类似面包屑导航条
的方式进行切换

【改动思路】
同上
research/11.0
Starryi 3 years ago
parent
commit
1ab435281d
  1. 30
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridControlPane.java
  2. 339
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java
  3. 4
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPane.java
  4. 64
      designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeDialog.java
  5. 59
      designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeGridPagesDialog.java
  6. 107
      designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeManageDialog.java
  7. 23
      designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeProfileDialog.java
  8. 107
      designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeUsingDialog.java
  9. 114
      designer-base/src/main/java/com/fr/design/mainframe/theme/ui/BreadcrumbBar.java
  10. 3
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  11. 3
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/DownloadSuitableThemeAction.java
  12. 7
      designer-realize/src/main/java/com/fr/design/actions/server/TemplateThemeManagerAction.java
  13. 3
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java
  14. 5
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java

30
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeManagePane.java → 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 * @version 1.0
* Created by Starryi on 2021/8/13 * Created by Starryi on 2021/8/13
*/ */
public class TemplateThemeManagePane<T extends TemplateTheme> extends BasicPane { public class TemplateThemeGridControlPane<T extends TemplateTheme> extends BasicPane {
public static final int CONTENT_WIDTH = TemplateThemeListPane.CONTENT_WIDTH + 10; public static final int CONTENT_WIDTH = TemplateThemeGridPane.CONTENT_WIDTH + 10;
public static final int CONTENT_HEIGHT = TemplateThemeListPane.CONTENT_HEIGHT + 37; public static final int CONTENT_HEIGHT = TemplateThemeGridPane.CONTENT_HEIGHT + 37;
private final RemoveThemeAction removeAction; private final RemoveThemeAction removeAction;
private final UIButton setTheme4NewTemplateButton; private final UIButton setTheme4NewTemplateButton;
private final TemplateThemeConfig<T> config; private final TemplateThemeConfig<T> config;
private final TemplateThemeListPane<T> themeListPane; private final TemplateThemeGridPane<T> themeListPane;
private final TemplateThemeProfilePane<T> profilePane; private final TemplateThemeProfilePane<T> profilePane;
private final AsyncThemeFetcher<T> asyncThemeFetcher; private final AsyncThemeFetcher<T> asyncThemeFetcher;
public static TemplateThemeManagePane<FormTheme> createFormThemesManagerPane() { public static TemplateThemeGridControlPane<FormTheme> createFormThemesManagerPane() {
FormThemeConfig config = FormThemeConfig.getInstance(); FormThemeConfig config = FormThemeConfig.getInstance();
FormThemeProfilePane editPane = new FormThemeProfilePane(config); FormThemeProfilePane editPane = new FormThemeProfilePane(config);
return new TemplateThemeManagePane<>(config, editPane); return new TemplateThemeGridControlPane<>(config, editPane);
} }
public static TemplateThemeManagePane<ReportTheme> createReportThemesManagerPane() { public static TemplateThemeGridControlPane<ReportTheme> createReportThemesManagerPane() {
ReportThemeConfig config = ReportThemeConfig.getInstance(); ReportThemeConfig config = ReportThemeConfig.getInstance();
ReportThemeProfilePane editPane = new ReportThemeProfilePane(config); ReportThemeProfilePane editPane = new ReportThemeProfilePane(config);
return new TemplateThemeManagePane<>(config, editPane); return new TemplateThemeGridControlPane<>(config, editPane);
} }
public TemplateThemeManagePane(TemplateThemeConfig<T> config, TemplateThemeProfilePane<T> profilePane) { public TemplateThemeGridControlPane(TemplateThemeConfig<T> config, TemplateThemeProfilePane<T> profilePane) {
this.config = config; this.config = config;
this.profilePane = profilePane; this.profilePane = profilePane;
this.themeListPane = new TemplateThemeListPane<>(true, config, profilePane); this.themeListPane = new TemplateThemeGridPane<>(true, config, profilePane);
this.removeAction = new RemoveThemeAction(false); this.removeAction = new RemoveThemeAction(false);
this.setTheme4NewTemplateButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Pane_Default_Setting")); this.setTheme4NewTemplateButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Pane_Default_Setting"));
this.asyncThemeFetcher = new AsyncThemeFetcher<>(1, config); this.asyncThemeFetcher = new AsyncThemeFetcher<>(1, config);
@ -179,7 +179,7 @@ public class TemplateThemeManagePane<T extends TemplateTheme> extends BasicPane
@Override @Override
public void afterRollback() { public void afterRollback() {
super.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_Template_Theme_Operation_Failed_Tip"),
i18nText("Fine-Design_Basic_Alert"), i18nText("Fine-Design_Basic_Alert"),
JOptionPane.WARNING_MESSAGE); JOptionPane.WARNING_MESSAGE);
@ -225,11 +225,11 @@ public class TemplateThemeManagePane<T extends TemplateTheme> extends BasicPane
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
T theme = TemplateThemeManagePane.this.themeListPane.getSelectedTheme(); T theme = TemplateThemeGridControlPane.this.themeListPane.getSelectedTheme();
if (theme == null) { if (theme == null) {
return; 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_Template_Theme_Manager_Pane_Delete_Tip", theme.getName()),
Toolkit.i18nText("Fine-Design_Basic_Delete"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); Toolkit.i18nText("Fine-Design_Basic_Delete"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
if (result == JOptionPane.YES_OPTION) { if (result == JOptionPane.YES_OPTION) {
@ -237,7 +237,7 @@ public class TemplateThemeManagePane<T extends TemplateTheme> extends BasicPane
@Override @Override
public void afterRollback() { public void afterRollback() {
super.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_Template_Theme_Operation_Failed_Tip"),
i18nText("Fine-Design_Basic_Alert"), i18nText("Fine-Design_Basic_Alert"),
JOptionPane.WARNING_MESSAGE); JOptionPane.WARNING_MESSAGE);
@ -269,7 +269,7 @@ public class TemplateThemeManagePane<T extends TemplateTheme> extends BasicPane
} }
private void createNewTheme(T prototypeTheme) { private void createNewTheme(T prototypeTheme) {
Window parent = SwingUtilities.getWindowAncestor(TemplateThemeManagePane.this); Window parent = SwingUtilities.getWindowAncestor(TemplateThemeGridControlPane.this);
TemplateThemeProfileDialog<T> profileDialog = new TemplateThemeProfileDialog<>(parent, profilePane); TemplateThemeProfileDialog<T> profileDialog = new TemplateThemeProfileDialog<>(parent, profilePane);
try { try {
T theme = (T) prototypeTheme.clone(); T theme = (T) prototypeTheme.clone();

339
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<UIButton> uiButtonList = new ArrayList<>();
Set<ThemeManageActionProvider> 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<? extends TemplateTheme> 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<? extends TemplateTheme> getConfig();
public void exit() { }
}
public static class TemplateThemeUsingPane extends TemplateThemeGridPagePane {
private final JTemplate<?,?> template;
public final TemplateThemeGridPane<? extends TemplateTheme> 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<? extends TemplateTheme> 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<? extends TemplateTheme> 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<FormTheme> formThemesManagerPane;
private final TemplateThemeGridControlPane<ReportTheme> 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<? extends TemplateTheme> config = template.getUsingTemplateThemeConfig();
if (config == reportThemesManagerPane.getConfig()) {
tabbedPane.setSelectedIndex(1);
}
}
@Override
public TemplateThemeConfig<? extends TemplateTheme> 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");
}
}
}

4
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeListPane.java → designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPane.java

@ -27,7 +27,7 @@ import java.util.Map;
* @version 1.0 * @version 1.0
* Created by Starryi on 2021/8/13 * Created by Starryi on 2021/8/13
*/ */
public class TemplateThemeListPane<T extends TemplateTheme> extends BasicPane { public class TemplateThemeGridPane<T extends TemplateTheme> extends BasicPane {
public static final int BLOCK_COUNT_ROW_LINE = 3; public static final int BLOCK_COUNT_ROW_LINE = 3;
public static final int BLOCK_GAP = IntervalConstants.INTERVAL_L1; 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; 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<T extends TemplateTheme> extends BasicPane {
private ChangeListener changeListener; private ChangeListener changeListener;
public TemplateThemeListPane(boolean displayTheme4NewTemplateMarker, TemplateThemeConfig<T> config, TemplateThemeProfilePane<T> profilePane) { public TemplateThemeGridPane(boolean displayTheme4NewTemplateMarker, TemplateThemeConfig<T> config, TemplateThemeProfilePane<T> profilePane) {
this.displayTheme4NewTemplateMarker = displayTheme4NewTemplateMarker; this.displayTheme4NewTemplateMarker = displayTheme4NewTemplateMarker;
this.config = config; this.config = config;
this.profilePane = profilePane; this.profilePane = profilePane;

64
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_GAP = 10;
public static final int DIALOG_BOTTOM_ACTION_BUTTON_HEIGHT = 20; 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) { public TemplateThemeDialog(Window parent, String title, int contentWidth, int contentHeight) {
super(parent, ModalityType.APPLICATION_MODAL); super(parent, ModalityType.APPLICATION_MODAL);
@ -44,25 +47,45 @@ public abstract class TemplateThemeDialog extends JDialog {
} }
}); });
GUICoreUtils.centerWindow(this); 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) { protected void setupContentPane() {
JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane(); contentContainer.add(createContentPane(), BorderLayout.CENTER, 0);
container.add(contentPane, BorderLayout.CENTER);
container.add(createActionsContainer(rightButtons), BorderLayout.SOUTH);
return container;
} }
protected final JPanel createDialogContentPane(JPanel contentPane, UIButton[] leftButtons, UIButton[] rightButtons) { protected JPanel createContentPane() {
JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane(); return new JPanel();
container.add(contentPane, BorderLayout.CENTER);
container.add(createActionsContainer(leftButtons, rightButtons), BorderLayout.SOUTH);
return container;
} }
protected UIButton[] createLeftButtons() {
return new UIButton[] {};
}
protected UIButton[] createRightButtons() {
return new UIButton[] {};
}
private JPanel createActionsContainer(UIButton... buttons) { public void setupActionButtons() {
return this.createActionsContainer(FlowLayout.RIGHT, buttons); 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) { private JPanel createActionsContainer(int align, UIButton... buttons) {
@ -84,21 +107,12 @@ public abstract class TemplateThemeDialog extends JDialog {
return container; return container;
} }
protected int getPaddingVertical(){ private JPanel createRightActionsContainer(UIButton... buttons) {
return (DIALOG_BOTTOM_ACTION_BAR_HEIGHT - DIALOG_BOTTOM_ACTION_BUTTON_HEIGHT) / 2; return createActionsContainer(FlowLayout.RIGHT, buttons);
} }
private int getPaddingVertical(){
return (DIALOG_BOTTOM_ACTION_BAR_HEIGHT - DIALOG_BOTTOM_ACTION_BUTTON_HEIGHT) / 2;
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;
} }
public void exit() { public void exit() {

59
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();
}
}

107
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.gui.ibutton.UIButton;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; 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 com.fr.design.mainframe.theme.provider.ThemeManageActionProvider;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -32,106 +33,10 @@ import java.util.Set;
* @version 1.0 * @version 1.0
* Created by Starryi on 2021/8/13 * Created by Starryi on 2021/8/13
*/ */
public class TemplateThemeManageDialog extends TemplateThemeDialog { public class TemplateThemeManageDialog extends TemplateThemeGridPagesDialog {
private final TemplateThemeManageDialogContentPane contentPane; public TemplateThemeManageDialog() {
super();
public TemplateThemeManageDialog(Window parent) { overallPane.showThemeManagingPane();
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<UIButton> uiButtonList = new ArrayList<>();
Set<ThemeManageActionProvider> 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<? extends TemplateTheme> 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<FormTheme> formThemesManagerPane;
private final TemplateThemeManagePane<ReportTheme> 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<? extends TemplateTheme> config = template.getUsingTemplateThemeConfig();
if (config == reportThemesManagerPane.getConfig()) {
tabbedPane.setSelectedIndex(1);
}
}
}
public TemplateThemeConfig<? extends TemplateTheme> getConfig() {
if (tabbedPane.getSelectedIndex() == 0) {
return FormThemeConfig.getInstance();
} else {
return ReportThemeConfig.getInstance();
}
}
public void exit() {
formThemesManagerPane.stopListenThemeConfig();
formThemesManagerPane.stopAsyncFetchTheme();
reportThemesManagerPane.stopListenThemeConfig();
reportThemesManagerPane.stopAsyncFetchTheme();
}
} }
} }

23
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 * Created by Starryi on 2021/8/13
*/ */
public class TemplateThemeProfileDialog<T extends TemplateTheme> extends TemplateThemeDialog { public class TemplateThemeProfileDialog<T extends TemplateTheme> extends TemplateThemeDialog {
private static final int PADDING_VERTICAL = 4;
public static TemplateThemeProfilePane<? extends TemplateTheme> currentVisibleProfilePane; public static TemplateThemeProfilePane<? extends TemplateTheme> currentVisibleProfilePane;
public static final int CONTENT_WIDTH = 1010; public static final int CONTENT_WIDTH = 1010;
public static final int CONTENT_HEIGHT = 542; public static final int CONTENT_HEIGHT = 542;
private final TemplateThemeProfilePane<T> profilePane;
public TemplateThemeProfileDialog(Window parent, TemplateThemeProfilePane<T> profilePane) { public TemplateThemeProfileDialog(Window parent, TemplateThemeProfilePane<T> profilePane) {
super(parent, profilePane.getTitle(), CONTENT_WIDTH, CONTENT_HEIGHT); 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(); JPanel content = FRGUIPaneFactory.createBorderLayout_S_Pane();
content.setPreferredSize(new Dimension(CONTENT_WIDTH, CONTENT_HEIGHT)); content.setPreferredSize(new Dimension(CONTENT_WIDTH, CONTENT_HEIGHT));
content.add(profilePane, BorderLayout.CENTER); content.add(profilePane, BorderLayout.CENTER);
return content;
}
setContentPane(createDialogContentPane(content, createActionButtons(profilePane))); @Override
protected UIButton[] createRightButtons() {
currentVisibleProfilePane = profilePane; return createActionButtons(profilePane);
} }
@Override @Override
@ -60,10 +71,6 @@ public class TemplateThemeProfileDialog<T extends TemplateTheme> extends Templat
return currentVisibleProfilePane != null; return currentVisibleProfilePane != null;
} }
protected int getPaddingVertical(){
return PADDING_VERTICAL;
}
private UIButton[] createActionButtons(final TemplateThemeProfilePane<T> profilePane) { private UIButton[] createActionButtons(final TemplateThemeProfilePane<T> profilePane) {
List<UIButton> uiButtonList = new ArrayList<>(); List<UIButton> uiButtonList = new ArrayList<>();

107
designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeUsingDialog.java

@ -1,112 +1,13 @@
package com.fr.design.mainframe.theme.dialog; 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 * @author Starryi
* @version 1.0 * @version 1.0
* Created by Starryi on 2021/8/13 * Created by Starryi on 2021/8/13
*/ */
public class TemplateThemeUsingDialog<T extends TemplateTheme> extends TemplateThemeDialog { public class TemplateThemeUsingDialog extends TemplateThemeGridPagesDialog {
public static final String COMPLETE_BUTTON = "theme_button_complete"; public TemplateThemeUsingDialog() {
public static final int CONTENT_WIDTH = TemplateThemeListPane.CONTENT_WIDTH + 42; super();
public static final int CONTENT_HEIGHT = TemplateThemeListPane.CONTENT_HEIGHT + 23; overallPane.showThemeUsingPane();
private final TemplateThemeListPane<T> themeListPane;
private final ThemedTemplate currentTemplate;
public TemplateThemeUsingDialog(Window parent, ThemedTemplate template, TemplateThemeConfig<T> 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();
} }
} }

114
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);
}
}

3
designer-form/src/main/java/com/fr/design/mainframe/JForm.java

@ -248,8 +248,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
button.addActionListener(new ActionListener() { button.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); TemplateThemeUsingDialog dialog = new TemplateThemeUsingDialog();
TemplateThemeUsingDialog<FormTheme> dialog = new TemplateThemeUsingDialog<>(designerFrame, JForm.this, FormThemeConfig.getInstance());
dialog.setVisible(true); dialog.setVisible(true);
} }
}); });

3
designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/DownloadSuitableThemeAction.java

@ -149,8 +149,7 @@ public class DownloadSuitableThemeAction extends UpdateAction {
return; return;
} }
Window designerFrame = DesignerContext.getDesignerFrame(); TemplateThemeUsingDialog dialog = new TemplateThemeUsingDialog();
TemplateThemeUsingDialog<FormTheme> dialog = new TemplateThemeUsingDialog<>(designerFrame, currentTemplate, FormThemeConfig.getInstance());
dialog.addWindowListener(new UsingDialogAdapter(theme)); dialog.addWindowListener(new UsingDialogAdapter(theme));
dialog.setVisible(true); dialog.setVisible(true);
} }

7
designer-realize/src/main/java/com/fr/design/actions/server/TemplateThemeManagerAction.java

@ -1,8 +1,7 @@
package com.fr.design.actions.server; package com.fr.design.actions.server;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.theme.TemplateThemeGridPagesPane;
import com.fr.design.mainframe.predefined.ui.ServerPredefinedStylePane;
import com.fr.design.mainframe.theme.dialog.TemplateThemeManageDialog; import com.fr.design.mainframe.theme.dialog.TemplateThemeManageDialog;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.menu.SnapChatUpdateAction; import com.fr.design.menu.SnapChatUpdateAction;
@ -25,12 +24,12 @@ public class TemplateThemeManagerAction extends SnapChatUpdateAction {
this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/icon/icon_predefined_style.png")); this.setSmallIcon(IOUtils.readIcon("/com/fr/design/icon/icon_predefined_style.png"));
this.generateAndSetSearchText(TemplateThemeManageDialog.TemplateThemeManageDialogContentPane.class.getName()); this.generateAndSetSearchText(TemplateThemeGridPagesPane.class.getName());
} }
@Override @Override
protected void actionPerformed0(ActionEvent e) { protected void actionPerformed0(ActionEvent e) {
TemplateThemeManageDialog dialog = new TemplateThemeManageDialog(DesignerContext.getDesignerFrame()); TemplateThemeManageDialog dialog = new TemplateThemeManageDialog();
dialog.setVisible(true); dialog.setVisible(true);
} }

3
designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

@ -233,8 +233,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
button.addActionListener(new ActionListener() { button.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); TemplateThemeUsingDialog dialog = new TemplateThemeUsingDialog();
TemplateThemeUsingDialog<ReportTheme> dialog = new TemplateThemeUsingDialog<>(designerFrame, JWorkBook.this, ReportThemeConfig.getInstance());
dialog.setVisible(true); dialog.setVisible(true);
} }
}); });

5
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; import java.util.TimerTask;
public class ThemeToggleGuide { public class ThemeToggleGuide {
private static TemplateThemeUsingDialog<FormTheme> themeDialog; private static TemplateThemeUsingDialog themeDialog;
private static String TARGET_XCREATOR_NAME = "chart00"; private static String TARGET_XCREATOR_NAME = "chart00";
private static String filePath; private static String filePath;
@ -190,8 +190,7 @@ public class ThemeToggleGuide {
private static void showTemplateThemeUsingDialog() { private static void showTemplateThemeUsingDialog() {
if (themeDialog == null) { if (themeDialog == null) {
DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); themeDialog = new TemplateThemeUsingDialog();
themeDialog = new TemplateThemeUsingDialog<>(designerFrame, DesignerContext.getDesignerFrame().getSelectedJTemplate(), FormThemeConfig.getInstance());
} }
GuideCreateUtils.showDialogWithoutModal(themeDialog); GuideCreateUtils.showDialogWithoutModal(themeDialog);
} }

Loading…
Cancel
Save