Browse Source

REPORT-58595【主题切换】主题色修改,模板预览的颜色没有更改

【问题原因】
1. 使用主题单元格样式时也需要重置CSS
2. 当主题色修改时主题编辑界面的数据只遍历一次,以提高联动效率
3. 修复主题单元格样式预览列表中边框不明显的问题

【改动思路】
同上
fix-lag
Starryi 3 years ago
parent
commit
932e839430
  1. 17
      designer-base/src/main/java/com/fr/design/mainframe/theme/FormThemeProfilePane.java
  2. 11
      designer-base/src/main/java/com/fr/design/mainframe/theme/ReportThemeProfilePane.java
  3. 16
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java
  4. 7
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/CellStyleListEditPane.java
  5. 2
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/ThemedCellStyleListPane.java

17
designer-base/src/main/java/com/fr/design/mainframe/theme/FormThemeProfilePane.java

@ -1,6 +1,5 @@
package com.fr.design.mainframe.theme; package com.fr.design.mainframe.theme;
import com.fr.base.theme.FineColorManager;
import com.fr.base.theme.FormTheme; import com.fr.base.theme.FormTheme;
import com.fr.base.theme.TemplateThemeConfig; import com.fr.base.theme.TemplateThemeConfig;
import com.fr.base.theme.settings.ThemedComponentStyle; import com.fr.base.theme.settings.ThemedComponentStyle;
@ -13,8 +12,6 @@ import com.fr.design.mainframe.theme.edit.FormBodyStyleEditPane;
import com.fr.design.mainframe.theme.preview.FormThemePreviewPane; import com.fr.design.mainframe.theme.preview.FormThemePreviewPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.util.List;
import java.awt.Color;
import static com.fr.design.i18n.Toolkit.i18nText; import static com.fr.design.i18n.Toolkit.i18nText;
@ -61,20 +58,6 @@ public class FormThemeProfilePane extends TemplateThemeProfilePane<FormTheme> {
return container; return container;
} }
@Override
public void onColorSchemeChanged(List<Color> colors) {
super.onColorSchemeChanged(colors);
FineColorManager.FineColorReplaceByColorScheme replaceByColorScheme = new FineColorManager.FineColorReplaceByColorScheme(colors);
ThemedFormBodyStyle formBodyStyle = formBodyStyleSettingPane.updateBean();
FineColorManager.traverse(formBodyStyle, replaceByColorScheme);
formBodyStyleSettingPane.populateBean(formBodyStyle);
ThemedComponentStyle componentStyle = componentStyleSettingPane.updateBean();
FineColorManager.traverse(componentStyle, replaceByColorScheme);
componentStyleSettingPane.populateBean(componentStyle);
}
@Override @Override
public void populateBean(FormTheme theme) { public void populateBean(FormTheme theme) {
super.populateBean(theme); super.populateBean(theme);

11
designer-base/src/main/java/com/fr/design/mainframe/theme/ReportThemeProfilePane.java

@ -39,17 +39,6 @@ public class ReportThemeProfilePane extends TemplateThemeProfilePane<ReportTheme
return container; return container;
} }
@Override
public void onColorSchemeChanged(List<Color> colors) {
super.onColorSchemeChanged(colors);
FineColorManager.FineColorReplaceByColorScheme replaceByColorScheme = new FineColorManager.FineColorReplaceByColorScheme(colors);
ThemedReportBodyStyle bodyStyle = reportBodyStyleSettingPane.updateBean();
FineColorManager.traverse(bodyStyle, replaceByColorScheme);
reportBodyStyleSettingPane.populateBean(bodyStyle);
}
@Override @Override
public void populateBean(ReportTheme theme) { public void populateBean(ReportTheme theme) {
super.populateBean(theme); super.populateBean(theme);

16
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java

@ -90,6 +90,8 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
private UIButton saveButton = new UIButton(); private UIButton saveButton = new UIButton();
private UIButton saveAsButton = new UIButton(); private UIButton saveAsButton = new UIButton();
private boolean refreshingThemedColor = false;
private boolean currentIsNewTheme; private boolean currentIsNewTheme;
private T theme; private T theme;
@ -265,8 +267,13 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
colorListPane.addColorChangeListener(new ChangeListener() { colorListPane.addColorChangeListener(new ChangeListener() {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
if (refreshingThemedColor) {
return;
}
List<Color> colors = colorListPane.update(); List<Color> colors = colorListPane.update();
refreshingThemedColor = true;
onColorSchemeChanged(colors); onColorSchemeChanged(colors);
refreshingThemedColor = false;
} }
}); });
@ -310,13 +317,10 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
public void onColorSchemeChanged(List<Color> colors) { public void onColorSchemeChanged(List<Color> colors) {
colorListExtendedPane.populate(colors); colorListExtendedPane.populate(colors);
FineColorManager.FineColorReplaceByColorScheme replaceByColorScheme = new FineColorManager.FineColorReplaceByColorScheme(colors); FineColorManager.FineColorReplaceByColorScheme replaceByColorScheme = new FineColorManager.FineColorReplaceByColorScheme(colors);
ThemedCellStyleList cellStyle = cellStyleSettingPane.updateBean(); T theme = updateBean();
FineColorManager.traverse(cellStyle, replaceByColorScheme);
ThemedChartStyle themedChartStyle = chartStyleSettingPane.updateBean(); FineColorManager.traverse(theme, replaceByColorScheme);
FineColorManager.traverse(themedChartStyle, replaceByColorScheme); populateBean(theme);
chartStyleSettingPane.populateBean(themedChartStyle);
chartStyleSettingPane.populateGradientBar(colors);
} }
public void populateBean(T theme) { public void populateBean(T theme) {

7
designer-base/src/main/java/com/fr/design/mainframe/theme/edit/CellStyleListEditPane.java

@ -173,6 +173,8 @@ public class CellStyleListEditPane extends JListControlPane {
return; return;
} }
int oldSelectedIndex = getSelectedIndex();
List<NameObject> nameObjectList = new ArrayList<>(); List<NameObject> nameObjectList = new ArrayList<>();
List<ThemedCellStyle> cellStyleList = ob.getCellStyleList(); List<ThemedCellStyle> cellStyleList = ob.getCellStyleList();
@ -185,6 +187,11 @@ public class CellStyleListEditPane extends JListControlPane {
populate(nameObjectArray); populate(nameObjectArray);
int newSelectedIndex = oldSelectedIndex;
if (newSelectedIndex >= nameObjectArray.length) {
newSelectedIndex = 0;
}
setSelectedIndex(newSelectedIndex);
} }
public ThemedCellStyleList updateBean() { public ThemedCellStyleList updateBean() {

2
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/ThemedCellStyleListPane.java

@ -181,8 +181,6 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane<NameStyle> imp
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
int resolution = ScreenResolution.getScreenResolution(); int resolution = ScreenResolution.getScreenResolution();
g.clipRect(0, 0, getWidth() - 3, getHeight() - 3);
if (style == Style.DEFAULT_STYLE) { if (style == Style.DEFAULT_STYLE) {
// 如果是默认的style,就只写"Report"上去 // 如果是默认的style,就只写"Report"上去
Style.paintContent(g2d, paintText, style, getWidth() - 3, getHeight() - 3, resolution); Style.paintContent(g2d, paintText, style, getWidth() - 3, getHeight() - 3, resolution);

Loading…
Cancel
Save