Browse Source

REPORT-62440 表头排序内置

feature/x
Henry.Wang 3 years ago
parent
commit
4b710825ae
  1. 2
      designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedStylePane.java
  2. 5
      designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortPane.java
  3. 2
      designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortItemPane.java
  4. 7
      designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortPane.java
  5. 4
      designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortGroupPane.java
  6. 21
      designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortItemPane.java
  7. 16
      designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortPane.java
  8. 22
      designer-realize/src/main/java/com/fr/design/sort/common/SortColumnRowPane.java
  9. 6
      designer-realize/src/main/java/com/fr/design/sort/common/SortUIExpandablePane.java
  10. 4
      designer-realize/src/main/java/com/fr/design/sort/expressionpane/CellSortExpressionPane.java
  11. 19
      designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequenceEditPane.java
  12. 4
      designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequenceSortExpressionPane.java
  13. 37
      designer-realize/src/main/java/com/fr/design/sort/expressionpane/EmptyExpressionPane.java
  14. 4
      designer-realize/src/main/java/com/fr/design/sort/expressionpane/FormulaSortExpressionPane.java
  15. 9
      designer-realize/src/main/java/com/fr/design/sort/header/HeaderAreaPane.java
  16. 5
      designer-realize/src/main/java/com/fr/design/sort/header/HeaderSettingPane.java
  17. 9
      designer-realize/src/main/java/com/fr/design/sort/header/HeaderSortRulePane.java
  18. 12
      designer-realize/src/main/java/com/fr/design/sort/header/SortHeaderPane.java

2
designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedStylePane.java

@ -48,7 +48,7 @@ public abstract class AbstractExtendedStylePane<T extends AbstractChart> extends
return this.chart; return this.chart;
} }
protected AttributeChangeListener getListener() { public AttributeChangeListener getListener() {
return this.listener; return this.listener;
} }

5
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) { protected CellSortAttr getCellSortAttr(TemplateCellElement cellElement) {
if (cellElement.getValue() instanceof DSColumn) { if (cellElement.getValue() instanceof DSColumn) {
DSColumn dsColumn = ((DSColumn) cellElement.getValue()); DSColumn dsColumn = ((DSColumn) cellElement.getValue());
if (dsColumn.getCellSortAttr() == null) {
dsColumn.setCellSortAttr(new CellSortAttr());
}
return dsColumn.getCellSortAttr(); return dsColumn.getCellSortAttr();
} }
return new CellSortAttr(); return null;
} }
protected void populateSortArea(TemplateCellElement cellElement) { protected void populateSortArea(TemplateCellElement cellElement) {

2
designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortItemPane.java

@ -18,7 +18,7 @@ public class CellExpandSortItemPane extends AbstractSortItemPane {
@Override @Override
public void initMainSortAreaPane(JPanel sortAreaPane) { 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); sortAreaPane.add(columnRowPane);
} }

7
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.design.sort.common.AbstractSortPane;
import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.TemplateCellElement;
import com.fr.report.cell.cellattr.CellExpandAttr; 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.common.CellSortAttr;
import com.fr.report.core.sort.sortexpression.FormulaSortExpression; import com.fr.report.core.sort.sortexpression.FormulaSortExpression;
import com.fr.report.core.sort.sortexpression.SortExpression; import com.fr.report.core.sort.sortexpression.SortExpression;
@ -50,9 +51,11 @@ public class CellExpandSortPane extends AbstractSortPane {
protected CellSortAttr getCellSortAttr(TemplateCellElement cellElement) { protected CellSortAttr getCellSortAttr(TemplateCellElement cellElement) {
CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr(); CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr();
if (cellExpandAttr != null) { if (cellExpandAttr != null) {
if (cellExpandAttr.getCellSortAttr() == null) {
cellExpandAttr.setCellSortAttr(new CellSortAttr());
}
return cellExpandAttr.getCellSortAttr(); return cellExpandAttr.getCellSortAttr();
} }
return new CellSortAttr(); return null;
} }
} }

