Browse Source

REPORT-56134js提交事件报错中添加定位信息

feature/10.0
Yuan.Wang 3 years ago
parent
commit
48ddaa7af5
  1. 13
      designer-base/src/main/java/com/fr/design/gui/controlpane/JControlUpdatePane.java
  2. 7
      designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java
  3. 3
      designer-base/src/main/java/com/fr/design/gui/controlpane/ListControlPaneProvider.java
  4. 7
      designer-base/src/main/java/com/fr/design/gui/controlpane/UIListControlPane.java
  5. 7
      designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java
  6. 104
      designer-base/src/main/java/com/fr/design/javascript/Commit2DBJavaScriptPane.java
  7. 15
      designer-base/src/main/java/com/fr/design/javascript/JavaScriptActionPane.java
  8. 10
      designer-realize/src/main/java/com/fr/design/javascript/ListenerEditPane.java
  9. 1175
      designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java
  10. 3
      designer-realize/src/main/java/com/fr/design/widget/CellWidgetCardPane.java
  11. 50
      designer-realize/src/main/java/com/fr/design/widget/WidgetEventPane.java

13
designer-base/src/main/java/com/fr/design/gui/controlpane/JControlUpdatePane.java

@ -10,6 +10,7 @@ import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.RemoteDesignerWorkspaceInfo; import com.fr.design.env.RemoteDesignerWorkspaceInfo;
import com.fr.design.gui.ilist.ListModelElement; import com.fr.design.gui.ilist.ListModelElement;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.event.Listener;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -76,9 +77,12 @@ class JControlUpdatePane extends JPanel {
cardPane.add(updatePanes[i], String.valueOf(i)); cardPane.add(updatePanes[i], String.valueOf(i));
} }
card.show(cardPane, String.valueOf(i)); card.show(cardPane, String.valueOf(i));
try{ try {
if (ob2Populate instanceof Listener) {
listControlPane.wrapperListener((Listener) ob2Populate);
}
updatePanes[i].populateBean(ob2Populate); updatePanes[i].populateBean(ob2Populate);
}catch (Exception e){ } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
break; break;
@ -103,12 +107,15 @@ class JControlUpdatePane extends JPanel {
if (pane != null && pane.isVisible()) { if (pane != null && pane.isVisible()) {
Object bean = pane.updateBean(); Object bean = pane.updateBean();
try { try {
if (bean instanceof Listener) {
listControlPane.wrapperListener((Listener) bean);
}
if (bean instanceof RemoteDesignerWorkspaceInfo) { if (bean instanceof RemoteDesignerWorkspaceInfo) {
DesignerWorkspaceInfo info = DesignerEnvManager.getEnvManager().getWorkspaceInfo(elEditing.wrapper.getName()); DesignerWorkspaceInfo info = DesignerEnvManager.getEnvManager().getWorkspaceInfo(elEditing.wrapper.getName());
String remindTime = info.getRemindTime(); String remindTime = info.getRemindTime();
((RemoteDesignerWorkspaceInfo) bean).setRemindTime(remindTime); ((RemoteDesignerWorkspaceInfo) bean).setRemindTime(remindTime);
} }
}catch (Exception e){ } catch (Exception e) {
FineLoggerFactory.getLogger().info("remindTime is not exist"); FineLoggerFactory.getLogger().info("remindTime is not exist");
} }
if (i < creators.length) { if (i < creators.length) {

7
designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java

@ -6,6 +6,7 @@ import com.fr.design.gui.ilist.JNameEdList;
import com.fr.design.gui.ilist.ListModelElement; import com.fr.design.gui.ilist.ListModelElement;
import com.fr.design.gui.ilist.ModNameActionListener; import com.fr.design.gui.ilist.ModNameActionListener;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.event.Listener;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.invoke.Reflect; import com.fr.invoke.Reflect;
@ -417,4 +418,10 @@ public abstract class JListControlPane extends JControlPane implements ListContr
public JControlUpdatePane getControlUpdatePane() { public JControlUpdatePane getControlUpdatePane() {
return (JControlUpdatePane) controlUpdatePane; return (JControlUpdatePane) controlUpdatePane;
} }
@Override
public void wrapperListener(Listener listener){
}
} }

3
designer-base/src/main/java/com/fr/design/gui/controlpane/ListControlPaneProvider.java

@ -3,6 +3,7 @@ package com.fr.design.gui.controlpane;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ilist.JNameEdList; import com.fr.design.gui.ilist.JNameEdList;
import com.fr.design.gui.ilist.ListModelElement; import com.fr.design.gui.ilist.ListModelElement;
import com.fr.form.event.Listener;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import javax.swing.DefaultListModel; import javax.swing.DefaultListModel;
@ -32,4 +33,6 @@ public interface ListControlPaneProvider extends UnrepeatedNameHelper {
void showSelectPane(); void showSelectPane();
void showEditPane(); void showEditPane();
ShortCut4JControlPane[] getShorts(); ShortCut4JControlPane[] getShorts();
void wrapperListener(Listener listener);
} }

7
designer-base/src/main/java/com/fr/design/gui/controlpane/UIListControlPane.java

@ -6,6 +6,7 @@ import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilist.JNameEdList; import com.fr.design.gui.ilist.JNameEdList;
import com.fr.design.gui.ilist.ListModelElement; import com.fr.design.gui.ilist.ListModelElement;
import com.fr.design.gui.ilist.UINameEdList; import com.fr.design.gui.ilist.UINameEdList;
import com.fr.form.event.Listener;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
@ -314,4 +315,10 @@ public abstract class UIListControlPane extends UIControlPane implements ListCon
public JNameEdList getNameableList() { public JNameEdList getNameableList() {
return nameableList; return nameableList;
} }
@Override
public void wrapperListener(Listener listener){
}
} }

7
designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java

@ -391,7 +391,7 @@ public abstract class UIListGroupControlPane extends UIControlPane implements Li
@Override @Override
public Nameable[] update() { public Nameable[] update() {
java.util.List<Nameable> res = new java.util.ArrayList<Nameable>(); List<Nameable> res = new ArrayList<Nameable>();
getControlUpdatePane().update(); getControlUpdatePane().update();
Iterator<Map.Entry<String, ListWrapperPane>> iterator = nameEdListMap.entrySet().iterator(); Iterator<Map.Entry<String, ListWrapperPane>> iterator = nameEdListMap.entrySet().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
@ -516,6 +516,11 @@ public abstract class UIListGroupControlPane extends UIControlPane implements Li
return StringUtils.EMPTY; return StringUtils.EMPTY;
} }
@Override
public void wrapperListener(Listener listener){
}
private class ListWrapperPane extends JPanel { private class ListWrapperPane extends JPanel {
private UINameEdList nameEdList; private UINameEdList nameEdList;

104
designer-base/src/main/java/com/fr/design/javascript/Commit2DBJavaScriptPane.java

@ -1,16 +1,17 @@
package com.fr.design.javascript; package com.fr.design.javascript;
import com.fr.design.write.submit.DBManipulationPane;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.gui.frpane.CommitTabbedPane; import com.fr.design.gui.frpane.CommitTabbedPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.write.submit.DBManipulationPane;
import com.fr.js.Commit2DBJavaScript; import com.fr.js.Commit2DBJavaScript;
import com.fr.write.DBManipulation; import com.fr.write.DBManipulation;
import javax.swing.*; import javax.swing.JPanel;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Dimension;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -25,63 +26,64 @@ public class Commit2DBJavaScriptPane extends FurtherBasicBeanPane<Commit2DBJavaS
/** /**
* 构造函数控件事件的提交入库面板 * 构造函数控件事件的提交入库面板
* @param javaScriptActionPane JS提交面板对象 *
* @param javaScriptActionPane JS提交面板对象
* @param dbManipulationPaneList 提交入库的提交面板列表 * @param dbManipulationPaneList 提交入库的提交面板列表
*/ */
public Commit2DBJavaScriptPane(final JavaScriptActionPane javaScriptActionPane, List dbManipulationPaneList) { public Commit2DBJavaScriptPane(final JavaScriptActionPane javaScriptActionPane, List dbManipulationPaneList) {
this.dbmPaneList=dbManipulationPaneList; this.dbmPaneList = dbManipulationPaneList;
this.javaScriptActionPane = javaScriptActionPane; this.javaScriptActionPane = javaScriptActionPane;
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
commitTabbedPane = new CommitTabbedPane(this,dbmPaneList); commitTabbedPane = new CommitTabbedPane(this, dbmPaneList);
commitTabbedPane.setPreferredSize(new Dimension(commitTabbedPane.getWidth(),20)); commitTabbedPane.setPreferredSize(new Dimension(commitTabbedPane.getWidth(), 20));
this.add(commitTabbedPane, BorderLayout.NORTH) ; this.add(commitTabbedPane, BorderLayout.NORTH);
cardPane = new JPanel(new CardLayout()); cardPane = new JPanel(new CardLayout());
cardNames = new String[dbmPaneList.size()] ; cardNames = new String[dbmPaneList.size()];
for (int i = 0; i < this.dbmPaneList.size(); i++) { for (int i = 0; i < this.dbmPaneList.size(); i++) {
if(((DBManipulationPane) this.dbmPaneList.get(i)).getSubMitName() == null){ if (((DBManipulationPane) this.dbmPaneList.get(i)).getSubMitName() == null) {
cardNames[i] = ""; cardNames[i] = "";
} else{ } else {
cardNames[i] =((DBManipulationPane) this.dbmPaneList.get(i)).getSubMitName(); cardNames[i] = ((DBManipulationPane) this.dbmPaneList.get(i)).getSubMitName();
} }
cardPane.add((DBManipulationPane)this.dbmPaneList.get(i),cardNames[i]); cardPane.add((DBManipulationPane) this.dbmPaneList.get(i), cardNames[i]);
} }
this.add(cardPane, BorderLayout.CENTER); this.add(cardPane, BorderLayout.CENTER);
JPanel btPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel btPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
this.add(btPane, BorderLayout.SOUTH); this.add(btPane, BorderLayout.SOUTH);
addCallbackButton = javaScriptActionPane.createCallButton();
btPane.add(addCallbackButton);
}
addCallbackButton = javaScriptActionPane.createCallButton();
btPane.add(addCallbackButton);
}
/** /**
* 更新DBManipulationPane * 更新DBManipulationPane
*/ */
public void updateCardPane(){ public void updateCardPane() {
cardNames = new String[dbmPaneList.size()] ; cardNames = new String[dbmPaneList.size()];
for (int i = 0; i < this.dbmPaneList.size(); i++) { for (int i = 0; i < this.dbmPaneList.size(); i++) {
if(((DBManipulationPane) this.dbmPaneList.get(i)).getSubMitName() == null){ if (((DBManipulationPane) this.dbmPaneList.get(i)).getSubMitName() == null) {
cardNames[i] = ""; cardNames[i] = "";
} else{ } else {
cardNames[i] =((DBManipulationPane) this.dbmPaneList.get(i)).getSubMitName(); cardNames[i] = ((DBManipulationPane) this.dbmPaneList.get(i)).getSubMitName();
} }
cardPane.add((DBManipulationPane)this.dbmPaneList.get(i),cardNames[i]); cardPane.add((DBManipulationPane) this.dbmPaneList.get(i), cardNames[i]);
} }
CardLayout cardLayout = (CardLayout)cardPane.getLayout(); CardLayout cardLayout = (CardLayout) cardPane.getLayout();
cardLayout.show(cardPane,cardNames[commitTabbedPane.getSelectedIndex()]); cardLayout.show(cardPane, cardNames[commitTabbedPane.getSelectedIndex()]);
} }
public void setList(List list){ public void setList(List list) {
this.dbmPaneList = list; this.dbmPaneList = list;
} }
/** /**
* 新建DBManipulationPane * 新建DBManipulationPane
* @return 新建的DBManipulationPane *
* @return 新建的DBManipulationPane
*/ */
public DBManipulationPane createDBManipulationPane(){ public DBManipulationPane createDBManipulationPane() {
DBManipulationPane db = javaScriptActionPane.createDBManipulationPane(); DBManipulationPane db = javaScriptActionPane.createDBManipulationPane();
db.populateBean(null); db.populateBean(null);
dbmPaneList.add(db); dbmPaneList.add(db);
@ -91,25 +93,26 @@ public class Commit2DBJavaScriptPane extends FurtherBasicBeanPane<Commit2DBJavaS
/** /**
* 窗口名称 * 窗口名称
*
* @return 返回窗口名称 * @return 返回窗口名称
*/ */
public String title4PopupWindow() { public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_JavaScript_Commit_To_Database"); return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_JavaScript_Commit_To_Database");
} }
/** /**
* 界面重置 * 界面重置
*/ */
public void reset() { public void reset() {
this.javaScriptActionPane.setCall(null); this.javaScriptActionPane.setCall(null);
//重置后只保留,只留第一个tab //重置后只保留,只留第一个tab
while (dbmPaneList.size() > 1){ while (dbmPaneList.size() > 1) {
dbmPaneList.remove(1); dbmPaneList.remove(1);
} }
((DBManipulationPane)dbmPaneList.get(0)).populateBean(null); ((DBManipulationPane) dbmPaneList.get(0)).populateBean(null);
} }
@Override @Override
/** /**
* 将JavaBean内的数据输出至界面上 * 将JavaBean内的数据输出至界面上
*/ */
@ -131,11 +134,15 @@ public class Commit2DBJavaScriptPane extends FurtherBasicBeanPane<Commit2DBJavaS
/** /**
* 更新数据层JavaBean * 更新数据层JavaBean
*
* @return 返回JavaBean * @return 返回JavaBean
*/ */
public Commit2DBJavaScript updateBean() { public Commit2DBJavaScript updateBean() {
Commit2DBJavaScript commit2dbJavaScript = new Commit2DBJavaScript(); Commit2DBJavaScript commit2dbJavaScript = new Commit2DBJavaScript();
if (javaScriptActionPane.getResourceInfo() != null) {
commit2dbJavaScript.setJsResourceInfo(javaScriptActionPane.getResourceInfo());
}
List dbmaniList = new ArrayList(); List dbmaniList = new ArrayList();
for(int i = 0; i < this.dbmPaneList.size(); i++){ for(int i = 0; i < this.dbmPaneList.size(); i++){
DBManipulationPane dbmpane =(DBManipulationPane)this.dbmPaneList.get(i); DBManipulationPane dbmpane =(DBManipulationPane)this.dbmPaneList.get(i);
@ -154,11 +161,12 @@ public class Commit2DBJavaScriptPane extends FurtherBasicBeanPane<Commit2DBJavaS
/** /**
* 判断是否是能接受的数据类型 * 判断是否是能接受的数据类型
*
* @param ob 对象 * @param ob 对象
* @return 返回是否是能接受的数据类型 * @return 返回是否是能接受的数据类型
*/ */
public boolean accept(Object ob) { public boolean accept(Object ob) {
return ob instanceof Commit2DBJavaScript; return ob instanceof Commit2DBJavaScript;
} }
} }

15
designer-base/src/main/java/com/fr/design/javascript/JavaScriptActionPane.java

@ -12,6 +12,7 @@ import com.fr.design.mainframe.JTemplate;
import com.fr.design.write.submit.DBManipulationPane; import com.fr.design.write.submit.DBManipulationPane;
import com.fr.form.ui.WebContentUtils; import com.fr.form.ui.WebContentUtils;
import com.fr.js.JavaScript; import com.fr.js.JavaScript;
import com.fr.write.JavaScriptResourceInfo;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -29,6 +30,8 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane<JavaScript> {
private List contentDBManiPane; private List contentDBManiPane;
private JavaScriptResourceInfo resourceInfo;
private JavaScript call = null; private JavaScript call = null;
public JavaScriptActionPane() { public JavaScriptActionPane() {
@ -71,6 +74,14 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane<JavaScript> {
} }
public JavaScriptResourceInfo getResourceInfo() {
return resourceInfo;
}
public void setResourceInfo(JavaScriptResourceInfo resourceInfo) {
this.resourceInfo = resourceInfo;
}
/** /**
* 生成回调函数的按钮 * 生成回调函数的按钮
* *
@ -178,8 +189,8 @@ 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();

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

@ -15,6 +15,8 @@ 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.js.JavaScript; import com.fr.js.JavaScript;
import com.fr.report.web.util.ReportEngineEventMapping;
import com.fr.write.JavaScriptResourceInfo;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -42,6 +44,8 @@ public class ListenerEditPane extends BasicBeanPane<Listener> {
private Listener listener; private Listener listener;
JavaScriptActionPane javaScriptActionPane;
public ListenerEditPane() { public ListenerEditPane() {
this.initComponents(new String[0]); this.initComponents(new String[0]);
} }
@ -81,7 +85,8 @@ public class ListenerEditPane extends BasicBeanPane<Listener> {
// 提交入库 // 提交入库
List dbManiList = new ArrayList(); List dbManiList = new ArrayList();
dbManiList.add(autoCreateDBManipulationPane()); dbManiList.add(autoCreateDBManipulationPane());
Commit2DBJavaScriptPane commit2DBJavaScriptPane = new Commit2DBJavaScriptPane(JavaScriptActionPane.createDefaultJavaScriptActionPane(), javaScriptActionPane = JavaScriptActionPane.createDefaultJavaScriptActionPane();
Commit2DBJavaScriptPane commit2DBJavaScriptPane = new Commit2DBJavaScriptPane(javaScriptActionPane,
dbManiList); dbManiList);
hyperlinkPane.add(DBCOMMIT, commit2DBJavaScriptPane); hyperlinkPane.add(DBCOMMIT, commit2DBJavaScriptPane);
// 自定义事件 // 自定义事件
@ -164,9 +169,12 @@ public class ListenerEditPane extends BasicBeanPane<Listener> {
@Override @Override
public Listener updateBean() { public Listener updateBean() {
String actionLocaleName = ReportEngineEventMapping.getLocaleName(listener.getEventName());
javaScriptActionPane.setResourceInfo(new JavaScriptResourceInfo(JavaScriptResourceInfo.Type.WEB_CONFIG, Toolkit.i18nText(actionLocaleName)));
this.listener.setEventName(this.nameText.getText()); this.listener.setEventName(this.nameText.getText());
FurtherBasicBeanPane<? extends JavaScript> pane = this.cards.get(this.styleBox.getSelectedIndex()); FurtherBasicBeanPane<? extends JavaScript> pane = this.cards.get(this.styleBox.getSelectedIndex());
this.listener.setAction(pane.updateBean()); this.listener.setAction(pane.updateBean());
return this.listener; return this.listener;
} }
} }

1175
designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java

File diff suppressed because it is too large Load Diff

3
designer-realize/src/main/java/com/fr/design/widget/CellWidgetCardPane.java

@ -14,7 +14,6 @@ import com.fr.design.widget.ui.BasicWidgetPropertySettingPane;
import com.fr.form.event.Listener; import com.fr.form.event.Listener;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -166,7 +165,7 @@ public class CellWidgetCardPane extends BasicPane {
} }
widgetPropertyPane.update(widget); widgetPropertyPane.update(widget);
Listener[] listener = eventPane == null ? new Listener[0] : eventPane.updateListeners(); Listener[] listener = eventPane == null ? new Listener[0] : eventPane.updateListeners(widget);
widget.clearListeners(); widget.clearListeners();
for (Listener l : listener) { for (Listener l : listener) {
widget.addListener(l); widget.addListener(l);

50
designer-realize/src/main/java/com/fr/design/widget/WidgetEventPane.java

@ -1,29 +1,30 @@
package com.fr.design.widget; package com.fr.design.widget;
import java.lang.reflect.Constructor;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.controlpane.UIListGroupControlPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.CellWidgetPropertyPane;
import com.fr.design.write.submit.DBManipulationPane;
import com.fr.design.write.submit.SmartInsertDBManipulationInWidgetEventPane;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.UIListGroupControlPane;
import com.fr.design.gui.frpane.ListenerUpdatePane; import com.fr.design.gui.frpane.ListenerUpdatePane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.javascript.JavaScriptActionPane; import com.fr.design.javascript.JavaScriptActionPane;
import com.fr.design.mainframe.CellWidgetPropertyPane;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.write.submit.DBManipulationPane;
import com.fr.design.write.submit.SmartInsertDBManipulationInWidgetEventPane;
import com.fr.form.event.Listener; import com.fr.form.event.Listener;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.grid.selection.Selection;
import com.fr.general.NameObject; import com.fr.general.NameObject;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.Selection;
import com.fr.js.Commit2DBJavaScript;
import com.fr.stable.AssistUtils; import com.fr.stable.AssistUtils;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import com.fr.write.JavaScriptResourceInfo;
import javax.swing.*; import javax.swing.BorderFactory;
import java.lang.reflect.Constructor;
public class WidgetEventPane extends UIListGroupControlPane { public class WidgetEventPane extends UIListGroupControlPane {
private static final Selection NO_SELECTION = new CellSelection(-1, -1, -1, -1); private static final Selection NO_SELECTION = new CellSelection(-1, -1, -1, -1);
@ -32,9 +33,11 @@ public class WidgetEventPane extends UIListGroupControlPane {
private ElementCasePane object; private ElementCasePane object;
private Widget targetWidget;
public WidgetEventPane(ElementCasePane pane) { public WidgetEventPane(ElementCasePane pane) {
this.object = pane; this.object = pane;
if(pane != null){ if (pane != null) {
selection = pane.getSelection(); selection = pane.getSelection();
} }
setBorder(BorderFactory.createEmptyBorder(10, 0, 15, 0)); setBorder(BorderFactory.createEmptyBorder(10, 0, 15, 0));
@ -125,18 +128,21 @@ public class WidgetEventPane extends UIListGroupControlPane {
if (widget == null) { if (widget == null) {
return; return;
} }
this.targetWidget = widget;
refreshPane(widget, EventCreator.createEventCreator(widget.supportedEvents(), WidgetEventListenerUpdatePane.class)); refreshPane(widget, EventCreator.createEventCreator(widget.supportedEvents(), WidgetEventListenerUpdatePane.class));
} }
/** /**
* 更新 * 更新
* @return 监听器 *
*/ * @return 监听器
public Listener[] updateListeners() { */
public Listener[] updateListeners(Widget widget) {
this.targetWidget = widget;
Nameable[] res = this.update(); Nameable[] res = this.update();
Listener[] res_array = new Listener[res.length]; Listener[] res_array = new Listener[res.length];
for (int i = 0, len = res.length; i < len; i++) { for (int i = 0, len = res.length; i < len; i++) {
res_array[i] = (Listener) ((NameObject)res[i]).getObject(); res_array[i] = (Listener) ((NameObject) res[i]).getObject();
} }
return res_array; return res_array;
} }
@ -174,14 +180,22 @@ public class WidgetEventPane extends UIListGroupControlPane {
if (constructor != null) { if (constructor != null) {
return constructor; return constructor;
} else { } else {
if (AssistUtils.equals(cls.getName(),Object.class.getName())) { if (AssistUtils.equals(cls.getName(), Object.class.getName())) {
return null; return null;
} }
return getConstructor(clazz, cls.getSuperclass()); return getConstructor(clazz, cls.getSuperclass());
} }
} }
protected String getWrapperLabelText(){ @Override
public void wrapperListener(Listener listener) {
if (listener.getAction() instanceof Commit2DBJavaScript) {
Commit2DBJavaScript commit2DBJavaScript = (Commit2DBJavaScript) listener.getAction();
commit2DBJavaScript.setJsResourceInfo(new JavaScriptResourceInfo(JavaScriptResourceInfo.Type.WIDGET, targetWidget.getWidgetName()));
}
}
protected String getWrapperLabelText() {
return Toolkit.i18nText("Fine-Design_Report_Event"); return Toolkit.i18nText("Fine-Design_Report_Event");
} }

Loading…
Cancel
Save