|
|
|
@ -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 { |
|
|
|
|