Browse Source

Merge pull request #5767 in DESIGN/design from release/11.0 to feature/x

* commit 'b308f8214e4181ac33338e3be7f7694e326dd095':
  REPORT-58036 【主题切换】发布前,添加的测试按钮需要去掉
research/11.0
superman 3 years ago
parent
commit
9d91a9d8f6
  1. 57
      designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeManageDialog.java
  2. 58
      designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeProfileDialog.java
  3. 23
      designer-base/src/main/java/com/fr/design/mainframe/theme/provider/AbstractThemeManageActionProvider.java
  4. 23
      designer-base/src/main/java/com/fr/design/mainframe/theme/provider/AbstractThemeProfileActionProvider.java
  5. 28
      designer-base/src/main/java/com/fr/design/mainframe/theme/provider/ThemeManageActionProvider.java
  6. 27
      designer-base/src/main/java/com/fr/design/mainframe/theme/provider/ThemeProfileActionProvider.java

57
designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeManageDialog.java

@ -1,17 +1,20 @@
package com.fr.design.mainframe.theme.dialog; package com.fr.design.mainframe.theme.dialog;
import com.fr.base.theme.FormTheme; import com.fr.base.theme.FormTheme;
import com.fr.base.theme.FormThemeConfig;
import com.fr.base.theme.ReportTheme; import com.fr.base.theme.ReportTheme;
import com.fr.base.theme.ReportThemeConfig;
import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.TemplateThemeConfig; import com.fr.base.theme.TemplateThemeConfig;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.frpane.UITabbedPane; 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.JTemplate; 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.TemplateThemeManagePane;
import com.fr.design.mainframe.theme.provider.ThemeManageActionProvider;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -20,6 +23,9 @@ import java.awt.Dimension;
import java.awt.Window; import java.awt.Window;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
/** /**
* @author Starryi * @author Starryi
@ -35,7 +41,37 @@ public class TemplateThemeManageDialog extends TemplateThemeDialog {
TemplateThemeManageDialogContentPane.CONTENT_WIDTH, TemplateThemeManageDialogContentPane.CONTENT_HEIGHT); TemplateThemeManageDialogContentPane.CONTENT_WIDTH, TemplateThemeManageDialogContentPane.CONTENT_HEIGHT);
contentPane = new TemplateThemeManageDialogContentPane(); 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() { private UIButton createCompleteButton() {
@ -49,16 +85,11 @@ public class TemplateThemeManageDialog extends TemplateThemeDialog {
return button; return button;
} }
@Override
public void exit(){
contentPane.exit();
super.exit();
}
public static class TemplateThemeManageDialogContentPane extends JPanel { public static class TemplateThemeManageDialogContentPane extends JPanel {
public static final int CONTENT_WIDTH = TemplateThemeManagePane.CONTENT_WIDTH + 24; public static final int CONTENT_WIDTH = TemplateThemeManagePane.CONTENT_WIDTH + 24;
public static final int CONTENT_HEIGHT = TemplateThemeManagePane.CONTENT_HEIGHT + 40; public static final int CONTENT_HEIGHT = TemplateThemeManagePane.CONTENT_HEIGHT + 40;
private final UITabbedPane tabbedPane;
private final TemplateThemeManagePane<FormTheme> formThemesManagerPane; private final TemplateThemeManagePane<FormTheme> formThemesManagerPane;
private final TemplateThemeManagePane<ReportTheme> reportThemesManagerPane; private final TemplateThemeManagePane<ReportTheme> reportThemesManagerPane;
@ -67,7 +98,7 @@ public class TemplateThemeManageDialog extends TemplateThemeDialog {
setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10)); setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10));
setPreferredSize(new Dimension(CONTENT_WIDTH, CONTENT_HEIGHT)); setPreferredSize(new Dimension(CONTENT_WIDTH, CONTENT_HEIGHT));
UITabbedPane tabbedPane = new UITabbedPane(); tabbedPane = new UITabbedPane();
add(tabbedPane, BorderLayout.NORTH); add(tabbedPane, BorderLayout.NORTH);
formThemesManagerPane = TemplateThemeManagePane.createFormThemesManagerPane(); 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() { public void exit() {
formThemesManagerPane.stopListenThemeConfig(); formThemesManagerPane.stopListenThemeConfig();
formThemesManagerPane.stopAsyncFetchTheme(); formThemesManagerPane.stopAsyncFetchTheme();

58
designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeProfileDialog.java

@ -1,10 +1,12 @@
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.TemplateTheme;
import com.fr.design.ExtraDesignClassManager;
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.theme.TemplateThemeProfilePane; import com.fr.design.mainframe.theme.TemplateThemeProfilePane;
import com.fr.design.mainframe.theme.provider.ThemeProfileActionProvider;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -13,7 +15,9 @@ import java.awt.Dimension;
import java.awt.Window; import java.awt.Window;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
* @author Starryi * @author Starryi
@ -34,26 +38,11 @@ public class TemplateThemeProfileDialog<T extends TemplateTheme> extends Templat
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);
setContentPane(createDialogContentPane(content, new UIButton[]{ setContentPane(createDialogContentPane(content, createActionButtons(profilePane)));
profilePane.createSaveButton(),
profilePane.createSaveAsButton(this),
createCancelButton()
}));
currentVisibleProfilePane = profilePane; currentVisibleProfilePane = profilePane;
} }
private UIButton createCancelButton() {
UIButton button = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Cancel"));
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
exit();
}
});
return button;
}
@Override @Override
public void exit() { public void exit() {
currentVisibleProfilePane = null; currentVisibleProfilePane = null;
@ -74,4 +63,41 @@ public class TemplateThemeProfileDialog<T extends TemplateTheme> extends Templat
protected int getPaddingVertical(){ protected int getPaddingVertical(){
return PADDING_VERTICAL; return PADDING_VERTICAL;
} }
private UIButton[] createActionButtons(final TemplateThemeProfilePane<T> profilePane) {
List<UIButton> uiButtonList = new ArrayList<>();
Set<ThemeProfileActionProvider> providers = ExtraDesignClassManager.getInstance().getArray(ThemeProfileActionProvider.MARK_STRING);
for (ThemeProfileActionProvider provider : providers) {
uiButtonList.add(provider.createButton(new ThemeProfileActionProvider.ThemeProfileActionContext() {
@Override
public TemplateThemeDialog getDialog() {
return TemplateThemeProfileDialog.this;
}
@Override
public TemplateThemeProfilePane<? extends TemplateTheme> getProfilePane() {
return profilePane;
}
}));
}
uiButtonList.add(profilePane.createSaveButton());
uiButtonList.add(profilePane.createSaveAsButton(TemplateThemeProfileDialog.this));
uiButtonList.add(createCancelButton());
return uiButtonList.toArray(new UIButton[]{});
}
private UIButton createCancelButton() {
UIButton button = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Cancel"));
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
exit();
}
});
return button;
}
} }

23
designer-base/src/main/java/com/fr/design/mainframe/theme/provider/AbstractThemeManageActionProvider.java

@ -0,0 +1,23 @@
package com.fr.design.mainframe.theme.provider;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
/**
* @author Starryi
* @version 1.0
* Created by Starryi on 2021/9/7
*/
@API(level = ThemeManageActionProvider.CURRENT_LEVEL)
public abstract class AbstractThemeManageActionProvider extends AbstractProvider implements ThemeManageActionProvider {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String mark4Provider() {
return getClass().getName();
}
}

