Browse Source

REPORT-3348 单元格元素数据列基本设置动态加载

master
yaoh.wu 7 years ago
parent
commit
2d0177c6cc
  1. 33
      designer/src/com/fr/design/dscolumn/DSColumnBasicEditorPane.java
  2. 48
      designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java

33
designer/src/com/fr/design/dscolumn/DSColumnBasicEditorPane.java

@ -31,19 +31,6 @@ public class DSColumnBasicEditorPane extends CellEditorPane {
this.add(this.createContentPane(), BorderLayout.CENTER); this.add(this.createContentPane(), BorderLayout.CENTER);
} }
private JPanel createContentPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {p, f};
double[] rowSize = {p, p};
Component[][] components = new Component[][]{
//数据集列选择
new Component[]{this.dataPane, null},
//数据分组设置
new Component[]{this.groupPane, null}
};
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
}
@Override @Override
public String getIconPath() { public String getIconPath() {
@ -68,4 +55,24 @@ public class DSColumnBasicEditorPane extends CellEditorPane {
dataPane.populate(null, cellElement); dataPane.populate(null, cellElement);
groupPane.populate(cellElement); groupPane.populate(cellElement);
} }
/**
* 创建有内容的面板显示信息
*
* @return content JPanel
*/
private JPanel createContentPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {p, f};
double[] rowSize = {p, p};
Component[][] components = new Component[][]{
//数据集列选择
new Component[]{this.dataPane, null},
//数据分组设置
new Component[]{this.groupPane, null}
};
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
}
} }

48
designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java

@ -92,12 +92,14 @@ public class CellDSColumnEditor extends CellQuickEditor {
} }
/** /**
* 创建面板占位
*
* @return JComponent 详细信息面板 * @return JComponent 详细信息面板
*/ */
@Override @Override
public JComponent createCenterBody() { public JComponent createCenterBody() {
this.initPaneList(); this.createPanes();
this.initSwitchTab(); this.createSwitchTab();
dsColumnRegion = new JPanel(new BorderLayout()); dsColumnRegion = new JPanel(new BorderLayout());
dsColumnRegion.add(tabsHeaderIconPane, BorderLayout.NORTH); dsColumnRegion.add(tabsHeaderIconPane, BorderLayout.NORTH);
dsColumnRegion.add(center, BorderLayout.CENTER); dsColumnRegion.add(center, BorderLayout.CENTER);
@ -107,12 +109,20 @@ public class CellDSColumnEditor extends CellQuickEditor {
} }
/** /**
* TODO 内容全部重新动态生成不然容易出错 * 内容全部重新动态生成不然容易出错
* 刷新详细信息面板 * 刷新详细信息面板
*/ */
@Override @Override
protected void refreshDetails() { protected void refreshDetails() {
this.createPanes();
this.createSwitchTab();
dsColumnRegion = new JPanel(new BorderLayout());
dsColumnRegion.add(tabsHeaderIconPane, BorderLayout.NORTH);
dsColumnRegion.add(center, BorderLayout.CENTER);
//必须removeAll之后再添加;重新再实例化一个centerJPanel,因为对象变了会显示不出来
centerPane.removeAll();
centerPane.add(dsColumnRegion, BorderLayout.CENTER);
for (CellEditorPane cellEditorPane : paneList) { for (CellEditorPane cellEditorPane : paneList) {
cellEditorPane.populate(cellElement); cellEditorPane.populate(cellElement);
} }
@ -129,25 +139,11 @@ public class CellDSColumnEditor extends CellQuickEditor {
centerPane = null; centerPane = null;
} }
/**
* 初始化数据列基本和高级设置面板
*/
private void initPaneList() {
paneList = new ArrayList<>();
paneList.add(this.initBasicPane());
paneList.add(this.initAdvancedPane());
/*
todo 预留插件的接口
doSomething()
*/
}
/** /**
* 初始化基本和高级设置切换tab * 初始化基本和高级设置切换tab
*/ */
private void initSwitchTab() { private void createSwitchTab() {
String[] iconArray = new String[paneList.size()]; String[] iconArray = new String[paneList.size()];
card = new CardLayout(); card = new CardLayout();
center = new JPanel(card); center = new JPanel(card);
@ -166,17 +162,21 @@ public class CellDSColumnEditor extends CellQuickEditor {
tabsHeaderIconPane.setNeedLeftRightOutLine(false); tabsHeaderIconPane.setNeedLeftRightOutLine(false);
} }
private DSColumnBasicEditorPane initBasicPane() { /**
* 刷新数据列基本和高级设置面板
*/
private void createPanes() {
paneList = new ArrayList<>();
/*基本设置面板*/
this.dataPane = new SelectedDataColumnPane(false); this.dataPane = new SelectedDataColumnPane(false);
this.groupPane = new ResultSetGroupDockingPane(tc); this.groupPane = new ResultSetGroupDockingPane(tc);
dataPane.addListener(dataListener); dataPane.addListener(dataListener);
groupPane.addListener(groupListener); groupPane.addListener(groupListener);
return new DSColumnBasicEditorPane(cellElement, dataPane, groupPane); paneList.add(new DSColumnBasicEditorPane(cellElement, dataPane, groupPane));
}
private DSColumnAdvancedEditorPane initAdvancedPane() {
return new DSColumnAdvancedEditorPane();
}
/*高级设置面板*/
paneList.add(new DSColumnAdvancedEditorPane());
}
} }
Loading…
Cancel
Save