|
|
|
@ -1,17 +1,20 @@
|
|
|
|
|
package com.fr.design.mainframe.theme.dialog; |
|
|
|
|
|
|
|
|
|
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.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.TemplateThemeListPane; |
|
|
|
|
import com.fr.design.mainframe.theme.TemplateThemeManagePane; |
|
|
|
|
import com.fr.design.mainframe.theme.provider.ThemeManageActionProvider; |
|
|
|
|
|
|
|
|
|
import javax.swing.BorderFactory; |
|
|
|
|
import javax.swing.JPanel; |
|
|
|
@ -20,6 +23,9 @@ import java.awt.Dimension;
|
|
|
|
|
import java.awt.Window; |
|
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
|
import java.awt.event.ActionListener; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Set; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @author Starryi |
|
|
|
@ -35,7 +41,37 @@ public class TemplateThemeManageDialog extends TemplateThemeDialog {
|
|
|
|
|
TemplateThemeManageDialogContentPane.CONTENT_WIDTH, TemplateThemeManageDialogContentPane.CONTENT_HEIGHT); |
|
|
|
|
contentPane = new TemplateThemeManageDialogContentPane(); |
|
|
|
|
|
|
|
|
|
setContentPane(createDialogContentPane(contentPane, new UIButton[]{ createCompleteButton() })); |
|
|
|
|
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() { |
|
|
|
@ -49,16 +85,11 @@ public class TemplateThemeManageDialog extends TemplateThemeDialog {
|
|
|
|
|
return button; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void exit(){ |
|
|
|
|
contentPane.exit(); |
|
|
|
|
super.exit(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
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; |
|
|
|
|
|
|
|
|
@ -67,7 +98,7 @@ public class TemplateThemeManageDialog extends TemplateThemeDialog {
|
|
|
|
|
setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10)); |
|
|
|
|
setPreferredSize(new Dimension(CONTENT_WIDTH, CONTENT_HEIGHT)); |
|
|
|
|
|
|
|
|
|
UITabbedPane tabbedPane = new UITabbedPane(); |
|
|
|
|
tabbedPane = new UITabbedPane(); |
|
|
|
|
add(tabbedPane, BorderLayout.NORTH); |
|
|
|
|
|
|
|
|
|
formThemesManagerPane = TemplateThemeManagePane.createFormThemesManagerPane(); |
|
|
|
@ -88,6 +119,14 @@ public class TemplateThemeManageDialog extends TemplateThemeDialog {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public TemplateThemeConfig<? extends TemplateTheme> getConfig() { |
|
|
|
|
if (tabbedPane.getSelectedIndex() == 0) { |
|
|
|
|
return FormThemeConfig.getInstance(); |
|
|
|
|
} else { |
|
|
|
|
return ReportThemeConfig.getInstance(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void exit() { |
|
|
|
|
formThemesManagerPane.stopListenThemeConfig(); |
|
|
|
|
formThemesManagerPane.stopAsyncFetchTheme(); |
|
|
|
|