Browse Source

REPORT-62440 表头排序内置

feature/x
Henry.Wang 3 years ago
parent
commit
1b66571feb
  1. 7
      designer-base/src/main/java/com/fr/design/event/ComponentChangeListener.java
  2. 6
      designer-base/src/main/java/com/fr/design/event/ComponentChangeObserver.java
  3. 11
      designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java
  4. 109
      designer-realize/src/main/java/com/fr/design/mainframe/cell/AbstractDSCellEditorPane.java
  5. 10
      designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortItemPane.java
  6. 4
      designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortPane.java
  7. 11
      designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortItemPane.java
  8. 23
      designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortPane.java
  9. 126
      designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortGroupPane.java
  10. 12
      designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortItemPane.java
  11. 18
      designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortPane.java
  12. 31
      designer-realize/src/main/java/com/fr/design/sort/common/SortColumnRowPane.java
  13. 5
      designer-realize/src/main/java/com/fr/design/sort/common/SortUIExpandablePane.java
  14. 2
      designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequenceSortExpressionPane.java
  15. 1
      designer-realize/src/main/java/com/fr/design/sort/expressionpane/FormulaSortExpressionPane.java
  16. 22
      designer-realize/src/main/java/com/fr/design/sort/header/HeaderAreaPane.java
  17. 10
      designer-realize/src/main/java/com/fr/design/sort/header/HeaderSettingPane.java
  18. 31
      designer-realize/src/main/java/com/fr/design/sort/header/HeaderSortRulePane.java
  19. 11
      designer-realize/src/main/java/com/fr/design/sort/header/SortHeaderPane.java
  20. 223
      designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java

7
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);
}

6
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);
}

11
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.dialog.BasicPane;
import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver; 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.UIObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.stable.StringUtils; 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);
}
});
}
} }
} }

109
designer-realize/src/main/java/com/fr/design/mainframe/cell/AbstractDSCellEditorPane.java

@ -1,17 +1,7 @@
package com.fr.design.mainframe.cell; package com.fr.design.mainframe.cell;
import com.fr.design.gui.iscrollbar.UIScrollBar; import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.CellElementPropertyPane; import com.fr.design.mainframe.AbstractAttrPane;
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;
/** /**
* 右侧单元格元素面板抽象类 * 右侧单元格元素面板抽象类
@ -20,26 +10,8 @@ import java.awt.event.MouseWheelListener;
* @version 2017年7月25日 * @version 2017年7月25日
* @since 9.0 * @since 9.0
*/ */
public abstract class AbstractDSCellEditorPane extends JPanel { public abstract class AbstractDSCellEditorPane extends AbstractAttrPane {
/**
* 滚动条相关配置
*/
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;
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(); 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 * 释放tc
*/ */
protected abstract void release(); protected abstract void release();
protected abstract AttributeChangeListener getAttributeChangeListener();
public void addAttributeChangeListener(){
this.addAttributeChangeListener(getAttributeChangeListener());
}
} }

10
designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortItemPane.java

@ -1,6 +1,5 @@
package com.fr.design.sort.celldscolumn; package com.fr.design.sort.celldscolumn;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.sort.common.AbstractSortItemPane; import com.fr.design.sort.common.AbstractSortItemPane;
import com.fr.design.sort.common.AbstractSortPane; import com.fr.design.sort.common.AbstractSortPane;
@ -38,13 +37,4 @@ public class CellDSColumnSortItemPane extends AbstractSortItemPane {
return sortExpression; return sortExpression;
} }
public void addListener(UIObserverListener uiObserverListener) {
super.addListener(uiObserverListener);
sortAreaUiComboBox.registerChangeListener(uiObserverListener);
}
public void removeListener(UIObserverListener uiObserverListener) {
super.removeListener(uiObserverListener);
sortAreaUiComboBox.removeChangeListener();
}
} }

4
designer-realize/src/main/java/com/fr/design/sort/celldscolumn/CellDSColumnSortPane.java

