Browse Source

REPORT-41753【预定义样式】如果新设计器远程老jar,显示的默认预定义不是兼容

research/11.0
kerry 4 years ago
parent
commit
e93a5886c1
  1. 4
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  2. 54
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleEditPane.java

4
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -160,8 +160,8 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
private void setPredefinedInfo(boolean isNewFile){
if (this.template.getAttrMark(PredefinedStyleAttrMark.XML_TAG) == null) {
PredefinedStyleAttrMark attrMark= new PredefinedStyleAttrMark();
if (!isNewFile){
PredefinedStyleAttrMark attrMark = new PredefinedStyleAttrMark();
if (!isNewFile || !DesignUtils.checkDesignerRemoteVersion()) {
attrMark.setPreferenceStyleName(InterProviderFactory.getProvider().getLocText("Fine-Engine_Predefined_Style_Compatibility"));
}
this.template.addAttrMark(attrMark);

54
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleEditPane.java

@ -1,5 +1,13 @@
package com.fr.design.mainframe.predefined.ui;
import com.fr.base.ChartColorMatching;
import com.fr.base.ChartPreStyleConfig;
import com.fr.base.Style;
import com.fr.base.background.ColorBackground;
import com.fr.config.predefined.ColorFillStyle;
import com.fr.config.predefined.PredefinedCellStyle;
import com.fr.config.predefined.PredefinedCellStyleConfig;
import com.fr.config.predefined.PredefinedColorStyle;
import com.fr.config.predefined.PredefinedStyle;
import com.fr.config.predefined.PredefinedStyleConfig;
import com.fr.config.ServerPreferenceConfig;
@ -18,6 +26,7 @@ import com.fr.design.mainframe.predefined.ui.detail.ComponentStyleSettingPane;
import com.fr.design.mainframe.predefined.ui.detail.CellStyleListControlPane;
import com.fr.design.mainframe.predefined.ui.preview.PredefinedStylePreviewPane;
import com.fr.design.utils.DesignUtils;
import com.fr.general.FRFont;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
@ -29,9 +38,9 @@ import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.List;
/**
* Created by kerry on 2020-08-26
@ -220,14 +229,51 @@ public class PredefinedStyleEditPane extends AbstractAttrNoScrollPane {
PredefinedStyle predefinedStyle = new PredefinedStyle();
predefinedStyle.setLightMode(isLightMode);
predefinedStyle.setStyleName(this.styleNameField.getText());
predefinedStyle.setCellStyleConfig(this.cellStyleSettingPane.updateBean());
PredefinedCellStyleConfig cellStyleConfig = this.cellStyleSettingPane.updateBean();
predefinedStyle.setCellStyleConfig(cellStyleConfig);
predefinedStyle.setPredefinedBackground(this.backgroundSettingPane.updateBean());
predefinedStyle.setComponentStyle(this.componentStyleSettingPane.updateBean());
predefinedStyle.setPredefinedColorStyle(this.colorFillStylePane.update());
PredefinedColorStyle colorStyle = this.colorFillStylePane.update();
updateCellStyleByColorStyle(colorStyle, cellStyleConfig);
predefinedStyle.setPredefinedColorStyle(colorStyle);
predefinedStyle.setPredefinedChartStyle(this.chartStyleSettingPane.updateBean());
return predefinedStyle;
}
private void updateCellStyleByColorStyle(PredefinedColorStyle colorStyle, PredefinedCellStyleConfig cellStyleConfig) {
PredefinedCellStyle headerStyle = cellStyleConfig.getStyle(com.fr.design.i18n.Toolkit.i18nText("表头"));
PredefinedCellStyle highlightStyle = cellStyleConfig.getStyle(com.fr.design.i18n.Toolkit.i18nText("高亮文本"));
ColorFillStyle colorFillStyle = colorStyle.getColorFillStyle();
List<Color> colorList = new ArrayList<>();
if (colorFillStyle == null || colorFillStyle.getColorList().size() == 0){
ChartPreStyleConfig config = ChartPreStyleConfig.getInstance();
String defaultName = config.getCurrentStyle();
ChartColorMatching defaultStyle = (ChartColorMatching) config.getPreStyle(defaultName);
if (defaultStyle != null) {
colorList = defaultStyle.getColorList();
}
} else {
colorList = colorFillStyle.getColorList();
}
if (colorList.size() < 2) {
return;
}
if (headerStyle != null) {
Style style = headerStyle.getStyle();
Color color = colorList.get(0);
headerStyle.setStyle(style.deriveBackground(ColorBackground.getInstance(color)));
}
if (highlightStyle != null) {
Style style = highlightStyle.getStyle();
Color color = colorList.get(1);
FRFont font = style.getFRFont();
font.setForeground(color);
highlightStyle.setStyle(style.deriveFRFont(font));
}
}
public boolean saveStyle() {
PredefinedStyle previewObject;
try {

Loading…
Cancel
Save