Browse Source

Pull request #7653: REPORT-66044 单元格复制以后,会导致两个单元格设置同一个表头区域 && REPORT-66020 点击智能框选后撤销,鼠标状态没有恢复默认 && REPORT-65994 添加排序按钮名称问题,交互确认 && REPORT-65993 表头图标颜色有问题

Merge in DESIGN/design from ~HENRY.WANG/design:feature/x to feature/x

* commit '2b83f41edc9efa1169ebeb5af20137ea9ffc7f1a':
  REPORT-66044 单元格复制以后,会导致两个单元格设置同一个表头区域 && REPORT-66020 点击智能框选后撤销,鼠标状态没有恢复默认 && REPORT-65994 添加排序按钮名称问题,交互确认 && REPORT-65993 表头图标颜色有问题
feature/x
Henry.Wang 3 years ago
parent
commit
9ba33b8bc7
  1. 19
      designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortGroupPane.java
  2. 2
      designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortPane.java
  3. 44
      designer-realize/src/main/java/com/fr/design/sort/common/SortColumnRowPane.java
  4. 9
      designer-realize/src/main/java/com/fr/design/sort/common/SortUIExpandablePane.java
  5. 24
      designer-realize/src/main/java/com/fr/design/sort/common/SortUtils.java
  6. 61
      designer-realize/src/main/java/com/fr/design/sort/header/HeaderAreaPane.java
  7. 1
      designer-realize/src/main/java/com/fr/design/sort/header/HeaderSortRulePane.java
  8. 4
      designer-realize/src/main/java/com/fr/design/sort/header/SortHeaderPane.java

19
designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortGroupPane.java

@ -123,11 +123,30 @@ public abstract class AbstractSortGroupPane extends JPanel implements ComponentC
}
protected void refresh() {
freshAddSortItemBarTip();
freshSortUIExpandablePaneTip();
validate();
repaint();
revalidate();
}
void freshAddSortItemBarTip() {
if (sortUIExpandablePanes != null) {
int itemCount = sortUIExpandablePanes.size();
uiButton.setText(itemCount == 0 ? Toolkit.i18nText("Fine-Design_Sort_Add_Main_Sort") : Toolkit.i18nText("Fine-Design_Sort_Add_Second_Sort"));
}
}
void freshSortUIExpandablePaneTip() {
for (int i = 0; i < sortUIExpandablePanes.size(); i++) {
if (i == 0) {
sortUIExpandablePanes.get(i).freshHeaderPaneTip(Toolkit.i18nText("Fine-Design_Sort_Main_Sort"));
} else {
sortUIExpandablePanes.get(i).freshHeaderPaneTip(Toolkit.i18nText("Fine-Design_Sort_Second_Sort"));
}
}
}
class AddSortItemBar extends JPanel {
AbstractSortGroupPane sortGroupPane;

2
designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortPane.java

@ -65,7 +65,7 @@ public abstract class AbstractSortPane extends JPanel {
if (cellSortAttr != null) {
sortHeader = cellSortAttr.getSortHeader();
}
sortHeaderPane.populateBean(sortHeader, defaultHeaderArea);
sortHeaderPane.populateBean(sortHeader, defaultHeaderArea, cellElement);
}
refresh();
}

44
designer-realize/src/main/java/com/fr/design/sort/common/SortColumnRowPane.java

