Browse Source

REPORT-50030 单元格外边框设置其他颜色设计器内显示与黑色不一样

【问题原因】
选中表格中区域后,设置边框颜色为黑色,勾选右侧外边框,表格中选中区域的
单元格都出现右边框,正确的效果是只有选中区域右侧的单元格有右边框。
目前代码中更新单元格边框的逻辑是
1. 首先将边框面板的单元格样式直接写入每个单元格中(此时单元格边样式对象值是不对的,需要进行修正)
2. 根据选中区域的单元格样式(旧样式)和边框面板中的样式(新样式)进行比较
3. 决定指定单元格边框是否使用新样式
问题出现在:
1. 无法获取当前选中区域的单元格样式(旧样式),因为已经被污染了.
2. 获取到的边框面板样式不对,导致比较结果出错
3. 只在单元格边框使用新样式时,才重写单元格边框样式对象,不使用新样式时,会继续使用被污染的值.
问题
【改动思路】
1. 在更新边框前,获取选中区域的单元格样式
2. 修改边框面板样式对象的创建逻辑
3. 不使用新样式时,重写单元格边框为旧样式
feature/big-screen
Starryi 4 years ago
parent
commit
6ce46d57e2
  1. 30
      designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java
  2. 5
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java
  3. 4
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CustomStylePane.java
  4. 5
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java
  5. 23
      designer-realize/src/main/java/com/fr/design/style/BorderUtils.java

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

@ -217,18 +217,36 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse
int lineStyle = currentLineCombo.getSelectedLineStyle();
Color lineColor = currentLineColorPane.getSelectObject();
CellBorderStyle cellBorderStyle = new CellBorderStyle();
cellBorderStyle.setTopColor(lineColor);
if (topToggleButton.isSelected()) {
cellBorderStyle.setTopColor(lineColor);
}
cellBorderStyle.setTopStyle(topToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE);
cellBorderStyle.setBottomColor(lineColor);
if (bottomToggleButton.isSelected()) {
cellBorderStyle.setBottomColor(lineColor);
}
cellBorderStyle.setBottomStyle(bottomToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE);
cellBorderStyle.setLeftColor(lineColor);
if (leftToggleButton.isSelected()) {
cellBorderStyle.setLeftColor(lineColor);
}
cellBorderStyle.setLeftStyle(leftToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE);
cellBorderStyle.setRightColor(lineColor);
if (rightToggleButton.isSelected()) {
cellBorderStyle.setRightColor(lineColor);
}
cellBorderStyle.setRightStyle(rightToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE);
cellBorderStyle.setVerticalColor(lineColor);
if (verticalToggleButton.isSelected()) {
cellBorderStyle.setVerticalColor(lineColor);
}
cellBorderStyle.setVerticalStyle(verticalToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE);
cellBorderStyle.setHorizontalColor(lineColor);
if (horizontalToggleButton.isSelected()) {
cellBorderStyle.setHorizontalColor(lineColor);
}
cellBorderStyle.setHorizontalStyle(horizontalToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE);
if (leftToggleButton.isSelected() && bottomToggleButton.isSelected() && rightToggleButton.isSelected() && topToggleButton.isSelected()) {
outerToggleButton.setSelected(true);
} else {

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

@ -3,6 +3,7 @@ package com.fr.design.mainframe.cell.settingpane;
import com.fr.base.Style;
import com.fr.design.constants.UIConstants;
import com.fr.design.mainframe.cell.settingpane.style.StylePane;
import com.fr.design.style.BorderUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.report.cell.DefaultTemplateCellElement;
@ -67,6 +68,7 @@ public class CellStylePane extends AbstractCellAttrPane {
@Override
public void updateBeans() {
Object[] selectionCellBorderObjects = BorderUtils.createCellBorderObject(elementCasePane);
if (stylePane.getSelectedIndex() == 1) {
Style s = stylePane.updateBean();
TemplateElementCase elementCase = elementCasePane.getEditingElementCase();
@ -110,7 +112,8 @@ public class CellStylePane extends AbstractCellAttrPane {
}
}
}
stylePane.updateBorder();// border必须特别处理
// border必须特别处理
stylePane.updateBorder(selectionCellBorderObjects);
}
}

4
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CustomStylePane.java

