Browse Source

Merging in latest from upstream (DESIGN/design:refs/heads/feature/x)

* commit '11200fb8b64e2c8682ecef97a83eeb6cca94bab5':
  REPORT-64075 【主题边框】框选设置主题样式,关闭模板,删除模板主题,重新打开模板边框丢失
feature/x
kerry 3 years ago
parent
commit
f52b66508f
  1. 18
      designer-base/src/main/java/com/fr/design/cell/CellRectangleStylePreviewPane.java
  2. 2
      designer-realize/src/main/java/com/fr/design/actions/cell/BorderAction.java
  3. 15
      designer-realize/src/main/java/com/fr/design/style/BorderUtils.java

18
designer-base/src/main/java/com/fr/design/cell/CellRectangleStylePreviewPane.java

@ -1,6 +1,6 @@
package com.fr.design.cell;
import com.fr.report.cell.CellElementBorderSourceFlag;
import com.fr.base.CellBorderSourceFlag;
import com.fr.base.CellBorderStyle;
import com.fr.base.Style;
import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase;
@ -20,6 +20,7 @@ public class CellRectangleStylePreviewPane extends JPanel {
private static final int COLUMN_COUNT = 2;
private final TemplateCellElement[][] cellElementGrid = new TemplateCellElement[ROW_COUNT][COLUMN_COUNT];
private final int[][] borderSourceFlags = new int[ROW_COUNT][COLUMN_COUNT];
private final CellStylePreviewPane[][] cellStylePreviewPaneGrid = new CellStylePreviewPane[ROW_COUNT][COLUMN_COUNT];
public CellRectangleStylePreviewPane() {
@ -29,25 +30,25 @@ public class CellRectangleStylePreviewPane extends JPanel {
for (int c = 0; c < COLUMN_COUNT; c++) {
CellStylePreviewPane pane = new CellStylePreviewPane();
TemplateCellElement cellElement = DefaultThemedTemplateCellElementCase.createInstance(c, r);
int flags = CellElementBorderSourceFlag.ALL_BORDER_SOURCE_OUTER;
int flags = CellBorderSourceFlag.ALL_BORDER_SOURCE_OUTER;
if (r != 0) {
flags |= CellElementBorderSourceFlag.TOP_BORDER_SOURCE_INNER;
flags |= CellBorderSourceFlag.TOP_BORDER_SOURCE_INNER;
}
if (r != ROW_COUNT - 1) {
flags |= CellElementBorderSourceFlag.BOTTOM_BORDER_SOURCE_INNER;
flags |= CellBorderSourceFlag.BOTTOM_BORDER_SOURCE_INNER;
}
if (c != 0) {
flags |= CellElementBorderSourceFlag.LEFT_BORDER_SOURCE_INNER;
flags |= CellBorderSourceFlag.LEFT_BORDER_SOURCE_INNER;
}
if (c != COLUMN_COUNT - 1) {
flags |= CellElementBorderSourceFlag.RIGHT_BORDER_SOURCE_INNER;
flags |= CellBorderSourceFlag.RIGHT_BORDER_SOURCE_INNER;
}
cellElement.setBorderSourceFlags(flags);
pane.setStyle(cellElement.getStyle());
add(pane);
cellElementGrid[r][c] = cellElement;
borderSourceFlags[r][c] = flags;
cellStylePreviewPaneGrid[r][c] = pane;
}
}
@ -64,7 +65,8 @@ public class CellRectangleStylePreviewPane extends JPanel {
for (int j = 0; j < COLUMN_COUNT; j++) {
CellStylePreviewPane pane = cellStylePreviewPaneGrid[i][j];
TemplateCellElement cellElement = cellElementGrid[i][j];
cellElement.setStyle(style, borderStyle);
int flag = borderSourceFlags[i][j];
cellElement.setStyle(CellBorderSourceFlag.deriveBorderedStyle(style, borderStyle, flag));
pane.setStyle(cellElement.getStyle());
}

2
designer-realize/src/main/java/com/fr/design/actions/cell/BorderAction.java

@ -14,7 +14,6 @@ import com.fr.design.style.BorderUtils;
import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection;
import com.fr.grid.selection.Selection;
import com.fr.report.cell.CellElementBorderSourceFlag;
import com.fr.report.cell.FloatElement;
import com.fr.report.cell.StyleProvider;
import com.fr.report.cell.TemplateCellElement;
@ -102,7 +101,6 @@ public class BorderAction extends ElementCaseAction implements ChangeListener {
TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row);
if (cellElement != null) {
resetElementStyleToCustom(cellElement);
cellElement.setBorderSourceFlags(CellElementBorderSourceFlag.INVALID_BORDER_SOURCE);
};
}
}

15
designer-realize/src/main/java/com/fr/design/style/BorderUtils.java

@ -6,7 +6,7 @@ import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
import com.fr.report.cell.CellElementBorderSourceFlag;
import com.fr.base.CellBorderSourceFlag;
import com.fr.base.CellBorderStyle;
import com.fr.base.NameStyle;
import com.fr.base.Style;
@ -527,15 +527,20 @@ public abstract class BorderUtils {
int cellColumnSpan = tmpCellElement.getColumnSpan();
int cellRow = tmpCellElement.getRow();
int cellRowSpan = tmpCellElement.getRowSpan();
int borderSourceFlags = CellElementBorderSourceFlag.inspectBorderSourceFlag(
int borderSourceFlags = CellBorderSourceFlag.inspectBorderSourceFlag(
column, row, column + columnSpan, row + rowSpan,
cellColumn, cellRow, cellColumn + cellColumnSpan, cellRow + cellRowSpan
);
tmpCellElement.setBorderSourceFlags(borderSourceFlags);
if (style instanceof NameStyle && !ThemedFeatureController.isCellStyleSupportInnerBorder()) {
tmpCellElement.setBorderSourceFlags(CellElementBorderSourceFlag.INVALID_BORDER_SOURCE);
borderSourceFlags = CellBorderSourceFlag.INVALID_BORDER_SOURCE;
}
tmpCellElement.setStyle(style, newCellBorderStyle);
if (style instanceof NameStyle) {
((NameStyle) style).refreshPassiveBorderStyle(newCellBorderStyle, borderSourceFlags);
} else {
style = CellBorderSourceFlag.deriveBorderedStyle(style, newCellBorderStyle, borderSourceFlags);
}
tmpCellElement.setStyle(style);
}
}
}

Loading…
Cancel
Save