Browse Source

REPORT-62480 调整下代码方便埋点设计

feature/x
Henry.Wang 3 years ago
parent
commit
8e74e0611a
  1. 8
      designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortItemPane.java
  2. 4
      designer-realize/src/main/java/com/fr/design/sort/common/SortColumnRowPane.java
  3. 6
      designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequencePane.java
  4. 44
      designer-realize/src/main/java/com/fr/design/sort/header/HeaderAreaPane.java

8
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) { if (currentSortExpressionPane != null) {
currentSortExpressionPane.setVisible(false); currentSortExpressionPane.setVisible(false);
} }
currentSortExpressionPane = sortExpressionPanes.get(sortBasisUiComboBox.getSelectedIndex()); triggerItemChanged(sortBasisUiComboBox.getSelectedIndex());
refreshCurrentSortExpressionPane();
} }
} }
}); });
@ -97,6 +96,11 @@ public abstract class AbstractSortItemPane extends JPanel {
} }
} }
void triggerItemChanged(Integer index) {
currentSortExpressionPane = sortExpressionPanes.get(index);
refreshCurrentSortExpressionPane();
}
private void refreshCurrentSortExpressionPane() { private void refreshCurrentSortExpressionPane() {
currentSortExpressionPane.setVisible(true); currentSortExpressionPane.setVisible(true);
sortAreaPane.setVisible(currentSortExpressionPane.needSortArea()); sortAreaPane.setVisible(currentSortExpressionPane.needSortArea());

4
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()) { for (ColumnRow headerColumnRow : disableHeaderCellsStyleMap.keySet()) {
TemplateCellElement headerTemplateCellElement TemplateCellElement headerTemplateCellElement
= elementCase.getTemplateCellElement(headerColumnRow.column, headerColumnRow.row); = elementCase.getTemplateCellElement(headerColumnRow.column, headerColumnRow.row);
headerTemplateCellElement.setStyle(disableHeaderCellsStyleMap.get(headerColumnRow)); if (headerTemplateCellElement != null) {
headerTemplateCellElement.setStyle(disableHeaderCellsStyleMap.get(headerColumnRow));
}
} }
for (TemplateCellElement templateCellElement : tempHeaderCells) { for (TemplateCellElement templateCellElement : tempHeaderCells) {
elementCase.removeCellElement(templateCellElement); elementCase.removeCellElement(templateCellElement);

6
designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequencePane.java

@ -43,7 +43,8 @@ public class CustomSequencePane extends JPanel {
@Override @Override
public void doOk() { public void doOk() {
customSequence = customSequenceEditPane.updateBean(); customSequence = customSequenceEditPane.updateBean();
textField.setText(CustomSequenceSortExpression.customSequenceToString(customSequence, ",")); triggerOk(CustomSequenceSortExpression.customSequenceToString(customSequence, ","),
CustomSequenceSortExpression.isReferenceCustomSequence(customSequence));
} }
}, new Dimension(700, 400)).setVisible(true); }, new Dimension(700, 400)).setVisible(true);
} }
@ -54,6 +55,9 @@ public class CustomSequencePane extends JPanel {
this.add(button); this.add(button);
} }
private void triggerOk(String customSequence, Boolean referenceCustomSequence) {
textField.setText(customSequence);
}
public List<String> updateBean() { public List<String> updateBean() {
return customSequence; return customSequence;

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

@ -113,7 +113,7 @@ public class HeaderAreaPane extends JPanel {
SortColumnRowPane columnRowPane; SortColumnRowPane columnRowPane;
JLayeredPane jLayeredPane; JLayeredPane jLayeredPane;
UIComboBox uiComboBox; UIComboBox uiComboBox;
boolean populateBeaning; boolean showHeaderArea;
AreaJLayeredPane() { AreaJLayeredPane() {
this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
@ -132,36 +132,37 @@ public class HeaderAreaPane extends JPanel {
uiComboBox.addItemListener(new ItemListener() { uiComboBox.addItemListener(new ItemListener() {
@Override @Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() != uiComboBox.getSelectedIndex()) { if ((showHeaderArea ? 1 : 0) != uiComboBox.getSelectedIndex()) {
setSortColumnRowPaneShow(uiComboBox.getSelectedIndex() == 1); triggerItemChanged(uiComboBox.getSelectedIndex());
} }
} }
}); });
uiComboBox.setEnabled(false); 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) { void setSortColumnRowPaneShow(boolean show) {
if (show) { if (show) {
jLayeredPane.setLayer(columnRowPane, JLayeredPane.POPUP_LAYER); jLayeredPane.setLayer(columnRowPane, JLayeredPane.POPUP_LAYER);
jLayeredPane.setLayer(uiComboBox, JLayeredPane.MODAL_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 { } else {
jLayeredPane.setLayer(uiComboBox, JLayeredPane.POPUP_LAYER); jLayeredPane.setLayer(uiComboBox, JLayeredPane.POPUP_LAYER);
jLayeredPane.setLayer(columnRowPane, JLayeredPane.MODAL_LAYER); jLayeredPane.setLayer(columnRowPane, JLayeredPane.MODAL_LAYER);
if (!populateBeaning) {
cellSelectionManager.removeNotSelectables(columnRowPane.updateBean());
}
} }
showHeaderArea = show;
refresh(); refresh();
} }
@ -175,16 +176,11 @@ public class HeaderAreaPane extends JPanel {
} }
public void populateBean(ColumnRow columnRow, boolean showHeaderArea, boolean enabled) { public void populateBean(ColumnRow columnRow, boolean showHeaderArea, boolean enabled) {
populateBeaning = true;
cellSelectionManager.build(); cellSelectionManager.build();
columnRowPane.populateBean(columnRow, enabled, cellSelectionManager); columnRowPane.populateBean(columnRow, enabled, cellSelectionManager);
if (showHeaderArea) { setSortColumnRowPaneShow(showHeaderArea);
uiComboBox.setSelectedIndex(1); uiComboBox.setSelectedIndex(showHeaderArea ? 1 : 0);
} else {
uiComboBox.setSelectedIndex(0);
}
uiComboBox.setEnabled(enabled); uiComboBox.setEnabled(enabled);
populateBeaning = false;
} }
public ColumnRow updateBean() { public ColumnRow updateBean() {

Loading…
Cancel
Save