Browse Source

Pull request #2913: MOBILE-27967 【设计器】tab样式自定义设置以后,切换回标准,在切换自定义之前设置未保留

Merge in DESIGN/design from ~HADES/design:MOBILE-27967 to release/10.0

* commit '9c287606d8fef68fda99e2d1cb6000d32c93ca3d':
  MOBILE-27967 【设计器】tab样式自定义设置以后,切换回标准,在切换自定义之前设置未保留
feature/big-screen
ju 4 years ago
parent
commit
f351309c9f
  1. 29
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java

29
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java

@ -44,6 +44,7 @@ public abstract class MobileTemplateStyleDefinePane extends BasicBeanPane<Mobile
private JPanel centerPane; private JPanel centerPane;
protected MobileTemplatePreviewPane previewPane; protected MobileTemplatePreviewPane previewPane;
private WCardTagLayout tagLayout; private WCardTagLayout tagLayout;
private MobileTemplateStyle customTempStyle;
public MobileTemplatePreviewPane getPreviewPane() { public MobileTemplatePreviewPane getPreviewPane() {
@ -87,6 +88,14 @@ public abstract class MobileTemplateStyleDefinePane extends BasicBeanPane<Mobile
custom.addItemListener(new ItemListener() { custom.addItemListener(new ItemListener() {
@Override @Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
// 自定义 -> 标准
if (custom.getSelectedIndex() == 0) {
customTempStyle = getCustomMobileTemplateStyle();
}
// 标准 -> 自定义
if (custom.getSelectedIndex() == 1 && customTempStyle != null) {
populateBean(customTempStyle);
}
boolean isCustom = custom.getSelectedIndex() == 1; boolean isCustom = custom.getSelectedIndex() == 1;
centerPane.setVisible(isCustom); centerPane.setVisible(isCustom);
updatePreviewPane(); updatePreviewPane();
@ -182,8 +191,24 @@ public abstract class MobileTemplateStyleDefinePane extends BasicBeanPane<Mobile
protected abstract MobileTemplatePreviewPane createPreviewPane(); protected abstract MobileTemplatePreviewPane createPreviewPane();
public MobileTemplateStyle getCustomMobileTemplateStyle() {
MobileTemplateStyle ob = updateSubStyle();
ob.setCustom(true);
if (initialColorBox != null) {
ob.setInitialColor(initialColorBox.getSelectObject());
}
if (fontConfPane != null) {
TabFontConfig config = new TabFontConfig();
config.setSelectColor(ob.getTabFontConfig().getSelectColor());
config.setFont(fontConfPane.update());
ob.setTabFontConfig(config);
}
return ob;
}
@Override @Override
public void populateBean(MobileTemplateStyle ob) { public void populateBean(MobileTemplateStyle ob) {
customTempStyle = ob.getCustomTemplateStyle();
centerPane.setVisible(ob.isCustom()); centerPane.setVisible(ob.isCustom());
populateSubStyle(ob); populateSubStyle(ob);
custom.setSelectedItem(!ob.isCustom() ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default") : custom.setSelectedItem(!ob.isCustom() ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default") :
@ -211,7 +236,9 @@ public abstract class MobileTemplateStyleDefinePane extends BasicBeanPane<Mobile
public MobileTemplateStyle updateConfig(){ public MobileTemplateStyle updateConfig(){
if (custom.getSelectedIndex() == 0) { if (custom.getSelectedIndex() == 0) {
return getDefaultTemplateStyle(); MobileTemplateStyle mobileTemplateStyle = getDefaultTemplateStyle();
mobileTemplateStyle.setCustomTemplateStyle(customTempStyle);
return mobileTemplateStyle;
} }
MobileTemplateStyle ob = updateSubStyle(); MobileTemplateStyle ob = updateSubStyle();
ob.setCustom(custom.getSelectedIndex() == 1); ob.setCustom(custom.getSelectedIndex() == 1);

Loading…
Cancel
Save