23
designer-base/src/main/java/com/fr/design/mainframe/theme/provider/AbstractThemeProfileActionProvider.java

@ -0,0 +1,23 @@
package com.fr.design.mainframe.theme.provider;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
/**
* @author Starryi
* @version 1.0
* Created by Starryi on 2021/9/7
*/
@API(level = ThemeProfileActionProvider.CURRENT_LEVEL)
public abstract class AbstractThemeProfileActionProvider extends AbstractProvider implements ThemeProfileActionProvider {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String mark4Provider() {
return getClass().getName();
}
}

28
designer-base/src/main/java/com/fr/design/mainframe/theme/provider/ThemeManageActionProvider.java

@ -0,0 +1,28 @@
package com.fr.design.mainframe.theme.provider;
import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.TemplateThemeConfig;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.theme.dialog.TemplateThemeDialog;
import com.fr.stable.fun.mark.Mutable;
/**
* @author Starryi
* @version 1.0
* Created by Starryi on 2021/9/7
*/
public interface ThemeManageActionProvider extends Mutable {
String MARK_STRING = "ThemeManageActionProvider";
int CURRENT_LEVEL = 1;
UIButton createButton(ThemeManageActionContext context);
interface ThemeManageActionContext {
TemplateThemeDialog getDialog();
TemplateThemeConfig<? extends TemplateTheme> getConfig();
}
}

27
designer-base/src/main/java/com/fr/design/mainframe/theme/provider/ThemeProfileActionProvider.java

@ -0,0 +1,27 @@
package com.fr.design.mainframe.theme.provider;
import com.fr.base.theme.TemplateTheme;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.theme.TemplateThemeProfilePane;
import com.fr.design.mainframe.theme.dialog.TemplateThemeDialog;
import com.fr.stable.fun.mark.Mutable;
/**
* @author Starryi
* @version 1.0
* Created by Starryi on 2021/9/7
*/
public interface ThemeProfileActionProvider extends Mutable {
String MARK_STRING = "ThemeProfileActionProvider";
int CURRENT_LEVEL = 1;
UIButton createButton(ThemeProfileActionContext context);
interface ThemeProfileActionContext {
TemplateThemeDialog getDialog();
TemplateThemeProfilePane<? extends TemplateTheme> getProfilePane();
}
}
Loading…
Cancel
Save