Browse Source

Pull request #5364: REPORT-56134js提交事件报错中添加定位信息

Merge in DESIGN/design from ~YUAN.WANG/design:feature/10.0 to feature/10.0

* commit '2146d43f0364f5e9d2c2ab2d787441a8b911b835':
  REPORT-56134js提交事件报错中添加定位信息
feature/10.0
Yuan.Wang 3 years ago
parent
commit
91a1af3a1b
  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.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;
@ -76,9 +77,12 @@ class JControlUpdatePane extends JPanel {
cardPane.add(updatePanes[i], String.valueOf(i));
}
card.show(cardPane, String.valueOf(i));
try{
try {
if (ob2Populate instanceof Listener) {
listControlPane.wrapperListener((Listener) ob2Populate);
}
updatePanes[i].populateBean(ob2Populate);
}catch (Exception e){
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
break;
@ -103,12 +107,15 @@ 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();
((RemoteDesignerWorkspaceInfo) bean).setRemindTime(remindTime);
}
}catch (Exception e){
} catch (Exception e) {
FineLoggerFactory.getLogger().info("remindTime is not exist");
}
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.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;

104
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,63 +26,64 @@ public class Commit2DBJavaScriptPane extends FurtherBasicBeanPane<Commit2DBJavaS
/**
* 构造函数控件事件的提交入库面板
* @param javaScriptActionPane JS提交面板对象
*
* @param javaScriptActionPane JS提交面板对象
* @param dbManipulationPaneList 提交入库的提交面板列表
*/
public Commit2DBJavaScriptPane(final JavaScriptActionPane javaScriptActionPane, List dbManipulationPaneList) {
this.dbmPaneList=dbManipulationPaneList;
this.dbmPaneList = dbManipulationPaneList;
this.javaScriptActionPane = javaScriptActionPane;
this.setLayout(FRGUIPaneFactory.createBorderLayout());
commitTabbedPane = new CommitTabbedPane(this,dbmPaneList);
commitTabbedPane.setPreferredSize(new Dimension(commitTabbedPane.getWidth(),20));
this.add(commitTabbedPane, BorderLayout.NORTH) ;
commitTabbedPane = new CommitTabbedPane(this, dbmPaneList);
commitTabbedPane.setPreferredSize(new Dimension(commitTabbedPane.getWidth(), 20));
this.add(commitTabbedPane, BorderLayout.NORTH);
cardPane = new JPanel(new CardLayout());
cardNames = new String[dbmPaneList.size()] ;
cardNames = new String[dbmPaneList.size()];
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] = "";
} else{
cardNames[i] =((DBManipulationPane) this.dbmPaneList.get(i)).getSubMitName();
} else {
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);
JPanel btPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
this.add(btPane, BorderLayout.SOUTH);
addCallbackButton = javaScriptActionPane.createCallButton();
btPane.add(addCallbackButton);
}
this.add(btPane, BorderLayout.SOUTH);
addCallbackButton = javaScriptActionPane.createCallButton();
btPane.add(addCallbackButton);
}
/**
* 更新DBManipulationPane
*/
public void updateCardPane(){
cardNames = new String[dbmPaneList.size()] ;
public void updateCardPane() {
cardNames = new String[dbmPaneList.size()];
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] = "";
} else{
cardNames[i] =((DBManipulationPane) this.dbmPaneList.get(i)).getSubMitName();
} else {
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.show(cardPane,cardNames[commitTabbedPane.getSelectedIndex()]);
CardLayout cardLayout = (CardLayout) cardPane.getLayout();
cardLayout.show(cardPane, cardNames[commitTabbedPane.getSelectedIndex()]);
}
public void setList(List list){
public void setList(List list) {
this.dbmPaneList = list;
}
/**
* 新建DBManipulationPane
* @return 新建的DBManipulationPane
*
* @return 新建的DBManipulationPane
*/
public DBManipulationPane createDBManipulationPane(){
public DBManipulationPane createDBManipulationPane() {
DBManipulationPane db = javaScriptActionPane.createDBManipulationPane();
db.populateBean(null);
dbmPaneList.add(db);
@ -91,25 +93,26 @@ public class Commit2DBJavaScriptPane extends FurtherBasicBeanPane<Commit2DBJavaS
/**
* 窗口名称
*
* @return 返回窗口名称
*/
public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_JavaScript_Commit_To_Database");
}
public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_JavaScript_Commit_To_Database");
}
/**
* 界面重置
*/
public void reset() {
this.javaScriptActionPane.setCall(null);
//重置后只保留,只留第一个tab
while (dbmPaneList.size() > 1){
/**
* 界面重置
*/
public void reset() {
this.javaScriptActionPane.setCall(null);
//重置后只保留,只留第一个tab
while (dbmPaneList.size() > 1) {
dbmPaneList.remove(1);
}
((DBManipulationPane)dbmPaneList.get(0)).populateBean(null);
}
((DBManipulationPane) dbmPaneList.get(0)).populateBean(null);
}
@Override
@Override
/**
* 将JavaBean内的数据输出至界面上
*/
@ -131,11 +134,15 @@ public class Commit2DBJavaScriptPane extends FurtherBasicBeanPane<Commit2DBJavaS
/**
* 更新数据层JavaBean
*
* @return 返回JavaBean
*/
public Commit2DBJavaScript updateBean() {
Commit2DBJavaScript commit2dbJavaScript = new Commit2DBJavaScript();
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,11 +161,12 @@ public class Commit2DBJavaScriptPane extends FurtherBasicBeanPane<Commit2DBJavaS
/**
* 判断是否是能接受的数据类型
*
* @param ob 对象
* @return 返回是否是能接受的数据类型
*/
public boolean accept(Object ob) {
return ob instanceof Commit2DBJavaScript;
}
public boolean accept(Object ob) {
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.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() {
@ -75,6 +78,14 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane<JavaScript> {
}
public JavaScriptResourceInfo getResourceInfo() {
return resourceInfo;
}
public void setResourceInfo(JavaScriptResourceInfo resourceInfo) {
this.resourceInfo = resourceInfo;
}
/**
* 生成回调函数的按钮
*
@ -182,8 +193,8 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane<JavaScript> {
* @return 返回生成的面板
*/
public static JavaScriptActionPane createDefault() {
return new JavaScriptActionPane() {
public static JavaScriptActionPane createDefault() {
return new JavaScriptActionPane() {
@Override
public DBManipulationPane createDBManipulationPane() {
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.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;
@ -44,6 +46,8 @@ public class ListenerEditPane extends BasicBeanPane<Listener> {
private Listener listener;
JavaScriptActionPane javaScriptActionPane;
public ListenerEditPane() {
this.initComponents(new String[0]);
}
@ -87,7 +91,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);
// 自定义事件
@ -176,9 +181,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;
}
}

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.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);

50
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,9 +33,11 @@ public class WidgetEventPane extends UIListGroupControlPane {
private ElementCasePane object;
private Widget targetWidget;
public WidgetEventPane(ElementCasePane pane) {
this.object = pane;
if(pane != null){
if (pane != null) {
selection = pane.getSelection();
}
setBorder(BorderFactory.createEmptyBorder(10, 0, 15, 0));
@ -125,18 +128,21 @@ public class WidgetEventPane extends UIListGroupControlPane {
if (widget == null) {
return;
}
this.targetWidget = widget;
refreshPane(widget, EventCreator.createEventCreator(widget.supportedEvents(), WidgetEventListenerUpdatePane.class));
}
/**
* 更新
* @return 监听器
*/
public Listener[] updateListeners() {
/**
* 更新
*
* @return 监听器
*/
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++) {
res_array[i] = (Listener) ((NameObject)res[i]).getObject();
res_array[i] = (Listener) ((NameObject) res[i]).getObject();
}
return res_array;
}
@ -174,14 +180,22 @@ public class WidgetEventPane extends UIListGroupControlPane {
if (constructor != null) {
return constructor;
} else {
if (AssistUtils.equals(cls.getName(),Object.class.getName())) {
if (AssistUtils.equals(cls.getName(), Object.class.getName())) {
return null;
}
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");
}

Loading…
Cancel
Save