Browse Source

REPORT-11538 自定义提交事件设计器部分bug

final/10.0
yaoh.wu 6 years ago
parent
commit
8dfe80a6a5
  1. 39
      designer-base/src/main/java/com/fr/design/gui/columnrow/ColumnRowPane.java
  2. 58
      designer-realize/src/main/java/com/fr/design/javascript/ListenerEditPane.java

39
designer-base/src/main/java/com/fr/design/gui/columnrow/ColumnRowPane.java

@ -1,8 +1,17 @@
package com.fr.design.gui.columnrow; package com.fr.design.gui.columnrow;
import java.awt.BorderLayout; import com.fr.design.designer.IntervalConstants;
import java.awt.Dimension; import com.fr.design.event.UIObserver;
import java.awt.GridLayout; import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ispinner.ColumnRowSpinner;
import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.gui.ispinner.UpperCaseSpinner;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.stable.ColumnRow;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import javax.swing.JFormattedTextField; import javax.swing.JFormattedTextField;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -16,19 +25,9 @@ import javax.swing.text.AbstractDocument;
import javax.swing.text.AttributeSet; import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException; import javax.swing.text.BadLocationException;
import javax.swing.text.DocumentFilter; import javax.swing.text.DocumentFilter;
import java.awt.BorderLayout;
import com.fr.design.designer.IntervalConstants; import java.awt.Dimension;
import com.fr.design.event.UIObserver; import java.awt.GridLayout;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.gui.ispinner.UpperCaseSpinner;
import com.fr.design.gui.ispinner.ColumnRowSpinner;
import com.fr.general.ComparatorUtils;
import com.fr.stable.ColumnRow;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.design.utils.gui.GUICoreUtils;
/** /**
* the component to edit ColumnRow * the component to edit ColumnRow
@ -46,10 +45,10 @@ public class ColumnRowPane extends JPanel implements UIObserver {
protected UIBasicSpinner rowSpinner; protected UIBasicSpinner rowSpinner;
static { static {
for (int i = 1; i < 1000; i++) { for (int i = 1; i <= 1000; i++) {
columnarray[i - 1] = StableUtils.convertIntToABC(i); columnarray[i - 1] = StableUtils.convertIntToABC(i);
} }
for (int i = 1; i < 5000; i++) { for (int i = 1; i <= 5000; i++) {
rowarray[i - 1] = StringUtils.EMPTY + i; rowarray[i - 1] = StringUtils.EMPTY + i;
} }
} }
@ -217,6 +216,7 @@ public class ColumnRowPane extends JPanel implements UIObserver {
/** /**
* 添加一个listener到listenerList中 * 添加一个listener到listenerList中
*
* @param l 监听 * @param l 监听
*/ */
public void addChangeListener(ChangeListener l) { public void addChangeListener(ChangeListener l) {
@ -225,6 +225,7 @@ public class ColumnRowPane extends JPanel implements UIObserver {
/** /**
* 从listenerList中移除一个listener * 从listenerList中移除一个listener
*
* @param l 监听 * @param l 监听
*/ */
public void removeChangeListener(ChangeListener l) { public void removeChangeListener(ChangeListener l) {
@ -244,6 +245,7 @@ public class ColumnRowPane extends JPanel implements UIObserver {
/** /**
* 给组件登记一个观察者监听事件 * 给组件登记一个观察者监听事件
*
* @param listener 监听 * @param listener 监听
*/ */
public void registerChangeListener(UIObserverListener listener) { public void registerChangeListener(UIObserverListener listener) {
@ -252,6 +254,7 @@ public class ColumnRowPane extends JPanel implements UIObserver {
/** /**
* 组件是否需要响应添加的观察者事件 * 组件是否需要响应添加的观察者事件
*
* @return 如果需要响应观察者事件则返回true否则返回false * @return 如果需要响应观察者事件则返回true否则返回false
*/ */
public boolean shouldResponseChangeListener() { public boolean shouldResponseChangeListener() {

58
designer-realize/src/main/java/com/fr/design/javascript/ListenerEditPane.java

@ -7,6 +7,7 @@ import com.fr.design.fun.JavaScriptActionProvider;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
@ -34,19 +35,10 @@ public class ListenerEditPane extends BasicBeanPane<Listener> {
private List<FurtherBasicBeanPane<? extends JavaScript>> cards; private List<FurtherBasicBeanPane<? extends JavaScript>> cards;
private JPanel hyperlinkPane; private JPanel hyperlinkPane;
private JavaScriptImplPane javaScriptPane; private static final String JS = Toolkit.i18nText("Fine-Design_Report_JavaScript");
private FormSubmitJavaScriptPane formSubmitScriptPane; private static final String DBCOMMIT = Toolkit.i18nText("Fine-Design_Basic_JavaScript_Commit_To_Database");
private Commit2DBJavaScriptPane commit2DBJavaScriptPane; private static final String CUSTOMACTION = Toolkit.i18nText("Fine-Design_Report_Submit_Type_Custom");
// 自定义事件 private static final String EMAIL = Toolkit.i18nText("Fine-Design_Report_Email_Sent_Email");
private CustomActionPane customActionPane;
// 发送邮件
private EmailPane emailPane;
private static final String JS = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JavaScript");
private static final String FORMSUBMIT = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JavaScript_Form_Submit");
private static final String DBCOMMIT = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JavaScript_Commit_To_Database");
private static final String CUSTOMACTION= com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JavaScript_Custom_Submit");
private static final String EMAIL = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Email_Sent_Email");
private Listener listener; private Listener listener;
@ -60,37 +52,43 @@ public class ListenerEditPane extends BasicBeanPane<Listener> {
/** /**
* 初始化各个组件 * 初始化各个组件
*
* @param defaultArgs 初始化参数 * @param defaultArgs 初始化参数
*/ */
public void initComponents(String[] defaultArgs) { public void initComponents(String[] defaultArgs) {
cards = new ArrayList<FurtherBasicBeanPane<? extends JavaScript>>(); cards = new ArrayList<>();
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel namePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel namePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
nameText = new UITextField(8); nameText = new UITextField(8);
nameText.setEditable(false); nameText.setEditable(false);
namePane.add(nameText, BorderLayout.WEST); namePane.add(nameText, BorderLayout.WEST);
String[] style = {JS, DBCOMMIT, CUSTOMACTION,EMAIL}; final String[] style = {JS, DBCOMMIT, CUSTOMACTION, EMAIL};
styleBox = new UIComboBox(style); styleBox = new UIComboBox(style);
namePane.add(styleBox); namePane.add(styleBox);
namePane = GUICoreUtils.createFlowPane(new Component[]{new UILabel(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event_Name") + ":"), nameText, new UILabel(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event_Type") + ":"), styleBox}, FlowLayout.LEFT); namePane = GUICoreUtils.createFlowPane(new Component[]{
namePane.setBorder(BorderFactory.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event_Name_Type"))); new UILabel(" " + Toolkit.i18nText("Fine-Design_Report_Event_Name") + ":"),
nameText,
new UILabel(" " + Toolkit.i18nText("Fine-Design_Report_Event_Type") + ":"),
styleBox},
FlowLayout.LEFT);
namePane.setBorder(BorderFactory.createTitledBorder(Toolkit.i18nText("Fine-Design_Report_Event_Name_Type")));
this.add(namePane, BorderLayout.NORTH); this.add(namePane, BorderLayout.NORTH);
card = new CardLayout(); card = new CardLayout();
hyperlinkPane = FRGUIPaneFactory.createCardLayout_S_Pane(); hyperlinkPane = FRGUIPaneFactory.createCardLayout_S_Pane();
hyperlinkPane.setLayout(card); hyperlinkPane.setLayout(card);
javaScriptPane = new JavaScriptImplPane(defaultArgs); JavaScriptImplPane javaScriptPane = new JavaScriptImplPane(defaultArgs);
hyperlinkPane.add(JS, javaScriptPane); hyperlinkPane.add(JS, javaScriptPane);
// 提交入库 // 提交入库
List dbmaniList = new ArrayList(); List dbManiList = new ArrayList();
dbmaniList.add(autoCreateDBManipulationPane()); dbManiList.add(autoCreateDBManipulationPane());
commit2DBJavaScriptPane = new Commit2DBJavaScriptPane(JavaScriptActionPane.defaultJavaScriptActionPane, Commit2DBJavaScriptPane commit2DBJavaScriptPane = new Commit2DBJavaScriptPane(JavaScriptActionPane.defaultJavaScriptActionPane,
dbmaniList); dbManiList);
hyperlinkPane.add(DBCOMMIT, commit2DBJavaScriptPane); hyperlinkPane.add(DBCOMMIT, commit2DBJavaScriptPane);
// 自定义事件 // 自定义事件
customActionPane = new CustomActionPane(); CustomActionPane customActionPane = new CustomActionPane();
hyperlinkPane.add(CUSTOMACTION, customActionPane); hyperlinkPane.add(CUSTOMACTION, customActionPane);
// 发送邮件 // 发送邮件
emailPane = new EmailPane(); EmailPane emailPane = new EmailPane();
hyperlinkPane.add(EMAIL, emailPane); hyperlinkPane.add(EMAIL, emailPane);
cards.add(javaScriptPane); cards.add(javaScriptPane);
cards.add(commit2DBJavaScriptPane); cards.add(commit2DBJavaScriptPane);
@ -98,11 +96,16 @@ public class ListenerEditPane extends BasicBeanPane<Listener> {
cards.add(emailPane); cards.add(emailPane);
//其他事件 //其他事件
addOtherEvent(); addOtherEvent();
hyperlinkPane.setBorder(BorderFactory.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JavaScript_Set"))); hyperlinkPane.setBorder(BorderFactory.createTitledBorder(Toolkit.i18nText("Fine-Design_Report_JavaScript_Set")));
this.add(hyperlinkPane); this.add(hyperlinkPane);
styleBox.addItemListener(new ItemListener() { styleBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
card.show(hyperlinkPane, styleBox.getSelectedItem().toString()); Object selected = styleBox.getSelectedItem();
if (selected == null) {
return;
}
card.show(hyperlinkPane, selected.toString());
} }
}); });
} }
@ -122,6 +125,7 @@ public class ListenerEditPane extends BasicBeanPane<Listener> {
/** /**
* 根据有无单元格创建 DBManipulationPane * 根据有无单元格创建 DBManipulationPane
*
* @return 有单元格有智能添加单元格等按钮返回 SmartInsertDBManipulationPane * @return 有单元格有智能添加单元格等按钮返回 SmartInsertDBManipulationPane
*/ */
private DBManipulationPane autoCreateDBManipulationPane() { private DBManipulationPane autoCreateDBManipulationPane() {
@ -131,7 +135,7 @@ public class ListenerEditPane extends BasicBeanPane<Listener> {
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event_Set"); return Toolkit.i18nText("Fine-Design_Report_Event_Set");
} }
@Override @Override

Loading…
Cancel
Save