@ -136,8 +136,8 @@ public class CustomStylePane extends MultiTabPane<Style> {
/**
*
*/
public void updateBorder() {
BorderUtils.update(reportPane, ((BorderPane) paneList.get(ONE_INDEX)).update());
public void updateBorder(Object[] selectionCellBorderObjects) {
BorderUtils.update(reportPane, selectionCellBorderObjects, ((BorderPane) paneList.get(ONE_INDEX)).update());
}
/**

5
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java

@ -38,10 +38,9 @@ public class StylePane extends UIComboBoxPane<Style> {
customStylePane.addTabChangeListener(changeListener);
}
public void updateBorder() {
public void updateBorder(Object[] selectionCellBorderObjects) {
if (getSelectedIndex() == 0 && customStylePane.isBorderPaneSelected()) {
customStylePane.updateBorder();
customStylePane.updateBorder(selectionCellBorderObjects);
}
}

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

@ -464,8 +464,13 @@ public abstract class BorderUtils {
* changed, need to support undo/redo
*/
public static boolean update(ElementCasePane reportPane, CellBorderStyle newCellBorderStyle) {
Object[] selectionCellBorderObjects = createCellBorderObject(reportPane);
return update(reportPane, selectionCellBorderObjects, newCellBorderStyle);
}
public static boolean update(ElementCasePane reportPane, Object[] selectionCellBorderObjects, CellBorderStyle newCellBorderStyle) {
boolean isBorderColorStyleChanged = false;
Object[] fourObjectArray = createCellBorderObject(reportPane);
Object[] fourObjectArray = selectionCellBorderObjects;
if (fourObjectArray == null || fourObjectArray.length < NUMBER) {
return false;
}
@ -526,44 +531,60 @@ public abstract class BorderUtils {
if (cellBorderStyle.getLeftStyle() != newCellBorderStyle.getLeftStyle()
|| !ComparatorUtils.equals(cellBorderStyle.getLeftColor(), newCellBorderStyle.getLeftColor())) {
style = style.deriveBorderLeft(newCellBorderStyle.getLeftStyle(), newCellBorderStyle.getLeftColor());
} else {
style = style.deriveBorderLeft(cellBorderStyle.getLeftStyle(), cellBorderStyle.getLeftColor());
}
} else {
if (cellBorderStyle.getVerticalStyle() != newCellBorderStyle.getVerticalStyle()
|| !ComparatorUtils.equals(cellBorderStyle.getVerticalColor(), newCellBorderStyle.getVerticalColor())) {
style = style.deriveBorderLeft(newCellBorderStyle.getVerticalStyle(), newCellBorderStyle.getVerticalColor());
} else {
style = style.deriveBorderLeft(cellBorderStyle.getVerticalStyle(), cellBorderStyle.getVerticalColor());
}
}
if (tmpCellElement.getColumn() + tmpCellElement.getColumnSpan() == column + columnSpan) {
if (cellBorderStyle.getRightStyle() != newCellBorderStyle.getRightStyle()
|| !ComparatorUtils.equals(cellBorderStyle.getRightColor(), newCellBorderStyle.getRightColor())) {
style = style.deriveBorderRight(newCellBorderStyle.getRightStyle(), newCellBorderStyle.getRightColor());
} else {
style = style.deriveBorderRight(cellBorderStyle.getRightStyle(), cellBorderStyle.getRightColor());
}
} else {
if (cellBorderStyle.getVerticalStyle() != newCellBorderStyle.getVerticalStyle()
|| !ComparatorUtils.equals(cellBorderStyle.getVerticalColor(), newCellBorderStyle.getVerticalColor())) {
style = style.deriveBorderRight(newCellBorderStyle.getVerticalStyle(), newCellBorderStyle.getVerticalColor());
} else {
style = style.deriveBorderRight(cellBorderStyle.getVerticalStyle(), cellBorderStyle.getVerticalColor());
}
}
if (tmpCellElement.getRow() == row) {
if (cellBorderStyle.getTopStyle() != newCellBorderStyle.getTopStyle()
|| !ComparatorUtils.equals(cellBorderStyle.getTopColor(), newCellBorderStyle.getTopColor())) {
style = style.deriveBorderTop(newCellBorderStyle.getTopStyle(), newCellBorderStyle.getTopColor());
} else {
style = style.deriveBorderTop(cellBorderStyle.getTopStyle(), cellBorderStyle.getTopColor());
}
} else {
if (cellBorderStyle.getHorizontalStyle() != newCellBorderStyle.getHorizontalStyle()
|| !ComparatorUtils.equals(cellBorderStyle.getHorizontalColor(), newCellBorderStyle.getHorizontalColor())) {
style = style.deriveBorderTop(newCellBorderStyle.getHorizontalStyle(), newCellBorderStyle.getHorizontalColor());
} else {
style = style.deriveBorderTop(cellBorderStyle.getHorizontalStyle(), cellBorderStyle.getHorizontalColor());
}
}
if (tmpCellElement.getRow() + tmpCellElement.getRowSpan() == row + rowSpan) {
if (cellBorderStyle.getBottomStyle() != newCellBorderStyle.getBottomStyle()
|| !ComparatorUtils.equals(cellBorderStyle.getBottomColor(), newCellBorderStyle.getBottomColor())) {
style = style.deriveBorderBottom(newCellBorderStyle.getBottomStyle(), newCellBorderStyle.getBottomColor());
} else {
style = style.deriveBorderBottom(cellBorderStyle.getBottomStyle(), cellBorderStyle.getBottomColor());
}
} else {
if (cellBorderStyle.getHorizontalStyle() != newCellBorderStyle.getHorizontalStyle()
|| !ComparatorUtils.equals(cellBorderStyle.getHorizontalColor(), newCellBorderStyle.getHorizontalColor())) {
style = style.deriveBorderBottom(newCellBorderStyle.getHorizontalStyle(), newCellBorderStyle.getHorizontalColor());
} else {
style = style.deriveBorderBottom(cellBorderStyle.getHorizontalStyle(), cellBorderStyle.getHorizontalColor());
}
}
return style;

Loading…
Cancel
Save