@ -1,16 +1,20 @@
package com.fr.design.sort.celldscolumn; package com.fr.design.sort.celldscolumn;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.sort.common.AbstractSortPane; import com.fr.design.sort.common.AbstractSortPane;
import com.fr.general.data.TableDataColumn; import com.fr.general.data.TableDataColumn;
import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.TemplateCellElement;
import com.fr.report.cell.cellattr.core.group.DSColumn; 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 javax.swing.*;
public class CellDSColumnSortPane extends AbstractSortPane { public class CellDSColumnSortPane extends AbstractSortPane {
public CellDSColumnSortPane() { public CellDSColumnSortPane() {
super(220, 150); super(220, 150);
//this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
} }
@Override @Override

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

@ -1,6 +1,5 @@
package com.fr.design.sort.cellexpand; 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.AbstractSortPane;
import com.fr.design.sort.common.SortColumnRowPane; import com.fr.design.sort.common.SortColumnRowPane;
import com.fr.design.sort.common.AbstractSortItemPane; import com.fr.design.sort.common.AbstractSortItemPane;
@ -35,14 +34,4 @@ public class CellExpandSortItemPane extends AbstractSortItemPane {
} }
return sortExpression; return sortExpression;
} }
public void addListener(UIObserverListener uiObserverListener) {
super.addListener(uiObserverListener);
columnRowPane.addListener(uiObserverListener);
}
public void removeListener(UIObserverListener uiObserverListener) {
super.removeListener(uiObserverListener);
columnRowPane.removeListener(uiObserverListener);
}
} }

23
designer-realize/src/main/java/com/fr/design/sort/cellexpand/CellExpandSortPane.java

