diff --git a/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortItemPane.java b/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortItemPane.java index 82d14bb7e..a5fec3f47 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortItemPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortItemPane.java @@ -82,8 +82,7 @@ public abstract class AbstractSortItemPane extends JPanel { if (currentSortExpressionPane != null) { currentSortExpressionPane.setVisible(false); } - currentSortExpressionPane = sortExpressionPanes.get(sortBasisUiComboBox.getSelectedIndex()); - refreshCurrentSortExpressionPane(); + triggerItemChanged(sortBasisUiComboBox.getSelectedIndex()); } } }); @@ -97,6 +96,11 @@ public abstract class AbstractSortItemPane extends JPanel { } } + void triggerItemChanged(Integer index) { + currentSortExpressionPane = sortExpressionPanes.get(index); + refreshCurrentSortExpressionPane(); + } + private void refreshCurrentSortExpressionPane() { currentSortExpressionPane.setVisible(true); sortAreaPane.setVisible(currentSortExpressionPane.needSortArea()); diff --git a/designer-realize/src/main/java/com/fr/design/sort/common/SortColumnRowPane.java b/designer-realize/src/main/java/com/fr/design/sort/common/SortColumnRowPane.java index 67a9aaff1..653ce86c8 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/common/SortColumnRowPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/common/SortColumnRowPane.java @@ -240,7 +240,9 @@ public class SortColumnRowPane extends JPanel implements UIObserver { for (ColumnRow headerColumnRow : disableHeaderCellsStyleMap.keySet()) { TemplateCellElement headerTemplateCellElement = elementCase.getTemplateCellElement(headerColumnRow.column, headerColumnRow.row); - headerTemplateCellElement.setStyle(disableHeaderCellsStyleMap.get(headerColumnRow)); + if (headerTemplateCellElement != null) { + headerTemplateCellElement.setStyle(disableHeaderCellsStyleMap.get(headerColumnRow)); + } } for (TemplateCellElement templateCellElement : tempHeaderCells) { elementCase.removeCellElement(templateCellElement); diff --git a/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequencePane.java b/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequencePane.java index 34fca093b..3a5b9641f 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequencePane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequencePane.java @@ -43,7 +43,8 @@ public class CustomSequencePane extends JPanel { @Override public void doOk() { customSequence = customSequenceEditPane.updateBean(); - textField.setText(CustomSequenceSortExpression.customSequenceToString(customSequence, ",")); + triggerOk(CustomSequenceSortExpression.customSequenceToString(customSequence, ","), + CustomSequenceSortExpression.isReferenceCustomSequence(customSequence)); } }, new Dimension(700, 400)).setVisible(true); } @@ -54,6 +55,9 @@ public class CustomSequencePane extends JPanel { this.add(button); } + private void triggerOk(String customSequence, Boolean referenceCustomSequence) { + textField.setText(customSequence); + } public List updateBean() { return customSequence; diff --git a/designer-realize/src/main/java/com/fr/design/sort/header/HeaderAreaPane.java b/designer-realize/src/main/java/com/fr/design/sort/header/HeaderAreaPane.java index 5ae972dbc..4f4617053 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/header/HeaderAreaPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/header/HeaderAreaPane.java @@ -113,7 +113,7 @@ public class HeaderAreaPane extends JPanel { SortColumnRowPane columnRowPane; JLayeredPane jLayeredPane; UIComboBox uiComboBox; - boolean populateBeaning; + boolean showHeaderArea; AreaJLayeredPane() { this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); @@ -132,36 +132,37 @@ public class HeaderAreaPane extends JPanel { uiComboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() != uiComboBox.getSelectedIndex()) { - setSortColumnRowPaneShow(uiComboBox.getSelectedIndex() == 1); + if ((showHeaderArea ? 1 : 0) != uiComboBox.getSelectedIndex()) { + triggerItemChanged(uiComboBox.getSelectedIndex()); } - } - - }); uiComboBox.setEnabled(false); } + void triggerItemChanged(Integer index) { + setSortColumnRowPaneShow(index == 1); + if (index == 1) { + ColumnRow columnRow = columnRowPane.updateBean(); + if (cellSelectionManager.isNotSelectables(columnRow)) { + columnRowPane.setColumnRow(ColumnRow.ERROR); + } else { + cellSelectionManager.addNotSelectables(columnRow); + } + } else { + cellSelectionManager.removeNotSelectables(columnRowPane.updateBean()); + } + } + void setSortColumnRowPaneShow(boolean show) { if (show) { jLayeredPane.setLayer(columnRowPane, JLayeredPane.POPUP_LAYER); jLayeredPane.setLayer(uiComboBox, JLayeredPane.MODAL_LAYER); - if (!populateBeaning) { - ColumnRow columnRow = columnRowPane.updateBean(); - if (cellSelectionManager.isNotSelectables(columnRow)) { - columnRowPane.setColumnRow(ColumnRow.ERROR); - } else { - cellSelectionManager.addNotSelectables(columnRow); - } - } } else { jLayeredPane.setLayer(uiComboBox, JLayeredPane.POPUP_LAYER); jLayeredPane.setLayer(columnRowPane, JLayeredPane.MODAL_LAYER); - if (!populateBeaning) { - cellSelectionManager.removeNotSelectables(columnRowPane.updateBean()); - } } + showHeaderArea = show; refresh(); } @@ -175,16 +176,11 @@ public class HeaderAreaPane extends JPanel { } public void populateBean(ColumnRow columnRow, boolean showHeaderArea, boolean enabled) { - populateBeaning = true; cellSelectionManager.build(); columnRowPane.populateBean(columnRow, enabled, cellSelectionManager); - if (showHeaderArea) { - uiComboBox.setSelectedIndex(1); - } else { - uiComboBox.setSelectedIndex(0); - } + setSortColumnRowPaneShow(showHeaderArea); + uiComboBox.setSelectedIndex(showHeaderArea ? 1 : 0); uiComboBox.setEnabled(enabled); - populateBeaning = false; } public ColumnRow updateBean() {