Browse Source

REPORT-1138 模板消息事件

master
kerry 8 years ago
parent
commit
c805bc3410
  1. 76
      designer/src/com/fr/design/javascript/ListenerEditPane.java
  2. 1
      designer/src/com/fr/design/widget/CellWidgetCardPane.java
  3. 5
      designer_base/src/com/fr/design/gui/frpane/ListenerUpdatePane.java
  4. 6
      designer_base/src/com/fr/design/gui/frpane/UIComboBoxPane.java
  5. 11
      designer_base/src/com/fr/design/javascript/JavaScriptActionPane.java

76
designer/src/com/fr/design/javascript/ListenerEditPane.java

@ -6,13 +6,15 @@ import java.awt.Component;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.beans.FurtherBasicBeanPane;
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;
@ -22,19 +24,14 @@ import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.write.submit.DBManipulationPane; import com.fr.design.write.submit.DBManipulationPane;
import com.fr.form.event.Listener; import com.fr.form.event.Listener;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.js.Commit2DBJavaScript;
import com.fr.js.CustomActionJavaScript;
import com.fr.js.EmailJavaScript;
import com.fr.js.FormSubmitJavaScript;
import com.fr.js.JavaScript; import com.fr.js.JavaScript;
import com.fr.js.JavaScriptImpl;
public class ListenerEditPane extends BasicBeanPane<Listener> { public class ListenerEditPane extends BasicBeanPane<Listener> {
private UITextField nameText; private UITextField nameText;
private UIComboBox styleBox; private UIComboBox styleBox;
private CardLayout card; private CardLayout card;
private List<FurtherBasicBeanPane<? extends JavaScript>> cards;
private JPanel hyperlinkPane; private JPanel hyperlinkPane;
private JavaScriptImplPane javaScriptPane; private JavaScriptImplPane javaScriptPane;
@ -66,6 +63,7 @@ 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>>();
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);
@ -100,6 +98,21 @@ public class ListenerEditPane extends BasicBeanPane<Listener> {
// 发送邮件 // 发送邮件
emailPane = new EmailPane(); emailPane = new EmailPane();
hyperlinkPane.add(EMAIL,emailPane); hyperlinkPane.add(EMAIL,emailPane);
cards.add(javaScriptPane);
cards.add(commit2DBJavaScriptPane);
cards.add(customActionPane);
cards.add(emailPane);
Set<JavaScriptActionProvider> javaScriptActionProviders = ExtraDesignClassManager.getInstance().getArray(JavaScriptActionProvider.XML_TAG);
if (javaScriptActionProviders != null) {
for (JavaScriptActionProvider jsp : javaScriptActionProviders) {
FurtherBasicBeanPane pane = jsp.getJavaScriptActionPane();
String title = pane.title4PopupWindow();
styleBox.addItem(title);
hyperlinkPane.add(title, pane);
cards.add(pane);
}
}
hyperlinkPane.setBorder(BorderFactory.createTitledBorder(Inter.getLocText("JavaScript_Set"))); hyperlinkPane.setBorder(BorderFactory.createTitledBorder(Inter.getLocText("JavaScript_Set")));
this.add(hyperlinkPane); this.add(hyperlinkPane);
@ -131,47 +144,28 @@ public class ListenerEditPane extends BasicBeanPane<Listener> {
if (this.listener == null) { if (this.listener == null) {
this.listener = new Listener(); this.listener = new Listener();
} }
this.nameText.setText(listener.getEventName()); this.nameText.setText(listener.getEventName());
JavaScript js = listener.getAction(); JavaScript js = listener.getAction();
if (js instanceof JavaScriptImpl) { for (int i = 0; i < this.cards.size(); i++) {
styleBox.setSelectedItem(JS); FurtherBasicBeanPane pane = cards.get(i);
card.show(hyperlinkPane, JS); if (pane.accept(js)) {
javaScriptPane.populateBean((JavaScriptImpl)js); styleBox.setSelectedItem(pane.title4PopupWindow());
} else if (js instanceof FormSubmitJavaScript){ card.show(hyperlinkPane, pane.title4PopupWindow());
styleBox.setSelectedItem(FORMSUBMIT); pane.populateBean(js);
card.show(hyperlinkPane, FORMSUBMIT); return;
formSubmitScriptPane.populateBean((FormSubmitJavaScript)js);
} else if (js instanceof Commit2DBJavaScript) {
styleBox.setSelectedItem(DBCOMMIT);
card.show(hyperlinkPane, DBCOMMIT);
commit2DBJavaScriptPane.populateBean((Commit2DBJavaScript)js);
} else if (js instanceof EmailJavaScript){
styleBox.setSelectedItem(EMAIL);
card.show(hyperlinkPane, EMAIL);
emailPane.populateBean((EmailJavaScript)js);
} else if (js instanceof CustomActionJavaScript){
styleBox.setSelectedItem(CUSTOMACTION);
card.show(hyperlinkPane, CUSTOMACTION);
customActionPane.populateBean((CustomActionJavaScript) js);
} }
} }
}
public void checkValid() throws Exception{
this.cards.get(this.styleBox.getSelectedIndex()).checkValid();
}
@Override @Override
public Listener updateBean(){ public Listener updateBean(){
this.listener.setEventName(this.nameText.getText()); this.listener.setEventName(this.nameText.getText());
if (ComparatorUtils.equals(styleBox.getSelectedItem(), JS)) { FurtherBasicBeanPane<? extends JavaScript> pane = this.cards.get(this.styleBox.getSelectedIndex());
this.listener.setAction(javaScriptPane.updateBean()); this.listener.setAction(pane.updateBean());
} else if (ComparatorUtils.equals(styleBox.getSelectedItem(), FORMSUBMIT)) {
this.listener.setAction(formSubmitScriptPane.updateBean());
} else if (ComparatorUtils.equals(styleBox.getSelectedItem(), DBCOMMIT)) {
this.listener.setAction(commit2DBJavaScriptPane.updateBean());
} else if (ComparatorUtils.equals(styleBox.getSelectedItem(),EMAIL)){
this.listener.setAction(emailPane.updateBean());
} else if (ComparatorUtils.equals(styleBox.getSelectedItem(), CUSTOMACTION)){
this.listener.setAction(customActionPane.updateBean());
}
return this.listener; return this.listener;
} }
} }

