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