|
|
|
@ -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<ClassTableData> { |
|
|
|
|
private UITextField classNameTextField; |
|
|
|
|
private UITableEditorPane<ParameterProvider> editorPane; |
|
|
|
|
|
|
|
|
|
public ClassTableDataPane() { |
|
|
|
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
|
|
@ -89,13 +97,62 @@ public class ClassTableDataPane extends AbstractTableDataPane<ClassTableData> {
|
|
|
|
|
}; |
|
|
|
|
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<ParameterProvider>(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<ParameterProvider> 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<ParameterProvider> 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<ClassTableData> {
|
|
|
|
|
|
|
|
|
|
@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<ParameterProvider> paras = this.editorPane.update(); |
|
|
|
|
tableData.setParameters(paras.toArray(new ParameterProvider[paras.size()])); |
|
|
|
|
|
|
|
|
|
return tableData; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|