From f6ee8dd2ce03865cf257069ff2b13d803662f6fb Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Wed, 8 Dec 2021 19:01:18 +0800 Subject: [PATCH 1/8] =?UTF-8?q?REPORT-62440=20=E8=A1=A8=E5=A4=B4=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E5=86=85=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/frpane/AbstractAttrNoScrollPane.java | 3 + .../fr/design/gui/icheckbox/UICheckBox.java | 6 +- .../theme/edit/ui/ColorListPane.java | 2 +- .../com/fr/design/images/sort/add.png | Bin 0 -> 141 bytes .../com/fr/design/images/sort/asc.svg | 19 ++ .../com/fr/design/images/sort/des.svg | 17 ++ .../com/fr/design/images/sort/down_arrow.png | Bin 0 -> 175 bytes .../com/fr/design/images/sort/left_arrow.png | Bin 0 -> 166 bytes .../com/fr/design/images/sort/nosort.svg | 41 +++ .../share/ui/base/PlaceholderTextArea.java | 33 ++- .../cell/settingpane/CellExpandAttrPane.java | 6 + .../CellDSColumnSortGroupPane.java | 40 +++ .../CellDSColumnSortItemPane.java | 52 ++++ .../celldscolumn/CellDSColumnSortPane.java | 57 ++++ .../cellexpand/CellExpandSortGroupPane.java | 20 ++ .../cellexpand/CellExpandSortItemPane.java | 49 ++++ .../sort/cellexpand/CellExpandSortPane.java | 58 ++++ .../sort/common/AbstractSortGroupPane.java | 146 ++++++++++ .../sort/common/AbstractSortItemPane.java | 173 ++++++++++++ .../design/sort/common/AbstractSortPane.java | 118 ++++++++ .../design/sort/common/SortColumnRowPane.java | 167 ++++++++++++ .../sort/common/SortUIExpandablePane.java | 102 +++++++ .../CellSortExpressionPane.java | 31 +++ .../CustomSequenceEditPane.java | 160 +++++++++++ .../expressionpane/CustomSequencePane.java | 70 +++++ .../CustomSequenceSortExpressionPane.java | 37 +++ .../expressionpane/EmptyExpressionPane.java | 37 +++ .../FormulaSortExpressionPane.java | 41 +++ .../expressionpane/SortExpressionPane.java | 23 ++ .../fr/design/sort/header/HeaderAreaPane.java | 149 ++++++++++ .../design/sort/header/HeaderSettingPane.java | 91 +++++++ .../sort/header/HeaderSortRulePane.java | 256 ++++++++++++++++++ .../fr/design/sort/header/SortHeaderPane.java | 74 +++++ .../cellquick/CellDSColumnEditor.java | 31 ++- 34 files changed, 2097 insertions(+), 12 deletions(-) create mode 100644 designer-base/src/main/resources/com/fr/design/images/sort/add.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/sort/asc.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/sort/des.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/sort/down_arrow.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/sort/left_arrow.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/sort/nosort.svg create mode 100644 designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortGroupPane.java create mode 100644 designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortItemPane.java create mode 100644 designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortPane.java create mode 100644 designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortGroupPane.java create mode 100644 designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortItemPane.java create mode 100644 designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortPane.java create mode 100644 designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortGroupPane.java create mode 100644 designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortItemPane.java create mode 100644 designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortPane.java create mode 100644 designer-realize/src/main/java/com/fr/design/sort/common/SortColumnRowPane.java create mode 100644 designer-realize/src/main/java/com/fr/design/sort/common/SortUIExpandablePane.java create mode 100644 designer-realize/src/main/java/com/fr/design/sort/expressionpane/CellSortExpressionPane.java create mode 100644 designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequenceEditPane.java create mode 100644 designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequencePane.java create mode 100644 designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequenceSortExpressionPane.java create mode 100644 designer-realize/src/main/java/com/fr/design/sort/expressionpane/EmptyExpressionPane.java create mode 100644 designer-realize/src/main/java/com/fr/design/sort/expressionpane/FormulaSortExpressionPane.java create mode 100644 designer-realize/src/main/java/com/fr/design/sort/expressionpane/SortExpressionPane.java create mode 100644 designer-realize/src/main/java/com/fr/design/sort/header/HeaderAreaPane.java create mode 100644 designer-realize/src/main/java/com/fr/design/sort/header/HeaderSettingPane.java create mode 100644 designer-realize/src/main/java/com/fr/design/sort/header/HeaderSortRulePane.java create mode 100644 designer-realize/src/main/java/com/fr/design/sort/header/SortHeaderPane.java diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java index a9321879c8..ce09568d6b 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java @@ -76,6 +76,9 @@ public abstract class AbstractAttrNoScrollPane extends BasicPane { hasChangeListener = false; } + public AttributeChangeListener getListener() { + return listener; + } public void initListener(Container parentComponent) { for (int i = 0; i < parentComponent.getComponentCount(); i++) { diff --git a/designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java b/designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java index e294d80220..0ddd3e22d2 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java @@ -58,7 +58,7 @@ public class UICheckBox extends JCheckBox implements UIObserver, GlobalNameObser super(locText, b); setUI(new UICheckBoxUI()); initListener(); - this.markMnemonic=markMnemonic; + this.markMnemonic = markMnemonic; } public UICheckBox(String text, Icon icon) { @@ -100,6 +100,10 @@ public class UICheckBox extends JCheckBox implements UIObserver, GlobalNameObser } + public void removeChangeListener() { + uiObserverListener = null; + } + @Override public void setGlobalName(String name) { checkboxName = name; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/ColorListPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/ColorListPane.java index 5c282033f0..ab5d8a4ecf 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/ColorListPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/ColorListPane.java @@ -139,7 +139,7 @@ public class ColorListPane extends JPanel implements UIObserver { return true; } - private static class ColorButton extends AbstractSelectBox { + public static class ColorButton extends AbstractSelectBox { private Color color; private NewColorSelectPane colorPane; private ChangeListener changeListener; diff --git a/designer-base/src/main/resources/com/fr/design/images/sort/add.png b/designer-base/src/main/resources/com/fr/design/images/sort/add.png new file mode 100644 index 0000000000000000000000000000000000000000..a14e2a40b81c54355768336ccb23450ccb570551 GIT binary patch literal 141 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|+&x_!LoEE0 zQx*sqJi45plT#$2QvdCZWOU3c4#^MlSqy%qi`fhe8V)l^-7-@-_Che=O~7%67&B?< m**$K`qK6tbopJHm#lY~}#7a>2LZvs*NCr<=KbLh*2~7Zq{3}-g literal 0 HcmV?d00001 diff --git a/designer-base/src/main/resources/com/fr/design/images/sort/asc.svg b/designer-base/src/main/resources/com/fr/design/images/sort/asc.svg new file mode 100644 index 0000000000..67dd9e829e --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/sort/asc.svg @@ -0,0 +1,19 @@ + + + 升序备份 + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/sort/des.svg b/designer-base/src/main/resources/com/fr/design/images/sort/des.svg new file mode 100644 index 0000000000..2fcef077e6 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/sort/des.svg @@ -0,0 +1,17 @@ + + + 降序 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/sort/down_arrow.png b/designer-base/src/main/resources/com/fr/design/images/sort/down_arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..84b4909efc7e542dd69b5e7f9e25fdf0f98e27aa GIT binary patch literal 175 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|GCf@!LoEE0 zQx*sq1g)5#Xd!vwzP)BkV`HM}#6+Q}h#A}2mWZkH{Q9ka-Pqty{(*dsWaq@hJY^qV zH-$&$ETP72+zHE)%vpks{g@quR|XeHJktd literal 0 HcmV?d00001 diff --git a/designer-base/src/main/resources/com/fr/design/images/sort/left_arrow.png b/designer-base/src/main/resources/com/fr/design/images/sort/left_arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..9166a9c96d8226d4396aea9096deb66105473683 GIT binary patch literal 166 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|5GG zqKj0+ZGkGu25W=P0>*zc7NnX8`7u9OaCF)w4Zl+@lk_*)9Nj6%a74>WF#1($B+xDf MPgg&ebxsLQ0Fz5I9RL6T literal 0 HcmV?d00001 diff --git a/designer-base/src/main/resources/com/fr/design/images/sort/nosort.svg b/designer-base/src/main/resources/com/fr/design/images/sort/nosort.svg new file mode 100644 index 0000000000..ca04928fc8 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/sort/nosort.svg @@ -0,0 +1,41 @@ + + + 不排序 + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/base/PlaceholderTextArea.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/base/PlaceholderTextArea.java index c463a49034..d37ee52c28 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/base/PlaceholderTextArea.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/base/PlaceholderTextArea.java @@ -10,22 +10,27 @@ import java.awt.RenderingHints; * created by Harrison on 2020/04/21 **/ public class PlaceholderTextArea extends UITextArea { - + private String placeholder; - + public PlaceholderTextArea() { } - + public PlaceholderTextArea(String s, String placeholder) { super(s); this.placeholder = placeholder; } - + + public PlaceholderTextArea(int i, int j, String placeholder) { + super(i, j); + this.placeholder = placeholder; + } + public void setPlaceholder(String placeholder) { - + this.placeholder = placeholder; } - + @Override protected void paintComponent(final Graphics pG) { super.paintComponent(pG); @@ -37,6 +42,16 @@ public class PlaceholderTextArea extends UITextArea { RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setColor(getDisabledTextColor()); - g.drawString(placeholder, getInsets().left, pG.getFontMetrics() - .getMaxAscent() + getInsets().top + 1); - }} + drawPlaceholder(pG); + } + + private void drawPlaceholder(Graphics g) { + int x = getInsets().left; + int y = g.getFontMetrics().getMaxAscent() + getInsets().top + 1; + for (String line : placeholder.split("\n")) { + g.drawString(line, x, y); + y += g.getFontMetrics().getHeight(); + } + + } +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java index cd454660df..979d4534f6 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java @@ -13,6 +13,7 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase; +import com.fr.design.sort.cellexpand.CellExpandSortPane; import com.fr.general.ComparatorUtils; import com.fr.general.IOUtils; import com.fr.report.cell.TemplateCellElement; @@ -43,6 +44,7 @@ public class CellExpandAttrPane extends AbstractCellAttrPane { private JPanel basicPane; private JPanel seniorPane; private CellExpandExtraAttrPane extraPane; + private CellExpandSortPane cellExpandSortPane; /** @@ -81,8 +83,10 @@ public class CellExpandAttrPane extends AbstractCellAttrPane { seniorPane = new JPanel(); basicPane = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Basic"), 223, 24, basicPane()); seniorPane = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Advanced"), 223, 24, seniorPane()); + JPanel sortUIExpandablePane = new UIExpandablePane("扩展后排序", 223, 24, cellExpandSortPane = new CellExpandSortPane(this)); layoutPane.add(basicPane, BorderLayout.NORTH); layoutPane.add(seniorPane, BorderLayout.CENTER); + layoutPane.add(sortUIExpandablePane, BorderLayout.SOUTH); extraPane = CellExpandExtraAttrPane.getInstance(); @@ -172,6 +176,7 @@ public class CellExpandAttrPane extends AbstractCellAttrPane { sortAfterExpand.populate(cellExpandAttr); extraPane.populate(cellElement); + cellExpandSortPane.populateBean(cellElement); } @@ -222,6 +227,7 @@ public class CellExpandAttrPane extends AbstractCellAttrPane { } extraPane.update(cellElement); + cellExpandSortPane.updateBean(cellElement); } /** diff --git a/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortGroupPane.java b/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortGroupPane.java new file mode 100644 index 0000000000..f5cdd0a8d9 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortGroupPane.java @@ -0,0 +1,40 @@ +package com.fr.design.sort.celldscolumn; + +import com.fr.design.data.DesignTableDataManager; +import com.fr.design.data.tabledata.wrapper.TableDataWrapper; +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.sort.common.AbstractSortGroupPane; +import com.fr.design.sort.common.AbstractSortItemPane; +import com.fr.report.cell.cellattr.core.group.DSColumn; +import com.fr.report.core.sort.sortexpression.SortExpression; + +public class CellDSColumnSortGroupPane extends AbstractSortGroupPane { + DSColumn dsColumn; + + + public CellDSColumnSortGroupPane(int sortGroupPaneWidth, int sortGroupPaneRightWidth) { + super(sortGroupPaneWidth, sortGroupPaneRightWidth); + } + + public void populateDsColumn( DSColumn dsColumn){ + this.dsColumn = dsColumn; + } + + + @Override + protected AbstractSortItemPane refreshSortItemPane(int sortItemPaneWidth, int sortItemPaneRightWidth, SortExpression sortExpression) { + CellDSColumnSortItemPane cellDSColumnSortItemPane = new CellDSColumnSortItemPane( sortItemPaneWidth, sortItemPaneRightWidth); + java.util.Map tableDataWrapperMap = + DesignTableDataManager.getAllEditingDataSet(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTarget()); + TableDataWrapper tableDataWrapper = tableDataWrapperMap.get(dsColumn.getDSName()); + java.util.List columnNameList = tableDataWrapper.calculateColumnNameList(); + String[] columnNames = new String[columnNameList.size()]; + columnNameList.toArray(columnNames); + cellDSColumnSortItemPane.sortAreaUiComboBox.removeAllItems(); + for (String columnName : columnNames) { + cellDSColumnSortItemPane.sortAreaUiComboBox.addItem(columnName); + } + cellDSColumnSortItemPane.populateBean(sortExpression); + return cellDSColumnSortItemPane; + } +} diff --git a/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortItemPane.java b/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortItemPane.java new file mode 100644 index 0000000000..c87b729e65 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortItemPane.java @@ -0,0 +1,52 @@ +package com.fr.design.sort.celldscolumn; + +import com.fr.design.event.UIObserverListener; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.sort.common.AbstractSortItemPane; +import com.fr.design.sort.common.AbstractSortPane; +import com.fr.report.core.sort.sortexpression.SortExpression; + +import javax.swing.*; +import java.awt.*; + + +public class CellDSColumnSortItemPane extends AbstractSortItemPane { + + + UIComboBox sortAreaUiComboBox; + + public CellDSColumnSortItemPane(int sortItemPaneWidth, int sortItemPaneRightWidth) { + super(sortItemPaneWidth, sortItemPaneRightWidth); + } + + @Override + public void initMainSortAreaPane(JPanel sortAreaPane) { + sortAreaUiComboBox = new UIComboBox(new String[0]); + sortAreaUiComboBox.setPreferredSize(new Dimension(sortItemPaneRightWidth, AbstractSortPane.PANE_COMPONENT_HEIGHT)); + sortAreaPane.add(sortAreaUiComboBox); + } + + public void populateBean(SortExpression sortExpression) { + sortAreaUiComboBox.setSelectedItem(sortExpression.getSortArea()); + super.populateBean(sortExpression); + } + + public SortExpression updateBean() { + SortExpression sortExpression = super.updateBean(); + if (sortExpression != null) { + sortExpression.setSortArea(sortAreaUiComboBox.getSelectedItem().toString()); + } + return sortExpression; + } + + public void addListener(UIObserverListener uiObserverListener) { + super.addListener(uiObserverListener); + sortAreaUiComboBox.registerChangeListener(uiObserverListener); + } + + + public void removeListener(UIObserverListener uiObserverListener) { + super.removeListener(uiObserverListener); + sortAreaUiComboBox.removeChangeListener(); + } +} \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortPane.java b/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortPane.java new file mode 100644 index 0000000000..68865dca43 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortPane.java @@ -0,0 +1,57 @@ +package com.fr.design.sort.celldscolumn; + +import com.fr.design.sort.common.AbstractSortPane; +import com.fr.general.data.TableDataColumn; +import com.fr.report.cell.TemplateCellElement; +import com.fr.report.cell.cellattr.core.group.DSColumn; +import com.fr.report.core.sort.common.CellSortAttr; + + +public class CellDSColumnSortPane extends AbstractSortPane { + + + public CellDSColumnSortPane() { + super(220, 150); + + } + + + @Override + protected void initSortGroupPane() { + sortGroupPane = new CellDSColumnSortGroupPane(sortPaneWidth, sortPaneRightWidth); + this.add(sortGroupPane); + } + + + @Override + protected CellSortAttr getCellSortAttr(TemplateCellElement cellElement) { + if (cellElement.getValue() instanceof DSColumn) { + DSColumn dsColumn = ((DSColumn) cellElement.getValue()); + return dsColumn.getCellSortAttr(); + } + return new CellSortAttr(); + } + + protected void populateSortArea(TemplateCellElement cellElement) { + super.populateSortArea(cellElement); + if (cellElement.getValue() instanceof DSColumn) { + DSColumn dsColumn = ((DSColumn) cellElement.getValue()); + TableDataColumn tableDataColumn = dsColumn.getColumn(); + if (tableDataColumn instanceof TableDataColumn.ColumnName) { + selfSortArea = ((TableDataColumn.ColumnName) dsColumn.getColumn()).getName(); + } + } + } + + + public void populateBean(TemplateCellElement cellElement) { + if (cellElement.getValue() instanceof DSColumn) { + DSColumn dsColumn = ((DSColumn) cellElement.getValue()); + if (sortGroupPane != null) { + ((CellDSColumnSortGroupPane) sortGroupPane).populateDsColumn(dsColumn); + } + } + super.populateBean(cellElement); + } + +} \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortGroupPane.java b/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortGroupPane.java new file mode 100644 index 0000000000..330b43d739 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortGroupPane.java @@ -0,0 +1,20 @@ +package com.fr.design.sort.cellexpand; + +import com.fr.design.sort.common.AbstractSortGroupPane; +import com.fr.design.sort.common.AbstractSortItemPane; +import com.fr.report.core.sort.sortexpression.SortExpression; + +public class CellExpandSortGroupPane extends AbstractSortGroupPane { + + + public CellExpandSortGroupPane(int sortGroupPaneWidth, int sortGroupPaneRightWidth) { + super(sortGroupPaneWidth, sortGroupPaneRightWidth); + } + + @Override + protected AbstractSortItemPane refreshSortItemPane(int sortItemPaneWidth, int sortItemPaneRightWidth, SortExpression sortExpression) { + AbstractSortItemPane abstractSortItemPane = new CellExpandSortItemPane( sortItemPaneWidth, sortItemPaneRightWidth); + abstractSortItemPane.populateBean(sortExpression); + return abstractSortItemPane; + } +} diff --git a/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortItemPane.java b/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortItemPane.java new file mode 100644 index 0000000000..2b3bee9943 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortItemPane.java @@ -0,0 +1,49 @@ +package com.fr.design.sort.cellexpand; + +import com.fr.design.event.UIObserverListener; +import com.fr.design.sort.common.AbstractSortPane; +import com.fr.design.sort.common.SortColumnRowPane; +import com.fr.design.sort.common.AbstractSortItemPane; +import com.fr.report.core.sort.sortexpression.SortExpression; +import com.fr.stable.ColumnRow; + +import javax.swing.*; + +public class CellExpandSortItemPane extends AbstractSortItemPane { + SortColumnRowPane columnRowPane; + + public CellExpandSortItemPane(int sortItemPaneWidth, int sortItemPaneRightWidth) { + super(sortItemPaneWidth, sortItemPaneRightWidth); + } + + @Override + public void initMainSortAreaPane(JPanel sortAreaPane) { + columnRowPane = new SortColumnRowPane(sortItemPaneRightWidth, AbstractSortPane.PANE_COMPONENT_HEIGHT); + sortAreaPane.add(columnRowPane); + } + + public void populateBean(SortExpression sortExpression) { + columnRowPane.populateBean(ColumnRow.valueOf(sortExpression.getSortArea())); + super.populateBean(sortExpression); + } + + public SortExpression updateBean() { + SortExpression sortExpression = super.updateBean(); + if (sortExpression != null) { + ColumnRow columnRow = columnRowPane.updateBean(); + sortExpression.setSortArea(columnRow == null ? null : columnRow.toString()); + } + return sortExpression; + } + + public void addListener(UIObserverListener uiObserverListener) { + super.addListener(uiObserverListener); + columnRowPane.addListener(uiObserverListener); + } + + + public void removeListener(UIObserverListener uiObserverListener) { + super.removeListener(uiObserverListener); + columnRowPane.removeListener(uiObserverListener); + } +} diff --git a/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortPane.java b/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortPane.java new file mode 100644 index 0000000000..b1412d18bc --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortPane.java @@ -0,0 +1,58 @@ +package com.fr.design.sort.cellexpand; + +import com.fr.design.event.UIObserverListener; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.mainframe.cell.settingpane.CellExpandAttrPane; +import com.fr.design.sort.common.AbstractSortPane; +import com.fr.report.cell.TemplateCellElement; +import com.fr.report.cell.cellattr.CellExpandAttr; +import com.fr.report.core.sort.common.CellSortAttr; +import com.fr.report.core.sort.sortexpression.FormulaSortExpression; +import com.fr.report.core.sort.sortexpression.SortExpression; +import com.fr.report.core.sort.header.SortHeader; +import com.fr.report.core.sort.common.SortRule; + + +import javax.swing.*; +import java.util.ArrayList; +import java.util.List; + +public class CellExpandSortPane extends AbstractSortPane { + CellExpandAttrPane cellExpandAttrPane; + + public CellExpandSortPane(CellExpandAttrPane cellExpandAttrPane) { + super(227, 155); + this.cellExpandAttrPane = cellExpandAttrPane; + this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); + } + + + @Override + protected void initSortGroupPane() { + sortGroupPane = new CellExpandSortGroupPane(sortPaneWidth, sortPaneRightWidth); + this.add(sortGroupPane); + } + + @Override + protected void initUIObserverListener() { + uiObserverListener = new UIObserverListener() { + @Override + public void doChange() { + AttributeChangeListener attributeChangeListener = cellExpandAttrPane.getListener(); + if (attributeChangeListener != null) { + attributeChangeListener.attributeChange(); + } + } + }; + } + + @Override + protected CellSortAttr getCellSortAttr(TemplateCellElement cellElement) { + CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr(); + if (cellExpandAttr != null) { + return cellExpandAttr.getCellSortAttr(); + } + return new CellSortAttr(); + } + +} diff --git a/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortGroupPane.java b/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortGroupPane.java new file mode 100644 index 0000000000..8aae8d30fe --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortGroupPane.java @@ -0,0 +1,146 @@ +package com.fr.design.sort.common; + +import com.fr.base.svg.IconUtils; +import com.fr.design.event.UIObserverListener; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.report.core.sort.sortexpression.CellSortExpression; +import com.fr.report.core.sort.sortexpression.SortExpression; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.util.ArrayList; +import java.util.List; + + +public abstract class AbstractSortGroupPane extends JPanel { + + protected int sortGroupPaneWidth; + protected int sortGroupPaneRightWidth; + UIObserverListener uiObserverListener; + List sortExpressions; + List sortItemPanes = new ArrayList<>(); + AddSortItemBar addSortItemBar; + UIButton uiButton; + String selfSortArea; + + public AbstractSortGroupPane(int sortGroupPaneWidth, int sortGroupPaneRightWidth) { + this.sortGroupPaneRightWidth = sortGroupPaneRightWidth; + this.sortGroupPaneWidth = sortGroupPaneWidth; + this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); + + initComponents(); + } + + private void initComponents() { + addSortItemBar = new AddSortItemBar(this); + this.add(addSortItemBar); + } + + public void populateBean(List sortExpressions, String selfSortArea) { + this.selfSortArea = selfSortArea; + this.sortExpressions = sortExpressions; + refreshBean(); + } + + public void refreshBean() { + removeListener(uiObserverListener); + this.removeAll(); + sortItemPanes = new ArrayList<>(); + for (int i = 0; i < sortExpressions.size(); i++) { + int sortItemPaneWidth = sortGroupPaneWidth; + int sortItemPaneRightWidth = sortGroupPaneRightWidth; + if (i != 0) { + sortItemPaneWidth -= 12; + sortItemPaneRightWidth -= 12; + } + AbstractSortItemPane sortItemPane = refreshSortItemPane(sortItemPaneWidth, sortItemPaneRightWidth, sortExpressions.get(i)); + sortItemPanes.add(sortItemPane); + if (i == 0) { + this.add(sortItemPane); + } else { + SortUIExpandablePane sortUIExpandablePane = new SortUIExpandablePane(sortItemPane, this); + this.add(sortUIExpandablePane); + } + } + initComponents(); + addListener(uiObserverListener); + refresh(); + } + + protected abstract AbstractSortItemPane refreshSortItemPane(int sortItemPaneWidth, int sortItemPaneRightWidth, SortExpression sortExpression); + + public List updateBean() { + updateSortExpressions(); + return sortExpressions; + } + + private void updateSortExpressions() { + sortExpressions = new ArrayList<>(); + for (AbstractSortItemPane sortItemPane : sortItemPanes) { + SortExpression sortExpression = sortItemPane.updateBean(); + if (sortExpression != null) { + sortExpressions.add(sortExpression); + } + } + } + + public void removeSortItem(int no) { + updateSortExpressions(); + if (no < sortExpressions.size()) { + sortExpressions.remove(no); + } + refreshBean(); + } + + public void addSortItem() { + updateSortExpressions(); + sortExpressions.add(new CellSortExpression(selfSortArea)); + refreshBean(); + } + + + protected void refresh() { + validate(); + repaint(); + revalidate(); + } + + class AddSortItemBar extends JPanel { + AbstractSortGroupPane sortGroupPane; + + AddSortItemBar(AbstractSortGroupPane sortGroupPane) { + init(); + this.sortGroupPane = sortGroupPane; + } + + void init() { + uiButton = new UIButton("添加排序", IconUtils.readIcon("/com/fr/design/images/sort/add.png")); + uiButton.setPreferredSize(new Dimension(sortGroupPaneWidth - 4, 20)); + this.add(uiButton); + uiButton.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + sortGroupPane.addSortItem(); + uiObserverListener.doChange(); + } + }); + } + } + + + public void addListener(UIObserverListener uiObserverListener) { + this.uiObserverListener = uiObserverListener; + for (AbstractSortItemPane abstractSortItemPane : sortItemPanes) { + abstractSortItemPane.addListener(uiObserverListener); + } + } + + public void removeListener(UIObserverListener uiObserverListener) { + for (AbstractSortItemPane abstractSortItemPane : sortItemPanes) { + abstractSortItemPane.removeListener(uiObserverListener); + } + } + +} 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 new file mode 100644 index 0000000000..0bd3701bbe --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortItemPane.java @@ -0,0 +1,173 @@ +package com.fr.design.sort.common; + +import com.fr.design.event.UIObserverListener; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; + +import com.fr.design.sort.expressionpane.CellSortExpressionPane; +import com.fr.design.sort.expressionpane.CustomSequenceSortExpressionPane; +import com.fr.design.sort.expressionpane.EmptyExpressionPane; +import com.fr.design.sort.expressionpane.FormulaSortExpressionPane; +import com.fr.design.sort.expressionpane.SortExpressionPane; +import com.fr.report.core.sort.sortexpression.SortExpression; +import com.fr.report.core.sort.common.SortRule; +import com.fr.stable.StringUtils; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.ArrayList; +import java.util.List; + +public abstract class AbstractSortItemPane extends JPanel { + + protected int sortItemPaneWidth; + protected int sortItemPaneRightWidth; + List sortExpressionPanes = new ArrayList<>(); + SortExpressionPane currentSortExpressionPane = null; + JPanel sortBasisPanel = null; + UIComboBox sortRuleUiComboBox; + UIComboBox sortBasisUiComboBox; + JPanel sortAreaPane; + JPanel sortRulePane; + + public AbstractSortItemPane(int sortItemPaneWidth, int sortItemPaneRightWidth) { + this.sortItemPaneWidth = sortItemPaneWidth; + this.sortItemPaneRightWidth = sortItemPaneRightWidth; + this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); + registerSortExpressionPanes(); + initComponents(); + } + + private void initComponents() { + initSortAreaPane(); + initSortBasisPanel(); + initSortRulePane(); + } + + private void registerSortExpressionPanes() { + sortExpressionPanes.add(new EmptyExpressionPane()); + sortExpressionPanes.add(new CellSortExpressionPane(sortItemPaneRightWidth)); + sortExpressionPanes.add(new FormulaSortExpressionPane(sortItemPaneRightWidth)); + sortExpressionPanes.add(new CustomSequenceSortExpressionPane(sortItemPaneWidth, sortItemPaneRightWidth)); + } + + void initSortAreaPane() { + sortAreaPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, AbstractSortPane.PANE_COMPONENT_V_GAP)); + sortAreaPane.add(new UILabel("排序区域", SwingConstants.LEFT)); + sortAreaPane.add(AbstractSortPane.createIntervalUILabel()); + initMainSortAreaPane(sortAreaPane); + this.add(sortAreaPane); + } + + public abstract void initMainSortAreaPane(JPanel sortAreaPane); + + void initSortRulePane() { + sortRulePane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, AbstractSortPane.PANE_COMPONENT_V_GAP)); + sortRuleUiComboBox = new UIComboBox(new String[]{"升序", "降序", "不排序"}); + sortRuleUiComboBox.setPreferredSize(new Dimension(sortItemPaneRightWidth, AbstractSortPane.PANE_COMPONENT_HEIGHT)); + sortRulePane.add(new UILabel("排序规则", SwingConstants.LEFT)); + sortRulePane.add(AbstractSortPane.createIntervalUILabel()); + sortRulePane.add(sortRuleUiComboBox); + this.add(sortRulePane); + } + + + void initSortBasisPanel() { + sortBasisPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, AbstractSortPane.PANE_COMPONENT_V_GAP)); + sortBasisUiComboBox = new UIComboBox(getSortNames()); + sortBasisUiComboBox.setPreferredSize(new Dimension(sortItemPaneRightWidth, AbstractSortPane.PANE_COMPONENT_HEIGHT)); + sortBasisUiComboBox.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + if (sortExpressionPanes.get(sortBasisUiComboBox.getSelectedIndex()) != currentSortExpressionPane) { + if (currentSortExpressionPane != null) { + currentSortExpressionPane.setVisible(false); + } + currentSortExpressionPane = sortExpressionPanes.get(sortBasisUiComboBox.getSelectedIndex()); + refreshCurrentSortExpressionPane(); + } + } + }); + + + sortBasisPanel.add(new UILabel("排序依据", SwingConstants.LEFT)); + sortBasisPanel.add(AbstractSortPane.createIntervalUILabel()); + sortBasisPanel.add(sortBasisUiComboBox); + this.add(sortBasisPanel); + for (SortExpressionPane sortExpressionPane : sortExpressionPanes) { + this.add(sortExpressionPane); + sortExpressionPane.setVisible(false); + } + } + + private void refreshCurrentSortExpressionPane() { + currentSortExpressionPane.setVisible(true); + sortAreaPane.setVisible(currentSortExpressionPane.needSortArea()); + sortRulePane.setVisible(currentSortExpressionPane.needSortRule()); + } + + private String[] getSortNames() { + String[] sortNames = new String[sortExpressionPanes.size()]; + for (int i = 0; i < sortExpressionPanes.size(); i++) { + sortNames[i] = sortExpressionPanes.get(i).getSortName(); + } + return sortNames; + } + + public void populateBean(SortExpression sortExpression) { + if (sortExpression.getSortRule() == SortRule.ASC) { + sortRuleUiComboBox.setSelectedIndex(0); + } else if (sortExpression.getSortRule() == SortRule.DES) { + sortRuleUiComboBox.setSelectedIndex(1); + } else if (sortExpression.getSortRule() == SortRule.NO_SORT) { + sortRuleUiComboBox.setSelectedIndex(2); + } + + for (int i = 0; i < sortExpressionPanes.size(); i++) { + if (StringUtils.equals(sortExpression.getSortName(), sortExpressionPanes.get(i).getSortName())) { + if (currentSortExpressionPane != null) { + currentSortExpressionPane.setVisible(false); + } + currentSortExpressionPane = sortExpressionPanes.get(i); + currentSortExpressionPane.populateBean(sortExpression); + sortBasisUiComboBox.setSelectedIndex(i); + refreshCurrentSortExpressionPane(); + break; + } + } + refresh(); + } + + public SortExpression updateBean() { + SortExpression sortExpression = currentSortExpressionPane.updateBean(); + if (sortExpression != null) { + if (StringUtils.equals(sortRuleUiComboBox.getSelectedItem().toString(), "升序")) { + sortExpression.setSortRule(SortRule.ASC); + } else if (StringUtils.equals(sortRuleUiComboBox.getSelectedItem().toString(), "降序")) { + sortExpression.setSortRule(SortRule.DES); + } else if (StringUtils.equals(sortRuleUiComboBox.getSelectedItem().toString(), "不排序")) { + sortExpression.setSortRule(SortRule.NO_SORT); + } + } + return sortExpression; + } + + public void addListener(UIObserverListener uiObserverListener) { + sortBasisUiComboBox.registerChangeListener(uiObserverListener); + sortRuleUiComboBox.registerChangeListener(uiObserverListener); + } + + + public void removeListener(UIObserverListener uiObserverListener) { + sortBasisUiComboBox.removeChangeListener(); + sortRuleUiComboBox.removeChangeListener(); + } + + protected void refresh() { + validate(); + repaint(); + revalidate(); + } +} diff --git a/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortPane.java b/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortPane.java new file mode 100644 index 0000000000..2febc4b6e5 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortPane.java @@ -0,0 +1,118 @@ +package com.fr.design.sort.common; + +import com.fr.design.event.UIObserverListener; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.sort.header.SortHeaderPane; +import com.fr.report.cell.TemplateCellElement; +import com.fr.report.core.sort.common.CellSortAttr; +import com.fr.report.core.sort.sortexpression.CellSortExpression; +import com.fr.report.core.sort.sortexpression.SortExpression; +import com.fr.report.core.sort.header.SortHeader; +import com.fr.stable.ColumnRow; + +import javax.swing.*; +import java.awt.*; +import java.util.ArrayList; +import java.util.List; + + +public abstract class AbstractSortPane extends JPanel { + protected int sortPaneWidth; + protected int sortPaneRightWidth; + public static final int PANE_COMPONENT_HEIGHT = 20; + public static final int PANE_COMPONENT_V_GAP = 4; + public static final int PANE_COMPONENT_H_GAP = 14; + protected UIObserverListener uiObserverListener; + protected AbstractSortGroupPane sortGroupPane; + protected SortHeaderPane sortHeaderPane; + protected String selfSortArea; + protected String defaultHeaderArea; + + + public AbstractSortPane(int sortPaneWidth, int sortPaneRightWidth) { + this.sortPaneWidth = sortPaneWidth; + this.sortPaneRightWidth = sortPaneRightWidth; + initUIObserverListener(); + initComponents(); + } + + + private void initComponents() { + initSortGroupPane(); + sortHeaderPane = new SortHeaderPane(sortPaneWidth, sortPaneRightWidth + 5); + this.add(sortHeaderPane); + } + + protected abstract void initSortGroupPane(); + + protected void initUIObserverListener() { + + } + + protected abstract CellSortAttr getCellSortAttr(TemplateCellElement cellElement); + + public void populateBean(TemplateCellElement cellElement) { + System.out.println("sport pane populateBean"); + populateSortArea(cellElement); + CellSortAttr cellSortAttr = getCellSortAttr(cellElement); + List sortExpressions = cellSortAttr.getSortExpressions(); + if (sortExpressions == null || sortExpressions.size() == 0) { + sortExpressions = new ArrayList<>(); + sortExpressions.add(new CellSortExpression(selfSortArea)); + } + sortGroupPane.populateBean(sortExpressions, selfSortArea); + sortHeaderPane.populateBean(cellSortAttr.getSortHeader(),defaultHeaderArea); + addListener(uiObserverListener); + refresh(); + } + + + protected void populateSortArea(TemplateCellElement cellElement) { + int row = cellElement.getRow(); + int column = cellElement.getColumn(); + selfSortArea = ColumnRow.valueOf(column, row).toString(); + if (row > 1) { + defaultHeaderArea = ColumnRow.valueOf(column, row - 1).toString(); + } else { + defaultHeaderArea = null; + } + } + + public void updateBean(TemplateCellElement cellElement) { + System.out.println("sport pane updateBean"); + List sortExpressions = sortGroupPane.updateBean(); + SortHeader sortHeader = sortHeaderPane.updateBean(); + CellSortAttr cellSortAttr = getCellSortAttr(cellElement); + cellSortAttr.setSortExpressions(sortExpressions); + cellSortAttr.setSortHeader(sortHeader); + } + + + public void addListener(UIObserverListener uiObserverListener) { + sortGroupPane.addListener(uiObserverListener); + sortHeaderPane.addListener(uiObserverListener); + } + + + public void removeListener(UIObserverListener uiObserverListener) { + sortGroupPane.removeListener(uiObserverListener); + sortHeaderPane.removeListener(uiObserverListener); + } + + + protected void refresh() { + validate(); + repaint(); + revalidate(); + } + + public static UILabel createIntervalUILabel() { + return createIntervalUILabel(PANE_COMPONENT_H_GAP); + } + + public static UILabel createIntervalUILabel(int vGap) { + UILabel uiLabel = new UILabel(); + uiLabel.setPreferredSize(new Dimension(vGap, 10)); + return uiLabel; + } +} 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 new file mode 100644 index 0000000000..16e0319cc0 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/sort/common/SortColumnRowPane.java @@ -0,0 +1,167 @@ +package com.fr.design.sort.common; + +import com.fr.base.BaseUtils; +import com.fr.design.designer.TargetComponent; +import com.fr.design.event.UIObserver; +import com.fr.design.event.UIObserverListener; +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.mainframe.ElementCasePane; +import com.fr.design.selection.SelectionEvent; +import com.fr.design.selection.SelectionListener; +import com.fr.grid.selection.CellSelection; +import com.fr.grid.selection.Selection; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.ColumnRow; +import com.fr.stable.EssentialUtils; +import com.fr.stable.StringUtils; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class SortColumnRowPane extends JPanel { + int paneWidth; + int paneHeight; + int jTextFieldWidth; + JTextField colJTextField; + JTextField rowJTextField; + UIButton selectButton; + private boolean isAlreadyAddListener = false; + private CellSelection oldSelection; + private SelectionListener gridSelectionChangeListener; + UIObserverListener uiObserverListener; + + public SortColumnRowPane(int paneWidth, int paneHeight) { + this.paneWidth = paneWidth; + this.paneHeight = paneHeight; + initComponents(); + } + + private void initComponents() { + initSize(); + this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); + intUILabel(); + initTextField(); + initSelectButton(); + this.setSize(new Dimension(paneWidth, paneHeight)); + } + + void initSize() { + jTextFieldWidth = (paneWidth - 42) / 2; + } + + void intUILabel() { + UILabel uiLabel = new UILabel(BaseUtils.readIcon("com\\fr\\design\\images\\buttonicon\\propertiestab\\cellelement_normal.png")); + this.add(uiLabel); + } + + + void initTextField() { + colJTextField = new JTextField(); + colJTextField.setEditable(false); + rowJTextField = new JTextField(); + rowJTextField.setEditable(false); + colJTextField.setPreferredSize(new Dimension(jTextFieldWidth, paneHeight)); + rowJTextField.setPreferredSize(new Dimension(jTextFieldWidth, paneHeight)); + this.add(colJTextField); + this.add(rowJTextField); + } + + void initSelectButton() { + selectButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/buttonicon/select.png")); + selectButton.addActionListener(new SelectActionListener(this)); + this.add(selectButton); + } + + public void populateBean(ColumnRow columnRow) { + if (columnRow != null && columnRow.getRow() != -1 && columnRow.getColumn() != -1) { + colJTextField.setText(EssentialUtils.convertIntToABC(columnRow.column + 1)); + rowJTextField.setText(String.valueOf(columnRow.row + 1)); + } + refresh(); + + } + + public ColumnRow updateBean() { + if (StringUtils.isNotBlank(colJTextField.getText()) && StringUtils.isNotBlank(rowJTextField.getText())) { + return ColumnRow.valueOf(colJTextField.getText() + rowJTextField.getText()); + } + return null; + } + + class SelectActionListener implements ActionListener { + SortColumnRowPane columnRowPane; + + SelectActionListener(SortColumnRowPane columnRowPane) { + this.columnRowPane = columnRowPane; + } + + @Override + public void actionPerformed(ActionEvent e) { + ElementCasePane elementCasePane = getCurrentElementCase(); + if (elementCasePane == null || isAlreadyAddListener) { + return; + } + oldSelection = (CellSelection) elementCasePane.getSelection(); + elementCasePane.getGrid().setNotShowingTableSelectPane(false); + elementCasePane.setEditable(false); + elementCasePane.repaint(10); + + gridSelectionChangeListener = new SelectionListener() { + @Override + public void selectionChanged(SelectionEvent e) { + Selection selection = elementCasePane.getSelection(); + if (selection instanceof CellSelection) { + CellSelection cellselection = (CellSelection) selection; + ColumnRow cr = ColumnRow.valueOf(cellselection.getColumn(), cellselection.getRow()); + elementCasePane.setOldSelecton(oldSelection); + columnRowPane.populateBean(cr); + if (columnRowPane.uiObserverListener != null) { + columnRowPane.uiObserverListener.doChange(); + } + } + elementCasePane.removeSelectionChangeListener(gridSelectionChangeListener); + isAlreadyAddListener = false; + elementCasePane.getGrid().setNotShowingTableSelectPane(true); + elementCasePane.setEditable(true); + elementCasePane.repaint(); + } + }; + elementCasePane.addSelectionChangeListener(gridSelectionChangeListener); + isAlreadyAddListener = true; + } + } + + 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; + } + + public void addListener(UIObserverListener uiObserverListener) { + this.uiObserverListener = uiObserverListener; + } + + + public void removeListener(UIObserverListener uiObserverListener) { + this.uiObserverListener = null; + } + + protected void refresh() { + validate(); + repaint(); + revalidate(); + } +} \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/sort/common/SortUIExpandablePane.java b/designer-realize/src/main/java/com/fr/design/sort/common/SortUIExpandablePane.java new file mode 100644 index 0000000000..ccee50fe75 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/sort/common/SortUIExpandablePane.java @@ -0,0 +1,102 @@ +package com.fr.design.sort.common; + +import com.fr.base.BaseUtils; +import com.fr.base.svg.IconUtils; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ilable.UILabel; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + + +public class SortUIExpandablePane extends JPanel { + + private static final long serialVersionUID = 1L; + private HeaderPane headerPane; + private AbstractSortItemPane contentPane; + private AbstractSortGroupPane sortGroupPane; + + private JPanel wrapPane; + + public JPanel getContentPane() { + return contentPane; + } + + public SortUIExpandablePane(AbstractSortItemPane contentPane, AbstractSortGroupPane sortGroupPane) { + super(); + this.sortGroupPane = sortGroupPane; + this.contentPane = contentPane; + initComponents(); + wrapPane.setBorder(BorderFactory.createLineBorder(Color.gray, 1)); + wrapPane.setBackground(Color.WHITE); + } + + + private void initComponents() { + wrapPane = new JPanel(); + wrapPane.setLayout(new BorderLayout()); + headerPane = new HeaderPane(sortGroupPane); + headerPane.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + setContentPanelShow(!contentPane.isVisible()); + } + }); + headerPane.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.gray)); + contentPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); + wrapPane.add(headerPane, BorderLayout.NORTH); + wrapPane.add(contentPane, BorderLayout.CENTER); + setContentPanelShow(false); + this.add(wrapPane); + } + + + private void setContentPanelShow(boolean show) { + contentPane.setVisible(show); + headerPane.setShow(show); + } + + class HeaderPane extends JPanel { + UILabel iconUiLabel; + UILabel closeButton; + AbstractSortGroupPane sortGroupPane; + + HeaderPane(AbstractSortGroupPane sortGroupPane) { + this.sortGroupPane = sortGroupPane; + this.setLayout(new FlowLayout(FlowLayout.LEFT, 3, 3)); + initComponents(); + + } + + private void initComponents() { + iconUiLabel = new UILabel(); + this.add(iconUiLabel); + UILabel uiLabel = new UILabel("次要排序列"); + this.add(uiLabel); + this.add(AbstractSortPane.createIntervalUILabel(114)); + + closeButton = new UILabel(IconUtils.readIcon("/com/fr/design/images/control/close.png")); + this.add(closeButton); + closeButton.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + sortGroupPane.removeSortItem(1); + } + }); + System.out.println(contentPane.sortItemPaneWidth); + this.setPreferredSize(new Dimension(contentPane.sortItemPaneWidth+7, AbstractSortPane.PANE_COMPONENT_HEIGHT)); + } + + public void setShow(boolean show) { + if (show) { + iconUiLabel.setIcon(IconUtils.readIcon("/com/fr/design/images/sort/down_arrow.png")); + } else { + iconUiLabel.setIcon(IconUtils.readIcon("/com/fr/design/images/sort/left_arrow.png")); + } + } + + } + +} \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CellSortExpressionPane.java b/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CellSortExpressionPane.java new file mode 100644 index 0000000000..863ca6d22b --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CellSortExpressionPane.java @@ -0,0 +1,31 @@ +package com.fr.design.sort.expressionpane; + +import com.fr.report.core.sort.sortexpression.CellSortExpression; + + +import java.awt.*; + + +public class CellSortExpressionPane extends SortExpressionPane { + public CellSortExpressionPane(int with) { + this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); + } + + + @Override + public String getSortName() { + return "单元格"; + } + + @Override + public void populateBean(CellSortExpression cellSortExpression) { + + } + + @Override + public CellSortExpression updateBean() { + return new CellSortExpression(); + } + + +} diff --git a/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequenceEditPane.java b/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequenceEditPane.java new file mode 100644 index 0000000000..db3d3b9208 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequenceEditPane.java @@ -0,0 +1,160 @@ +package com.fr.design.sort.expressionpane; + +import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ilist.UIList; +import com.fr.design.mainframe.dnd.SerializableTransferable; +import com.fr.design.mainframe.share.ui.base.PlaceholderTextArea; +import com.fr.report.core.sort.sortexpression.CustomSequenceSortExpression; + +import javax.swing.*; +import java.awt.*; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; +import java.awt.dnd.DnDConstants; +import java.awt.dnd.DragGestureEvent; +import java.awt.dnd.DragGestureListener; +import java.awt.dnd.DragSource; +import java.awt.dnd.DragSourceAdapter; +import java.awt.dnd.DropTarget; +import java.awt.dnd.DropTargetAdapter; +import java.awt.dnd.DropTargetDropEvent; +import java.util.ArrayList; +import java.util.List; + +public class CustomSequenceEditPane extends BasicPane { + java.util.List customSequence; + JPanel referenceSequencePanel; + JPanel editSequencePanel; + JTextArea jTextArea; + + CustomSequenceEditPane(java.util.List customSequence) { + this.customSequence = customSequence; + initComponents(); + } + + + void initComponents() { + this.setLayout(new BorderLayout()); + initReferenceSequencePanel(); + initEditSequencePanel(); + } + + void initReferenceSequencePanel() { + referenceSequencePanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); + UILabel uiLabel = new UILabel("参考序列:"); + referenceSequencePanel.add(uiLabel); + UIScrollPane uiScrollPane = new UIScrollPane(getReferenceSequenceList()); + uiScrollPane.setPreferredSize(new Dimension(200, 300)); + referenceSequencePanel.add(uiScrollPane); + referenceSequencePanel.setPreferredSize(new Dimension(200, 400)); + this.add(referenceSequencePanel, BorderLayout.WEST); + } + + private UIList getReferenceSequenceList() { + UIList uiList = new UIList(getReferenceSequenceModel()); + new CustomSequenceEditDragSource(uiList, DnDConstants.ACTION_MOVE); + return uiList; + } + + private String[] getReferenceSequenceModel() { + List> customSequences = CustomSequenceSortExpression.getReferenceCustomSequences(); + String[] listModel = new String[customSequences.size()]; + for (int i = 0; i < customSequences.size(); i++) { + listModel[i] = CustomSequenceSortExpression.customSequenceToString(customSequences.get(i), ","); + } + return listModel; + } + + void initEditSequencePanel() { + editSequencePanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); + UILabel uiLabel = new UILabel("输入序列(E):"); + editSequencePanel.add(uiLabel); + UILabel uiLabel2 = new UILabel("请将序列元素隔行输入"); + uiLabel2.setForeground(Color.lightGray); + editSequencePanel.add(uiLabel2); + jTextArea = getTextArea(); + UIScrollPane uiScrollPane = new UIScrollPane(jTextArea); + uiScrollPane.setPreferredSize(new Dimension(475, 300)); + editSequencePanel.add(uiScrollPane); + this.add(editSequencePanel, BorderLayout.CENTER); + + } + + + JTextArea getTextArea() { + PlaceholderTextArea placeholderTextArea = new PlaceholderTextArea(10, 10, getPlaceholderText()); + new CustomSequenceEditDropTarget(placeholderTextArea, CustomSequenceSortExpression.getReferenceCustomSequences()); + placeholderTextArea.setText(CustomSequenceSortExpression.customSequenceToString(customSequence, "\n")); + return placeholderTextArea; + } + + String getPlaceholderText() { + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append("请将序列元素隔行输入,如:\n"); + stringBuilder.append("部门一\n"); + stringBuilder.append("部门二\n"); + stringBuilder.append("部门三\n"); + System.out.println(stringBuilder); + return stringBuilder.toString(); + } + + @Override + protected String title4PopupWindow() { + return "自定义序列"; + } + + + class CustomSequenceEditDragSource extends DragSourceAdapter implements DragGestureListener { + private DragSource source; + + public CustomSequenceEditDragSource(UIList uiList, int actions) { + source = new DragSource(); + source.createDefaultDragGestureRecognizer(uiList, actions, this); + } + + public void dragGestureRecognized(DragGestureEvent dge) { + Component comp = dge.getComponent(); + if (comp instanceof UIList) { + UIList uiList = (UIList) comp; + source.startDrag(dge, DragSource.DefaultLinkDrop, new SerializableTransferable(uiList.getSelectedIndex()), this); + } + } + } + + + class CustomSequenceEditDropTarget extends DropTargetAdapter { + java.util.List> customSequences = new ArrayList<>(); + + public CustomSequenceEditDropTarget(PlaceholderTextArea jPanel, java.util.List> customSequences) { + new DropTarget(jPanel, this); + this.customSequences = customSequences; + } + + @Override + public void drop(DropTargetDropEvent dtde) { + try { + Transferable transferable = dtde.getTransferable(); + DataFlavor[] dataFlavors = transferable.getTransferDataFlavors(); + if (dataFlavors.length == 1) { + Integer index = (Integer) transferable.getTransferData(dataFlavors[0]); + String text = ""; + java.util.List customSequence = customSequences.get(index); + for (int i = 0; i < customSequence.size(); i++) { + text += customSequence.get(i) + "\n"; + } + JTextArea jTextArea = (JTextArea) dtde.getDropTargetContext().getComponent(); + jTextArea.setText(text); + } + } catch (Exception e) { + + } + } + } + + public List updateBean() { + return CustomSequenceSortExpression.stringToCustomSequence(jTextArea.getText(), "\n"); + } + +} 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 new file mode 100644 index 0000000000..507ac204ca --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequencePane.java @@ -0,0 +1,70 @@ +package com.fr.design.sort.expressionpane; + +import com.fr.base.BaseUtils; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.sort.common.AbstractSortPane; +import com.fr.report.core.sort.sortexpression.CustomSequenceSortExpression; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.List; + + +public class CustomSequencePane extends JPanel { + + + protected UITextField textField; + protected UIButton button; + List customSequence; + + public CustomSequencePane(int width) { + this.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0)); + this.initComponents(width); + } + + protected void initComponents(int width) { + + textField = new UITextField(); + textField.setEditable(false); + textField.setPreferredSize(new Dimension(width - 20, 20)); + + // 添加一公式编辑器按钮 + Icon icon = BaseUtils.readIcon("/com/fr/design/images/control/refresh.png"); + button = new UIButton(icon); + button.setBackground(Color.RED); + button.setPreferredSize(new Dimension(24, 20)); + button.setOpaque(false); + button.setCursor(new Cursor(Cursor.HAND_CURSOR)); + button.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent evt) { + CustomSequenceEditPane customSequenceEditPane = new CustomSequenceEditPane(customSequence); + customSequenceEditPane.showWindowWithCustomSize(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { + @Override + public void doOk() { + customSequence = customSequenceEditPane.updateBean(); + textField.setText(CustomSequenceSortExpression.customSequenceToString(customSequence, ",")); + } + }, new Dimension(700, 400)).setVisible(true); + } + }); + button.setPreferredSize(new Dimension(24, AbstractSortPane.PANE_COMPONENT_HEIGHT)); + + this.add(textField); + this.add(button); + } + + + public List updateBean() { + return customSequence; + } + + public void populateBean(List customSequence) { + this.customSequence = customSequence; + textField.setText(CustomSequenceSortExpression.customSequenceToString(customSequence, ",")); + } +} \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequenceSortExpressionPane.java b/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequenceSortExpressionPane.java new file mode 100644 index 0000000000..c9589f92e3 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequenceSortExpressionPane.java @@ -0,0 +1,37 @@ +package com.fr.design.sort.expressionpane; + + +import com.fr.design.sort.common.AbstractSortPane; +import com.fr.report.core.sort.sortexpression.CustomSequenceSortExpression; + +import java.awt.*; +import java.util.List; + + +public class CustomSequenceSortExpressionPane extends SortExpressionPane { + CustomSequencePane customSequencePane; + + public CustomSequenceSortExpressionPane(int width, int rightWidth) { + this.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0)); + customSequencePane = new CustomSequencePane(rightWidth); + customSequencePane.setPreferredSize(new Dimension(width, AbstractSortPane.PANE_COMPONENT_HEIGHT)); + this.add(customSequencePane); + } + + @Override + public String getSortName() { + return "自定义序列"; + } + + @Override + public void populateBean(CustomSequenceSortExpression customSequenceSortExpression) { + List customSequence = customSequenceSortExpression.getCustomSequence(); + customSequencePane.populateBean(customSequence); + } + + @Override + public CustomSequenceSortExpression updateBean() { + List customSequence = customSequencePane.updateBean(); + return new CustomSequenceSortExpression(customSequence); + } +} diff --git a/designer-realize/src/main/java/com/fr/design/sort/expressionpane/EmptyExpressionPane.java b/designer-realize/src/main/java/com/fr/design/sort/expressionpane/EmptyExpressionPane.java new file mode 100644 index 0000000000..042be1b975 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/sort/expressionpane/EmptyExpressionPane.java @@ -0,0 +1,37 @@ +package com.fr.design.sort.expressionpane; + + +import com.fr.report.core.sort.sortexpression.SortExpression; + +import java.awt.*; + + +public class EmptyExpressionPane extends SortExpressionPane { + + public EmptyExpressionPane() { + this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); + } + + @Override + public String getSortName() { + return "无"; + } + + @Override + public void populateBean(SortExpression sortExpression) { + + } + + @Override + public SortExpression updateBean() { + return null; + } + + public boolean needSortArea() { + return false; + } + + public boolean needSortRule() { + return false; + } +} \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/sort/expressionpane/FormulaSortExpressionPane.java b/designer-realize/src/main/java/com/fr/design/sort/expressionpane/FormulaSortExpressionPane.java new file mode 100644 index 0000000000..2dd098ab65 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/sort/expressionpane/FormulaSortExpressionPane.java @@ -0,0 +1,41 @@ +package com.fr.design.sort.expressionpane; + +import com.fr.design.formula.TinyFormulaPane; +import com.fr.design.sort.common.AbstractSortPane; +import com.fr.report.core.sort.sortexpression.FormulaSortExpression; + +import java.awt.*; + +public class FormulaSortExpressionPane extends SortExpressionPane { + + TinyFormulaPane tinyFormulaPane; + + public FormulaSortExpressionPane(int width) { + this.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 1)); + tinyFormulaPane = new TinyFormulaPane(); + tinyFormulaPane.setPreferredSize(new Dimension(width, AbstractSortPane.PANE_COMPONENT_HEIGHT)); + this.add(tinyFormulaPane); + } + + @Override + public String getSortName() { + return "公式"; + } + + @Override + public void populateBean(FormulaSortExpression formulaSortExpression) { + String formula = formulaSortExpression.getFormula(); + tinyFormulaPane.getUITextField().setText(formula); + } + + @Override + public FormulaSortExpression updateBean() { + String formula = tinyFormulaPane.getUITextField().getText(); + return new FormulaSortExpression(formula); + } + + public boolean needSortArea() { + return false; + } + +} diff --git a/designer-realize/src/main/java/com/fr/design/sort/expressionpane/SortExpressionPane.java b/designer-realize/src/main/java/com/fr/design/sort/expressionpane/SortExpressionPane.java new file mode 100644 index 0000000000..69af8464cb --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/sort/expressionpane/SortExpressionPane.java @@ -0,0 +1,23 @@ +package com.fr.design.sort.expressionpane; + +import com.fr.report.core.sort.sortexpression.SortExpression; + +import javax.swing.*; + + +public abstract class SortExpressionPane extends JPanel { + + public abstract String getSortName(); + + public abstract void populateBean(T sortExpression); + + public abstract T updateBean(); + + public boolean needSortArea() { + return true; + } + + public boolean needSortRule() { + return true; + } +} 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 new file mode 100644 index 0000000000..92f7aaf2e9 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/sort/header/HeaderAreaPane.java @@ -0,0 +1,149 @@ +package com.fr.design.sort.header; + +import com.fr.design.event.UIObserverListener; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.mainframe.ElementCasePane; +import com.fr.design.sort.common.AbstractSortPane; +import com.fr.design.sort.common.SortColumnRowPane; +import com.fr.stable.ColumnRow; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; + + +public class HeaderAreaPane extends JPanel { + protected int headerAreaPaneWidth; + protected int headerAreaPaneRightWidth; + + AreaJLayeredPane areaJLayeredPane; + + HeaderAreaPane(int headerAreaPaneWidth, int headerAreaPaneRightWidth) { + this.headerAreaPaneWidth = headerAreaPaneWidth; + this.headerAreaPaneRightWidth = headerAreaPaneRightWidth; + this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); + initComponents(); + } + + void initComponents() { + initUILabel(); + initLayeredPane(); + } + + + void initUILabel() { + UILabel uiLabel = new UILabel("表头区域", SwingConstants.LEFT); + this.add(uiLabel); + this.add(AbstractSortPane.createIntervalUILabel()); + } + + void initLayeredPane() { + areaJLayeredPane = new AreaJLayeredPane(); + this.add(areaJLayeredPane); + } + + + public void populateBean(ColumnRow columnRow) { + areaJLayeredPane.populateBean(columnRow); + } + + public ColumnRow updateBean() { + return areaJLayeredPane.updateBean(); + } + + class AreaJLayeredPane extends JPanel { + SortColumnRowPane columnRowPane; + JLayeredPane jLayeredPane; + UIComboBox uiComboBox; + + AreaJLayeredPane() { + this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); + initComponents(); + } + + private void initComponents() { + initUIComboBox(); + initJLayeredPane(); + } + + + void initUIComboBox() { + uiComboBox = new UIComboBox(new String[]{"无", "自定义"}); + uiComboBox.setSize(new Dimension(headerAreaPaneRightWidth, AbstractSortPane.PANE_COMPONENT_HEIGHT)); + uiComboBox.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + setSortColumnRowPaneShow(uiComboBox.getSelectedIndex() == 1); + } + }); + } + + void setSortColumnRowPaneShow(boolean show) { + if (show) { + jLayeredPane.setLayer(columnRowPane, JLayeredPane.POPUP_LAYER); + jLayeredPane.setLayer(uiComboBox, JLayeredPane.MODAL_LAYER); + } else { + jLayeredPane.setLayer(uiComboBox, JLayeredPane.POPUP_LAYER); + jLayeredPane.setLayer(columnRowPane, JLayeredPane.MODAL_LAYER); + } + refresh(); + } + + void initJLayeredPane() { + jLayeredPane = new JLayeredPane(); + columnRowPane = new SortColumnRowPane(headerAreaPaneRightWidth - 18, AbstractSortPane.PANE_COMPONENT_HEIGHT); + jLayeredPane.setPreferredSize(new Dimension(headerAreaPaneRightWidth, AbstractSortPane.PANE_COMPONENT_HEIGHT)); + jLayeredPane.add(columnRowPane, JLayeredPane.MODAL_LAYER); + jLayeredPane.add(uiComboBox, JLayeredPane.POPUP_LAYER); + this.add(jLayeredPane); + } + + public void populateBean(ColumnRow columnRow) { + if (columnRow != null && columnRow.getRow() != -1 && columnRow.getColumn() != -1) { + columnRowPane.populateBean(columnRow); + uiComboBox.setSelectedIndex(1); + } else { + uiComboBox.setSelectedIndex(0); + } + setSortColumnRowPaneShow(uiComboBox.getSelectedIndex() == 1); + } + + public ColumnRow updateBean() { + if (uiComboBox.getSelectedIndex() == 0) { + return null; + } else { + return columnRowPane.updateBean(); + } + } + + public void addListener(UIObserverListener uiObserverListener) { + columnRowPane.addListener(uiObserverListener); + uiComboBox.registerChangeListener(uiObserverListener); + } + + + public void removeListener(UIObserverListener uiObserverListener) { + columnRowPane.removeListener(uiObserverListener); + uiComboBox.removeChangeListener(); + } + + public void refresh() { + validate(); + repaint(); + revalidate(); + } + + } + + public void addListener(UIObserverListener uiObserverListener) { + areaJLayeredPane.addListener(uiObserverListener); + } + + + public void removeListener(UIObserverListener uiObserverListener) { + areaJLayeredPane.removeListener(uiObserverListener); + } + +} \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/sort/header/HeaderSettingPane.java b/designer-realize/src/main/java/com/fr/design/sort/header/HeaderSettingPane.java new file mode 100644 index 0000000000..4cf2229c81 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/sort/header/HeaderSettingPane.java @@ -0,0 +1,91 @@ +package com.fr.design.sort.header; + +import com.fr.design.event.UIObserverListener; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.sort.common.AbstractSortPane; +import com.fr.report.core.sort.header.SortHeader; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.*; + +public class HeaderSettingPane extends JPanel { + protected int headerSettingPaneWidth; + protected int headerSettingPaneRightWidth; + HeaderSortRulePane headerSortRulePane; + UICheckBox uiCheckBox; + + HeaderSettingPane(int headerSettingPaneWidth, int headerSettingPaneRightWidth) { + this.headerSettingPaneWidth = headerSettingPaneWidth; + this.headerSettingPaneRightWidth = headerSettingPaneRightWidth; + this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); + initComponents(); + } + + void initComponents() { + initUILabel(); + initHeaderSortRulePane(); + } + + void initUILabel() { + JPanel jPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 2)); + UILabel uiLabel = new UILabel("表头设置"); + UILabel emptyUILabel = new UILabel(); + emptyUILabel.setPreferredSize(new Dimension(10, 10)); + + uiCheckBox = new UICheckBox("用户点击排列顺序"); + uiCheckBox.setPreferredSize(new Dimension(headerSettingPaneRightWidth - 10, AbstractSortPane.PANE_COMPONENT_HEIGHT)); + uiCheckBox.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + headerSortRulePane.setVisible(uiCheckBox.isSelected()); + } + }); + jPanel.add(uiLabel); + jPanel.add(emptyUILabel); + jPanel.add(uiCheckBox); + this.add(jPanel); + } + + void initHeaderSortRulePane() { + headerSortRulePane = new HeaderSortRulePane(); + this.add(headerSortRulePane); + headerSortRulePane.setVisible(false); + } + + protected void refresh() { + validate(); + repaint(); + revalidate(); + } + + public void populateBean(SortHeader.SortItem[] sortItems) { + if (sortItems == null) { + uiCheckBox.setSelected(false); + } else { + uiCheckBox.setSelected(true); + } + headerSortRulePane.populateBean(sortItems); + } + + public SortHeader.SortItem[] updateBean() { + if (uiCheckBox.isSelected()) { + return headerSortRulePane.updateBean(); + } else { + return null; + } + } + + public void addListener(UIObserverListener uiObserverListener) { + uiCheckBox.registerChangeListener(uiObserverListener); + headerSortRulePane.addListener(uiObserverListener); + } + + + public void removeListener(UIObserverListener uiObserverListener) { + uiCheckBox.removeChangeListener(); + headerSortRulePane.removeListener(uiObserverListener); + } +} diff --git a/designer-realize/src/main/java/com/fr/design/sort/header/HeaderSortRulePane.java b/designer-realize/src/main/java/com/fr/design/sort/header/HeaderSortRulePane.java new file mode 100644 index 0000000000..55db383b29 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/sort/header/HeaderSortRulePane.java @@ -0,0 +1,256 @@ +package com.fr.design.sort.header; + +import com.fr.base.svg.SVGIcon; +import com.fr.base.svg.SVGTranscoder; +import com.fr.design.event.UIObserverListener; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.theme.edit.ui.ColorListPane; +import com.fr.general.IOUtils; +import com.fr.report.core.sort.header.SortHeader; +import com.fr.report.core.sort.common.SortRule; +import org.apache.batik.transcoder.TranscoderInput; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.*; +import java.awt.image.BufferedImage; +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.util.ArrayList; + +public class HeaderSortRulePane extends JPanel { + + + private static final String ASC_ICON_TEMPLATE_PATH = "/com/fr/design/images/sort/asc.svg"; + private static final String DES_ICON_TEMPLATE_PATH = "/com/fr/design/images/sort/des.svg"; + private static final String NOSORT_ICON_TEMPLATE_PATH = "/com/fr/design/images/sort/nosort.svg"; + IconButton ascIconButton; + IconButton desIconButton; + IconButton nosortIconButton; + UICheckBox ascUICheckBox; + UICheckBox desUICheckBox; + UICheckBox nosortUICheckBox; + + + HeaderSortRulePane() { + initComponents(); + initState(); + this.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 15)); + } + + void initComponents() { + this.setLayout(new BorderLayout()); + initUILabel(); + initSortRuleItem(); + this.setPreferredSize(new Dimension(160, 160)); + } + + void initUILabel() { + UILabel uiLabel = new UILabel("排序依据:", SwingConstants.LEFT); + this.add(uiLabel, BorderLayout.NORTH); + } + + void initSortRuleItem() { + Component[][] components = new Component[][]{ + new Component[]{ascUICheckBox = new UICheckBox("升序"), ascIconButton = new IconButton(ASC_ICON_TEMPLATE_PATH)}, + new Component[]{desUICheckBox = new UICheckBox("降序"), desIconButton = new IconButton(DES_ICON_TEMPLATE_PATH)}, + new Component[]{nosortUICheckBox = new UICheckBox("不排序"), nosortIconButton = new IconButton(NOSORT_ICON_TEMPLATE_PATH)}, + }; + double[] rowSize = {24, 24, 24}; + double[] columnSize = {80, 30}; + JPanel sortRuleItem = TableLayoutHelper.createCommonTableLayoutPane(components, rowSize, columnSize, 0); + this.add(sortRuleItem, BorderLayout.CENTER); + } + + void initState() { + ascUICheckBox.setSelected(false); + desUICheckBox.setSelected(false); + nosortUICheckBox.setSelected(false); + ascIconButton.refreshIconLabelColor(new Color(33, 33, 34)); + desIconButton.refreshIconLabelColor(new Color(33, 33, 34)); + nosortIconButton.refreshIconLabelColor(new Color(33, 33, 34)); + } + + + class IconButton extends JPanel { + JLayeredPane jLayeredPane; + String iconTemplatePath; + UILabel iconLabel; + ColorListPane.ColorButton colorButton; + Color color; + BufferedImage bufferedImage; + UIObserverListener uiObserverListener; + + IconButton(String iconTemplatePath) { + this.iconTemplatePath = iconTemplatePath; + initComponents(); + } + + void initComponents() { + jLayeredPane = new JLayeredPane(); + iconLabel = getIconLabel(iconTemplatePath); + + + UILabel emptyUiLabel = new UILabel(); + emptyUiLabel.setSize(16, 16); + emptyUiLabel.setOpaque(true); + emptyUiLabel.setBackground(Color.WHITE); + iconLabel.setSize(16, 16); + colorButton = new ColorListPane.ColorButton(Color.CYAN); + colorButton.setSize(16, 16); + colorButton.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + color = colorButton.getSelectObject(); + refreshIconLabelColor(color); + if (uiObserverListener != null) { + uiObserverListener.doChange(); + } + } + }); + jLayeredPane.setPreferredSize(new Dimension(16, 16)); + + jLayeredPane.add(iconLabel, JLayeredPane.POPUP_LAYER); + jLayeredPane.add(emptyUiLabel, JLayeredPane.MODAL_LAYER); + jLayeredPane.add(colorButton, JLayeredPane.PALETTE_LAYER); + this.add(jLayeredPane); + } + + void refreshIconLabelColor(Color color) { + Icon icon = getIcon(iconTemplatePath, color); + refreshIconLabel(icon); + } + + void refreshIconLabel(Icon icon) { + if (icon != null) { + iconLabel.removeAll(); + iconLabel.setIcon(icon); + iconLabel.repaint(); + } + } + + UILabel getIconLabel(String iconPath) { + return getIconLabel(iconPath, new Color(33, 33, 34)); + } + + UILabel getIconLabel(String iconPath, Color color) { + Icon svgIcon = getIcon(iconPath, color); + return new UILabel(svgIcon); + } + + Icon getIcon(String iconPath, Color color) { + try { + InputStream inputStream = IOUtils.getResourceAsStream(iconPath, HeaderSortRulePane.class); + String svgText = getSvgText(inputStream); + svgText = svgText.replaceAll("\\{fillColor\\}", shiftColor(color)); + InputStream svgInputStream = new ByteArrayInputStream(svgText.getBytes()); + TranscoderInput input = new TranscoderInput(svgInputStream); + bufferedImage = SVGTranscoder.createImage(1.0, input).getImage(); + SVGIcon svgIcon = new SVGIcon(bufferedImage); + return svgIcon; + } catch (Exception e) { + + } + return null; + + } + + String shiftColor(Color color) { + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append(shiftValue(color.getRed())); + stringBuilder.append(shiftValue(color.getGreen())); + stringBuilder.append(shiftValue(color.getBlue())); + return stringBuilder.toString(); + } + + String shiftValue(int value) { + int resultValue = (int) ((((float) value) / 255) * 99); + if (resultValue < 10) { + return "0" + resultValue; + } else { + return "" + resultValue; + } + } + + private String getSvgText(InputStream inputStream) throws Exception { + StringBuffer stringBuffer = new StringBuffer(); + byte[] b = new byte[1024]; + for (int n; (n = inputStream.read(b)) != -1; ) { + stringBuffer.append(new String(b, 0, n)); + } + return stringBuffer.toString(); + } + + public void addListener(UIObserverListener uiObserverListener) { + this.uiObserverListener = uiObserverListener; + } + + + public void removeListener(UIObserverListener uiObserverListener) { + this.uiObserverListener = null; + } + } + + + public void populateBean(SortHeader.SortItem[] sortItems) { + initState(); + if (sortItems != null) { + for (SortHeader.SortItem sortItem : sortItems) { + SortRule sortRule = sortItem.getSortRule(); + BufferedImage bufferedImage = sortItem.getBufferedImage(); + Icon icon = null; + if (bufferedImage != null) { + icon = new SVGIcon(bufferedImage); + } + if (sortRule == SortRule.ASC) { + ascIconButton.refreshIconLabel(icon); + ascUICheckBox.setSelected(true); + } else if (sortRule == SortRule.DES) { + desIconButton.refreshIconLabel(icon); + desUICheckBox.setSelected(true); + } else if (sortRule == SortRule.NO_SORT) { + nosortIconButton.refreshIconLabel(icon); + nosortUICheckBox.setSelected(true); + } + + } + } + } + + public SortHeader.SortItem[] updateBean() { + java.util.List items = new ArrayList<>(); + if (ascUICheckBox.isSelected()) { + items.add(new SortHeader.SortItem(SortRule.ASC, ascIconButton.bufferedImage)); + } + if (desUICheckBox.isSelected()) { + items.add(new SortHeader.SortItem(SortRule.DES, desIconButton.bufferedImage)); + } + if (nosortUICheckBox.isSelected()) { + items.add(new SortHeader.SortItem(SortRule.NO_SORT, nosortIconButton.bufferedImage)); + } + SortHeader.SortItem[] resultItems = new SortHeader.SortItem[items.size()]; + return items.toArray(resultItems); + } + + public void addListener(UIObserverListener uiObserverListener) { + ascIconButton.addListener(uiObserverListener); + desIconButton.addListener(uiObserverListener); + nosortIconButton.addListener(uiObserverListener); + ascUICheckBox.registerChangeListener(uiObserverListener); + desUICheckBox.registerChangeListener(uiObserverListener); + nosortUICheckBox.registerChangeListener(uiObserverListener); + } + + + public void removeListener(UIObserverListener uiObserverListener) { + ascIconButton.removeListener(uiObserverListener); + desIconButton.removeListener(uiObserverListener); + nosortIconButton.removeListener(uiObserverListener); + ascUICheckBox.removeChangeListener(); + desUICheckBox.removeChangeListener(); + nosortUICheckBox.removeChangeListener(); + } +} diff --git a/designer-realize/src/main/java/com/fr/design/sort/header/SortHeaderPane.java b/designer-realize/src/main/java/com/fr/design/sort/header/SortHeaderPane.java new file mode 100644 index 0000000000..d82c2483c6 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/sort/header/SortHeaderPane.java @@ -0,0 +1,74 @@ +package com.fr.design.sort.header; + +import com.fr.design.event.UIObserverListener; +import com.fr.report.core.sort.header.SortHeader; +import com.fr.stable.ColumnRow; + +import javax.swing.*; + +public class SortHeaderPane extends JPanel { + int sortHeaderPaneWidth; + int sortHeaderPaneRightWidth; + SortHeader sortHeader; + HeaderAreaPane headerAreaPane; + HeaderSettingPane headerSettingPane; + + public SortHeaderPane(int sortHeaderPaneWidth, int sortHeaderPaneRightWidth) { + this.sortHeaderPaneWidth = sortHeaderPaneWidth; + this.sortHeaderPaneRightWidth = sortHeaderPaneRightWidth; + this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); + initHeaderArea(); + initHeaderSetting(); + this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); + } + + + void initHeaderArea() { + this.headerAreaPane = new HeaderAreaPane(sortHeaderPaneWidth, sortHeaderPaneRightWidth); + this.add(headerAreaPane); + } + + void initHeaderSetting() { + this.headerSettingPane = new HeaderSettingPane(sortHeaderPaneWidth, sortHeaderPaneRightWidth); + this.add(headerSettingPane); + } + + + public void populateBean(SortHeader sortHeader, String defaultHeaderArea) { + this.sortHeader = sortHeader; + ColumnRow columnRow = null; + SortHeader.SortItem[] sortItems = null; + String sortArea = defaultHeaderArea; + if (sortHeader != null) { + sortArea = sortHeader.getSortArea(); + sortItems = sortHeader.getSortItems(); + } + columnRow = ColumnRow.valueOf(sortArea); + + headerAreaPane.populateBean(columnRow); + headerSettingPane.populateBean(sortItems); + } + + public SortHeader updateBean() { + ColumnRow columnRow = headerAreaPane.updateBean(); + SortHeader.SortItem[] items = headerSettingPane.updateBean(); + String sortArea = null; + if (columnRow != null) { + sortArea = columnRow.toString(); + } + SortHeader sortHeader = new SortHeader(sortArea, items); + return sortHeader; + } + + public void addListener(UIObserverListener uiObserverListener) { + headerAreaPane.addListener(uiObserverListener); + headerSettingPane.addListener(uiObserverListener); + } + + + public void removeListener(UIObserverListener uiObserverListener) { + headerAreaPane.removeListener(uiObserverListener); + headerSettingPane.removeListener(uiObserverListener); + } +} + diff --git a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java index 0ede5114ff..3d82ebb315 100644 --- a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java +++ b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java @@ -11,6 +11,7 @@ import com.fr.design.dscolumn.DSColumnAdvancedPane; import com.fr.design.dscolumn.ResultSetGroupDockingPane; import com.fr.design.dscolumn.SelectedDataColumnPane; import com.fr.design.event.UIObserverListener; +import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.formula.CustomVariableResolver; import com.fr.design.formula.FormulaFactory; import com.fr.design.formula.UIFormula; @@ -31,6 +32,7 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.cell.AbstractDSCellEditorPane; +import com.fr.design.sort.celldscolumn.CellDSColumnSortPane; import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.widget.FRWidgetFactory; import com.fr.general.IOUtils; @@ -221,6 +223,7 @@ public class CellDSColumnEditor extends CellQuickEditor { */ private UIButton conditionUIButton; + /** * 分组设置监听器 */ @@ -373,6 +376,8 @@ public class CellDSColumnEditor extends CellQuickEditor { * 补充空白数据数目面板 可隐藏 */ private JPanel multiPane; + + private CellDSColumnSortPane cellDSColumnSortPane; /*pane end*/ @@ -449,6 +454,14 @@ public class CellDSColumnEditor extends CellQuickEditor { fireTargetModified(); } }; + + private UIObserverListener cellDSColumnSortPaneChangeListener = new UIObserverListener() { + @Override + public void doChange() { + cellDSColumnSortPane.updateBean(cellElement); + fireTargetModified(); + } + }; /*listeners end*/ @@ -480,6 +493,7 @@ public class CellDSColumnEditor extends CellQuickEditor { updateExtendConfig(); //更新补充空白设置 updateMultipleConfig(); + cellDSColumnSortPane.updateBean(cellElement); } } @@ -524,6 +538,9 @@ public class CellDSColumnEditor extends CellQuickEditor { useMultiNumCheckBox.setSelected(true); multiNumSpinner.setValue(cellExpandAttr.getMultipleNumber()); } + if (cellDSColumnSortPane != null) { + cellDSColumnSortPane.populateBean(cellElement); + } this.checkButtonEnabled(); enableListener(); } @@ -578,6 +595,7 @@ public class CellDSColumnEditor extends CellQuickEditor { */ @Override protected JPanel createContentPane() { + JPanel contentPane = new JPanel(new BorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout()); //结果集排序 @@ -630,8 +648,13 @@ public class CellDSColumnEditor extends CellQuickEditor { double[] rowSize = new double[components.length]; Arrays.fill(rowSize, P); double[] columnSize = {F}; + JPanel advancePropertyPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, HGAP, VGAP); + contentPane.add(advancePropertyPane, BorderLayout.NORTH); + UIExpandablePane sortUIExpandablePane = + new UIExpandablePane("扩展后排序", 223, 24, cellDSColumnSortPane = new CellDSColumnSortPane()); - return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, HGAP, VGAP); + contentPane.add(sortUIExpandablePane, BorderLayout.CENTER); + return contentPane; } public void enableListener() { @@ -643,6 +666,9 @@ public class CellDSColumnEditor extends CellQuickEditor { veCheckBox.addChangeListener(veCheckBoxChangeListener); useMultiNumCheckBox.addActionListener(useMultiNumCheckBoxChangeListener); multiNumSpinner.addChangeListener(multiNumSpinnerChangeListener); + if (cellDSColumnSortPane != null) { + cellDSColumnSortPane.addListener(cellDSColumnSortPaneChangeListener); + } } public void disableListener() { @@ -653,6 +679,9 @@ public class CellDSColumnEditor extends CellQuickEditor { veCheckBox.removeChangeListener(veCheckBoxChangeListener); useMultiNumCheckBox.removeActionListener(useMultiNumCheckBoxChangeListener); multiNumSpinner.removeChangeListener(multiNumSpinnerChangeListener); + if (cellDSColumnSortPane != null) { + cellDSColumnSortPane.removeListener(cellDSColumnSortPaneChangeListener); + } } From 4b710825aecd8e60d28f808463adab29b245c109 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Thu, 9 Dec 2021 22:03:30 +0800 Subject: [PATCH 2/8] =?UTF-8?q?REPORT-62440=20=E8=A1=A8=E5=A4=B4=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E5=86=85=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/AbstractExtendedStylePane.java | 2 +- .../celldscolumn/CellDSColumnSortPane.java | 5 ++- .../cellexpand/CellExpandSortItemPane.java | 2 +- .../sort/cellexpand/CellExpandSortPane.java | 7 +++- .../sort/common/AbstractSortGroupPane.java | 4 +- .../sort/common/AbstractSortItemPane.java | 21 +++++------ .../design/sort/common/AbstractSortPane.java | 16 ++++++-- .../design/sort/common/SortColumnRowPane.java | 22 ++++++----- .../sort/common/SortUIExpandablePane.java | 6 +-- .../CellSortExpressionPane.java | 4 +- .../CustomSequenceEditPane.java | 19 +++++----- .../CustomSequenceSortExpressionPane.java | 4 +- .../expressionpane/EmptyExpressionPane.java | 37 ------------------- .../FormulaSortExpressionPane.java | 4 +- .../fr/design/sort/header/HeaderAreaPane.java | 9 +++-- .../design/sort/header/HeaderSettingPane.java | 5 ++- .../sort/header/HeaderSortRulePane.java | 9 +++-- .../fr/design/sort/header/SortHeaderPane.java | 12 +++--- 18 files changed, 88 insertions(+), 100 deletions(-) delete mode 100644 designer-realize/src/main/java/com/fr/design/sort/expressionpane/EmptyExpressionPane.java diff --git a/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedStylePane.java b/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedStylePane.java index 3346c03eca..d71f59a07d 100644 --- a/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedStylePane.java +++ b/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedStylePane.java @@ -48,7 +48,7 @@ public abstract class AbstractExtendedStylePane extends return this.chart; } - protected AttributeChangeListener getListener() { + public AttributeChangeListener getListener() { return this.listener; } diff --git a/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortPane.java b/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortPane.java index 68865dca43..9760de0ff2 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortPane.java @@ -27,9 +27,12 @@ public class CellDSColumnSortPane extends AbstractSortPane { protected CellSortAttr getCellSortAttr(TemplateCellElement cellElement) { if (cellElement.getValue() instanceof DSColumn) { DSColumn dsColumn = ((DSColumn) cellElement.getValue()); + if (dsColumn.getCellSortAttr() == null) { + dsColumn.setCellSortAttr(new CellSortAttr()); + } return dsColumn.getCellSortAttr(); } - return new CellSortAttr(); + return null; } protected void populateSortArea(TemplateCellElement cellElement) { diff --git a/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortItemPane.java b/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortItemPane.java index 2b3bee9943..3812fbaf62 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortItemPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortItemPane.java @@ -18,7 +18,7 @@ public class CellExpandSortItemPane extends AbstractSortItemPane { @Override public void initMainSortAreaPane(JPanel sortAreaPane) { - columnRowPane = new SortColumnRowPane(sortItemPaneRightWidth, AbstractSortPane.PANE_COMPONENT_HEIGHT); + columnRowPane = new SortColumnRowPane(sortItemPaneRightWidth + 4, AbstractSortPane.PANE_COMPONENT_HEIGHT); sortAreaPane.add(columnRowPane); } diff --git a/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortPane.java b/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortPane.java index b1412d18bc..36243533d3 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortPane.java @@ -6,6 +6,7 @@ import com.fr.design.mainframe.cell.settingpane.CellExpandAttrPane; import com.fr.design.sort.common.AbstractSortPane; import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.cellattr.CellExpandAttr; +import com.fr.report.cell.cellattr.core.group.DSColumn; import com.fr.report.core.sort.common.CellSortAttr; import com.fr.report.core.sort.sortexpression.FormulaSortExpression; import com.fr.report.core.sort.sortexpression.SortExpression; @@ -50,9 +51,11 @@ public class CellExpandSortPane extends AbstractSortPane { protected CellSortAttr getCellSortAttr(TemplateCellElement cellElement) { CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr(); if (cellExpandAttr != null) { + if (cellExpandAttr.getCellSortAttr() == null) { + cellExpandAttr.setCellSortAttr(new CellSortAttr()); + } return cellExpandAttr.getCellSortAttr(); } - return new CellSortAttr(); + return null; } - } diff --git a/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortGroupPane.java b/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortGroupPane.java index 8aae8d30fe..ed1fde2420 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortGroupPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortGroupPane.java @@ -3,6 +3,7 @@ package com.fr.design.sort.common; import com.fr.base.svg.IconUtils; import com.fr.design.event.UIObserverListener; import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.i18n.Toolkit; import com.fr.report.core.sort.sortexpression.CellSortExpression; import com.fr.report.core.sort.sortexpression.SortExpression; @@ -116,7 +117,8 @@ public abstract class AbstractSortGroupPane extends JPanel { } void init() { - uiButton = new UIButton("添加排序", IconUtils.readIcon("/com/fr/design/images/sort/add.png")); + uiButton = new UIButton(Toolkit.i18nText("Fine-Design_Sort_Add_Second_Sort"), + IconUtils.readIcon("/com/fr/design/images/sort/add.png")); uiButton.setPreferredSize(new Dimension(sortGroupPaneWidth - 4, 20)); this.add(uiButton); uiButton.addMouseListener(new MouseAdapter() { 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 0bd3701bbe..8a86813396 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 @@ -4,9 +4,9 @@ import com.fr.design.event.UIObserverListener; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.design.sort.expressionpane.CellSortExpressionPane; import com.fr.design.sort.expressionpane.CustomSequenceSortExpressionPane; -import com.fr.design.sort.expressionpane.EmptyExpressionPane; import com.fr.design.sort.expressionpane.FormulaSortExpressionPane; import com.fr.design.sort.expressionpane.SortExpressionPane; import com.fr.report.core.sort.sortexpression.SortExpression; @@ -47,7 +47,6 @@ public abstract class AbstractSortItemPane extends JPanel { } private void registerSortExpressionPanes() { - sortExpressionPanes.add(new EmptyExpressionPane()); sortExpressionPanes.add(new CellSortExpressionPane(sortItemPaneRightWidth)); sortExpressionPanes.add(new FormulaSortExpressionPane(sortItemPaneRightWidth)); sortExpressionPanes.add(new CustomSequenceSortExpressionPane(sortItemPaneWidth, sortItemPaneRightWidth)); @@ -55,7 +54,7 @@ public abstract class AbstractSortItemPane extends JPanel { void initSortAreaPane() { sortAreaPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, AbstractSortPane.PANE_COMPONENT_V_GAP)); - sortAreaPane.add(new UILabel("排序区域", SwingConstants.LEFT)); + sortAreaPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Sort_Sort_Area"), SwingConstants.LEFT)); sortAreaPane.add(AbstractSortPane.createIntervalUILabel()); initMainSortAreaPane(sortAreaPane); this.add(sortAreaPane); @@ -65,9 +64,10 @@ public abstract class AbstractSortItemPane extends JPanel { void initSortRulePane() { sortRulePane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, AbstractSortPane.PANE_COMPONENT_V_GAP)); - sortRuleUiComboBox = new UIComboBox(new String[]{"升序", "降序", "不排序"}); + sortRuleUiComboBox = new UIComboBox(new String[]{SortRule.ASC.getDescription(), + SortRule.DES.getDescription(), SortRule.NO_SORT.getDescription()}); sortRuleUiComboBox.setPreferredSize(new Dimension(sortItemPaneRightWidth, AbstractSortPane.PANE_COMPONENT_HEIGHT)); - sortRulePane.add(new UILabel("排序规则", SwingConstants.LEFT)); + sortRulePane.add(new UILabel(Toolkit.i18nText("Fine-Design_Sort_Sort_Rule"), SwingConstants.LEFT)); sortRulePane.add(AbstractSortPane.createIntervalUILabel()); sortRulePane.add(sortRuleUiComboBox); this.add(sortRulePane); @@ -92,7 +92,7 @@ public abstract class AbstractSortItemPane extends JPanel { }); - sortBasisPanel.add(new UILabel("排序依据", SwingConstants.LEFT)); + sortBasisPanel.add(new UILabel(Toolkit.i18nText("Fine-Design_Sort_Sort_Basis"), SwingConstants.LEFT)); sortBasisPanel.add(AbstractSortPane.createIntervalUILabel()); sortBasisPanel.add(sortBasisUiComboBox); this.add(sortBasisPanel); @@ -143,12 +143,9 @@ public abstract class AbstractSortItemPane extends JPanel { public SortExpression updateBean() { SortExpression sortExpression = currentSortExpressionPane.updateBean(); if (sortExpression != null) { - if (StringUtils.equals(sortRuleUiComboBox.getSelectedItem().toString(), "升序")) { - sortExpression.setSortRule(SortRule.ASC); - } else if (StringUtils.equals(sortRuleUiComboBox.getSelectedItem().toString(), "降序")) { - sortExpression.setSortRule(SortRule.DES); - } else if (StringUtils.equals(sortRuleUiComboBox.getSelectedItem().toString(), "不排序")) { - sortExpression.setSortRule(SortRule.NO_SORT); + String sortRule = sortRuleUiComboBox.getSelectedItem().toString(); + if (StringUtils.isNotBlank(sortRule)) { + sortExpression.setSortRule(SortRule.parse(sortRule)); } } return sortExpression; diff --git a/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortPane.java b/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortPane.java index 2febc4b6e5..35e8a3c096 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortPane.java @@ -52,16 +52,22 @@ public abstract class AbstractSortPane extends JPanel { protected abstract CellSortAttr getCellSortAttr(TemplateCellElement cellElement); public void populateBean(TemplateCellElement cellElement) { - System.out.println("sport pane populateBean"); populateSortArea(cellElement); + List sortExpressions = null; CellSortAttr cellSortAttr = getCellSortAttr(cellElement); - List sortExpressions = cellSortAttr.getSortExpressions(); + if (cellSortAttr != null) { + sortExpressions = cellSortAttr.getSortExpressions(); + } if (sortExpressions == null || sortExpressions.size() == 0) { sortExpressions = new ArrayList<>(); sortExpressions.add(new CellSortExpression(selfSortArea)); } sortGroupPane.populateBean(sortExpressions, selfSortArea); - sortHeaderPane.populateBean(cellSortAttr.getSortHeader(),defaultHeaderArea); + SortHeader sortHeader = null; + if (cellSortAttr != null) { + sortHeader = cellSortAttr.getSortHeader(); + } + sortHeaderPane.populateBean(sortHeader, defaultHeaderArea); addListener(uiObserverListener); refresh(); } @@ -79,11 +85,13 @@ public abstract class AbstractSortPane extends JPanel { } public void updateBean(TemplateCellElement cellElement) { - System.out.println("sport pane updateBean"); List sortExpressions = sortGroupPane.updateBean(); SortHeader sortHeader = sortHeaderPane.updateBean(); CellSortAttr cellSortAttr = getCellSortAttr(cellElement); cellSortAttr.setSortExpressions(sortExpressions); + if (sortHeader != null) { + sortHeader.setSortArea(selfSortArea); + } cellSortAttr.setSortHeader(sortHeader); } 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 16e0319cc0..489f136bee 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 @@ -1,8 +1,7 @@ package com.fr.design.sort.common; -import com.fr.base.BaseUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.designer.TargetComponent; -import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.gui.ibutton.UIButton; @@ -18,8 +17,6 @@ import com.fr.stable.EssentialUtils; import com.fr.stable.StringUtils; import javax.swing.*; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -52,14 +49,18 @@ public class SortColumnRowPane extends JPanel { } void initSize() { - jTextFieldWidth = (paneWidth - 42) / 2; + jTextFieldWidth = (paneWidth - 40) / 2; } void intUILabel() { - UILabel uiLabel = new UILabel(BaseUtils.readIcon("com\\fr\\design\\images\\buttonicon\\propertiestab\\cellelement_normal.png")); + UILabel uiLabel = new UILabel(IconUtils.readIcon("/com/fr/design/images/buttonicon/propertiestab/cellelement_normal.png")); this.add(uiLabel); } + public static boolean isAvailableColumnRow(ColumnRow columnRow) { + return columnRow != null && columnRow.getRow() != -1 && columnRow.getColumn() != -1; + } + void initTextField() { colJTextField = new JTextField(); @@ -73,18 +74,20 @@ public class SortColumnRowPane extends JPanel { } void initSelectButton() { - selectButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/buttonicon/select.png")); + selectButton = new UIButton(IconUtils.readIcon("/com/fr/design/images/buttonicon/select.png")); selectButton.addActionListener(new SelectActionListener(this)); this.add(selectButton); } public void populateBean(ColumnRow columnRow) { - if (columnRow != null && columnRow.getRow() != -1 && columnRow.getColumn() != -1) { + if (SortColumnRowPane.isAvailableColumnRow(columnRow)) { colJTextField.setText(EssentialUtils.convertIntToABC(columnRow.column + 1)); rowJTextField.setText(String.valueOf(columnRow.row + 1)); + } else { + colJTextField.setText(StringUtils.EMPTY); + rowJTextField.setText(StringUtils.EMPTY); } refresh(); - } public ColumnRow updateBean() { @@ -154,7 +157,6 @@ public class SortColumnRowPane extends JPanel { this.uiObserverListener = uiObserverListener; } - public void removeListener(UIObserverListener uiObserverListener) { this.uiObserverListener = null; } diff --git a/designer-realize/src/main/java/com/fr/design/sort/common/SortUIExpandablePane.java b/designer-realize/src/main/java/com/fr/design/sort/common/SortUIExpandablePane.java index ccee50fe75..47c6c62cc7 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/common/SortUIExpandablePane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/common/SortUIExpandablePane.java @@ -4,6 +4,7 @@ import com.fr.base.BaseUtils; import com.fr.base.svg.IconUtils; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import javax.swing.*; import java.awt.*; @@ -73,7 +74,7 @@ public class SortUIExpandablePane extends JPanel { private void initComponents() { iconUiLabel = new UILabel(); this.add(iconUiLabel); - UILabel uiLabel = new UILabel("次要排序列"); + UILabel uiLabel = new UILabel(Toolkit.i18nText("Fine-Design_Sort_Second_Sort")); this.add(uiLabel); this.add(AbstractSortPane.createIntervalUILabel(114)); @@ -85,8 +86,7 @@ public class SortUIExpandablePane extends JPanel { sortGroupPane.removeSortItem(1); } }); - System.out.println(contentPane.sortItemPaneWidth); - this.setPreferredSize(new Dimension(contentPane.sortItemPaneWidth+7, AbstractSortPane.PANE_COMPONENT_HEIGHT)); + this.setPreferredSize(new Dimension(contentPane.sortItemPaneWidth + 7, AbstractSortPane.PANE_COMPONENT_HEIGHT)); } public void setShow(boolean show) { diff --git a/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CellSortExpressionPane.java b/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CellSortExpressionPane.java index 863ca6d22b..5891cfcf09 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CellSortExpressionPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CellSortExpressionPane.java @@ -1,5 +1,7 @@ package com.fr.design.sort.expressionpane; +import com.fr.design.i18n.Toolkit; +import com.fr.locale.InterProviderFactory; import com.fr.report.core.sort.sortexpression.CellSortExpression; @@ -14,7 +16,7 @@ public class CellSortExpressionPane extends SortExpressionPane Date: Thu, 9 Dec 2021 22:19:02 +0800 Subject: [PATCH 3/8] =?UTF-8?q?REPORT-62440=20=E8=A1=A8=E5=A4=B4=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E5=86=85=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/cell/settingpane/CellExpandAttrPane.java | 3 ++- .../java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java index 979d4534f6..2a9aab95de 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java @@ -83,7 +83,8 @@ public class CellExpandAttrPane extends AbstractCellAttrPane { seniorPane = new JPanel(); basicPane = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Basic"), 223, 24, basicPane()); seniorPane = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Advanced"), 223, 24, seniorPane()); - JPanel sortUIExpandablePane = new UIExpandablePane("扩展后排序", 223, 24, cellExpandSortPane = new CellExpandSortPane(this)); + JPanel sortUIExpandablePane = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Expend_Sort"), + 223, 24, cellExpandSortPane = new CellExpandSortPane(this)); layoutPane.add(basicPane, BorderLayout.NORTH); layoutPane.add(seniorPane, BorderLayout.CENTER); layoutPane.add(sortUIExpandablePane, BorderLayout.SOUTH); diff --git a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java index 3d82ebb315..473cb599ac 100644 --- a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java +++ b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java @@ -651,7 +651,8 @@ public class CellDSColumnEditor extends CellQuickEditor { JPanel advancePropertyPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, HGAP, VGAP); contentPane.add(advancePropertyPane, BorderLayout.NORTH); UIExpandablePane sortUIExpandablePane = - new UIExpandablePane("扩展后排序", 223, 24, cellDSColumnSortPane = new CellDSColumnSortPane()); + new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Expend_Sort"), + 223, 24, cellDSColumnSortPane = new CellDSColumnSortPane()); contentPane.add(sortUIExpandablePane, BorderLayout.CENTER); return contentPane; From 787fb204af5b69a24d67d8d4f4aec810033916b6 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Thu, 9 Dec 2021 22:21:32 +0800 Subject: [PATCH 4/8] =?UTF-8?q?REPORT-62440=20=E8=A1=A8=E5=A4=B4=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E5=86=85=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/sort/celldscolumn/CellDSColumnSortPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortPane.java b/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortPane.java index 9760de0ff2..20c65cb801 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortPane.java @@ -41,7 +41,7 @@ public class CellDSColumnSortPane extends AbstractSortPane { DSColumn dsColumn = ((DSColumn) cellElement.getValue()); TableDataColumn tableDataColumn = dsColumn.getColumn(); if (tableDataColumn instanceof TableDataColumn.ColumnName) { - selfSortArea = ((TableDataColumn.ColumnName) dsColumn.getColumn()).getName(); + selfSortArea = TableDataColumn.getColumnName(tableDataColumn); } } } From 20452f96e5bc2a55856ac3158e82a4d38e0d9498 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Thu, 9 Dec 2021 22:56:03 +0800 Subject: [PATCH 5/8] =?UTF-8?q?REPORT-62440=20=E8=A1=A8=E5=A4=B4=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E5=86=85=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sort/celldscolumn/CellDSColumnSortGroupPane.java | 2 -- .../sort/celldscolumn/CellDSColumnSortItemPane.java | 2 -- .../fr/design/sort/celldscolumn/CellDSColumnSortPane.java | 7 +------ .../design/sort/cellexpand/CellExpandSortGroupPane.java | 1 - .../fr/design/sort/cellexpand/CellExpandSortItemPane.java | 1 - .../com/fr/design/sort/cellexpand/CellExpandSortPane.java | 1 - .../com/fr/design/sort/common/AbstractSortItemPane.java | 5 ----- .../java/com/fr/design/sort/common/AbstractSortPane.java | 5 ----- .../java/com/fr/design/sort/common/SortColumnRowPane.java | 1 - .../com/fr/design/sort/common/SortUIExpandablePane.java | 1 - .../sort/expressionpane/CellSortExpressionPane.java | 1 - .../sort/expressionpane/CustomSequenceEditPane.java | 1 - .../fr/design/sort/expressionpane/CustomSequencePane.java | 8 ++------ .../expressionpane/CustomSequenceSortExpressionPane.java | 2 -- .../java/com/fr/design/sort/header/HeaderAreaPane.java | 3 --- .../java/com/fr/design/sort/header/HeaderSettingPane.java | 1 - .../com/fr/design/sort/header/HeaderSortRulePane.java | 6 ------ .../java/com/fr/design/sort/header/SortHeaderPane.java | 6 +----- 18 files changed, 4 insertions(+), 50 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortGroupPane.java b/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortGroupPane.java index f5cdd0a8d9..c74c3c9e3e 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortGroupPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortGroupPane.java @@ -11,7 +11,6 @@ import com.fr.report.core.sort.sortexpression.SortExpression; public class CellDSColumnSortGroupPane extends AbstractSortGroupPane { DSColumn dsColumn; - public CellDSColumnSortGroupPane(int sortGroupPaneWidth, int sortGroupPaneRightWidth) { super(sortGroupPaneWidth, sortGroupPaneRightWidth); } @@ -20,7 +19,6 @@ public class CellDSColumnSortGroupPane extends AbstractSortGroupPane { this.dsColumn = dsColumn; } - @Override protected AbstractSortItemPane refreshSortItemPane(int sortItemPaneWidth, int sortItemPaneRightWidth, SortExpression sortExpression) { CellDSColumnSortItemPane cellDSColumnSortItemPane = new CellDSColumnSortItemPane( sortItemPaneWidth, sortItemPaneRightWidth); diff --git a/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortItemPane.java b/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortItemPane.java index c87b729e65..cd7b33ee02 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortItemPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortItemPane.java @@ -12,7 +12,6 @@ import java.awt.*; public class CellDSColumnSortItemPane extends AbstractSortItemPane { - UIComboBox sortAreaUiComboBox; public CellDSColumnSortItemPane(int sortItemPaneWidth, int sortItemPaneRightWidth) { @@ -44,7 +43,6 @@ public class CellDSColumnSortItemPane extends AbstractSortItemPane { sortAreaUiComboBox.registerChangeListener(uiObserverListener); } - public void removeListener(UIObserverListener uiObserverListener) { super.removeListener(uiObserverListener); sortAreaUiComboBox.removeChangeListener(); diff --git a/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortPane.java b/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortPane.java index 20c65cb801..c215ab1507 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortPane.java @@ -9,20 +9,16 @@ import com.fr.report.core.sort.common.CellSortAttr; public class CellDSColumnSortPane extends AbstractSortPane { - public CellDSColumnSortPane() { super(220, 150); - } - @Override protected void initSortGroupPane() { sortGroupPane = new CellDSColumnSortGroupPane(sortPaneWidth, sortPaneRightWidth); this.add(sortGroupPane); } - @Override protected CellSortAttr getCellSortAttr(TemplateCellElement cellElement) { if (cellElement.getValue() instanceof DSColumn) { @@ -40,13 +36,12 @@ public class CellDSColumnSortPane extends AbstractSortPane { if (cellElement.getValue() instanceof DSColumn) { DSColumn dsColumn = ((DSColumn) cellElement.getValue()); TableDataColumn tableDataColumn = dsColumn.getColumn(); - if (tableDataColumn instanceof TableDataColumn.ColumnName) { + if (tableDataColumn instanceof TableDataColumn) { selfSortArea = TableDataColumn.getColumnName(tableDataColumn); } } } - public void populateBean(TemplateCellElement cellElement) { if (cellElement.getValue() instanceof DSColumn) { DSColumn dsColumn = ((DSColumn) cellElement.getValue()); diff --git a/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortGroupPane.java b/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortGroupPane.java index 330b43d739..62cb37e91f 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortGroupPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortGroupPane.java @@ -6,7 +6,6 @@ import com.fr.report.core.sort.sortexpression.SortExpression; public class CellExpandSortGroupPane extends AbstractSortGroupPane { - public CellExpandSortGroupPane(int sortGroupPaneWidth, int sortGroupPaneRightWidth) { super(sortGroupPaneWidth, sortGroupPaneRightWidth); } diff --git a/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortItemPane.java b/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortItemPane.java index 3812fbaf62..12be4ec20d 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortItemPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortItemPane.java @@ -41,7 +41,6 @@ public class CellExpandSortItemPane extends AbstractSortItemPane { columnRowPane.addListener(uiObserverListener); } - public void removeListener(UIObserverListener uiObserverListener) { super.removeListener(uiObserverListener); columnRowPane.removeListener(uiObserverListener); diff --git a/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortPane.java b/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortPane.java index 36243533d3..e230d319dd 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortPane.java @@ -27,7 +27,6 @@ public class CellExpandSortPane extends AbstractSortPane { this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); } - @Override protected void initSortGroupPane() { sortGroupPane = new CellExpandSortGroupPane(sortPaneWidth, sortPaneRightWidth); 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 8a86813396..0e58985528 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 @@ -21,7 +21,6 @@ import java.util.ArrayList; import java.util.List; public abstract class AbstractSortItemPane extends JPanel { - protected int sortItemPaneWidth; protected int sortItemPaneRightWidth; List sortExpressionPanes = new ArrayList<>(); @@ -73,7 +72,6 @@ public abstract class AbstractSortItemPane extends JPanel { this.add(sortRulePane); } - void initSortBasisPanel() { sortBasisPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, AbstractSortPane.PANE_COMPONENT_V_GAP)); sortBasisUiComboBox = new UIComboBox(getSortNames()); @@ -90,8 +88,6 @@ public abstract class AbstractSortItemPane extends JPanel { } } }); - - sortBasisPanel.add(new UILabel(Toolkit.i18nText("Fine-Design_Sort_Sort_Basis"), SwingConstants.LEFT)); sortBasisPanel.add(AbstractSortPane.createIntervalUILabel()); sortBasisPanel.add(sortBasisUiComboBox); @@ -124,7 +120,6 @@ public abstract class AbstractSortItemPane extends JPanel { } else if (sortExpression.getSortRule() == SortRule.NO_SORT) { sortRuleUiComboBox.setSelectedIndex(2); } - for (int i = 0; i < sortExpressionPanes.size(); i++) { if (StringUtils.equals(sortExpression.getSortName(), sortExpressionPanes.get(i).getSortName())) { if (currentSortExpressionPane != null) { diff --git a/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortPane.java b/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortPane.java index 35e8a3c096..24e1f6bac8 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortPane.java @@ -28,7 +28,6 @@ public abstract class AbstractSortPane extends JPanel { protected String selfSortArea; protected String defaultHeaderArea; - public AbstractSortPane(int sortPaneWidth, int sortPaneRightWidth) { this.sortPaneWidth = sortPaneWidth; this.sortPaneRightWidth = sortPaneRightWidth; @@ -36,7 +35,6 @@ public abstract class AbstractSortPane extends JPanel { initComponents(); } - private void initComponents() { initSortGroupPane(); sortHeaderPane = new SortHeaderPane(sortPaneWidth, sortPaneRightWidth + 5); @@ -46,7 +44,6 @@ public abstract class AbstractSortPane extends JPanel { protected abstract void initSortGroupPane(); protected void initUIObserverListener() { - } protected abstract CellSortAttr getCellSortAttr(TemplateCellElement cellElement); @@ -72,7 +69,6 @@ public abstract class AbstractSortPane extends JPanel { refresh(); } - protected void populateSortArea(TemplateCellElement cellElement) { int row = cellElement.getRow(); int column = cellElement.getColumn(); @@ -107,7 +103,6 @@ public abstract class AbstractSortPane extends JPanel { sortHeaderPane.removeListener(uiObserverListener); } - protected void refresh() { validate(); repaint(); 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 489f136bee..814651063b 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 @@ -61,7 +61,6 @@ public class SortColumnRowPane extends JPanel { return columnRow != null && columnRow.getRow() != -1 && columnRow.getColumn() != -1; } - void initTextField() { colJTextField = new JTextField(); colJTextField.setEditable(false); diff --git a/designer-realize/src/main/java/com/fr/design/sort/common/SortUIExpandablePane.java b/designer-realize/src/main/java/com/fr/design/sort/common/SortUIExpandablePane.java index 47c6c62cc7..88e61a4e34 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/common/SortUIExpandablePane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/common/SortUIExpandablePane.java @@ -13,7 +13,6 @@ import java.awt.event.MouseEvent; public class SortUIExpandablePane extends JPanel { - private static final long serialVersionUID = 1L; private HeaderPane headerPane; private AbstractSortItemPane contentPane; diff --git a/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CellSortExpressionPane.java b/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CellSortExpressionPane.java index 5891cfcf09..1381b92cf2 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CellSortExpressionPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CellSortExpressionPane.java @@ -13,7 +13,6 @@ public class CellSortExpressionPane extends SortExpressionPane customSequence; @@ -28,13 +27,10 @@ public class CustomSequencePane extends JPanel { } protected void initComponents(int width) { - textField = new UITextField(); textField.setEditable(false); textField.setPreferredSize(new Dimension(width - 20, 20)); - - // 添加一公式编辑器按钮 - Icon icon = BaseUtils.readIcon("/com/fr/design/images/control/refresh.png"); + Icon icon = IconUtils.readIcon("/com/fr/design/images/control/refresh.png"); button = new UIButton(icon); button.setBackground(Color.RED); button.setPreferredSize(new Dimension(24, 20)); diff --git a/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequenceSortExpressionPane.java b/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequenceSortExpressionPane.java index 6ce23b8e7c..56ccfc511b 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequenceSortExpressionPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequenceSortExpressionPane.java @@ -1,7 +1,5 @@ package com.fr.design.sort.expressionpane; - -import com.fr.design.i18n.Toolkit; import com.fr.design.sort.common.AbstractSortPane; import com.fr.locale.InterProviderFactory; import com.fr.report.core.sort.sortexpression.CustomSequenceSortExpression; 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 799be4f67a..8a728cae17 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 @@ -33,7 +33,6 @@ public class HeaderAreaPane extends JPanel { initLayeredPane(); } - void initUILabel() { UILabel uiLabel = new UILabel(Toolkit.i18nText("Fine-Design_Sort_Header_Area"), SwingConstants.LEFT); this.add(uiLabel); @@ -45,7 +44,6 @@ public class HeaderAreaPane extends JPanel { this.add(areaJLayeredPane); } - public void populateBean(ColumnRow columnRow) { areaJLayeredPane.populateBean(columnRow); } @@ -142,7 +140,6 @@ public class HeaderAreaPane extends JPanel { areaJLayeredPane.addListener(uiObserverListener); } - public void removeListener(UIObserverListener uiObserverListener) { areaJLayeredPane.removeListener(uiObserverListener); } diff --git a/designer-realize/src/main/java/com/fr/design/sort/header/HeaderSettingPane.java b/designer-realize/src/main/java/com/fr/design/sort/header/HeaderSettingPane.java index 7d4f3663cf..38d75e55e5 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/header/HeaderSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/header/HeaderSettingPane.java @@ -84,7 +84,6 @@ public class HeaderSettingPane extends JPanel { headerSortRulePane.addListener(uiObserverListener); } - public void removeListener(UIObserverListener uiObserverListener) { uiCheckBox.removeChangeListener(); headerSortRulePane.removeListener(uiObserverListener); diff --git a/designer-realize/src/main/java/com/fr/design/sort/header/HeaderSortRulePane.java b/designer-realize/src/main/java/com/fr/design/sort/header/HeaderSortRulePane.java index dc9b4f615c..0bff87af5c 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/header/HeaderSortRulePane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/header/HeaderSortRulePane.java @@ -23,8 +23,6 @@ import java.io.InputStream; import java.util.ArrayList; public class HeaderSortRulePane extends JPanel { - - private static final String ASC_ICON_TEMPLATE_PATH = "/com/fr/design/images/sort/asc.svg"; private static final String DES_ICON_TEMPLATE_PATH = "/com/fr/design/images/sort/des.svg"; private static final String NOSORT_ICON_TEMPLATE_PATH = "/com/fr/design/images/sort/nosort.svg"; @@ -35,7 +33,6 @@ public class HeaderSortRulePane extends JPanel { UICheckBox desUICheckBox; UICheckBox nosortUICheckBox; - HeaderSortRulePane() { initComponents(); initState(); @@ -75,7 +72,6 @@ public class HeaderSortRulePane extends JPanel { nosortIconButton.refreshIconLabelColor(new Color(33, 33, 34)); } - class IconButton extends JPanel { JLayeredPane jLayeredPane; String iconTemplatePath; @@ -195,7 +191,6 @@ public class HeaderSortRulePane extends JPanel { } } - public void populateBean(SortHeader.SortItem[] sortItems) { initState(); if (sortItems != null) { @@ -245,7 +240,6 @@ public class HeaderSortRulePane extends JPanel { nosortUICheckBox.registerChangeListener(uiObserverListener); } - public void removeListener(UIObserverListener uiObserverListener) { ascIconButton.removeListener(uiObserverListener); desIconButton.removeListener(uiObserverListener); diff --git a/designer-realize/src/main/java/com/fr/design/sort/header/SortHeaderPane.java b/designer-realize/src/main/java/com/fr/design/sort/header/SortHeaderPane.java index 2780139338..ff8807d835 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/header/SortHeaderPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/header/SortHeaderPane.java @@ -22,7 +22,6 @@ public class SortHeaderPane extends JPanel { this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); } - void initHeaderArea() { this.headerAreaPane = new HeaderAreaPane(sortHeaderPaneWidth, sortHeaderPaneRightWidth); this.add(headerAreaPane); @@ -33,7 +32,6 @@ public class SortHeaderPane extends JPanel { this.add(headerSettingPane); } - public void populateBean(SortHeader sortHeader, String defaultHeaderArea) { this.sortHeader = sortHeader; ColumnRow columnRow = null; @@ -65,10 +63,8 @@ public class SortHeaderPane extends JPanel { headerSettingPane.addListener(uiObserverListener); } - public void removeListener(UIObserverListener uiObserverListener) { headerAreaPane.removeListener(uiObserverListener); headerSettingPane.removeListener(uiObserverListener); } -} - +} \ No newline at end of file From 1b66571feb613f605467f6e734062ddf5288b588 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Sun, 12 Dec 2021 15:29:47 +0800 Subject: [PATCH 6/8] =?UTF-8?q?REPORT-62440=20=E8=A1=A8=E5=A4=B4=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E5=86=85=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/event/ComponentChangeListener.java | 7 + .../design/event/ComponentChangeObserver.java | 6 + .../gui/frpane/AbstractAttrNoScrollPane.java | 11 + .../cell/AbstractDSCellEditorPane.java | 109 +-------- .../CellDSColumnSortItemPane.java | 10 - .../celldscolumn/CellDSColumnSortPane.java | 4 + .../cellexpand/CellExpandSortItemPane.java | 11 - .../sort/cellexpand/CellExpandSortPane.java | 23 +- .../sort/common/AbstractSortGroupPane.java | 128 +++++----- .../sort/common/AbstractSortItemPane.java | 12 - .../design/sort/common/AbstractSortPane.java | 18 -- .../design/sort/common/SortColumnRowPane.java | 31 ++- .../sort/common/SortUIExpandablePane.java | 5 +- .../CustomSequenceSortExpressionPane.java | 2 + .../FormulaSortExpressionPane.java | 1 - .../fr/design/sort/header/HeaderAreaPane.java | 22 -- .../design/sort/header/HeaderSettingPane.java | 10 - .../sort/header/HeaderSortRulePane.java | 33 +-- .../fr/design/sort/header/SortHeaderPane.java | 11 - .../cellquick/CellDSColumnEditor.java | 223 ++++-------------- 20 files changed, 180 insertions(+), 497 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/event/ComponentChangeListener.java create mode 100644 designer-base/src/main/java/com/fr/design/event/ComponentChangeObserver.java diff --git a/designer-base/src/main/java/com/fr/design/event/ComponentChangeListener.java b/designer-base/src/main/java/com/fr/design/event/ComponentChangeListener.java new file mode 100644 index 0000000000..c4087ef112 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/event/ComponentChangeListener.java @@ -0,0 +1,7 @@ +package com.fr.design.event; + +import java.awt.*; + +public interface ComponentChangeListener { + void initListener(Container parentComponent); +} diff --git a/designer-base/src/main/java/com/fr/design/event/ComponentChangeObserver.java b/designer-base/src/main/java/com/fr/design/event/ComponentChangeObserver.java new file mode 100644 index 0000000000..9ef75d514a --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/event/ComponentChangeObserver.java @@ -0,0 +1,6 @@ +package com.fr.design.event; + + +public interface ComponentChangeObserver { + void registerChangeListener(ComponentChangeListener uiChangeableListener); +} diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java index ce09568d6b..0465702965 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java @@ -3,6 +3,8 @@ package com.fr.design.gui.frpane; import com.fr.design.dialog.BasicPane; import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameObserver; +import com.fr.design.event.ComponentChangeListener; +import com.fr.design.event.ComponentChangeObserver; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.stable.StringUtils; @@ -106,6 +108,15 @@ public abstract class AbstractAttrNoScrollPane extends BasicPane { } }); } + if(tmpComp instanceof ComponentChangeObserver){ + ComponentChangeObserver uiChangeableObserver = ((ComponentChangeObserver)tmpComp); + uiChangeableObserver.registerChangeListener(new ComponentChangeListener() { + @Override + public void initListener(Container parentComponent) { + AbstractAttrNoScrollPane.this.initListener(parentComponent); + } + }); + } } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/AbstractDSCellEditorPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/AbstractDSCellEditorPane.java index 8a3b2ded4d..86b93a210d 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/AbstractDSCellEditorPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/AbstractDSCellEditorPane.java @@ -1,17 +1,7 @@ package com.fr.design.mainframe.cell; -import com.fr.design.gui.iscrollbar.UIScrollBar; -import com.fr.design.mainframe.CellElementPropertyPane; -import com.fr.quickeditor.cellquick.layout.CellElementBarLayout; - -import javax.swing.BorderFactory; -import javax.swing.JPanel; -import java.awt.Container; -import java.awt.Dimension; -import java.awt.event.AdjustmentEvent; -import java.awt.event.AdjustmentListener; -import java.awt.event.MouseWheelEvent; -import java.awt.event.MouseWheelListener; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.mainframe.AbstractAttrPane; /** * 右侧单元格元素面板抽象类 @@ -20,26 +10,8 @@ import java.awt.event.MouseWheelListener; * @version 2017年7月25日 * @since 9.0 */ -public abstract class AbstractDSCellEditorPane extends JPanel { - - /** - * 滚动条相关配置 - */ - private static final int MAXVALUE = 100; - private static final int TITLE_HEIGHT = 95; - private static final int CONTENT_PANE_WIDTH_GAP = 3; - private static final int SCROLLBAR_WIDTH = 7; - private static final int MOUSE_WHEEL_SPEED = 5; - private int maxHeight = 280; - - private JPanel leftContentPane; - private UIScrollBar scrollBar; +public abstract class AbstractDSCellEditorPane extends AbstractAttrPane { - protected abstract JPanel createContentPane(); - - public abstract String getIconPath(); - - public abstract String title4PopupWindow(); /** * 从面板拿数据保存 @@ -51,78 +23,15 @@ public abstract class AbstractDSCellEditorPane extends JPanel { */ public abstract void populate(); - protected void createScrollPane() { - leftContentPane = this.createContentPane(); - this.prepareScrollBar(); - leftContentPane.setBorder(BorderFactory.createMatteBorder(10, 10, 0, 0, this.getBackground())); - - this.setLayout(new CellElementBarLayout(leftContentPane) { - @Override - public void layoutContainer(Container parent) { - maxHeight = CellElementPropertyPane.getInstance().getHeight() - TITLE_HEIGHT; - int beginY; - if ((MAXVALUE - scrollBar.getVisibleAmount()) == 0) { - beginY = 0; - } else { - int preferredHeight = leftContentPane.getPreferredSize().height; - int value = scrollBar.getValue(); - beginY = value * (preferredHeight - maxHeight) / (MAXVALUE - scrollBar.getVisibleAmount()); - } - int width = parent.getWidth(); - int height = parent.getHeight(); - if (leftContentPane.getPreferredSize().height > maxHeight) { - leftContentPane.setBounds(0, -beginY, width - SCROLLBAR_WIDTH - CONTENT_PANE_WIDTH_GAP, height + beginY); - scrollBar.setBounds(width - SCROLLBAR_WIDTH - CONTENT_PANE_WIDTH_GAP, 0, SCROLLBAR_WIDTH + CONTENT_PANE_WIDTH_GAP, height); - } else { - leftContentPane.setBounds(0, 0, width - SCROLLBAR_WIDTH - CONTENT_PANE_WIDTH_GAP, height); - } - } - }); - this.add(scrollBar); - this.add(leftContentPane); - } - - - private void prepareScrollBar() { - scrollBar = new UIScrollBar(UIScrollBar.VERTICAL) { - @Override - public int getVisibleAmount() { - int preferredHeight = leftContentPane.getPreferredSize().height; - int e = MAXVALUE * (maxHeight) / preferredHeight; - setVisibleAmount(e); - return e; - } - - @Override - public int getMaximum() { - return MAXVALUE; - } - }; - - scrollBar.addAdjustmentListener(new AdjustmentListener() { - - @Override - public void adjustmentValueChanged(AdjustmentEvent e) { - doLayout(); - } - }); - this.addMouseWheelListener(new MouseWheelListener() { - - @Override - public void mouseWheelMoved(MouseWheelEvent e) { - int value = scrollBar.getValue(); - value += MOUSE_WHEEL_SPEED * e.getWheelRotation(); - scrollBar.setValue(value); - doLayout(); - } - }); - scrollBar.setPreferredSize(new Dimension(SCROLLBAR_WIDTH + CONTENT_PANE_WIDTH_GAP, this.getHeight())); - scrollBar.setBlockIncrement(SCROLLBAR_WIDTH + CONTENT_PANE_WIDTH_GAP); - scrollBar.setBorder(BorderFactory.createMatteBorder(0, CONTENT_PANE_WIDTH_GAP, 0, 0, this.getBackground())); - } /** * 释放tc */ protected abstract void release(); + + protected abstract AttributeChangeListener getAttributeChangeListener(); + + public void addAttributeChangeListener(){ + this.addAttributeChangeListener(getAttributeChangeListener()); + } } diff --git a/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortItemPane.java b/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortItemPane.java index cd7b33ee02..044d284a7f 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortItemPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortItemPane.java @@ -1,6 +1,5 @@ package com.fr.design.sort.celldscolumn; -import com.fr.design.event.UIObserverListener; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.sort.common.AbstractSortItemPane; import com.fr.design.sort.common.AbstractSortPane; @@ -38,13 +37,4 @@ public class CellDSColumnSortItemPane extends AbstractSortItemPane { return sortExpression; } - public void addListener(UIObserverListener uiObserverListener) { - super.addListener(uiObserverListener); - sortAreaUiComboBox.registerChangeListener(uiObserverListener); - } - - public void removeListener(UIObserverListener uiObserverListener) { - super.removeListener(uiObserverListener); - sortAreaUiComboBox.removeChangeListener(); - } } \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortPane.java b/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortPane.java index c215ab1507..aec9c0bccf 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortPane.java @@ -1,16 +1,20 @@ package com.fr.design.sort.celldscolumn; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.sort.common.AbstractSortPane; import com.fr.general.data.TableDataColumn; import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.cellattr.core.group.DSColumn; import com.fr.report.core.sort.common.CellSortAttr; +import javax.swing.*; + public class CellDSColumnSortPane extends AbstractSortPane { public CellDSColumnSortPane() { super(220, 150); + //this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortItemPane.java b/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortItemPane.java index 12be4ec20d..4b14dc6929 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortItemPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortItemPane.java @@ -1,6 +1,5 @@ package com.fr.design.sort.cellexpand; -import com.fr.design.event.UIObserverListener; import com.fr.design.sort.common.AbstractSortPane; import com.fr.design.sort.common.SortColumnRowPane; import com.fr.design.sort.common.AbstractSortItemPane; @@ -35,14 +34,4 @@ public class CellExpandSortItemPane extends AbstractSortItemPane { } return sortExpression; } - - public void addListener(UIObserverListener uiObserverListener) { - super.addListener(uiObserverListener); - columnRowPane.addListener(uiObserverListener); - } - - public void removeListener(UIObserverListener uiObserverListener) { - super.removeListener(uiObserverListener); - columnRowPane.removeListener(uiObserverListener); - } } diff --git a/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortPane.java b/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortPane.java index e230d319dd..5bfc20eeae 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortPane.java @@ -1,22 +1,14 @@ package com.fr.design.sort.cellexpand; -import com.fr.design.event.UIObserverListener; -import com.fr.design.gui.frpane.AttributeChangeListener; + import com.fr.design.mainframe.cell.settingpane.CellExpandAttrPane; import com.fr.design.sort.common.AbstractSortPane; import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.cellattr.CellExpandAttr; -import com.fr.report.cell.cellattr.core.group.DSColumn; import com.fr.report.core.sort.common.CellSortAttr; -import com.fr.report.core.sort.sortexpression.FormulaSortExpression; -import com.fr.report.core.sort.sortexpression.SortExpression; -import com.fr.report.core.sort.header.SortHeader; -import com.fr.report.core.sort.common.SortRule; import javax.swing.*; -import java.util.ArrayList; -import java.util.List; public class CellExpandSortPane extends AbstractSortPane { CellExpandAttrPane cellExpandAttrPane; @@ -33,19 +25,6 @@ public class CellExpandSortPane extends AbstractSortPane { this.add(sortGroupPane); } - @Override - protected void initUIObserverListener() { - uiObserverListener = new UIObserverListener() { - @Override - public void doChange() { - AttributeChangeListener attributeChangeListener = cellExpandAttrPane.getListener(); - if (attributeChangeListener != null) { - attributeChangeListener.attributeChange(); - } - } - }; - } - @Override protected CellSortAttr getCellSortAttr(TemplateCellElement cellElement) { CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr(); diff --git a/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortGroupPane.java b/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortGroupPane.java index ed1fde2420..85cd58ec94 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortGroupPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortGroupPane.java @@ -1,7 +1,8 @@ package com.fr.design.sort.common; import com.fr.base.svg.IconUtils; -import com.fr.design.event.UIObserverListener; +import com.fr.design.event.ComponentChangeListener; +import com.fr.design.event.ComponentChangeObserver; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.i18n.Toolkit; import com.fr.report.core.sort.sortexpression.CellSortExpression; @@ -9,98 +10,114 @@ import com.fr.report.core.sort.sortexpression.SortExpression; import javax.swing.*; import java.awt.*; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; -public abstract class AbstractSortGroupPane extends JPanel { +public abstract class AbstractSortGroupPane extends JPanel implements ComponentChangeObserver { protected int sortGroupPaneWidth; protected int sortGroupPaneRightWidth; - UIObserverListener uiObserverListener; List sortExpressions; - List sortItemPanes = new ArrayList<>(); + List sortItemPanes = new ArrayList<>(); AddSortItemBar addSortItemBar; + JPanel sortItemListPane; UIButton uiButton; String selfSortArea; + ComponentChangeListener componentChangeListener; + public AbstractSortGroupPane(int sortGroupPaneWidth, int sortGroupPaneRightWidth) { this.sortGroupPaneRightWidth = sortGroupPaneRightWidth; this.sortGroupPaneWidth = sortGroupPaneWidth; this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); - initComponents(); } private void initComponents() { addSortItemBar = new AddSortItemBar(this); + sortItemListPane = new JPanel(); + sortItemListPane.setLayout(new BoxLayout(sortItemListPane, BoxLayout.Y_AXIS)); + this.add(sortItemListPane); this.add(addSortItemBar); } public void populateBean(List sortExpressions, String selfSortArea) { + this.sortItemListPane.removeAll(); this.selfSortArea = selfSortArea; this.sortExpressions = sortExpressions; - refreshBean(); - } - - public void refreshBean() { - removeListener(uiObserverListener); - this.removeAll(); - sortItemPanes = new ArrayList<>(); + this.sortItemPanes = new ArrayList<>(); for (int i = 0; i < sortExpressions.size(); i++) { - int sortItemPaneWidth = sortGroupPaneWidth; - int sortItemPaneRightWidth = sortGroupPaneRightWidth; - if (i != 0) { - sortItemPaneWidth -= 12; - sortItemPaneRightWidth -= 12; - } - AbstractSortItemPane sortItemPane = refreshSortItemPane(sortItemPaneWidth, sortItemPaneRightWidth, sortExpressions.get(i)); - sortItemPanes.add(sortItemPane); - if (i == 0) { - this.add(sortItemPane); - } else { - SortUIExpandablePane sortUIExpandablePane = new SortUIExpandablePane(sortItemPane, this); - this.add(sortUIExpandablePane); - } + addSortItem(sortExpressions.get(i), i == 0); } - initComponents(); - addListener(uiObserverListener); refresh(); } protected abstract AbstractSortItemPane refreshSortItemPane(int sortItemPaneWidth, int sortItemPaneRightWidth, SortExpression sortExpression); public List updateBean() { - updateSortExpressions(); - return sortExpressions; - } - - private void updateSortExpressions() { - sortExpressions = new ArrayList<>(); - for (AbstractSortItemPane sortItemPane : sortItemPanes) { - SortExpression sortExpression = sortItemPane.updateBean(); + List sortExpressions = new ArrayList<>(); + for (JPanel sortItemPane : sortItemPanes) { + SortExpression sortExpression = null; + AbstractSortItemPane abstractSortItemPane = null; + if (sortItemPane instanceof AbstractSortItemPane) { + abstractSortItemPane = (AbstractSortItemPane) sortItemPane; + } else if (sortItemPane instanceof SortUIExpandablePane) { + abstractSortItemPane = (AbstractSortItemPane) ((SortUIExpandablePane) sortItemPane).getContentPane(); + } + if (abstractSortItemPane != null) { + sortExpression = abstractSortItemPane.updateBean(); + } if (sortExpression != null) { sortExpressions.add(sortExpression); } } + return sortExpressions; } + public void removeSortItem(int no) { - updateSortExpressions(); if (no < sortExpressions.size()) { + sortItemListPane.remove(sortItemPanes.get(no)); sortExpressions.remove(no); + sortItemPanes.remove(no); + refresh(); } - refreshBean(); } - public void addSortItem() { - updateSortExpressions(); - sortExpressions.add(new CellSortExpression(selfSortArea)); - refreshBean(); + public void registerChangeListener(ComponentChangeListener componentChangeListener) { + this.componentChangeListener = componentChangeListener; } + public void addSortItem(SortExpression sortExpression, boolean mainSort) { + int sortItemPaneWidth = sortGroupPaneWidth; + int sortItemPaneRightWidth = sortGroupPaneRightWidth; + if (!mainSort) { + sortItemPaneWidth -= 12; + sortItemPaneRightWidth -= 12; + } + if (sortExpression == null) { + sortExpression = new CellSortExpression(selfSortArea); + sortExpressions.add(sortExpression); + } + + AbstractSortItemPane abstractSortItemPane = + refreshSortItemPane(sortItemPaneWidth, sortItemPaneRightWidth, sortExpression); + + JPanel sortItemPane = abstractSortItemPane; + if (!mainSort) { + sortItemPane = new SortUIExpandablePane(abstractSortItemPane, this); + } + sortItemListPane.add(sortItemPane); + sortItemPanes.add(sortItemPane); + + if (componentChangeListener != null) { + componentChangeListener.initListener(sortItemPane); + } + refresh(); + } protected void refresh() { validate(); @@ -121,28 +138,11 @@ public abstract class AbstractSortGroupPane extends JPanel { IconUtils.readIcon("/com/fr/design/images/sort/add.png")); uiButton.setPreferredSize(new Dimension(sortGroupPaneWidth - 4, 20)); this.add(uiButton); - uiButton.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent e) { - sortGroupPane.addSortItem(); - uiObserverListener.doChange(); + uiButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + sortGroupPane.addSortItem(null, false); } }); } } - - - public void addListener(UIObserverListener uiObserverListener) { - this.uiObserverListener = uiObserverListener; - for (AbstractSortItemPane abstractSortItemPane : sortItemPanes) { - abstractSortItemPane.addListener(uiObserverListener); - } - } - - public void removeListener(UIObserverListener uiObserverListener) { - for (AbstractSortItemPane abstractSortItemPane : sortItemPanes) { - abstractSortItemPane.removeListener(uiObserverListener); - } - } - } 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 0e58985528..82d14bb7ec 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 @@ -1,6 +1,5 @@ package com.fr.design.sort.common; -import com.fr.design.event.UIObserverListener; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; @@ -146,17 +145,6 @@ public abstract class AbstractSortItemPane extends JPanel { return sortExpression; } - public void addListener(UIObserverListener uiObserverListener) { - sortBasisUiComboBox.registerChangeListener(uiObserverListener); - sortRuleUiComboBox.registerChangeListener(uiObserverListener); - } - - - public void removeListener(UIObserverListener uiObserverListener) { - sortBasisUiComboBox.removeChangeListener(); - sortRuleUiComboBox.removeChangeListener(); - } - protected void refresh() { validate(); repaint(); diff --git a/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortPane.java b/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortPane.java index 24e1f6bac8..7dd539361a 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortPane.java @@ -1,6 +1,5 @@ package com.fr.design.sort.common; -import com.fr.design.event.UIObserverListener; import com.fr.design.gui.ilable.UILabel; import com.fr.design.sort.header.SortHeaderPane; import com.fr.report.cell.TemplateCellElement; @@ -22,7 +21,6 @@ public abstract class AbstractSortPane extends JPanel { public static final int PANE_COMPONENT_HEIGHT = 20; public static final int PANE_COMPONENT_V_GAP = 4; public static final int PANE_COMPONENT_H_GAP = 14; - protected UIObserverListener uiObserverListener; protected AbstractSortGroupPane sortGroupPane; protected SortHeaderPane sortHeaderPane; protected String selfSortArea; @@ -31,7 +29,6 @@ public abstract class AbstractSortPane extends JPanel { public AbstractSortPane(int sortPaneWidth, int sortPaneRightWidth) { this.sortPaneWidth = sortPaneWidth; this.sortPaneRightWidth = sortPaneRightWidth; - initUIObserverListener(); initComponents(); } @@ -43,8 +40,6 @@ public abstract class AbstractSortPane extends JPanel { protected abstract void initSortGroupPane(); - protected void initUIObserverListener() { - } protected abstract CellSortAttr getCellSortAttr(TemplateCellElement cellElement); @@ -65,7 +60,6 @@ public abstract class AbstractSortPane extends JPanel { sortHeader = cellSortAttr.getSortHeader(); } sortHeaderPane.populateBean(sortHeader, defaultHeaderArea); - addListener(uiObserverListener); refresh(); } @@ -91,18 +85,6 @@ public abstract class AbstractSortPane extends JPanel { cellSortAttr.setSortHeader(sortHeader); } - - public void addListener(UIObserverListener uiObserverListener) { - sortGroupPane.addListener(uiObserverListener); - sortHeaderPane.addListener(uiObserverListener); - } - - - public void removeListener(UIObserverListener uiObserverListener) { - sortGroupPane.removeListener(uiObserverListener); - sortHeaderPane.removeListener(uiObserverListener); - } - protected void refresh() { validate(); repaint(); 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 814651063b..e8371b3e1b 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 @@ -2,6 +2,7 @@ package com.fr.design.sort.common; import com.fr.base.svg.IconUtils; import com.fr.design.designer.TargetComponent; +import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.gui.ibutton.UIButton; @@ -21,7 +22,7 @@ import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -public class SortColumnRowPane extends JPanel { +public class SortColumnRowPane extends JPanel implements UIObserver { int paneWidth; int paneHeight; int jTextFieldWidth; @@ -89,6 +90,11 @@ public class SortColumnRowPane extends JPanel { refresh(); } + public void setColumnRow(ColumnRow columnRow){ + populateBean(columnRow); + uiObserverListener.doChange(); + } + public ColumnRow updateBean() { if (StringUtils.isNotBlank(colJTextField.getText()) && StringUtils.isNotBlank(rowJTextField.getText())) { return ColumnRow.valueOf(colJTextField.getText() + rowJTextField.getText()); @@ -96,6 +102,16 @@ public class SortColumnRowPane extends JPanel { return null; } + @Override + public void registerChangeListener(UIObserverListener listener) { + this.uiObserverListener = listener; + } + + @Override + public boolean shouldResponseChangeListener() { + return true; + } + class SelectActionListener implements ActionListener { SortColumnRowPane columnRowPane; @@ -122,10 +138,7 @@ public class SortColumnRowPane extends JPanel { CellSelection cellselection = (CellSelection) selection; ColumnRow cr = ColumnRow.valueOf(cellselection.getColumn(), cellselection.getRow()); elementCasePane.setOldSelecton(oldSelection); - columnRowPane.populateBean(cr); - if (columnRowPane.uiObserverListener != null) { - columnRowPane.uiObserverListener.doChange(); - } + columnRowPane.setColumnRow(cr); } elementCasePane.removeSelectionChangeListener(gridSelectionChangeListener); isAlreadyAddListener = false; @@ -152,14 +165,6 @@ public class SortColumnRowPane extends JPanel { return null; } - public void addListener(UIObserverListener uiObserverListener) { - this.uiObserverListener = uiObserverListener; - } - - public void removeListener(UIObserverListener uiObserverListener) { - this.uiObserverListener = null; - } - protected void refresh() { validate(); repaint(); diff --git a/designer-realize/src/main/java/com/fr/design/sort/common/SortUIExpandablePane.java b/designer-realize/src/main/java/com/fr/design/sort/common/SortUIExpandablePane.java index 88e61a4e34..c5537ff533 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/common/SortUIExpandablePane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/common/SortUIExpandablePane.java @@ -48,12 +48,12 @@ public class SortUIExpandablePane extends JPanel { contentPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); wrapPane.add(headerPane, BorderLayout.NORTH); wrapPane.add(contentPane, BorderLayout.CENTER); - setContentPanelShow(false); + setContentPanelShow(true); this.add(wrapPane); } - private void setContentPanelShow(boolean show) { + private void setContentPanelShow(Boolean show) { contentPane.setVisible(show); headerPane.setShow(show); } @@ -67,7 +67,6 @@ public class SortUIExpandablePane extends JPanel { this.sortGroupPane = sortGroupPane; this.setLayout(new FlowLayout(FlowLayout.LEFT, 3, 3)); initComponents(); - } private void initComponents() { diff --git a/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequenceSortExpressionPane.java b/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequenceSortExpressionPane.java index 56ccfc511b..3e20d5de92 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequenceSortExpressionPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequenceSortExpressionPane.java @@ -4,6 +4,7 @@ import com.fr.design.sort.common.AbstractSortPane; import com.fr.locale.InterProviderFactory; import com.fr.report.core.sort.sortexpression.CustomSequenceSortExpression; +import javax.swing.*; import java.awt.*; import java.util.List; @@ -15,6 +16,7 @@ public class CustomSequenceSortExpressionPane extends SortExpressionPane Date: Sun, 12 Dec 2021 15:56:23 +0800 Subject: [PATCH 7/8] =?UTF-8?q?REPORT-62440=20=E8=A1=A8=E5=A4=B4=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E5=86=85=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java | 3 --- .../java/com/fr/extended/chart/AbstractExtendedStylePane.java | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java index 0465702965..26cedd79d4 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java @@ -78,9 +78,6 @@ public abstract class AbstractAttrNoScrollPane extends BasicPane { hasChangeListener = false; } - public AttributeChangeListener getListener() { - return listener; - } public void initListener(Container parentComponent) { for (int i = 0; i < parentComponent.getComponentCount(); i++) { diff --git a/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedStylePane.java b/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedStylePane.java index d71f59a07d..3346c03eca 100644 --- a/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedStylePane.java +++ b/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedStylePane.java @@ -48,7 +48,7 @@ public abstract class AbstractExtendedStylePane extends return this.chart; } - public AttributeChangeListener getListener() { + protected AttributeChangeListener getListener() { return this.listener; } From bd82a9d6949b8793092b28235099a8661e2c75fb Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Sun, 12 Dec 2021 16:51:49 +0800 Subject: [PATCH 8/8] =?UTF-8?q?REPORT-62440=20=E8=A1=A8=E5=A4=B4=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E5=86=85=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/event/ComponentChangeListener.java | 2 +- .../com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/event/ComponentChangeListener.java b/designer-base/src/main/java/com/fr/design/event/ComponentChangeListener.java index c4087ef112..d16d49b6a4 100644 --- a/designer-base/src/main/java/com/fr/design/event/ComponentChangeListener.java +++ b/designer-base/src/main/java/com/fr/design/event/ComponentChangeListener.java @@ -3,5 +3,5 @@ package com.fr.design.event; import java.awt.*; public interface ComponentChangeListener { - void initListener(Container parentComponent); + void initListener(Container changedComponent); } diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java index 26cedd79d4..15d50d00cb 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java @@ -109,8 +109,8 @@ public abstract class AbstractAttrNoScrollPane extends BasicPane { ComponentChangeObserver uiChangeableObserver = ((ComponentChangeObserver)tmpComp); uiChangeableObserver.registerChangeListener(new ComponentChangeListener() { @Override - public void initListener(Container parentComponent) { - AbstractAttrNoScrollPane.this.initListener(parentComponent); + public void initListener(Container changedComponent) { + AbstractAttrNoScrollPane.this.initListener(changedComponent); } }); }