Browse Source

CHART-21877 fix:fvs.cpt 批量设置单元格背景颜色后 单元格字体是黑色

zheng-1641779399395
shine 3 years ago
parent
commit
e49d512d18
  1. 13
      designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java
  2. 9
      designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java
  3. 5
      designer-realize/src/main/java/com/fr/design/actions/utils/ReportActionUtils.java
  4. 2
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/AbstractCellAttrPane.java
  5. 12
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java

13
designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java

@ -17,14 +17,19 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.style.color.NewColorSelectBox; import com.fr.design.style.color.NewColorSelectBox;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import javax.swing.*; import javax.swing.Icon;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.GridLayout;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
@ -198,7 +203,7 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse
public Style update(Style style) { public Style update(Style style) {
if (style == null) { if (style == null) {
style = Style.DEFAULT_STYLE; style = AdjustWorkBookDefaultStyleUtils.adjustCellElement(Style.DEFAULT_STYLE);
} }
if (backgroundPane.currentPane.isBackgroundChange()) { if (backgroundPane.currentPane.isBackgroundChange()) {

9
designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java

@ -32,13 +32,20 @@ public class AdjustWorkBookDefaultStyleUtils {
public static void adjustCellElement(CellElement cellElement) { public static void adjustCellElement(CellElement cellElement) {
if (DesignModeContext.isDuchampMode()) { if (DesignModeContext.isDuchampMode()) {
Style style = cellElement.getStyle(); Style style = cellElement.getStyle();
style = adjustCellElement(style);
cellElement.setStyle(style);
}
}
public static Style adjustCellElement(Style style) {
if (DesignModeContext.isDuchampMode()) {
style = style.deriveFRFont(style.getFRFont().applyForeground(CELL_ELEMENT_FONT_FOREGROUND)); style = style.deriveFRFont(style.getFRFont().applyForeground(CELL_ELEMENT_FONT_FOREGROUND));
style = style.deriveBorder(0, CELL_ELEMENT_BORDER, style = style.deriveBorder(0, CELL_ELEMENT_BORDER,
0, CELL_ELEMENT_BORDER, 0, CELL_ELEMENT_BORDER,
0, CELL_ELEMENT_BORDER, 0, CELL_ELEMENT_BORDER,
0, CELL_ELEMENT_BORDER); 0, CELL_ELEMENT_BORDER);
cellElement.setStyle(style);
} }
return style;
} }
public static Color adjustCellElementFontForeground(Color color) { public static Color adjustCellElementFontForeground(Color color) {

5
designer-realize/src/main/java/com/fr/design/actions/utils/ReportActionUtils.java

@ -4,6 +4,7 @@ import com.fr.base.Style;
import com.fr.design.actions.cell.style.StyleActionInterface; import com.fr.design.actions.cell.style.StyleActionInterface;
import com.fr.design.mainframe.DesignOperationEvent; import com.fr.design.mainframe.DesignOperationEvent;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.FloatSelection;
@ -15,7 +16,7 @@ import com.fr.report.cell.TemplateCellElement;
import com.fr.report.elementcase.ElementCase; import com.fr.report.elementcase.ElementCase;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
import java.awt.*; import java.awt.Rectangle;
public class ReportActionUtils { public class ReportActionUtils {
private ReportActionUtils() { private ReportActionUtils() {
@ -113,7 +114,7 @@ public class ReportActionUtils {
CellElement editCellElement = report.getCellElement(((CellSelection) sel).getColumn(), ((CellSelection) sel).getRow()); CellElement editCellElement = report.getCellElement(((CellSelection) sel).getColumn(), ((CellSelection) sel).getRow());
if (editCellElement == null) { if (editCellElement == null) {
return Style.DEFAULT_STYLE; return AdjustWorkBookDefaultStyleUtils.adjustCellElement(Style.DEFAULT_STYLE);
} }
//peter:直接返回当前编辑元素的Style //peter:直接返回当前编辑元素的Style

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

@ -2,6 +2,7 @@ package com.fr.design.mainframe.cell.settingpane;
import com.fr.design.mainframe.AbstractAttrPane; import com.fr.design.mainframe.AbstractAttrPane;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.FloatSelection;
import com.fr.report.cell.DefaultTemplateCellElement; import com.fr.report.cell.DefaultTemplateCellElement;
@ -53,6 +54,7 @@ public abstract class AbstractCellAttrPane extends AbstractAttrPane {
TemplateCellElement cellElement = elementCase.getTemplateCellElement(cs.getColumn(), cs.getRow()); TemplateCellElement cellElement = elementCase.getTemplateCellElement(cs.getColumn(), cs.getRow());
if (cellElement == null) { if (cellElement == null) {
cellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow()); cellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow());
AdjustWorkBookDefaultStyleUtils.adjustCellElement(cellElement);
} }
this.cellElement = cellElement; this.cellElement = cellElement;
elementCase.addCellElement(this.cellElement); elementCase.addCellElement(this.cellElement);

12
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java

@ -5,16 +5,18 @@ import com.fr.design.actions.utils.ReportActionUtils;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.mainframe.cell.settingpane.style.StylePane; import com.fr.design.mainframe.cell.settingpane.style.StylePane;
import com.fr.design.style.BorderUtils; import com.fr.design.style.BorderUtils;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.report.cell.DefaultTemplateCellElement; import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.TemplateCellElement;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
import javax.swing.*; import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Rectangle;
/** /**
* @author zhou * @author zhou
@ -101,12 +103,12 @@ public class CellStylePane extends AbstractCellAttrPane {
TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row); TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row);
if (cellElement == null) { if (cellElement == null) {
cellElement = new DefaultTemplateCellElement(column, row); cellElement = new DefaultTemplateCellElement(column, row);
AdjustWorkBookDefaultStyleUtils.adjustCellElement(cellElement);
elementCase.addCellElement(cellElement); elementCase.addCellElement(cellElement);
} }
Style style = cellElement.getStyle(); Style style = cellElement.getStyle();
if (style == null) { if (style == null) {
style = Style.DEFAULT_STYLE; style = AdjustWorkBookDefaultStyleUtils.adjustCellElement(Style.DEFAULT_STYLE);
} }
style = stylePane.updateStyle(style); style = stylePane.updateStyle(style);
cellElement.setStyle(style); cellElement.setStyle(style);

Loading…
Cancel
Save