@ -1,22 +1,14 @@
package com.fr.design.sort.cellexpand; 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.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.SortExpression;
import com.fr.report.core.sort.header.SortHeader;
import com.fr.report.core.sort.common.SortRule;
import javax.swing.*; import javax.swing.*;
import java.util.ArrayList;
import java.util.List;
public class CellExpandSortPane extends AbstractSortPane { public class CellExpandSortPane extends AbstractSortPane {
CellExpandAttrPane cellExpandAttrPane; CellExpandAttrPane cellExpandAttrPane;
@ -33,19 +25,6 @@ public class CellExpandSortPane extends AbstractSortPane {
this.add(sortGroupPane); this.add(sortGroupPane);
} }
@Override
protected void initUIObserverListener() {
uiObserverListener = new UIObserverListener() {
@Override
public void doChange() {
AttributeChangeListener attributeChangeListener = cellExpandAttrPane.getListener();
if (attributeChangeListener != null) {
attributeChangeListener.attributeChange();
}
}
};
}
@Override @Override
protected CellSortAttr getCellSortAttr(TemplateCellElement cellElement) { protected CellSortAttr getCellSortAttr(TemplateCellElement cellElement) {
CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr(); CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr();

126
designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortGroupPane.java

@ -1,7 +1,8 @@
package com.fr.design.sort.common; 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.ComponentChangeListener;
import com.fr.design.event.ComponentChangeObserver;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.report.core.sort.sortexpression.CellSortExpression; import com.fr.report.core.sort.sortexpression.CellSortExpression;
@ -9,98 +10,114 @@ import com.fr.report.core.sort.sortexpression.SortExpression;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.event.MouseAdapter; import java.awt.event.ActionEvent;
import java.awt.event.MouseEvent; import java.awt.event.ActionListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public abstract class AbstractSortGroupPane extends JPanel { public abstract class AbstractSortGroupPane extends JPanel implements ComponentChangeObserver {
protected int sortGroupPaneWidth; protected int sortGroupPaneWidth;
protected int sortGroupPaneRightWidth; protected int sortGroupPaneRightWidth;
UIObserverListener uiObserverListener;
List<SortExpression> sortExpressions; List<SortExpression> sortExpressions;
List<AbstractSortItemPane> sortItemPanes = new ArrayList<>(); List<JPanel> sortItemPanes = new ArrayList<>();
AddSortItemBar addSortItemBar; AddSortItemBar addSortItemBar;
JPanel sortItemListPane;
UIButton uiButton; UIButton uiButton;
String selfSortArea; String selfSortArea;
ComponentChangeListener componentChangeListener;
public AbstractSortGroupPane(int sortGroupPaneWidth, int sortGroupPaneRightWidth) { public AbstractSortGroupPane(int sortGroupPaneWidth, int sortGroupPaneRightWidth) {
this.sortGroupPaneRightWidth = sortGroupPaneRightWidth; this.sortGroupPaneRightWidth = sortGroupPaneRightWidth;
this.sortGroupPaneWidth = sortGroupPaneWidth; this.sortGroupPaneWidth = sortGroupPaneWidth;
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
initComponents(); initComponents();
} }
private void initComponents() { private void initComponents() {
addSortItemBar = new AddSortItemBar(this); addSortItemBar = new AddSortItemBar(this);
sortItemListPane = new JPanel();
sortItemListPane.setLayout(new BoxLayout(sortItemListPane, BoxLayout.Y_AXIS));
this.add(sortItemListPane);
this.add(addSortItemBar); this.add(addSortItemBar);
} }
public void populateBean(List<SortExpression> sortExpressions, String selfSortArea) { public void populateBean(List<SortExpression> sortExpressions, String selfSortArea) {
this.sortItemListPane.removeAll();
this.selfSortArea = selfSortArea; this.selfSortArea = selfSortArea;
this.sortExpressions = sortExpressions; this.sortExpressions = sortExpressions;
refreshBean(); this.sortItemPanes = new ArrayList<>();
}
public void refreshBean() {
removeListener(uiObserverListener);
this.removeAll();
sortItemPanes = new ArrayList<>();
for (int i = 0; i < sortExpressions.size(); i++) { for (int i = 0; i < sortExpressions.size(); i++) {
int sortItemPaneWidth = sortGroupPaneWidth; addSortItem(sortExpressions.get(i), i == 0);
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(); refresh();
} }
protected abstract AbstractSortItemPane refreshSortItemPane(int sortItemPaneWidth, int sortItemPaneRightWidth, SortExpression sortExpression); protected abstract AbstractSortItemPane refreshSortItemPane(int sortItemPaneWidth, int sortItemPaneRightWidth, SortExpression sortExpression);
public List<SortExpression> updateBean() { public List<SortExpression> updateBean() {
updateSortExpressions(); List<SortExpression> sortExpressions = new ArrayList<>();
return sortExpressions; 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();
} }
private void updateSortExpressions() {
sortExpressions = new ArrayList<>();
for (AbstractSortItemPane sortItemPane : sortItemPanes) {
SortExpression sortExpression = sortItemPane.updateBean();
if (sortExpression != null) { if (sortExpression != null) {
sortExpressions.add(sortExpression); sortExpressions.add(sortExpression);
} }
} }
return sortExpressions;
} }
public void removeSortItem(int no) { public void removeSortItem(int no) {
updateSortExpressions();
if (no < sortExpressions.size()) { if (no < sortExpressions.size()) {
sortItemListPane.remove(sortItemPanes.get(no));
sortExpressions.remove(no); sortExpressions.remove(no);
sortItemPanes.remove(no);
refresh();
}
}
public void registerChangeListener(ComponentChangeListener componentChangeListener) {
this.componentChangeListener = componentChangeListener;
} }
refreshBean();
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);
public void addSortItem() { JPanel sortItemPane = abstractSortItemPane;
updateSortExpressions(); if (!mainSort) {
sortExpressions.add(new CellSortExpression(selfSortArea)); sortItemPane = new SortUIExpandablePane(abstractSortItemPane, this);
refreshBean();
} }
sortItemListPane.add(sortItemPane);
sortItemPanes.add(sortItemPane);
if (componentChangeListener != null) {
componentChangeListener.initListener(sortItemPane);
}
refresh();
}
protected void refresh() { protected void refresh() {
validate(); validate();
@ -121,28 +138,11 @@ public abstract class AbstractSortGroupPane extends JPanel {
IconUtils.readIcon("/com/fr/design/images/sort/add.png")); 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.addActionListener(new ActionListener() {
@Override public void actionPerformed(ActionEvent e) {
public void mouseClicked(MouseEvent e) { sortGroupPane.addSortItem(null, false);
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);
}
}
} }

12
designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortItemPane.java

@ -1,6 +1,5 @@
package com.fr.design.sort.common; package com.fr.design.sort.common;
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;
@ -146,17 +145,6 @@ public abstract class AbstractSortItemPane extends JPanel {
return sortExpression; 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() { protected void refresh() {
validate(); validate();
repaint(); repaint();

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

@ -1,6 +1,5 @@
package com.fr.design.sort.common; package com.fr.design.sort.common;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.sort.header.SortHeaderPane; import com.fr.design.sort.header.SortHeaderPane;
import com.fr.report.cell.TemplateCellElement; 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_HEIGHT = 20;
public static final int PANE_COMPONENT_V_GAP = 4; public static final int PANE_COMPONENT_V_GAP = 4;
public static final int PANE_COMPONENT_H_GAP = 14; public static final int PANE_COMPONENT_H_GAP = 14;
protected UIObserverListener uiObserverListener;
protected AbstractSortGroupPane sortGroupPane; protected AbstractSortGroupPane sortGroupPane;
protected SortHeaderPane sortHeaderPane; protected SortHeaderPane sortHeaderPane;
protected String selfSortArea; protected String selfSortArea;
@ -31,7 +29,6 @@ public abstract class AbstractSortPane extends JPanel {
public AbstractSortPane(int sortPaneWidth, int sortPaneRightWidth) { public AbstractSortPane(int sortPaneWidth, int sortPaneRightWidth) {
this.sortPaneWidth = sortPaneWidth; this.sortPaneWidth = sortPaneWidth;
this.sortPaneRightWidth = sortPaneRightWidth; this.sortPaneRightWidth = sortPaneRightWidth;
initUIObserverListener();
initComponents(); initComponents();
} }
@ -43,8 +40,6 @@ public abstract class AbstractSortPane extends JPanel {
protected abstract void initSortGroupPane(); protected abstract void initSortGroupPane();
protected void initUIObserverListener() {
}
protected abstract CellSortAttr getCellSortAttr(TemplateCellElement cellElement); protected abstract CellSortAttr getCellSortAttr(TemplateCellElement cellElement);
@ -65,7 +60,6 @@ public abstract class AbstractSortPane extends JPanel {
sortHeader = cellSortAttr.getSortHeader(); sortHeader = cellSortAttr.getSortHeader();
} }
sortHeaderPane.populateBean(sortHeader, defaultHeaderArea); sortHeaderPane.populateBean(sortHeader, defaultHeaderArea);
addListener(uiObserverListener);
refresh(); refresh();
} }
@ -91,18 +85,6 @@ public abstract class AbstractSortPane extends JPanel {
cellSortAttr.setSortHeader(sortHeader); 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() { protected void refresh() {
validate(); validate();
repaint(); repaint();

31
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.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;
@ -21,7 +22,7 @@ import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
public class SortColumnRowPane extends JPanel { public class SortColumnRowPane extends JPanel implements UIObserver {
int paneWidth; int paneWidth;
int paneHeight; int paneHeight;
int jTextFieldWidth; int jTextFieldWidth;
@ -89,6 +90,11 @@ public class SortColumnRowPane extends JPanel {
refresh(); refresh();
} }
public void setColumnRow(ColumnRow columnRow){
populateBean(columnRow);
uiObserverListener.doChange();
}
public ColumnRow updateBean() { public ColumnRow updateBean() {
if (StringUtils.isNotBlank(colJTextField.getText()) && StringUtils.isNotBlank(rowJTextField.getText())) { if (StringUtils.isNotBlank(colJTextField.getText()) && StringUtils.isNotBlank(rowJTextField.getText())) {
return ColumnRow.valueOf(colJTextField.getText() + rowJTextField.getText()); return ColumnRow.valueOf(colJTextField.getText() + rowJTextField.getText());
@ -96,6 +102,16 @@ public class SortColumnRowPane extends JPanel {
return null; return null;
} }
@Override
public void registerChangeListener(UIObserverListener listener) {
this.uiObserverListener = listener;
}
@Override
public boolean shouldResponseChangeListener() {
return true;
}
class SelectActionListener implements ActionListener { class SelectActionListener implements ActionListener {
SortColumnRowPane columnRowPane; SortColumnRowPane columnRowPane;
@ -122,10 +138,7 @@ public class SortColumnRowPane extends JPanel {
CellSelection cellselection = (CellSelection) selection; CellSelection cellselection = (CellSelection) selection;
ColumnRow cr = ColumnRow.valueOf(cellselection.getColumn(), cellselection.getRow()); ColumnRow cr = ColumnRow.valueOf(cellselection.getColumn(), cellselection.getRow());
elementCasePane.setOldSelecton(oldSelection); elementCasePane.setOldSelecton(oldSelection);
columnRowPane.populateBean(cr); columnRowPane.setColumnRow(cr);
if (columnRowPane.uiObserverListener != null) {
columnRowPane.uiObserverListener.doChange();
}
} }
elementCasePane.removeSelectionChangeListener(gridSelectionChangeListener); elementCasePane.removeSelectionChangeListener(gridSelectionChangeListener);
isAlreadyAddListener = false; isAlreadyAddListener = false;
@ -152,14 +165,6 @@ public class SortColumnRowPane extends JPanel {
return null; return null;
} }
public void addListener(UIObserverListener uiObserverListener) {
this.uiObserverListener = uiObserverListener;
}
public void removeListener(UIObserverListener uiObserverListener) {
this.uiObserverListener = null;
}
protected void refresh() { protected void refresh() {
validate(); validate();
repaint(); repaint();

5
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)); contentPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
wrapPane.add(headerPane, BorderLayout.NORTH); wrapPane.add(headerPane, BorderLayout.NORTH);
wrapPane.add(contentPane, BorderLayout.CENTER); wrapPane.add(contentPane, BorderLayout.CENTER);
setContentPanelShow(false); setContentPanelShow(true);
this.add(wrapPane); this.add(wrapPane);
} }
private void setContentPanelShow(boolean show) { private void setContentPanelShow(Boolean show) {
contentPane.setVisible(show); contentPane.setVisible(show);
headerPane.setShow(show); headerPane.setShow(show);
} }
@ -67,7 +67,6 @@ public class SortUIExpandablePane extends JPanel {
this.sortGroupPane = sortGroupPane; this.sortGroupPane = sortGroupPane;
this.setLayout(new FlowLayout(FlowLayout.LEFT, 3, 3)); this.setLayout(new FlowLayout(FlowLayout.LEFT, 3, 3));
initComponents(); initComponents();
} }
private void initComponents() { private void initComponents() {

2
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.locale.InterProviderFactory;
import com.fr.report.core.sort.sortexpression.CustomSequenceSortExpression; import com.fr.report.core.sort.sortexpression.CustomSequenceSortExpression;
import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.util.List; import java.util.List;
@ -15,6 +16,7 @@ public class CustomSequenceSortExpressionPane extends SortExpressionPane<CustomS
this.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0)); this.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
customSequencePane = new CustomSequencePane(rightWidth); customSequencePane = new CustomSequencePane(rightWidth);
customSequencePane.setPreferredSize(new Dimension(width, AbstractSortPane.PANE_COMPONENT_HEIGHT)); customSequencePane.setPreferredSize(new Dimension(width, AbstractSortPane.PANE_COMPONENT_HEIGHT));
customSequencePane.setBorder(BorderFactory.createEmptyBorder(0,0,0,3));
this.add(customSequencePane); this.add(customSequencePane);
} }

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

@ -1,7 +1,6 @@
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.locale.InterProviderFactory;
import com.fr.report.core.sort.sortexpression.FormulaSortExpression; import com.fr.report.core.sort.sortexpression.FormulaSortExpression;

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

@ -1,10 +1,8 @@
package com.fr.design.sort.header; package com.fr.design.sort.header;
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.i18n.Toolkit;
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;
import com.fr.stable.ColumnRow; import com.fr.stable.ColumnRow;
@ -117,17 +115,6 @@ public class HeaderAreaPane extends JPanel {
} }
} }
public void addListener(UIObserverListener uiObserverListener) {
columnRowPane.addListener(uiObserverListener);
uiComboBox.registerChangeListener(uiObserverListener);
}
public void removeListener(UIObserverListener uiObserverListener) {
columnRowPane.removeListener(uiObserverListener);
uiComboBox.removeChangeListener();
}
public void refresh() { public void refresh() {
validate(); validate();
repaint(); repaint();
@ -135,13 +122,4 @@ public class HeaderAreaPane extends JPanel {
} }
} }
public void addListener(UIObserverListener uiObserverListener) {
areaJLayeredPane.addListener(uiObserverListener);
}
public void removeListener(UIObserverListener uiObserverListener) {
areaJLayeredPane.removeListener(uiObserverListener);
}
} }

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

@ -1,6 +1,5 @@
package com.fr.design.sort.header; package com.fr.design.sort.header;
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.i18n.Toolkit;
@ -79,13 +78,4 @@ public class HeaderSettingPane extends JPanel {
} }
} }
public void addListener(UIObserverListener uiObserverListener) {
uiCheckBox.registerChangeListener(uiObserverListener);
headerSortRulePane.addListener(uiObserverListener);
}
public void removeListener(UIObserverListener uiObserverListener) {
uiCheckBox.removeChangeListener();
headerSortRulePane.removeListener(uiObserverListener);
}
} }

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

