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() { protected void refresh() {
freshAddSortItemBarTip();
freshSortUIExpandablePaneTip();
validate(); validate();
repaint(); repaint();
revalidate(); 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 { class AddSortItemBar extends JPanel {
AbstractSortGroupPane sortGroupPane; 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) { if (cellSortAttr != null) {
sortHeader = cellSortAttr.getSortHeader(); sortHeader = cellSortAttr.getSortHeader();
} }
sortHeaderPane.populateBean(sortHeader, defaultHeaderArea); sortHeaderPane.populateBean(sortHeader, defaultHeaderArea, cellElement);
} }
refresh(); 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 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 final static Icon ENABLE_ICON = IconUtils.readIcon("/com/fr/design/images/buttonicon/select_normal.svg");
private boolean enabled; private boolean enabled;
SelectActionListener selectActionListener;
HeaderAreaPane.CellSelectionManager cellSelectionManager; HeaderAreaPane.CellSelectionManager cellSelectionManager;
@ -94,7 +95,8 @@ public class SortColumnRowPane extends JPanel implements UIObserver {
void initSelectButton() { void initSelectButton() {
selectButton = new UIButton(ENABLE_ICON); selectButton = new UIButton(ENABLE_ICON);
selectButton.addMouseListener(new SelectActionListener(this)); selectActionListener = new SelectActionListener(this);
selectButton.addMouseListener(selectActionListener);
this.add(selectButton); this.add(selectButton);
} }
@ -147,6 +149,11 @@ public class SortColumnRowPane extends JPanel implements UIObserver {
return true; return true;
} }
public void cancelSelectState() {
selectActionListener.recoverSelectHeader(SortUtils.getCurrentElementCase());
}
class SelectActionListener extends MouseAdapter { class SelectActionListener extends MouseAdapter {
SortColumnRowPane columnRowPane; SortColumnRowPane columnRowPane;
ColumnRow oldColumnRow; ColumnRow oldColumnRow;
@ -161,7 +168,7 @@ public class SortColumnRowPane extends JPanel implements UIObserver {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
if (enabled) { if (enabled) {
ElementCasePane elementCasePane = getCurrentElementCase(); ElementCasePane elementCasePane = SortUtils.getCurrentElementCase();
if (elementCasePane == null || isAlreadyAddListener) { if (elementCasePane == null || isAlreadyAddListener) {
return; return;
} }
@ -201,15 +208,21 @@ public class SortColumnRowPane extends JPanel implements UIObserver {
} }
columnRowPane.setColumnRow(columnRow); columnRowPane.setColumnRow(columnRow);
} }
}
recoverSelectHeader(elementCasePane);
}
private void recoverSelectHeader(ElementCasePane elementCasePane) {
if (isAlreadyAddListener) {
restoreDisableHeaderCellsStyle(elementCasePane.getEditingElementCase()); 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) { private void ashDisableHeaderCellsStyle(TemplateElementCase elementCase) {
@ -263,17 +276,4 @@ public class SortColumnRowPane extends JPanel implements UIObserver {
repaint(); repaint();
revalidate(); 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); headerPane.setShow(show);
} }
public void freshHeaderPaneTip(String tip) {
headerPane.tipUILabel.setText(tip);
}
class HeaderPane extends JPanel implements UIObserver { class HeaderPane extends JPanel implements UIObserver {
UILabel tipUILabel;
UILabel iconUiLabel; UILabel iconUiLabel;
UILabel closeButton; UILabel closeButton;
AbstractSortGroupPane sortGroupPane; AbstractSortGroupPane sortGroupPane;
@ -78,8 +83,8 @@ public class SortUIExpandablePane extends JPanel {
private void initComponents() { private void initComponents() {
iconUiLabel = new UILabel(); iconUiLabel = new UILabel();
this.add(iconUiLabel); this.add(iconUiLabel);
UILabel uiLabel = new UILabel(Toolkit.i18nText("Fine-Design_Sort_Second_Sort")); tipUILabel = new UILabel(Toolkit.i18nText("Fine-Design_Sort_Second_Sort"));
this.add(uiLabel); this.add(tipUILabel);
this.add(AbstractSortPane.createIntervalUILabel(108)); this.add(AbstractSortPane.createIntervalUILabel(108));
closeButton = new UILabel(IconUtils.readIcon("/com/fr/design/images/control/close.png")); 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.mainframe.ElementCasePane;
import com.fr.design.sort.common.AbstractSortPane; import com.fr.design.sort.common.AbstractSortPane;
import com.fr.design.sort.common.SortColumnRowPane; import com.fr.design.sort.common.SortColumnRowPane;
import com.fr.design.sort.common.SortUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.TemplateCellElement;
import com.fr.report.cell.cellattr.CellExpandAttr; import com.fr.report.cell.cellattr.CellExpandAttr;
@ -35,6 +36,7 @@ public class HeaderAreaPane extends JPanel {
protected int headerAreaPaneWidth; protected int headerAreaPaneWidth;
protected int headerAreaPaneRightWidth; protected int headerAreaPaneRightWidth;
private CellSelectionManager cellSelectionManager = new CellSelectionManager(); private CellSelectionManager cellSelectionManager = new CellSelectionManager();
TemplateCellElement cellElement;
AreaJLayeredPane areaJLayeredPane; AreaJLayeredPane areaJLayeredPane;
@ -62,9 +64,10 @@ public class HeaderAreaPane extends JPanel {
this.add(areaJLayeredPane); 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; boolean enabled = true;
ElementCasePane elementCasePane = getCurrentElementCase(); ElementCasePane elementCasePane = SortUtils.getCurrentElementCase();
if (elementCasePane != null) { if (elementCasePane != null) {
enabled = elementCasePane.isSelectedOneCell(); enabled = elementCasePane.isSelectedOneCell();
} }
@ -72,7 +75,7 @@ public class HeaderAreaPane extends JPanel {
} }
public ColumnRow updateBean(TemplateCellElement cellElement) { public ColumnRow updateBean(TemplateCellElement cellElement) {
ElementCasePane elementCasePane = getCurrentElementCase(); ElementCasePane elementCasePane = SortUtils.getCurrentElementCase();
if (elementCasePane != null) { if (elementCasePane != null) {
if (!elementCasePane.isSelectedOneCell()) { if (!elementCasePane.isSelectedOneCell()) {
return getOldColumnRow(cellElement); 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 { class AreaJLayeredPane extends JPanel {
SortColumnRowPane columnRowPane; SortColumnRowPane columnRowPane;
JLayeredPane jLayeredPane; JLayeredPane jLayeredPane;
@ -151,6 +141,7 @@ public class HeaderAreaPane extends JPanel {
} }
} else { } else {
cellSelectionManager.removeNotSelectables(columnRowPane.updateBean()); cellSelectionManager.removeNotSelectables(columnRowPane.updateBean());
columnRowPane.cancelSelectState();
} }
} }
@ -176,7 +167,8 @@ public class HeaderAreaPane extends JPanel {
} }
public void populateBean(ColumnRow columnRow, boolean showHeaderArea, boolean enabled) { 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); columnRowPane.populateBean(columnRow, enabled, cellSelectionManager);
setSortColumnRowPaneShow(showHeaderArea); setSortColumnRowPaneShow(showHeaderArea);
uiComboBox.setSelectedIndex(showHeaderArea ? 1 : 0); uiComboBox.setSelectedIndex(showHeaderArea ? 1 : 0);
@ -203,15 +195,26 @@ public class HeaderAreaPane extends JPanel {
ElementCasePane elementCase; ElementCasePane elementCase;
java.util.List<ColumnRow> notSelectables = new ArrayList<>(); java.util.List<ColumnRow> notSelectables = new ArrayList<>();
void build() { void build(TemplateCellElement templateCellElement, ColumnRow headerColumnRow) {
ElementCasePane elementCase = SortColumnRowPane.getCurrentElementCase(); ElementCasePane elementCase = SortUtils.getCurrentElementCase();
if (elementCase != null) { if (elementCase != null) {
this.elementCase = elementCase; this.elementCase = elementCase;
notSelectables = new ArrayList<>(); 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() { public java.util.List<ColumnRow> getNotSelectables() {
return this.notSelectables; return this.notSelectables;
} }
@ -232,24 +235,20 @@ public class HeaderAreaPane extends JPanel {
notSelectables.remove(columnRow); notSelectables.remove(columnRow);
} }
private void buildNotSelectables(TemplateElementCase elementCase) { private void buildNotSelectables(TemplateElementCase elementCase, TemplateCellElement excludeTemplateCellElement) {
Iterator iterator = elementCase.cellIterator(); Iterator iterator = elementCase.cellIterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
TemplateCellElement templateCellElement = (TemplateCellElement) iterator.next(); TemplateCellElement templateCellElement = (TemplateCellElement) iterator.next();
CellExpandAttr cellExpandAttr = templateCellElement.getCellExpandAttr(); if (templateCellElement != excludeTemplateCellElement) {
if (cellExpandAttr != null) { handleDisableHeaderCell(templateCellElement);
handleDisableHeaderCell(cellExpandAttr);
}
Object value = templateCellElement.getValue();
if (value instanceof DSColumn) {
handleDisableHeaderCell((DSColumn) value);
} }
} }
} }
private void handleDisableHeaderCell(CellSortable cellSortable) { private void handleDisableHeaderCell(TemplateCellElement templateCellElement) {
if (cellSortable.getCellSortAttr() != null) { CellExpandAttr cellExpandAttr = templateCellElement.getCellExpandAttr();
SortHeader sortHeader = cellSortable.getCellSortAttr().getSortHeader(); if (cellExpandAttr != null && cellExpandAttr.getCellSortAttr() != null) {
SortHeader sortHeader = cellExpandAttr.getCellSortAttr().getSortHeader();
if (sortHeader != null) { if (sortHeader != null) {
String headerArea = sortHeader.getHeaderArea(); String headerArea = sortHeader.getHeaderArea();
if (headerArea != null) { 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) { void refreshIconLabelColor(FineColor fineColor) {
this.fineColor = fineColor;
Icon icon = getIcon(fineColor); Icon icon = getIcon(fineColor);
refreshIconLabel(icon); 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); this.add(headerSettingPane);
} }
public void populateBean(SortHeader sortHeader, String defaultHeaderArea) { public void populateBean(SortHeader sortHeader, String defaultHeaderArea,TemplateCellElement cellElement) {
this.sortHeader = sortHeader; this.sortHeader = sortHeader;
boolean showHeaderArea = false; boolean showHeaderArea = false;
SortHeader.SortItem[] sortItems = null; SortHeader.SortItem[] sortItems = null;
@ -48,7 +48,7 @@ public class SortHeaderPane extends JPanel {
columnRow = ColumnRow.valueOf(headerArea); columnRow = ColumnRow.valueOf(headerArea);
} }
} }
headerAreaPane.populateBean(columnRow, showHeaderArea); headerAreaPane.populateBean(columnRow, showHeaderArea, cellElement);
headerSettingPane.populateBean(sortItems); headerSettingPane.populateBean(sortItems);
} }

Loading…
Cancel
Save