From 49a462968430d71a63062ffd2022446091e50d9c Mon Sep 17 00:00:00 2001 From: neil Date: Sat, 8 Oct 2016 17:00:18 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-381:=E7=A8=8B=E5=BA=8F=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E6=B7=BB=E5=8A=A0=E5=8F=82=E6=95=B0=E7=95=8C?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tabledatapane/ClassTableDataPane.java | 74 +++++++++++++++++-- 1 file changed, 68 insertions(+), 6 deletions(-) diff --git a/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java b/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java index fd127375d2..724831aebe 100644 --- a/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java +++ b/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java @@ -1,16 +1,23 @@ package com.fr.design.data.tabledata.tabledatapane; +import com.fr.base.Parameter; import com.fr.data.impl.ClassTableData; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.formula.JavaEditorPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itableeditorpane.ParameterTableModel; +import com.fr.design.gui.itableeditorpane.UITableEditAction; +import com.fr.design.gui.itableeditorpane.UITableEditorPane; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.general.IOUtils; import com.fr.general.Inter; +import com.fr.script.Calculator; +import com.fr.stable.ParameterProvider; import com.fr.stable.project.ProjectConstants; import javax.swing.*; @@ -21,6 +28,7 @@ import java.io.File; public class ClassTableDataPane extends AbstractTableDataPane { private UITextField classNameTextField; + private UITableEditorPane editorPane; public ClassTableDataPane() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); @@ -89,13 +97,62 @@ public class ClassTableDataPane extends AbstractTableDataPane { }; JPanel northPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); this.add(northPane, BorderLayout.NORTH); - // TODO alex_ENV -// northPane.add(flowTableLayoutHelper.createLabelFlowPane( -// " ", new UILabel(Inter.getLocText("Example") + ":" + -// BaseCoreUtils.pathJoin(new String[] {FRContext.getCurrentEnv().getPath(), "classes"})))); + this.add(initSouthPanel(), BorderLayout.SOUTH); + } + private JPanel initSouthPanel() { + JPanel jpanel = new JPanel(); + jpanel.setPreferredSize(new Dimension(-1, 150)); + jpanel.setLayout(new BorderLayout()); + + editorPane = new UITableEditorPane(new ParameterTableModel() { + @Override + public UITableEditAction[] createAction() { + return new UITableEditAction[]{ + new AddParaAction(), + new RemoveParaAction() + }; + } + }, " " + Inter.getLocText(new String[]{"DS-TableData", "DEFAULT", "Parameter"})); + + jpanel.add(editorPane, BorderLayout.CENTER); + return jpanel; } - + + public class AddParaAction extends UITableEditAction { + public AddParaAction() { + this.setName(Inter.getLocText("FR-Designer_Add")); + this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/buttonicon/add.png")); + } + + public void actionPerformed(ActionEvent e) { + java.util.List oldParas = editorPane.update(); + oldParas.add(new Parameter()); + editorPane.populate(oldParas.toArray(new ParameterProvider[oldParas.size()])); + } + + @Override + public void checkEnabled() { + } + } + private class RemoveParaAction extends UITableEditAction { + public RemoveParaAction() { + this.setName(Inter.getLocText("FR-Designer_Remove")); + this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/control/remove.png")); + } + + public void actionPerformed(ActionEvent e) { + ParameterProvider selectedPara = editorPane.getTableModel().getSelectedValue(); + java.util.List oldParas = editorPane.update(); + oldParas.remove(selectedPara); + editorPane.populate(oldParas.toArray(new ParameterProvider[oldParas.size()])); + } + + @Override + public void checkEnabled() { + } + } + @Override protected String title4PopupWindow() { return Inter.getLocText("DS-Class_TableData"); @@ -103,12 +160,17 @@ public class ClassTableDataPane extends AbstractTableDataPane { @Override public void populateBean(ClassTableData ob) { + this.editorPane.populate(ob.getParameters(Calculator.createCalculator())); this.classNameTextField.setText(ob.getClassName()); } @Override public ClassTableData updateBean() { - return new ClassTableData(this.classNameTextField.getText()); + ClassTableData tableData = new ClassTableData(this.classNameTextField.getText()); + java.util.List paras = this.editorPane.update(); + tableData.setParameters(paras.toArray(new ParameterProvider[paras.size()])); + + return tableData; } From 833cbbd2236c42655d1926e40de47fa1b15bbe64 Mon Sep 17 00:00:00 2001 From: neil Date: Sat, 8 Oct 2016 17:03:38 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=9B=BD=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/data/tabledata/tabledatapane/ClassTableDataPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java b/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java index 724831aebe..7a40959ed2 100644 --- a/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java +++ b/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java @@ -112,7 +112,7 @@ public class ClassTableDataPane extends AbstractTableDataPane { new RemoveParaAction() }; } - }, " " + Inter.getLocText(new String[]{"DS-TableData", "DEFAULT", "Parameter"})); + }, " " + Inter.getLocText("FR-Designer_TableData-Default-Para")); jpanel.add(editorPane, BorderLayout.CENTER);