@ -2,6 +2,7 @@ package com.fr.design.sort.header;
import com.fr.base.svg.SVGIcon; import com.fr.base.svg.SVGIcon;
import com.fr.base.svg.SVGTranscoder; import com.fr.base.svg.SVGTranscoder;
import com.fr.design.event.UIObserver;
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;
@ -72,7 +73,7 @@ public class HeaderSortRulePane extends JPanel {
nosortIconButton.refreshIconLabelColor(new Color(33, 33, 34)); nosortIconButton.refreshIconLabelColor(new Color(33, 33, 34));
} }
class IconButton extends JPanel { class IconButton extends JPanel implements UIObserver {
JLayeredPane jLayeredPane; JLayeredPane jLayeredPane;
String iconTemplatePath; String iconTemplatePath;
UILabel iconLabel; UILabel iconLabel;
@ -103,10 +104,8 @@ public class HeaderSortRulePane extends JPanel {
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
color = colorButton.getSelectObject(); color = colorButton.getSelectObject();
refreshIconLabelColor(color); refreshIconLabelColor(color);
if (uiObserverListener != null) {
uiObserverListener.doChange(); uiObserverListener.doChange();
} }
}
}); });
jLayeredPane.setPreferredSize(new Dimension(16, 16)); jLayeredPane.setPreferredSize(new Dimension(16, 16));
@ -181,13 +180,14 @@ public class HeaderSortRulePane extends JPanel {
return stringBuffer.toString(); return stringBuffer.toString();
} }
public void addListener(UIObserverListener uiObserverListener) { @Override
public void registerChangeListener(UIObserverListener uiObserverListener) {
this.uiObserverListener = uiObserverListener; this.uiObserverListener = uiObserverListener;
} }
@Override
public void removeListener(UIObserverListener uiObserverListener) { public boolean shouldResponseChangeListener() {
this.uiObserverListener = null; return true;
} }
} }
@ -231,21 +231,4 @@ public class HeaderSortRulePane extends JPanel {
return items.toArray(resultItems); 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();
}
} }

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

