Browse Source

REPORT-3348 单元格元素数据列基本设置OK

master
yaoh.wu 7 years ago
parent
commit
89bd13daaf
  1. 1
      designer/src/com/fr/design/dscolumn/DSColumnBasicEditorPane.java
  2. 38
      designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java
  3. 7
      designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java

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

@ -27,6 +27,7 @@ public class DSColumnBasicEditorPane extends CellEditorPane {
private JPanel conditionPane; private JPanel conditionPane;
public DSColumnBasicEditorPane(TemplateCellElement cellElement, SelectedDataColumnPane dataPane, ResultSetGroupDockingPane groupPane, JPanel conditionPane) { public DSColumnBasicEditorPane(TemplateCellElement cellElement, SelectedDataColumnPane dataPane, ResultSetGroupDockingPane groupPane, JPanel conditionPane) {
this.setLayout(new BorderLayout());
this.cellElement = cellElement; this.cellElement = cellElement;
this.dataPane = dataPane; this.dataPane = dataPane;
this.groupPane = groupPane; this.groupPane = groupPane;

38
designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java

@ -40,15 +40,15 @@ import java.util.regex.Pattern;
* *
* @author yaoh.wu * @author yaoh.wu
* @version 2017年7月26日 * @version 2017年7月26日
* todo 9.0设计器更新修改动态参数注入按钮部分,使其能在右侧边栏正常显示 * 9.0设计器更新修改动态参数注入按钮部分,使其显示动态参数按钮时能在右侧边栏正常显示
* @since 8.0 * @since 8.0
*/ */
public class SelectedDataColumnPane extends BasicPane { public class SelectedDataColumnPane extends BasicPane {
protected UITableEditorPane<ParameterProvider> editorPane; private UITableEditorPane<ParameterProvider> editorPane;
protected Parameter[] ps; private Parameter[] ps;
protected TableDataComboBox tableNameComboBox; TableDataComboBox tableNameComboBox;
protected LazyComboBox columnNameComboBox; LazyComboBox columnNameComboBox;
private ItemListener itemListener; private ItemListener itemListener;
private UIButton paramButton; private UIButton paramButton;
@ -57,7 +57,7 @@ public class SelectedDataColumnPane extends BasicPane {
this(true); this(true);
} }
public SelectedDataColumnPane(boolean showParameterButton) { SelectedDataColumnPane(boolean showParameterButton) {
initComponent(showParameterButton); initComponent(showParameterButton);
} }
@ -72,32 +72,33 @@ public class SelectedDataColumnPane extends BasicPane {
initWithParameterButton(); initWithParameterButton();
} }
columnNameComboBox = new LazyComboBox() { columnNameComboBox = new LazyComboBox() {
@Override @Override
public Object[] load() { public Object[] load() {
List<String> l = calculateColumnNameList(); List<String> l = calculateColumnNameList();
return l.toArray(new String[l.size()]); return l.toArray(new String[l.size()]);
} }
}; };
columnNameComboBox.setEditable(true); columnNameComboBox.setEditable(true);
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
UILabel label1 = new UILabel(Inter.getLocText("TableData") + ":"); UILabel label1 = new UILabel(Inter.getLocText("TableData") + ":");
UILabel label2 = new UILabel(Inter.getLocText("DataColumn") + ":"); UILabel label3 = new UILabel(Inter.getLocText("DataColumn") + ":");
if (showParameterButton) { if (showParameterButton) {
label1.setPreferredSize(new Dimension(200, 25)); //todo 国际化
label2.setPreferredSize(new Dimension(200, 25)); UILabel label2 = new UILabel("param" + ":");
} Component[][] components = {
if (showParameterButton) { {label1, tableNameComboBox},
Component[][] comps = {{label1, null, label2}, {tableNameComboBox, paramButton, columnNameComboBox}}; {label2, paramButton},
this.add(TableLayoutHelper.createTableLayoutPane(comps, new double[]{p, p}, new double[]{p, p, p})); {label3, columnNameComboBox}
};
this.setLayout(new BorderLayout());
this.add(TableLayoutHelper.createTableLayoutPane(components, new double[]{p, p, p}, new double[]{p, f}));
} else { } else {
double f = TableLayout.FILL;
double[] columnSize = {p, f}; double[] columnSize = {p, f};
double[] rowSize = {p, p}; double[] rowSize = {p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{label1, tableNameComboBox}, new Component[]{label1, tableNameComboBox},
new Component[]{label2, columnNameComboBox} new Component[]{label3, columnNameComboBox}
}; };
JPanel jPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); JPanel jPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
@ -110,16 +111,13 @@ public class SelectedDataColumnPane extends BasicPane {
if (cellElement == null) { if (cellElement == null) {
return; return;
} }
if (itemListener != null) { if (itemListener != null) {
removeListener(itemListener); removeListener(itemListener);
} }
Object value = cellElement.getValue(); Object value = cellElement.getValue();
if (!(value instanceof DSColumn)) { if (!(value instanceof DSColumn)) {
return; return;
} }
DSColumn dsColumn = (DSColumn) value; DSColumn dsColumn = (DSColumn) value;
String dsName = dsColumn.getDSName(); String dsName = dsColumn.getDSName();
tableNameComboBox.setSelectedTableDataByName(dsName); tableNameComboBox.setSelectedTableDataByName(dsName);

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

@ -174,19 +174,18 @@ public class CellDSColumnEditor extends CellQuickEditor {
paneList = new ArrayList<>(); paneList = new ArrayList<>();
/*基本设置面板*/ /*基本设置面板*/
this.dataPane = new SelectedDataColumnPane(false); this.dataPane = new SelectedDataColumnPane();
this.groupPane = new ResultSetGroupDockingPane(tc); this.groupPane = new ResultSetGroupDockingPane(tc);
this.conditionPane = new JPanel(new BorderLayout()); this.conditionPane = new JPanel(new BorderLayout());
conditionPane.add(new UILabel("filter"), BorderLayout.WEST); conditionPane.add(new UILabel("filter:"), BorderLayout.WEST);
if (tc != null) { if (tc != null) {
//第一次初始化时tc为空,引发NullPointerException //第一次初始化时tc为空,引发NullPointerException
conditionPane.add(new UIButton(new DSColumnConditionAction(tc)), BorderLayout.EAST); conditionPane.add(new UIButton(new DSColumnConditionAction(tc)), BorderLayout.CENTER);
} }
dataPane.addListener(dataListener); dataPane.addListener(dataListener);
groupPane.addListener(groupListener); groupPane.addListener(groupListener);
paneList.add(new DSColumnBasicEditorPane(cellElement, dataPane, groupPane, conditionPane)); paneList.add(new DSColumnBasicEditorPane(cellElement, dataPane, groupPane, conditionPane));
/*高级设置面板*/ /*高级设置面板*/
paneList.add(new DSColumnAdvancedEditorPane()); paneList.add(new DSColumnAdvancedEditorPane());
} }

Loading…
Cancel
Save