1
designer/src/com/fr/design/widget/CellWidgetCardPane.java

@ -155,6 +155,7 @@ public class CellWidgetCardPane extends BasicPane {
*/ */
public void checkValid() throws Exception { public void checkValid() throws Exception {
currentEditorDefinePane.checkValid(); currentEditorDefinePane.checkValid();
eventTabPane.checkValid();
} }
//:jackie 如果选择的项有形态,则将形态面板加入tab面板 //:jackie 如果选择的项有形态,则将形态面板加入tab面板

5
designer_base/src/com/fr/design/gui/frpane/ListenerUpdatePane.java

@ -45,4 +45,9 @@ public abstract class ListenerUpdatePane extends BasicBeanPane<Listener> {
return editing; return editing;
} }
@Override
public void checkValid() throws Exception{
actionPane.checkValid();
}
} }

6
designer_base/src/com/fr/design/gui/frpane/UIComboBoxPane.java

@ -133,6 +133,12 @@ public abstract class UIComboBoxPane<T> extends BasicBeanPane<T> {
return cards.get(jcb.getSelectedIndex()).updateBean(); return cards.get(jcb.getSelectedIndex()).updateBean();
} }
@Override
public void checkValid() throws Exception {
cards.get(jcb.getSelectedIndex()).checkValid();
}
public int getSelectedIndex() { public int getSelectedIndex() {
return jcb.getSelectedIndex(); return jcb.getSelectedIndex();
} }

11
designer_base/src/com/fr/design/javascript/JavaScriptActionPane.java

@ -43,15 +43,6 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane<JavaScript> {
contentDBManiPane = new ArrayList(); contentDBManiPane = new ArrayList();
contentDBManiPane.add(createDBManipulationPane()); contentDBManiPane.add(createDBManipulationPane());
paneList.add(new Commit2DBJavaScriptPane(this, contentDBManiPane)); paneList.add(new Commit2DBJavaScriptPane(this, contentDBManiPane));
paneList.add(new ProcessJSImplPane() {
private static final long serialVersionUID = 1;
@Override
protected Editor[] getCorrespondEditors() {
return isForm() ? ValueEditorPaneFactory.formEditors() : ValueEditorPaneFactory.extendedEditors();
}
}
);
paneList.add(initEmaiPane()); paneList.add(initEmaiPane());
Set<JavaScriptActionProvider> javaScriptActionProviders = ExtraDesignClassManager.getInstance().getArray(JavaScriptActionProvider.XML_TAG); Set<JavaScriptActionProvider> javaScriptActionProviders = ExtraDesignClassManager.getInstance().getArray(JavaScriptActionProvider.XML_TAG);
if (javaScriptActionProviders != null) { if (javaScriptActionProviders != null) {
@ -179,10 +170,10 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane<JavaScript> {
* 生成界面默认的组建 * 生成界面默认的组建
* *
* @return 返回生成的面板 * @return 返回生成的面板
*/ */
public static JavaScriptActionPane createDefault() { public static JavaScriptActionPane createDefault() {
return new JavaScriptActionPane() { return new JavaScriptActionPane() {
@Override @Override
public DBManipulationPane createDBManipulationPane() { public DBManipulationPane createDBManipulationPane() {
return new DBManipulationPane(); return new DBManipulationPane();

Loading…
Cancel
Save