4
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.base.svg.IconUtils;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ibutton.UIButton; 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.CellSortExpression;
import com.fr.report.core.sort.sortexpression.SortExpression; import com.fr.report.core.sort.sortexpression.SortExpression;
@ -116,7 +117,8 @@ public abstract class AbstractSortGroupPane extends JPanel {
} }
void init() { 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)); uiButton.setPreferredSize(new Dimension(sortGroupPaneWidth - 4, 20));
this.add(uiButton); this.add(uiButton);
uiButton.addMouseListener(new MouseAdapter() { uiButton.addMouseListener(new MouseAdapter() {

21
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.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; 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.CellSortExpressionPane;
import com.fr.design.sort.expressionpane.CustomSequenceSortExpressionPane; 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.FormulaSortExpressionPane;
import com.fr.design.sort.expressionpane.SortExpressionPane; import com.fr.design.sort.expressionpane.SortExpressionPane;
import com.fr.report.core.sort.sortexpression.SortExpression; import com.fr.report.core.sort.sortexpression.SortExpression;
@ -47,7 +47,6 @@ public abstract class AbstractSortItemPane extends JPanel {
} }
private void registerSortExpressionPanes() { private void registerSortExpressionPanes() {
sortExpressionPanes.add(new EmptyExpressionPane());
sortExpressionPanes.add(new CellSortExpressionPane(sortItemPaneRightWidth)); sortExpressionPanes.add(new CellSortExpressionPane(sortItemPaneRightWidth));
sortExpressionPanes.add(new FormulaSortExpressionPane(sortItemPaneRightWidth)); sortExpressionPanes.add(new FormulaSortExpressionPane(sortItemPaneRightWidth));
sortExpressionPanes.add(new CustomSequenceSortExpressionPane(sortItemPaneWidth, sortItemPaneRightWidth)); sortExpressionPanes.add(new CustomSequenceSortExpressionPane(sortItemPaneWidth, sortItemPaneRightWidth));
@ -55,7 +54,7 @@ public abstract class AbstractSortItemPane extends JPanel {
void initSortAreaPane() { void initSortAreaPane() {
sortAreaPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, AbstractSortPane.PANE_COMPONENT_V_GAP)); 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()); sortAreaPane.add(AbstractSortPane.createIntervalUILabel());
initMainSortAreaPane(sortAreaPane); initMainSortAreaPane(sortAreaPane);
this.add(sortAreaPane); this.add(sortAreaPane);
@ -65,9 +64,10 @@ public abstract class AbstractSortItemPane extends JPanel {
void initSortRulePane() { void initSortRulePane() {
sortRulePane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, AbstractSortPane.PANE_COMPONENT_V_GAP)); 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)); 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(AbstractSortPane.createIntervalUILabel());
sortRulePane.add(sortRuleUiComboBox); sortRulePane.add(sortRuleUiComboBox);
this.add(sortRulePane); 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(AbstractSortPane.createIntervalUILabel());
sortBasisPanel.add(sortBasisUiComboBox); sortBasisPanel.add(sortBasisUiComboBox);
this.add(sortBasisPanel); this.add(sortBasisPanel);
@ -143,12 +143,9 @@ public abstract class AbstractSortItemPane extends JPanel {
public SortExpression updateBean() { public SortExpression updateBean() {
SortExpression sortExpression = currentSortExpressionPane.updateBean(); SortExpression sortExpression = currentSortExpressionPane.updateBean();
if (sortExpression != null) { if (sortExpression != null) {
if (StringUtils.equals(sortRuleUiComboBox.getSelectedItem().toString(), "升序")) { String sortRule = sortRuleUiComboBox.getSelectedItem().toString();
sortExpression.setSortRule(SortRule.ASC); if (StringUtils.isNotBlank(sortRule)) {
} else if (StringUtils.equals(sortRuleUiComboBox.getSelectedItem().toString(), "降序")) { sortExpression.setSortRule(SortRule.parse(sortRule));
sortExpression.setSortRule(SortRule.DES);
} else if (StringUtils.equals(sortRuleUiComboBox.getSelectedItem().toString(), "不排序")) {
sortExpression.setSortRule(SortRule.NO_SORT);
} }
} }
return sortExpression; return sortExpression;

16
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); protected abstract CellSortAttr getCellSortAttr(TemplateCellElement cellElement);
public void populateBean(TemplateCellElement cellElement) { public void populateBean(TemplateCellElement cellElement) {
System.out.println("sport pane populateBean");
populateSortArea(cellElement); populateSortArea(cellElement);
List<SortExpression> sortExpressions = null;
CellSortAttr cellSortAttr = getCellSortAttr(cellElement); CellSortAttr cellSortAttr = getCellSortAttr(cellElement);
List<SortExpression> sortExpressions = cellSortAttr.getSortExpressions(); if (cellSortAttr != null) {
sortExpressions = cellSortAttr.getSortExpressions();
}
if (sortExpressions == null || sortExpressions.size() == 0) { if (sortExpressions == null || sortExpressions.size() == 0) {
sortExpressions = new ArrayList<>(); sortExpressions = new ArrayList<>();
sortExpressions.add(new CellSortExpression(selfSortArea)); sortExpressions.add(new CellSortExpression(selfSortArea));
} }
sortGroupPane.populateBean(sortExpressions, 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); addListener(uiObserverListener);
refresh(); refresh();
} }
@ -79,11 +85,13 @@ public abstract class AbstractSortPane extends JPanel {
} }
public void updateBean(TemplateCellElement cellElement) { public void updateBean(TemplateCellElement cellElement) {
System.out.println("sport pane updateBean");
List<SortExpression> sortExpressions = sortGroupPane.updateBean(); List<SortExpression> sortExpressions = sortGroupPane.updateBean();
SortHeader sortHeader = sortHeaderPane.updateBean(); SortHeader sortHeader = sortHeaderPane.updateBean();
CellSortAttr cellSortAttr = getCellSortAttr(cellElement); CellSortAttr cellSortAttr = getCellSortAttr(cellElement);
cellSortAttr.setSortExpressions(sortExpressions); cellSortAttr.setSortExpressions(sortExpressions);
if (sortHeader != null) {
sortHeader.setSortArea(selfSortArea);
}
cellSortAttr.setSortHeader(sortHeader); cellSortAttr.setSortHeader(sortHeader);
} }

22
designer-realize/src/main/java/com/fr/design/sort/common/SortColumnRowPane.java

@ -1,8 +1,7 @@
package com.fr.design.sort.common; 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.designer.TargetComponent;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
@ -18,8 +17,6 @@ import com.fr.stable.EssentialUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -52,14 +49,18 @@ public class SortColumnRowPane extends JPanel {
} }
void initSize() { void initSize() {
jTextFieldWidth = (paneWidth - 42) / 2; jTextFieldWidth = (paneWidth - 40) / 2;
} }
void intUILabel() { 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); this.add(uiLabel);
} }
public static boolean isAvailableColumnRow(ColumnRow columnRow) {
return columnRow != null && columnRow.getRow() != -1 && columnRow.getColumn() != -1;
}
void initTextField() { void initTextField() {
colJTextField = new JTextField(); colJTextField = new JTextField();
@ -73,18 +74,20 @@ public class SortColumnRowPane extends JPanel {
} }
void initSelectButton() { 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)); selectButton.addActionListener(new SelectActionListener(this));
this.add(selectButton); this.add(selectButton);
} }
public void populateBean(ColumnRow columnRow) { 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)); colJTextField.setText(EssentialUtils.convertIntToABC(columnRow.column + 1));
rowJTextField.setText(String.valueOf(columnRow.row + 1)); rowJTextField.setText(String.valueOf(columnRow.row + 1));
} else {
colJTextField.setText(StringUtils.EMPTY);
rowJTextField.setText(StringUtils.EMPTY);
} }
refresh(); refresh();
} }
public ColumnRow updateBean() { public ColumnRow updateBean() {
@ -154,7 +157,6 @@ public class SortColumnRowPane extends JPanel {
this.uiObserverListener = uiObserverListener; this.uiObserverListener = uiObserverListener;
} }
public void removeListener(UIObserverListener uiObserverListener) { public void removeListener(UIObserverListener uiObserverListener) {
this.uiObserverListener = null; this.uiObserverListener = null;
} }

6
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.base.svg.IconUtils;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -73,7 +74,7 @@ public class SortUIExpandablePane extends JPanel {
private void initComponents() { private void initComponents() {
iconUiLabel = new UILabel(); iconUiLabel = new UILabel();
this.add(iconUiLabel); this.add(iconUiLabel);
UILabel uiLabel = new UILabel("次要排序列"); UILabel uiLabel = new UILabel(Toolkit.i18nText("Fine-Design_Sort_Second_Sort"));
this.add(uiLabel); this.add(uiLabel);
this.add(AbstractSortPane.createIntervalUILabel(114)); this.add(AbstractSortPane.createIntervalUILabel(114));
@ -85,8 +86,7 @@ public class SortUIExpandablePane extends JPanel {
sortGroupPane.removeSortItem(1); 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) { public void setShow(boolean show) {

4
designer-realize/src/main/java/com/fr/design/sort/expressionpane/CellSortExpressionPane.java

@ -1,5 +1,7 @@
package com.fr.design.sort.expressionpane; 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; import com.fr.report.core.sort.sortexpression.CellSortExpression;
@ -14,7 +16,7 @@ public class CellSortExpressionPane extends SortExpressionPane<CellSortExpressio
@Override @Override
public String getSortName() { public String getSortName() {
return "单元格"; return InterProviderFactory.getProvider().getLocText("Fine-Engine_Sort_Cell");
} }
@Override @Override

19
designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequenceEditPane.java

@ -4,8 +4,10 @@ import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ilist.UIList; import com.fr.design.gui.ilist.UIList;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.dnd.SerializableTransferable; import com.fr.design.mainframe.dnd.SerializableTransferable;
import com.fr.design.mainframe.share.ui.base.PlaceholderTextArea; import com.fr.design.mainframe.share.ui.base.PlaceholderTextArea;
import com.fr.locale.InterProviderFactory;
import com.fr.report.core.sort.sortexpression.CustomSequenceSortExpression; import com.fr.report.core.sort.sortexpression.CustomSequenceSortExpression;
import javax.swing.*; import javax.swing.*;
@ -43,7 +45,7 @@ public class CustomSequenceEditPane extends BasicPane {
void initReferenceSequencePanel() { void initReferenceSequencePanel() {
referenceSequencePanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); referenceSequencePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
UILabel uiLabel = new UILabel("参考序列:"); UILabel uiLabel = new UILabel(Toolkit.i18nText("Fine-Design_Sort_Reference_Sequence"));
referenceSequencePanel.add(uiLabel); referenceSequencePanel.add(uiLabel);
UIScrollPane uiScrollPane = new UIScrollPane(getReferenceSequenceList()); UIScrollPane uiScrollPane = new UIScrollPane(getReferenceSequenceList());
uiScrollPane.setPreferredSize(new Dimension(200, 300)); uiScrollPane.setPreferredSize(new Dimension(200, 300));
@ -69,9 +71,9 @@ public class CustomSequenceEditPane extends BasicPane {
void initEditSequencePanel() { void initEditSequencePanel() {
editSequencePanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); editSequencePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
UILabel uiLabel = new UILabel("输入序列(E):"); UILabel uiLabel = new UILabel(Toolkit.i18nText("Fine-Design_Sort_Input_Sequence"));
editSequencePanel.add(uiLabel); editSequencePanel.add(uiLabel);
UILabel uiLabel2 = new UILabel("请将序列元素隔行输入"); UILabel uiLabel2 = new UILabel(Toolkit.i18nText("Fine-Design_Sort_Please_Interlace_Sequence_Elements"));
uiLabel2.setForeground(Color.lightGray); uiLabel2.setForeground(Color.lightGray);
editSequencePanel.add(uiLabel2); editSequencePanel.add(uiLabel2);
jTextArea = getTextArea(); jTextArea = getTextArea();
@ -92,17 +94,16 @@ public class CustomSequenceEditPane extends BasicPane {
String getPlaceholderText() { String getPlaceholderText() {
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("请将序列元素隔行输入,如:\n"); stringBuilder.append(Toolkit.i18nText("Fine-Design_Sort_Please_Interlace_Sequence_Elements_Such_As") + "\n");
stringBuilder.append("部门一\n"); stringBuilder.append(Toolkit.i18nText("Fine-Design_Sort_Department_One") + "\n");
stringBuilder.append("部门二\n"); stringBuilder.append(Toolkit.i18nText("Fine-Design_Sort_Department_Two") + "\n");
stringBuilder.append("部门三\n"); stringBuilder.append(Toolkit.i18nText("Fine-Design_Sort_Department_Three") + "\n");
System.out.println(stringBuilder);
return stringBuilder.toString(); return stringBuilder.toString();
} }
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return "自定义序列"; return InterProviderFactory.getProvider().getLocText("Fine-Engine_Sort_Custom_Sequence");
} }

4
designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequenceSortExpressionPane.java

@ -1,7 +1,9 @@
package com.fr.design.sort.expressionpane; package com.fr.design.sort.expressionpane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.sort.common.AbstractSortPane; import com.fr.design.sort.common.AbstractSortPane;
import com.fr.locale.InterProviderFactory;
import com.fr.report.core.sort.sortexpression.CustomSequenceSortExpression; import com.fr.report.core.sort.sortexpression.CustomSequenceSortExpression;
import java.awt.*; import java.awt.*;
@ -20,7 +22,7 @@ public class CustomSequenceSortExpressionPane extends SortExpressionPane<CustomS
@Override @Override
public String getSortName() { public String getSortName() {
return "自定义序列"; return InterProviderFactory.getProvider().getLocText("Fine-Engine_Sort_Custom_Sequence");
} }
@Override @Override

37
designer-realize/src/main/java/com/fr/design/sort/expressionpane/EmptyExpressionPane.java

@ -1,37 +0,0 @@
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;
}
}

4
designer-realize/src/main/java/com/fr/design/sort/expressionpane/FormulaSortExpressionPane.java

@ -1,7 +1,9 @@
package com.fr.design.sort.expressionpane; package com.fr.design.sort.expressionpane;
import com.fr.design.formula.TinyFormulaPane; import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.sort.common.AbstractSortPane; import com.fr.design.sort.common.AbstractSortPane;
import com.fr.locale.InterProviderFactory;
import com.fr.report.core.sort.sortexpression.FormulaSortExpression; import com.fr.report.core.sort.sortexpression.FormulaSortExpression;
import java.awt.*; import java.awt.*;
@ -19,7 +21,7 @@ public class FormulaSortExpressionPane extends SortExpressionPane<FormulaSortExp
@Override @Override
public String getSortName() { public String getSortName() {
return "公式"; return InterProviderFactory.getProvider().getLocText("Fine-Engine_Sort_Formula");
} }
@Override @Override

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

@ -3,6 +3,7 @@ package com.fr.design.sort.header;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.sort.common.AbstractSortPane; import com.fr.design.sort.common.AbstractSortPane;
import com.fr.design.sort.common.SortColumnRowPane; import com.fr.design.sort.common.SortColumnRowPane;
@ -34,7 +35,7 @@ public class HeaderAreaPane extends JPanel {
void initUILabel() { void initUILabel() {
UILabel uiLabel = new UILabel("表头区域", SwingConstants.LEFT); UILabel uiLabel = new UILabel(Toolkit.i18nText("Fine-Design_Sort_Header_Area"), SwingConstants.LEFT);
this.add(uiLabel); this.add(uiLabel);
this.add(AbstractSortPane.createIntervalUILabel()); this.add(AbstractSortPane.createIntervalUILabel());
} }
@ -70,7 +71,7 @@ public class HeaderAreaPane extends JPanel {
void initUIComboBox() { void initUIComboBox() {
uiComboBox = new UIComboBox(new String[]{"无", "自定义"}); uiComboBox = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Basic_None"), Toolkit.i18nText("Fine-Design_Basic_Custom")});
uiComboBox.setSize(new Dimension(headerAreaPaneRightWidth, AbstractSortPane.PANE_COMPONENT_HEIGHT)); uiComboBox.setSize(new Dimension(headerAreaPaneRightWidth, AbstractSortPane.PANE_COMPONENT_HEIGHT));
uiComboBox.addItemListener(new ItemListener() { uiComboBox.addItemListener(new ItemListener() {
@Override @Override
@ -101,12 +102,12 @@ public class HeaderAreaPane extends JPanel {
} }
public void populateBean(ColumnRow columnRow) { public void populateBean(ColumnRow columnRow) {
if (columnRow != null && columnRow.getRow() != -1 && columnRow.getColumn() != -1) { if (SortColumnRowPane.isAvailableColumnRow(columnRow)) {
columnRowPane.populateBean(columnRow);
uiComboBox.setSelectedIndex(1); uiComboBox.setSelectedIndex(1);
} else { } else {
uiComboBox.setSelectedIndex(0); uiComboBox.setSelectedIndex(0);
} }
columnRowPane.populateBean(columnRow);
setSortColumnRowPaneShow(uiComboBox.getSelectedIndex() == 1); setSortColumnRowPaneShow(uiComboBox.getSelectedIndex() == 1);
} }

5
designer-realize/src/main/java/com/fr/design/sort/header/HeaderSettingPane.java

@ -3,6 +3,7 @@ package com.fr.design.sort.header;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.sort.common.AbstractSortPane; import com.fr.design.sort.common.AbstractSortPane;
import com.fr.report.core.sort.header.SortHeader; import com.fr.report.core.sort.header.SortHeader;
@ -31,11 +32,11 @@ public class HeaderSettingPane extends JPanel {
void initUILabel() { void initUILabel() {
JPanel jPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 2)); JPanel jPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 2));
UILabel uiLabel = new UILabel("表头设置"); UILabel uiLabel = new UILabel(Toolkit.i18nText("Fine-Design_Sort_Header_Setting"));
UILabel emptyUILabel = new UILabel(); UILabel emptyUILabel = new UILabel();
emptyUILabel.setPreferredSize(new Dimension(10, 10)); emptyUILabel.setPreferredSize(new Dimension(10, 10));
uiCheckBox = new UICheckBox("用户点击排列顺序"); uiCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Sort_Allow_User_Click_Sort_Order"));
uiCheckBox.setPreferredSize(new Dimension(headerSettingPaneRightWidth - 10, AbstractSortPane.PANE_COMPONENT_HEIGHT)); uiCheckBox.setPreferredSize(new Dimension(headerSettingPaneRightWidth - 10, AbstractSortPane.PANE_COMPONENT_HEIGHT));
uiCheckBox.addChangeListener(new ChangeListener() { uiCheckBox.addChangeListener(new ChangeListener() {
@Override @Override

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

@ -5,6 +5,7 @@ import com.fr.base.svg.SVGTranscoder;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.theme.edit.ui.ColorListPane; import com.fr.design.mainframe.theme.edit.ui.ColorListPane;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
@ -49,15 +50,15 @@ public class HeaderSortRulePane extends JPanel {
} }
void initUILabel() { void initUILabel() {
UILabel uiLabel = new UILabel("排序依据:", SwingConstants.LEFT); UILabel uiLabel = new UILabel(Toolkit.i18nText("Fine-Design_Sort_Header_Sort_Basis"), SwingConstants.LEFT);
this.add(uiLabel, BorderLayout.NORTH); this.add(uiLabel, BorderLayout.NORTH);
} }
void initSortRuleItem() { void initSortRuleItem() {
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{ascUICheckBox = new UICheckBox("升序"), ascIconButton = new IconButton(ASC_ICON_TEMPLATE_PATH)}, new Component[]{ascUICheckBox = new UICheckBox(SortRule.ASC.getDescription()), ascIconButton = new IconButton(ASC_ICON_TEMPLATE_PATH)},
new Component[]{desUICheckBox = new UICheckBox("降序"), desIconButton = new IconButton(DES_ICON_TEMPLATE_PATH)}, new Component[]{desUICheckBox = new UICheckBox(SortRule.DES.getDescription()), desIconButton = new IconButton(DES_ICON_TEMPLATE_PATH)},
new Component[]{nosortUICheckBox = new UICheckBox("不排序"), nosortIconButton = new IconButton(NOSORT_ICON_TEMPLATE_PATH)}, new Component[]{nosortUICheckBox = new UICheckBox(SortRule.NO_SORT.getDescription()), nosortIconButton = new IconButton(NOSORT_ICON_TEMPLATE_PATH)},
}; };
double[] rowSize = {24, 24, 24}; double[] rowSize = {24, 24, 24};
double[] columnSize = {80, 30}; double[] columnSize = {80, 30};

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

@ -38,12 +38,12 @@ public class SortHeaderPane extends JPanel {
this.sortHeader = sortHeader; this.sortHeader = sortHeader;
ColumnRow columnRow = null; ColumnRow columnRow = null;
SortHeader.SortItem[] sortItems = null; SortHeader.SortItem[] sortItems = null;
String sortArea = defaultHeaderArea; String headerArea = defaultHeaderArea;
if (sortHeader != null) { if (sortHeader != null) {
sortArea = sortHeader.getSortArea(); headerArea = sortHeader.getHeaderArea();
sortItems = sortHeader.getSortItems(); sortItems = sortHeader.getSortItems();
} }
columnRow = ColumnRow.valueOf(sortArea); columnRow = ColumnRow.valueOf(headerArea);
headerAreaPane.populateBean(columnRow); headerAreaPane.populateBean(columnRow);
headerSettingPane.populateBean(sortItems); headerSettingPane.populateBean(sortItems);
@ -52,11 +52,11 @@ public class SortHeaderPane extends JPanel {
public SortHeader updateBean() { public SortHeader updateBean() {
ColumnRow columnRow = headerAreaPane.updateBean(); ColumnRow columnRow = headerAreaPane.updateBean();
SortHeader.SortItem[] items = headerSettingPane.updateBean(); SortHeader.SortItem[] items = headerSettingPane.updateBean();
String sortArea = null; String headerArea = null;
if (columnRow != null) { if (columnRow != null) {
sortArea = columnRow.toString(); headerArea = columnRow.toString();
} }
SortHeader sortHeader = new SortHeader(sortArea, items); SortHeader sortHeader = new SortHeader(headerArea, null, items);
return sortHeader; return sortHeader;
} }

Loading…
Cancel
Save