|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package com.fr.design.data.tabledata.tabledatapane; |
|
|
|
|
|
|
|
|
|
import com.formdev.flatlaf.util.ScaledEmptyBorder; |
|
|
|
|
import com.fine.theme.icon.LazyIcon; |
|
|
|
|
import com.fine.theme.utils.FineUIStyle; |
|
|
|
|
import com.fr.base.Parameter; |
|
|
|
|
import com.fr.data.impl.ClassTableData; |
|
|
|
|
import com.fr.design.constants.LayoutConstants; |
|
|
|
@ -13,16 +14,13 @@ 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.general.IOUtils; |
|
|
|
|
import com.fr.script.Calculator; |
|
|
|
|
import com.fr.stable.ParameterProvider; |
|
|
|
|
import com.fr.stable.StableUtils; |
|
|
|
|
import com.fr.stable.project.ProjectConstants; |
|
|
|
|
|
|
|
|
|
import javax.swing.BorderFactory; |
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
import javax.swing.SwingUtilities; |
|
|
|
|
import java.awt.BorderLayout; |
|
|
|
|
import java.awt.Dialog; |
|
|
|
|
import java.awt.Dimension; |
|
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
@ -32,6 +30,7 @@ import static com.fine.swing.ui.layout.Layouts.cell;
|
|
|
|
|
import static com.fine.swing.ui.layout.Layouts.column; |
|
|
|
|
import static com.fine.swing.ui.layout.Layouts.flex; |
|
|
|
|
import static com.fine.swing.ui.layout.Layouts.row; |
|
|
|
|
import static com.fine.swing.ui.layout.Layouts.fix; |
|
|
|
|
|
|
|
|
|
public class ClassTableDataPane extends AbstractTableDataPane<ClassTableData> { |
|
|
|
|
private UITextField classNameTextField; |
|
|
|
@ -39,7 +38,20 @@ public class ClassTableDataPane extends AbstractTableDataPane<ClassTableData> {
|
|
|
|
|
|
|
|
|
|
public ClassTableDataPane() { |
|
|
|
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
|
|
|
// 数据集默认参数
|
|
|
|
|
editorPane = new UITableEditorPane<ParameterProvider>(new ParameterTableModel() { |
|
|
|
|
@Override |
|
|
|
|
public UITableEditAction[] createAction() { |
|
|
|
|
return new UITableEditAction[]{ |
|
|
|
|
new AddParaAction(), |
|
|
|
|
new RemoveParaAction() |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
}, " " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_TableData_Default_Para")); |
|
|
|
|
this.add(column(cell(initNorthPanel()), fix(LayoutConstants.VERTICAL_GAP), cell(editorPane).weight(1)).getComponent()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private JPanel initNorthPanel() { |
|
|
|
|
//类名
|
|
|
|
|
classNameTextField = new UITextField(); |
|
|
|
|
UIButton browserButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Select")); |
|
|
|
@ -51,60 +63,42 @@ public class ClassTableDataPane extends AbstractTableDataPane<ClassTableData> {
|
|
|
|
|
BasicDialog dlg= bPane.showWindow( |
|
|
|
|
(Dialog) SwingUtilities.getWindowAncestor(ClassTableDataPane.this), |
|
|
|
|
new DialogActionAdapter() { |
|
|
|
|
public void doOk() { |
|
|
|
|
String classPath = bPane.getClassPath(); |
|
|
|
|
ClassTableData tableData = new ClassTableData(classPath); |
|
|
|
|
populateBean(tableData); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
public void doOk() { |
|
|
|
|
String classPath = bPane.getClassPath(); |
|
|
|
|
ClassTableData tableData = new ClassTableData(classPath); |
|
|
|
|
populateBean(tableData); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
dlg.setVisible(true); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
JPanel tipPanel = column(LayoutConstants.VERTICAL_GAP, |
|
|
|
|
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Function_The_Class_Must_Implement_The_Interface") + "\"com.fr.data.Tabledata\"")), |
|
|
|
|
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Example") + ":\"com.fr.data.impl.ArrayTableData\"")), |
|
|
|
|
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Class_Location_Description", StableUtils.pathJoin(ProjectConstants.WEBINF_NAME, ProjectConstants.CLASSES_NAME)))) |
|
|
|
|
).getComponent(); |
|
|
|
|
|
|
|
|
|
JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
|
northPane.add(column(LayoutConstants.VERTICAL_GAP, |
|
|
|
|
return column(LayoutConstants.VERTICAL_GAP, |
|
|
|
|
row(LayoutConstants.HGAP_LARGE, |
|
|
|
|
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS_Class_Name"))).weight(0.12), |
|
|
|
|
row(LayoutConstants.HGAP_LARGE, |
|
|
|
|
cell(classNameTextField).weight(0.85), |
|
|
|
|
cell(browserButton).weight(0.15) |
|
|
|
|
).weight(0.58), |
|
|
|
|
row(LayoutConstants.HGAP_LARGE, cell(classNameTextField).weight(0.85), cell(browserButton).weight(0.15)).weight(0.58), |
|
|
|
|
flex(0.3) |
|
|
|
|
), |
|
|
|
|
row(LayoutConstants.HGAP_LARGE, flex(0.12), cell(tipPanel).weight(0.88)) |
|
|
|
|
).with(it -> it.setBorder(new ScaledEmptyBorder(0, 0,10, 0))).getComponent()); |
|
|
|
|
this.add(northPane, BorderLayout.NORTH); |
|
|
|
|
this.add(initSouthPanel(), BorderLayout.CENTER); |
|
|
|
|
row(LayoutConstants.HGAP_LARGE, flex(0.12), cell(getTipPanel()).weight(0.88)) |
|
|
|
|
).getComponent(); |
|
|
|
|
} |
|
|
|
|
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() |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
}, " " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_TableData_Default_Para")); |
|
|
|
|
|
|
|
|
|
jpanel.add(editorPane, BorderLayout.CENTER); |
|
|
|
|
return jpanel; |
|
|
|
|
private JPanel getTipPanel() { |
|
|
|
|
return column( |
|
|
|
|
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Function_The_Class_Must_Implement_The_Interface") + |
|
|
|
|
"\"com.fr.data.Tabledata\"", FineUIStyle.LABEL_TIP)), |
|
|
|
|
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Class_Location_Description", |
|
|
|
|
StableUtils.pathJoin(ProjectConstants.WEBINF_NAME, ProjectConstants.CLASSES_NAME)), FineUIStyle.LABEL_TIP)), |
|
|
|
|
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Example") + |
|
|
|
|
":\"com.fr.data.impl.ArrayTableData\"", FineUIStyle.LABEL_TIP)) |
|
|
|
|
).getComponent(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class AddParaAction extends UITableEditAction { |
|
|
|
|
public AddParaAction() { |
|
|
|
|
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Add")); |
|
|
|
|
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/buttonicon/add.png")); |
|
|
|
|
this.setSmallIcon(new LazyIcon("add")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -122,7 +116,7 @@ public class ClassTableDataPane extends AbstractTableDataPane<ClassTableData> {
|
|
|
|
|
private class RemoveParaAction extends UITableEditAction { |
|
|
|
|
public RemoveParaAction() { |
|
|
|
|
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove")); |
|
|
|
|
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/control/remove.png")); |
|
|
|
|
this.setSmallIcon(new LazyIcon("remove")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|