@ -1,6 +1,5 @@
package com.fr.design.sort.header; package com.fr.design.sort.header;
import com.fr.design.event.UIObserverListener;
import com.fr.report.core.sort.header.SortHeader; import com.fr.report.core.sort.header.SortHeader;
import com.fr.stable.ColumnRow; import com.fr.stable.ColumnRow;
@ -57,14 +56,4 @@ public class SortHeaderPane extends JPanel {
SortHeader sortHeader = new SortHeader(headerArea, null, items); SortHeader sortHeader = new SortHeader(headerArea, null, items);
return sortHeader; return sortHeader;
} }
public void addListener(UIObserverListener uiObserverListener) {
headerAreaPane.addListener(uiObserverListener);
headerSettingPane.addListener(uiObserverListener);
}
public void removeListener(UIObserverListener uiObserverListener) {
headerAreaPane.removeListener(uiObserverListener);
headerSettingPane.removeListener(uiObserverListener);
}
} }

223
designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java

@ -224,63 +224,6 @@ public class CellDSColumnEditor extends CellQuickEditor {
private UIButton conditionUIButton; private UIButton conditionUIButton;
/**
* 分组设置监听器
*/
private ItemListener groupListener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e == null) {
//分组-高级-自定义点确定的时候传进来null的e,但是这时候应该触发保存
groupPane.update();
fireTargetModified();
return;
}
if (e.getStateChange() == ItemEvent.DESELECTED) {
groupPane.update();
fireTargetModified();
}
}
};
/**
* 数据集列设置监听器
*/
private ItemListener dataListener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
dataPane.update(cellElement);
fireTargetModified();
}
}
};
DSColumnBasicEditorPane() {
dataPane = new SelectedDataColumnPane(true, true);
groupPane = new ResultSetGroupDockingPane();
dataPane.setListener(dataListener);
groupPane.setListener(groupListener);
double[] rowSize = {P}, columnSize = {60, F};
UILabel uiLabel = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Report_Filter_Conditions"));
condition = new DSColumnConditionAction();
if (tc != null) {
condition.setEditingComponent(tc);
}
//丢掉icon,修改按钮名称为编辑
condition.setSmallIcon(UIConstants.EMPTY_ICON);
condition.setName(Toolkit.i18nText("Fine-Design_Basic_Edit"));
conditionUIButton = new UIButton(condition);
Component[][] components = new Component[][]{
new Component[]{uiLabel, UIComponentUtils.wrapWithBorderLayoutPane(conditionUIButton)}
};
conditionPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, HGAP, VGAP);
this.createScrollPane();
this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
}
@Override @Override
public String getIconPath() { public String getIconPath() {
return Toolkit.i18nText("Fine-Design_Report_Basic"); return Toolkit.i18nText("Fine-Design_Report_Basic");
@ -300,11 +243,13 @@ public class CellDSColumnEditor extends CellQuickEditor {
@Override @Override
public void populate() { public void populate() {
this.removeAttributeChangeListener();
dataPane.populate(DesignTableDataManager.getEditingTableDataSource(), cellElement, tc); dataPane.populate(DesignTableDataManager.getEditingTableDataSource(), cellElement, tc);
groupPane.populate(cellElement); groupPane.populate(cellElement);
if (tc != null) { if (tc != null) {
condition.setEditingComponent(tc); condition.setEditingComponent(tc);
} }
this.addAttributeChangeListener();
} }
@Override @Override
@ -321,7 +266,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
*/ */
@Override @Override
protected JPanel createContentPane() { protected JPanel createContentPane() {
initComponents();
double[] columnSize = {F}; double[] columnSize = {F};
double[] rowSize = {P, P, P}; double[] rowSize = {P, P, P};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
@ -334,6 +279,37 @@ public class CellDSColumnEditor extends CellQuickEditor {
}; };
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, HGAP, VGAP); return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, HGAP, VGAP);
} }
private void initComponents(){
dataPane = new SelectedDataColumnPane(true, true);
groupPane = new ResultSetGroupDockingPane();
double[] rowSize = {P}, columnSize = {60, F};
UILabel uiLabel = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Report_Filter_Conditions"));
condition = new DSColumnConditionAction();
if (tc != null) {
condition.setEditingComponent(tc);
}
//丢掉icon,修改按钮名称为编辑
condition.setSmallIcon(UIConstants.EMPTY_ICON);
condition.setName(Toolkit.i18nText("Fine-Design_Basic_Edit"));
conditionUIButton = new UIButton(condition);
Component[][] components = new Component[][]{
new Component[]{uiLabel, UIComponentUtils.wrapWithBorderLayoutPane(conditionUIButton)}
};
conditionPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, HGAP, VGAP);
this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
}
@Override
protected AttributeChangeListener getAttributeChangeListener() {
return new AttributeChangeListener() {
@Override
public void attributeChange() {
update();
fireTargetModified();
}
};
}
} }
@ -381,93 +357,8 @@ public class CellDSColumnEditor extends CellQuickEditor {
/*pane end*/ /*pane end*/
/*listeners begin*/
private UIObserverListener sortPaneFormulaChangeListener = new UIObserverListener() {
@Override
public void doChange() {
sortPane.update(cellElement);
fireTargetModified();
}
};
private ChangeListener sortTypeBtnGroupChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
sortPane.update(cellElement);
fireTargetModified();
}
};
private UIObserverListener filterPaneChangeListener = new UIObserverListener() {
@Override
public void doChange() {
filterPane.update(cellElement);
fireTargetModified();
}
};
private UIObserverListener customValuePaneChangeListener = new UIObserverListener() {
@Override
public void doChange() {
valuePane.update(cellElement);
fireTargetModified();
}
};
private AttributeChangeListener formatChangeListener = new AttributeChangeListener() {
@Override
public void attributeChange() {
formatAttrPane.update(cellElement);
fireTargetModified();
}
};
private ChangeListener heCheckBoxChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
cellDSColumnAdvancedPane.updateExtendConfig();
fireTargetModified();
}
};
private ChangeListener veCheckBoxChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
cellDSColumnAdvancedPane.updateExtendConfig();
fireTargetModified();
}
};
private ActionListener useMultiNumCheckBoxChangeListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkButtonEnabled();
cellDSColumnAdvancedPane.updateMultipleConfig();
fireTargetModified();
}
};
private ChangeListener multiNumSpinnerChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
cellDSColumnAdvancedPane.updateMultipleConfig();
fireTargetModified();
}
};
private UIObserverListener cellDSColumnSortPaneChangeListener = new UIObserverListener() {
@Override
public void doChange() {
cellDSColumnSortPane.updateBean(cellElement);
fireTargetModified();
}
};
/*listeners end*/
public DSColumnAdvancedEditorPane() { public DSColumnAdvancedEditorPane() {
this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
this.createScrollPane();
} }
@ -482,6 +373,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
} }
@Override @Override
public void update() { public void update() {
if (cellElement != null) { if (cellElement != null) {
@ -500,7 +392,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
@Override @Override
public void populate() { public void populate() {
if (cellElement != null) { if (cellElement != null) {
disableListener(); this.removeAttributeChangeListener();
sortPane.populate(cellElement); sortPane.populate(cellElement);
valuePane.populate(cellElement); valuePane.populate(cellElement);
formatAttrPane.populate(cellElement); formatAttrPane.populate(cellElement);
@ -542,7 +434,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
cellDSColumnSortPane.populateBean(cellElement); cellDSColumnSortPane.populateBean(cellElement);
} }
this.checkButtonEnabled(); this.checkButtonEnabled();
enableListener(); this.addAttributeChangeListener();
} }
} }
@ -551,6 +443,17 @@ public class CellDSColumnEditor extends CellQuickEditor {
} }
@Override
protected AttributeChangeListener getAttributeChangeListener() {
return new AttributeChangeListener() {
@Override
public void attributeChange() {
update();
fireTargetModified();
}
};
}
/** /**
* 更新单元格扩展属性 * 更新单元格扩展属性
*/ */
@ -634,8 +537,6 @@ public class CellDSColumnEditor extends CellQuickEditor {
multiPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); multiPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
multiNumPane.add(multiPane); multiNumPane.add(multiPane);
enableListener();
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
{sortPane}, {sortPane},
{filterPane}, {filterPane},
@ -658,34 +559,6 @@ public class CellDSColumnEditor extends CellQuickEditor {
return contentPane; return contentPane;
} }
public void enableListener() {
sortPane.addListener(sortPaneFormulaChangeListener, sortTypeBtnGroupChangeListener);
filterPane.addListener(filterPaneChangeListener);
valuePane.addListener(customValuePaneChangeListener);
formatAttrPane.addAttributeChangeListener(formatChangeListener);
heCheckBox.addChangeListener(heCheckBoxChangeListener);
veCheckBox.addChangeListener(veCheckBoxChangeListener);
useMultiNumCheckBox.addActionListener(useMultiNumCheckBoxChangeListener);
multiNumSpinner.addChangeListener(multiNumSpinnerChangeListener);
if (cellDSColumnSortPane != null) {
cellDSColumnSortPane.addListener(cellDSColumnSortPaneChangeListener);
}
}
public void disableListener() {
sortPane.removeListener(sortTypeBtnGroupChangeListener);
filterPane.removeListener();
valuePane.removeListener();
heCheckBox.removeChangeListener(heCheckBoxChangeListener);
veCheckBox.removeChangeListener(veCheckBoxChangeListener);
useMultiNumCheckBox.removeActionListener(useMultiNumCheckBoxChangeListener);
multiNumSpinner.removeChangeListener(multiNumSpinnerChangeListener);
if (cellDSColumnSortPane != null) {
cellDSColumnSortPane.removeListener(cellDSColumnSortPaneChangeListener);
}
}
private void checkButtonEnabled() { private void checkButtonEnabled() {
if (useMultiNumCheckBox.isSelected()) { if (useMultiNumCheckBox.isSelected()) {
multiNumSpinner.setEnabled(true); multiNumSpinner.setEnabled(true);

Loading…
Cancel
Save