From 56a4a954e53d05a3ae895b699bb6c5c49b89511d Mon Sep 17 00:00:00 2001 From: MoMeak Date: Mon, 13 Nov 2017 16:05:49 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-5194=20=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E5=A1=AB=E6=8A=A5=E7=9A=84=E6=8E=A5=E5=8F=A3=E8=AF=B4=E6=98=8E?= =?UTF-8?q?=E4=B8=8D=E6=AD=A3=E7=A1=AE=20REPORT-4549=20=E5=A1=AB=E6=8A=A5?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E6=8F=90=E4=BA=A4=E7=9A=84=E5=9C=B0?= =?UTF-8?q?=E6=96=B9=EF=BC=8C=E8=AF=B4=E6=98=8E=E4=B8=8D=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/write/submit/CustomJobPane.java | 141 +++++++++++++++++- 1 file changed, 140 insertions(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/write/submit/CustomJobPane.java b/designer_base/src/com/fr/design/write/submit/CustomJobPane.java index 15c6552872..c29c751489 100644 --- a/designer_base/src/com/fr/design/write/submit/CustomJobPane.java +++ b/designer_base/src/com/fr/design/write/submit/CustomJobPane.java @@ -1 +1,140 @@ -package com.fr.design.write.submit; import com.fr.base.GraphHelper; import com.fr.data.AbstractClassJob; import com.fr.design.data.tabledata.tabledatapane.ClassNameSelectPane; import com.fr.design.beans.BasicBeanPane; import com.fr.design.formula.JavaEditorPane; import com.fr.design.gui.frpane.ObjectProperiesPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.general.Inter; import com.fr.stable.StringUtils; import com.fr.design.utils.gui.GUICoreUtils; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; /** * Author : Shockway * Date: 13-7-29 * Time: 下午6:48 */ public abstract class CustomJobPane extends BasicBeanPane { protected UITextField classNameTextField; protected ObjectProperiesPane objectProperiesPane; public static final int DEFAULT_LENGTH = 30; public CustomJobPane() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); JPanel reportletNamePane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(); classNameTextField = new UITextField(getLengthOfTextField()); reportletNamePane.add(classNameTextField); UIButton browserButton = new UIButton(Inter.getLocText("FR-Designer_Select")); browserButton.setPreferredSize(new Dimension( GraphHelper.getLocTextWidth("FR-Designer_Select") + 20, classNameTextField.getPreferredSize().height)); UIButton editButton = new UIButton(Inter.getLocText("FR-Designer_Edit")); editButton.setPreferredSize(new Dimension( GraphHelper.getLocTextWidth("FR-Designer_Edit") + 20, classNameTextField.getPreferredSize().height)); reportletNamePane.add(browserButton); reportletNamePane.add(editButton); browserButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { final ClassNameSelectPane bPane = new ClassNameSelectPane(); bPane.setClassPath(classNameTextField.getText()); bPane.showWindow( SwingUtilities.getWindowAncestor(getWindowAncestor()), new DialogActionAdapter() { public void doOk() { classNameTextField.setText(bPane.getClassPath()); checkAddButtonEnable(); } }).setVisible(true); } }); editButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final JavaEditorPane javaEditorPane = new JavaEditorPane(classNameTextField.getText(), JavaEditorPane.DEFAULT_SUBMIT_JOB); final BasicDialog dlg = javaEditorPane.showMediumWindow(SwingUtilities.getWindowAncestor(CustomJobPane.this), new DialogActionAdapter() { public void doOk() { classNameTextField.setText(javaEditorPane.getClassText()); checkAddButtonEnable(); } }); javaEditorPane.addSaveActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { dlg.doOK(); } }); dlg.setVisible(true); } }); reportletNamePane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("FR-Designer_ClassName"), null)); this.add(reportletNamePane, BorderLayout.NORTH); objectProperiesPane = new ObjectProperiesPane(); objectProperiesPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("FR-Designer_Property"), null)); this.add(objectProperiesPane, BorderLayout.CENTER); UITextArea area = new UITextArea(2, 1); area.setText(Inter.getLocText(new String[]{"Come_True", "Interface"}) + ":com.fr.data.AbstractSubmitTask"); JPanel dsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); dsPane.add(area); dsPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("FR-Designer_Custom_Job_Description"), null)); this.add(dsPane, BorderLayout.SOUTH); checkAddButtonEnable(); } public int getLengthOfTextField() { return DEFAULT_LENGTH; } protected String title4PopupWindow() { return "CustomJob"; } protected Component getWindowAncestor() { return this; } @Override public void populateBean(Object ob) { if (ob instanceof AbstractClassJob) { AbstractClassJob cj = (AbstractClassJob) ob; this.classNameTextField.setText(cj.getClassName()); this.objectProperiesPane.populateBean(cj.getPropertyMap()); checkAddButtonEnable(); } } /** * 添加按钮可用 */ public void checkAddButtonEnable() { objectProperiesPane.enableAddButton(StringUtils.isNotEmpty(classNameTextField.getText())); } /** * 重置 */ public void reset() { this.classNameTextField.setText(null); this.checkAddButtonEnable(); } } \ No newline at end of file +package com.fr.design.write.submit; + +import com.fr.base.GraphHelper; +import com.fr.data.AbstractClassJob; +import com.fr.design.data.tabledata.tabledatapane.ClassNameSelectPane; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.formula.JavaEditorPane; +import com.fr.design.gui.frpane.ObjectProperiesPane; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.itextarea.UITextArea; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.general.Inter; +import com.fr.stable.StringUtils; +import com.fr.design.utils.gui.GUICoreUtils; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * Author : Shockway + * Date: 13-7-29 + * Time: 下午6:48 + */ +public abstract class CustomJobPane extends BasicBeanPane { + protected UITextField classNameTextField; + protected ObjectProperiesPane objectProperiesPane; + public static final int DEFAULT_LENGTH = 30; + + public CustomJobPane() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + JPanel reportletNamePane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(); + classNameTextField = new UITextField(getLengthOfTextField()); + reportletNamePane.add(classNameTextField); + + UIButton browserButton = new UIButton(Inter.getLocText("FR-Designer_Select")); + browserButton.setPreferredSize(new Dimension( + GraphHelper.getLocTextWidth("FR-Designer_Select") + 20, + classNameTextField.getPreferredSize().height)); + + UIButton editButton = new UIButton(Inter.getLocText("FR-Designer_Edit")); + editButton.setPreferredSize(new Dimension( + GraphHelper.getLocTextWidth("FR-Designer_Edit") + 20, + classNameTextField.getPreferredSize().height)); + + reportletNamePane.add(browserButton); + reportletNamePane.add(editButton); + + browserButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent evt) { + final ClassNameSelectPane bPane = new ClassNameSelectPane(); + bPane.setClassPath(classNameTextField.getText()); + bPane.showWindow( + SwingUtilities.getWindowAncestor(getWindowAncestor()), + new DialogActionAdapter() { + public void doOk() { + classNameTextField.setText(bPane.getClassPath()); + checkAddButtonEnable(); + } + }).setVisible(true); + } + }); + editButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + final JavaEditorPane javaEditorPane = new JavaEditorPane(classNameTextField.getText(), JavaEditorPane.DEFAULT_SUBMIT_JOB); + final BasicDialog dlg = javaEditorPane.showMediumWindow(SwingUtilities.getWindowAncestor(CustomJobPane.this), + new DialogActionAdapter() { + public void doOk() { + classNameTextField.setText(javaEditorPane.getClassText()); + checkAddButtonEnable(); + } + }); + javaEditorPane.addSaveActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + dlg.doOK(); + } + }); + dlg.setVisible(true); + } + }); + + reportletNamePane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("FR-Designer_ClassName"), null)); + this.add(reportletNamePane, BorderLayout.NORTH); + + objectProperiesPane = new ObjectProperiesPane(); + objectProperiesPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("FR-Designer_Property"), null)); + this.add(objectProperiesPane, BorderLayout.CENTER); + + UITextArea area = new UITextArea(2, 1); + area.setText(Inter.getLocText(new String[]{"Come_True", "Interface"}) + ":com.fr.data.AbstractSubmitTask"); + JPanel dsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + dsPane.add(area); + dsPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("FR-Designer_Custom_Job_Description"), null)); + this.add(dsPane, BorderLayout.SOUTH); + checkAddButtonEnable(); + } + + public int getLengthOfTextField() { + return DEFAULT_LENGTH; + } + + protected String title4PopupWindow() { + return "CustomJob"; + } + + protected Component getWindowAncestor() { + return this; + } + + @Override + public void populateBean(Object ob) { + if (ob instanceof AbstractClassJob) { + AbstractClassJob cj = (AbstractClassJob) ob; + this.classNameTextField.setText(cj.getClassName()); + this.objectProperiesPane.populateBean(cj.getPropertyMap()); + checkAddButtonEnable(); + } + } + + /** + * 添加按钮可用 + */ + public void checkAddButtonEnable() { + objectProperiesPane.enableAddButton(StringUtils.isNotEmpty(classNameTextField.getText())); + } + + /** + * 重置 + */ + public void reset() { + this.classNameTextField.setText(null); + this.checkAddButtonEnable(); + } +} \ No newline at end of file