Browse Source

Merge branch 'feature/10.0' of https://cloud.finedevelop.com/scm/~bjorn/design into feature/10.0

persist/11.0
白岳 4 years ago
parent
commit
13b4e01275
  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("Fine-Design_Basic_Predefined_Style_Header"));
PredefinedCellStyle highlightStyle = cellStyleConfig.getStyle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Highlight_Text"));
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