Browse Source

Pull request #7188: REPORT-62440 表头排序内置

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

* commit 'c61ab4d317b0a8f2858f9c53c0181dfb7e3200d4':
  REPORT-62440 表头排序内置
feature/x
Henry.Wang 3 years ago
parent
commit
1658378937
  1. 2
      designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortPane.java
  2. 8
      designer-realize/src/main/java/com/fr/design/sort/header/HeaderAreaPane.java
  3. 53
      designer-realize/src/main/java/com/fr/design/sort/header/HeaderSortRulePane.java
  4. 6
      designer-realize/src/main/java/com/fr/design/sort/header/SortHeaderPane.java

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

@ -75,7 +75,7 @@ public abstract class AbstractSortPane extends JPanel {
int row = cellElement.getRow();
int column = cellElement.getColumn();
selfSortArea = ColumnRow.valueOf(column, row).toString();
if (row > 1) {
if (row > 0) {
defaultHeaderArea = ColumnRow.valueOf(column, row - 1).toString();
} else {
defaultHeaderArea = null;

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

@ -42,8 +42,8 @@ public class HeaderAreaPane extends JPanel {
this.add(areaJLayeredPane);
}
public void populateBean(ColumnRow columnRow) {
areaJLayeredPane.populateBean(columnRow);
public void populateBean(ColumnRow columnRow, boolean showHeaderArea) {
areaJLayeredPane.populateBean(columnRow, showHeaderArea);
}
public ColumnRow updateBean() {
@ -97,8 +97,8 @@ public class HeaderAreaPane extends JPanel {
this.add(jLayeredPane);
}
public void populateBean(ColumnRow columnRow) {
if (SortColumnRowPane.isAvailableColumnRow(columnRow)) {
public void populateBean(ColumnRow columnRow, boolean showHeaderArea) {
if (showHeaderArea) {
uiComboBox.setSelectedIndex(1);
} else {
uiComboBox.setSelectedIndex(0);

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

@ -36,7 +36,7 @@ public class HeaderSortRulePane extends JPanel {
HeaderSortRulePane() {
initComponents();
initState();
initState(true);
this.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 15));
}
@ -62,12 +62,24 @@ public class HeaderSortRulePane extends JPanel {
double[] columnSize = {80, 30};
JPanel sortRuleItem = TableLayoutHelper.createCommonTableLayoutPane(components, rowSize, columnSize, 0);
this.add(sortRuleItem, BorderLayout.CENTER);
initUICheckBoxChange(ascUICheckBox, ascIconButton);
initUICheckBoxChange(desUICheckBox, desIconButton);
initUICheckBoxChange(nosortUICheckBox, nosortIconButton);
}
void initState() {
ascUICheckBox.setSelected(false);
desUICheckBox.setSelected(false);
nosortUICheckBox.setSelected(false);
void initUICheckBoxChange(UICheckBox uiCheckBox, IconButton iconButton) {
uiCheckBox.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
iconButton.setActiveState(uiCheckBox.isSelected());
}
});
}
void initState(boolean selected) {
ascUICheckBox.setSelected(selected);
desUICheckBox.setSelected(selected);
nosortUICheckBox.setSelected(selected);
ascIconButton.refreshIconLabelColor(new Color(33, 33, 34));
desIconButton.refreshIconLabelColor(new Color(33, 33, 34));
nosortIconButton.refreshIconLabelColor(new Color(33, 33, 34));
@ -81,21 +93,36 @@ public class HeaderSortRulePane extends JPanel {
Color color;
BufferedImage bufferedImage;
UIObserverListener uiObserverListener;
boolean activeState;
UILabel borderUiLabel;
IconButton(String iconTemplatePath) {
this.iconTemplatePath = iconTemplatePath;
initComponents();
}
public boolean isActiveState() {
return activeState;
}
public void setActiveState(boolean activeState) {
if (activeState) {
borderUiLabel.setBorder(BorderFactory.createLineBorder(Color.gray, 1));
colorButton.setVisible(true);
} else {
borderUiLabel.setBorder(null);
colorButton.setVisible(false);
}
this.activeState = activeState;
}
void initComponents() {
jLayeredPane = new JLayeredPane();
iconLabel = getIconLabel(iconTemplatePath);
UILabel emptyUiLabel = new UILabel();
emptyUiLabel.setSize(16, 16);
emptyUiLabel.setOpaque(true);
emptyUiLabel.setBackground(Color.WHITE);
borderUiLabel = new UILabel();
borderUiLabel.setSize(16, 16);
borderUiLabel.setOpaque(true);
borderUiLabel.setBackground(Color.WHITE);
iconLabel.setSize(16, 16);
colorButton = new ColorListPane.ColorButton(Color.CYAN);
colorButton.setSize(16, 16);
@ -110,7 +137,7 @@ public class HeaderSortRulePane extends JPanel {
jLayeredPane.setPreferredSize(new Dimension(16, 16));
jLayeredPane.add(iconLabel, JLayeredPane.POPUP_LAYER);
jLayeredPane.add(emptyUiLabel, JLayeredPane.MODAL_LAYER);
jLayeredPane.add(borderUiLabel, JLayeredPane.MODAL_LAYER);
jLayeredPane.add(colorButton, JLayeredPane.PALETTE_LAYER);
this.add(jLayeredPane);
}
@ -192,7 +219,7 @@ public class HeaderSortRulePane extends JPanel {
}
public void populateBean(SortHeader.SortItem[] sortItems) {
initState();
initState(sortItems == null);
if (sortItems != null) {
for (SortHeader.SortItem sortItem : sortItems) {
SortRule sortRule = sortItem.getSortRule();

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

@ -1,5 +1,6 @@
package com.fr.design.sort.header;
import com.fr.design.sort.common.SortColumnRowPane;
import com.fr.report.core.sort.header.SortHeader;
import com.fr.stable.ColumnRow;
@ -33,16 +34,17 @@ public class SortHeaderPane extends JPanel {
public void populateBean(SortHeader sortHeader, String defaultHeaderArea) {
this.sortHeader = sortHeader;
boolean showHeaderArea = false;
ColumnRow columnRow = null;
SortHeader.SortItem[] sortItems = null;
String headerArea = defaultHeaderArea;
if (sortHeader != null) {
headerArea = sortHeader.getHeaderArea();
sortItems = sortHeader.getSortItems();
showHeaderArea = SortColumnRowPane.isAvailableColumnRow(ColumnRow.valueOf(headerArea));
}
columnRow = ColumnRow.valueOf(headerArea);
headerAreaPane.populateBean(columnRow);
headerAreaPane.populateBean(columnRow, showHeaderArea);
headerSettingPane.populateBean(sortItems);
}

Loading…
Cancel
Save