Browse Source

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

feature/10.0
Yuan.Wang 3 years ago
parent
commit
48ddaa7af5
  1. 7
      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. 18
      designer-base/src/main/java/com/fr/design/javascript/Commit2DBJavaScriptPane.java
  7. 11
      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. 9
      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. 34
      designer-realize/src/main/java/com/fr/design/widget/WidgetEventPane.java

7
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.gui.ilist.ListModelElement;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.event.Listener;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
@ -77,6 +78,9 @@ class JControlUpdatePane extends JPanel {
}
card.show(cardPane, String.valueOf(i));
try {
if (ob2Populate instanceof Listener) {
listControlPane.wrapperListener((Listener) ob2Populate);
}
updatePanes[i].populateBean(ob2Populate);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
@ -103,6 +107,9 @@ class JControlUpdatePane extends JPanel {
if (pane != null && pane.isVisible()) {
Object bean = pane.updateBean();
try {
if (bean instanceof Listener) {
listControlPane.wrapperListener((Listener) bean);
}
if (bean instanceof RemoteDesignerWorkspaceInfo) {
DesignerWorkspaceInfo info = DesignerEnvManager.getEnvManager().getWorkspaceInfo(elEditing.wrapper.getName());
String remindTime = info.getRemindTime();

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.ModNameActionListener;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.event.Listener;
import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.invoke.Reflect;
@ -417,4 +418,10 @@ public abstract class JListControlPane extends JControlPane implements ListContr
public JControlUpdatePane getControlUpdatePane() {
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.gui.ilist.JNameEdList;
import com.fr.design.gui.ilist.ListModelElement;
import com.fr.form.event.Listener;
import com.fr.stable.Nameable;
import javax.swing.DefaultListModel;
@ -32,4 +33,6 @@ public interface ListControlPaneProvider extends UnrepeatedNameHelper {
void showSelectPane();
void showEditPane();
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.ListModelElement;
import com.fr.design.gui.ilist.UINameEdList;
import com.fr.form.event.Listener;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Nameable;
@ -314,4 +315,10 @@ public abstract class UIListControlPane extends UIControlPane implements ListCon
public JNameEdList getNameableList() {
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
public Nameable[] update() {
java.util.List<Nameable> res = new java.util.ArrayList<Nameable>();
List<Nameable> res = new ArrayList<Nameable>();
getControlUpdatePane().update();
Iterator<Map.Entry<String, ListWrapperPane>> iterator = nameEdListMap.entrySet().iterator();
while (iterator.hasNext()) {
@ -516,6 +516,11 @@ public abstract class UIListGroupControlPane extends UIControlPane implements Li
return StringUtils.EMPTY;
}
@Override
public void wrapperListener(Listener listener){
}
private class ListWrapperPane extends JPanel {
private UINameEdList nameEdList;

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

@ -1,16 +1,17 @@
package com.fr.design.javascript;
import com.fr.design.write.submit.DBManipulationPane;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.gui.frpane.CommitTabbedPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.write.submit.DBManipulationPane;
import com.fr.js.Commit2DBJavaScript;
import com.fr.write.DBManipulation;
import javax.swing.*;
import java.awt.*;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Dimension;
import java.util.ArrayList;
import java.util.List;
@ -25,6 +26,7 @@ public class Commit2DBJavaScriptPane extends FurtherBasicBeanPane<Commit2DBJavaS
/**
* 构造函数控件事件的提交入库面板
*
* @param javaScriptActionPane JS提交面板对象
* @param dbManipulationPaneList 提交入库的提交面板列表
*/
@ -55,7 +57,6 @@ public class Commit2DBJavaScriptPane extends FurtherBasicBeanPane<Commit2DBJavaS
btPane.add(addCallbackButton);
}
/**
* 更新DBManipulationPane
*/
@ -79,6 +80,7 @@ public class Commit2DBJavaScriptPane extends FurtherBasicBeanPane<Commit2DBJavaS
/**
* 新建DBManipulationPane
*
* @return 新建的DBManipulationPane
*/
public DBManipulationPane createDBManipulationPane() {
@ -91,6 +93,7 @@ public class Commit2DBJavaScriptPane extends FurtherBasicBeanPane<Commit2DBJavaS
/**
* 窗口名称
*
* @return 返回窗口名称
*/
public String title4PopupWindow() {
@ -131,11 +134,15 @@ public class Commit2DBJavaScriptPane extends FurtherBasicBeanPane<Commit2DBJavaS
/**
* 更新数据层JavaBean
*
* @return 返回JavaBean
*/
public Commit2DBJavaScript updateBean() {
Commit2DBJavaScript commit2dbJavaScript = new Commit2DBJavaScript();
if (javaScriptActionPane.getResourceInfo() != null) {
commit2dbJavaScript.setJsResourceInfo(javaScriptActionPane.getResourceInfo());
}
List dbmaniList = new ArrayList();
for(int i = 0; i < this.dbmPaneList.size(); i++){
DBManipulationPane dbmpane =(DBManipulationPane)this.dbmPaneList.get(i);
@ -154,6 +161,7 @@ public class Commit2DBJavaScriptPane extends FurtherBasicBeanPane<Commit2DBJavaS
/**
* 判断是否是能接受的数据类型
*
* @param ob 对象
* @return 返回是否是能接受的数据类型
*/

11
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.form.ui.WebContentUtils;
import com.fr.js.JavaScript;
import com.fr.write.JavaScriptResourceInfo;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
@ -29,6 +30,8 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane<JavaScript> {
private List contentDBManiPane;
private JavaScriptResourceInfo resourceInfo;
private JavaScript call = null;
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;
}
/**
* 生成回调函数的按钮
*

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

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

@ -38,6 +38,7 @@ import com.fr.report.web.button.write.AppendColumnRow;
import com.fr.report.web.button.write.Submit;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import com.fr.write.JavaScriptResourceInfo;
import javax.swing.BorderFactory;
import javax.swing.Box;
@ -322,6 +323,7 @@ public class EditToolBar extends BasicPane {
/**
* 动作
*
* @param e 事件
*/
public void actionPerformed(ActionEvent e) {
@ -517,6 +519,8 @@ public class EditToolBar extends BasicPane {
if (javaScriptPane == null || ((CustomToolBarButton) widget).getJSImpl() == null) {
javaScriptPane = JavaScriptActionPane.createDefault();
}
javaScriptPane.setResourceInfo(new JavaScriptResourceInfo(JavaScriptResourceInfo.Type.WIDGET, ((Button) widget).getText()));
javaScriptPane.setPreferredSize(new Dimension(750, 500));
BasicDialog dialog = javaScriptPane.showWindow(SwingUtilities.getWindowAncestor(ButtonPane.this));
dialog.addDialogActionListener(new DialogActionAdapter() {
@ -672,7 +676,8 @@ public class EditToolBar extends BasicPane {
export.setImageAvailable(this.image.isSelected());
if (exportToolBarProviders != null) {
for (int i = 0; i < exportToolBarProviders.length; i++) {
exportToolBarProviders[i].update();;
exportToolBarProviders[i].update();
;
}
}
}
@ -689,6 +694,8 @@ public class EditToolBar extends BasicPane {
if (customToolBarButton.getJSImpl() == null) {
this.javaScriptPane = JavaScriptActionPane.createDefault();
}
javaScriptPane.setResourceInfo(new JavaScriptResourceInfo(JavaScriptResourceInfo.Type.CUSTOM_BUTTON, ((Button) widget).getText()));
customToolBarButton.setJSImpl(this.javaScriptPane.updateBean());
}
}

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.ui.Widget;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
@ -166,7 +165,7 @@ public class CellWidgetCardPane extends BasicPane {
}
widgetPropertyPane.update(widget);
Listener[] listener = eventPane == null ? new Listener[0] : eventPane.updateListeners();
Listener[] listener = eventPane == null ? new Listener[0] : eventPane.updateListeners(widget);
widget.clearListeners();
for (Listener l : listener) {
widget.addListener(l);

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

@ -1,29 +1,30 @@
package com.fr.design.widget;
import java.lang.reflect.Constructor;
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.UIListGroupControlPane;
import com.fr.design.gui.frpane.ListenerUpdatePane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.javascript.JavaScriptActionPane;
import com.fr.design.mainframe.CellWidgetPropertyPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
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.ui.Widget;
import com.fr.grid.selection.Selection;
import com.fr.general.NameObject;
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.Nameable;
import com.fr.write.JavaScriptResourceInfo;
import javax.swing.*;
import javax.swing.BorderFactory;
import java.lang.reflect.Constructor;
public class WidgetEventPane extends UIListGroupControlPane {
private static final Selection NO_SELECTION = new CellSelection(-1, -1, -1, -1);
@ -32,6 +33,8 @@ public class WidgetEventPane extends UIListGroupControlPane {
private ElementCasePane object;
private Widget targetWidget;
public WidgetEventPane(ElementCasePane pane) {
this.object = pane;
if (pane != null) {
@ -125,14 +128,17 @@ public class WidgetEventPane extends UIListGroupControlPane {
if (widget == null) {
return;
}
this.targetWidget = widget;
refreshPane(widget, EventCreator.createEventCreator(widget.supportedEvents(), WidgetEventListenerUpdatePane.class));
}
/**
* 更新
*
* @return 监听器
*/
public Listener[] updateListeners() {
public Listener[] updateListeners(Widget widget) {
this.targetWidget = widget;
Nameable[] res = this.update();
Listener[] res_array = new Listener[res.length];
for (int i = 0, len = res.length; i < len; i++) {
@ -181,6 +187,14 @@ public class WidgetEventPane extends UIListGroupControlPane {
}
}
@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");
}

Loading…
Cancel
Save