@ -50,6 +50,7 @@ public class SortColumnRowPane extends JPanel implements UIObserver {
private final static Icon DISABLED_ICON = IconUtils.readIcon("/com/fr/design/images/buttonicon/select_disabled.svg");
private final static Icon ENABLE_ICON = IconUtils.readIcon("/com/fr/design/images/buttonicon/select_normal.svg");
private boolean enabled;
SelectActionListener selectActionListener;
HeaderAreaPane.CellSelectionManager cellSelectionManager;
@ -94,7 +95,8 @@ public class SortColumnRowPane extends JPanel implements UIObserver {
void initSelectButton() {
selectButton = new UIButton(ENABLE_ICON);
selectButton.addMouseListener(new SelectActionListener(this));
selectActionListener = new SelectActionListener(this);
selectButton.addMouseListener(selectActionListener);
this.add(selectButton);
}
@ -147,6 +149,11 @@ public class SortColumnRowPane extends JPanel implements UIObserver {
return true;
}
public void cancelSelectState() {
selectActionListener.recoverSelectHeader(SortUtils.getCurrentElementCase());
}
class SelectActionListener extends MouseAdapter {
SortColumnRowPane columnRowPane;
ColumnRow oldColumnRow;
@ -161,7 +168,7 @@ public class SortColumnRowPane extends JPanel implements UIObserver {
@Override
public void mouseClicked(MouseEvent e) {
if (enabled) {
ElementCasePane elementCasePane = getCurrentElementCase();
ElementCasePane elementCasePane = SortUtils.getCurrentElementCase();
if (elementCasePane == null || isAlreadyAddListener) {
return;
}
@ -201,15 +208,21 @@ public class SortColumnRowPane extends JPanel implements UIObserver {
}
columnRowPane.setColumnRow(columnRow);
}
}
recoverSelectHeader(elementCasePane);
}
private void recoverSelectHeader(ElementCasePane elementCasePane) {
if (isAlreadyAddListener) {
restoreDisableHeaderCellsStyle(elementCasePane.getEditingElementCase());
elementCasePane.removeSelectionChangeListener(gridSelectionChangeListener);
isAlreadyAddListener = false;
elementCasePane.getGrid().setNotShowingTableSelectPane(true);
elementCasePane.setRepeatSelection(false);
elementCasePane.setEditable(true);
elementCasePane.repaint();
oldColumnRow = null;
}
elementCasePane.removeSelectionChangeListener(gridSelectionChangeListener);
isAlreadyAddListener = false;
elementCasePane.getGrid().setNotShowingTableSelectPane(true);
elementCasePane.setRepeatSelection(false);
elementCasePane.setEditable(true);
elementCasePane.repaint();
oldColumnRow = null;
}
private void ashDisableHeaderCellsStyle(TemplateElementCase elementCase) {
@ -263,17 +276,4 @@ public class SortColumnRowPane extends JPanel implements UIObserver {
repaint();
revalidate();
}
public static ElementCasePane getCurrentElementCase() {
try {
TargetComponent targetComponent
= HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane();
if (targetComponent instanceof ElementCasePane) {
return (ElementCasePane) targetComponent;
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
}
return null;
}
}

9
designer-realize/src/main/java/com/fr/design/sort/common/SortUIExpandablePane.java

@ -63,7 +63,12 @@ public class SortUIExpandablePane extends JPanel {
headerPane.setShow(show);
}
public void freshHeaderPaneTip(String tip) {
headerPane.tipUILabel.setText(tip);
}
class HeaderPane extends JPanel implements UIObserver {
UILabel tipUILabel;
UILabel iconUiLabel;
UILabel closeButton;
AbstractSortGroupPane sortGroupPane;
@ -78,8 +83,8 @@ public class SortUIExpandablePane extends JPanel {
private void initComponents() {
iconUiLabel = new UILabel();
this.add(iconUiLabel);
UILabel uiLabel = new UILabel(Toolkit.i18nText("Fine-Design_Sort_Second_Sort"));
this.add(uiLabel);
tipUILabel = new UILabel(Toolkit.i18nText("Fine-Design_Sort_Second_Sort"));
this.add(tipUILabel);
this.add(AbstractSortPane.createIntervalUILabel(108));
closeButton = new UILabel(IconUtils.readIcon("/com/fr/design/images/control/close.png"));

24
designer-realize/src/main/java/com/fr/design/sort/common/SortUtils.java

@ -0,0 +1,24 @@
package com.fr.design.sort.common;
import com.fr.design.designer.TargetComponent;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.JTemplate;
import com.fr.log.FineLoggerFactory;
public class SortUtils {
public static ElementCasePane getCurrentElementCase() {
try {
JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jTemplate != null) {
TargetComponent targetComponent = jTemplate.getCurrentElementCasePane();
if (targetComponent instanceof ElementCasePane) {
return (ElementCasePane) targetComponent;
}
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
}
return null;
}
}

61
designer-realize/src/main/java/com/fr/design/sort/header/HeaderAreaPane.java

@ -8,6 +8,7 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.sort.common.AbstractSortPane;
import com.fr.design.sort.common.SortColumnRowPane;
import com.fr.design.sort.common.SortUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.report.cell.TemplateCellElement;
import com.fr.report.cell.cellattr.CellExpandAttr;
@ -35,6 +36,7 @@ public class HeaderAreaPane extends JPanel {
protected int headerAreaPaneWidth;
protected int headerAreaPaneRightWidth;
private CellSelectionManager cellSelectionManager = new CellSelectionManager();
TemplateCellElement cellElement;
AreaJLayeredPane areaJLayeredPane;
@ -62,9 +64,10 @@ public class HeaderAreaPane extends JPanel {
this.add(areaJLayeredPane);
}
public void populateBean(ColumnRow columnRow, boolean showHeaderArea) {
public void populateBean(ColumnRow columnRow, boolean showHeaderArea, TemplateCellElement cellElement) {
this.cellElement = cellElement;
boolean enabled = true;
ElementCasePane elementCasePane = getCurrentElementCase();
ElementCasePane elementCasePane = SortUtils.getCurrentElementCase();
if (elementCasePane != null) {
enabled = elementCasePane.isSelectedOneCell();
}
@ -72,7 +75,7 @@ public class HeaderAreaPane extends JPanel {
}
public ColumnRow updateBean(TemplateCellElement cellElement) {
ElementCasePane elementCasePane = getCurrentElementCase();
ElementCasePane elementCasePane = SortUtils.getCurrentElementCase();
if (elementCasePane != null) {
if (!elementCasePane.isSelectedOneCell()) {
return getOldColumnRow(cellElement);
@ -96,19 +99,6 @@ public class HeaderAreaPane extends JPanel {
}
}
private ElementCasePane getCurrentElementCase() {
try {
TargetComponent targetComponent
= HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane();
if (targetComponent instanceof ElementCasePane) {
return (ElementCasePane) targetComponent;
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
}
return null;
}
class AreaJLayeredPane extends JPanel {
SortColumnRowPane columnRowPane;
JLayeredPane jLayeredPane;
@ -151,6 +141,7 @@ public class HeaderAreaPane extends JPanel {
}
} else {
cellSelectionManager.removeNotSelectables(columnRowPane.updateBean());
columnRowPane.cancelSelectState();
}
}
@ -176,7 +167,8 @@ public class HeaderAreaPane extends JPanel {
}
public void populateBean(ColumnRow columnRow, boolean showHeaderArea, boolean enabled) {
cellSelectionManager.build();
cellSelectionManager.build(cellElement, columnRow);
columnRow = cellSelectionManager.buildCurrentCell(cellElement, columnRow);
columnRowPane.populateBean(columnRow, enabled, cellSelectionManager);
setSortColumnRowPaneShow(showHeaderArea);
uiComboBox.setSelectedIndex(showHeaderArea ? 1 : 0);
@ -203,15 +195,26 @@ public class HeaderAreaPane extends JPanel {
ElementCasePane elementCase;
java.util.List<ColumnRow> notSelectables = new ArrayList<>();
void build() {
ElementCasePane elementCase = SortColumnRowPane.getCurrentElementCase();
void build(TemplateCellElement templateCellElement, ColumnRow headerColumnRow) {
ElementCasePane elementCase = SortUtils.getCurrentElementCase();
if (elementCase != null) {
this.elementCase = elementCase;
notSelectables = new ArrayList<>();
buildNotSelectables(elementCase.getEditingElementCase());
buildNotSelectables(elementCase.getEditingElementCase(), templateCellElement);
}
}
private ColumnRow buildCurrentCell(TemplateCellElement templateCellElement, ColumnRow headerColumnRow) {
if (isNotSelectables(headerColumnRow)) {
SortHeader sortHeader = templateCellElement.getCellExpandAttr().getCellSortAttr().getSortHeader();
headerColumnRow = ColumnRow.ERROR;
sortHeader.setHeaderArea(headerColumnRow.toString());
} else {
handleDisableHeaderCell(templateCellElement);
}
return headerColumnRow;
}
public java.util.List<ColumnRow> getNotSelectables() {
return this.notSelectables;
}
@ -232,24 +235,20 @@ public class HeaderAreaPane extends JPanel {
notSelectables.remove(columnRow);
}
private void buildNotSelectables(TemplateElementCase elementCase) {
private void buildNotSelectables(TemplateElementCase elementCase, TemplateCellElement excludeTemplateCellElement) {
Iterator iterator = elementCase.cellIterator();
while (iterator.hasNext()) {
TemplateCellElement templateCellElement = (TemplateCellElement) iterator.next();
CellExpandAttr cellExpandAttr = templateCellElement.getCellExpandAttr();
if (cellExpandAttr != null) {
handleDisableHeaderCell(cellExpandAttr);
}
Object value = templateCellElement.getValue();
if (value instanceof DSColumn) {
handleDisableHeaderCell((DSColumn) value);
if (templateCellElement != excludeTemplateCellElement) {
handleDisableHeaderCell(templateCellElement);
}
}
}
private void handleDisableHeaderCell(CellSortable cellSortable) {
if (cellSortable.getCellSortAttr() != null) {
SortHeader sortHeader = cellSortable.getCellSortAttr().getSortHeader();
private void handleDisableHeaderCell(TemplateCellElement templateCellElement) {
CellExpandAttr cellExpandAttr = templateCellElement.getCellExpandAttr();
if (cellExpandAttr != null && cellExpandAttr.getCellSortAttr() != null) {
SortHeader sortHeader = cellExpandAttr.getCellSortAttr().getSortHeader();
if (sortHeader != null) {
String headerArea = sortHeader.getHeaderArea();
if (headerArea != null) {

1
designer-realize/src/main/java/com/fr/design/sort/header/HeaderSortRulePane.java

@ -135,6 +135,7 @@ public class HeaderSortRulePane extends JPanel {
}
void refreshIconLabelColor(FineColor fineColor) {
this.fineColor = fineColor;
Icon icon = getIcon(fineColor);
refreshIconLabel(icon);
}

4
designer-realize/src/main/java/com/fr/design/sort/header/SortHeaderPane.java

@ -34,7 +34,7 @@ public class SortHeaderPane extends JPanel {
this.add(headerSettingPane);
}
public void populateBean(SortHeader sortHeader, String defaultHeaderArea) {
public void populateBean(SortHeader sortHeader, String defaultHeaderArea,TemplateCellElement cellElement) {
this.sortHeader = sortHeader;
boolean showHeaderArea = false;
SortHeader.SortItem[] sortItems = null;
@ -48,7 +48,7 @@ public class SortHeaderPane extends JPanel {
columnRow = ColumnRow.valueOf(headerArea);
}
}
headerAreaPane.populateBean(columnRow, showHeaderArea);
headerAreaPane.populateBean(columnRow, showHeaderArea, cellElement);
headerSettingPane.populateBean(sortItems);
}

Loading…
Cancel
Save