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. 60
      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. 35
      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. 42
      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;

60
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,26 +26,27 @@ 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);
@ -55,33 +57,33 @@ public class Commit2DBJavaScriptPane extends FurtherBasicBeanPane<Commit2DBJavaS
btPane.add(addCallbackButton); 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,6 +93,7 @@ public class Commit2DBJavaScriptPane extends FurtherBasicBeanPane<Commit2DBJavaS
/** /**
* 窗口名称 * 窗口名称
*
* @return 返回窗口名称 * @return 返回窗口名称
*/ */
public String title4PopupWindow() { public String title4PopupWindow() {
@ -103,10 +106,10 @@ public class Commit2DBJavaScriptPane extends FurtherBasicBeanPane<Commit2DBJavaS
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
@ -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,6 +161,7 @@ public class Commit2DBJavaScriptPane extends FurtherBasicBeanPane<Commit2DBJavaS
/** /**
* 判断是否是能接受的数据类型 * 判断是否是能接受的数据类型
*
* @param ob 对象 * @param ob 对象
* @return 返回是否是能接受的数据类型 * @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.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;
}
/** /**
* 生成回调函数的按钮 * 生成回调函数的按钮
* *

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;
} }
} }

35
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.report.web.button.write.Submit;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.write.JavaScriptResourceInfo;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.Box; import javax.swing.Box;
@ -322,6 +323,7 @@ public class EditToolBar extends BasicPane {
/** /**
* 动作 * 动作
*
* @param e 事件 * @param e 事件
*/ */
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -455,7 +457,7 @@ public class EditToolBar extends BasicPane {
export.add(word); export.add(word);
export.add(Box.createVerticalStrut(2)); export.add(Box.createVerticalStrut(2));
export.add(image); export.add(image);
for(int i=0; i<ArrayUtils.getLength(exportToolBarProviders); i++){ for (int i = 0; i < ArrayUtils.getLength(exportToolBarProviders); i++) {
export = exportToolBarProviders[i].updateCenterPane(export); export = exportToolBarProviders[i].updateCenterPane(export);
} }
@ -514,9 +516,11 @@ public class EditToolBar extends BasicPane {
if (!(widget instanceof CustomToolBarButton)) { if (!(widget instanceof CustomToolBarButton)) {
return; return;
} }
if (javaScriptPane == null || ((CustomToolBarButton)widget).getJSImpl() == null) { if (javaScriptPane == null || ((CustomToolBarButton) widget).getJSImpl() == null) {
javaScriptPane = JavaScriptActionPane.createDefault(); javaScriptPane = JavaScriptActionPane.createDefault();
} }
javaScriptPane.setResourceInfo(new JavaScriptResourceInfo(JavaScriptResourceInfo.Type.WIDGET, ((Button) widget).getText()));
javaScriptPane.setPreferredSize(new Dimension(750, 500)); javaScriptPane.setPreferredSize(new Dimension(750, 500));
BasicDialog dialog = javaScriptPane.showWindow(SwingUtilities.getWindowAncestor(ButtonPane.this)); BasicDialog dialog = javaScriptPane.showWindow(SwingUtilities.getWindowAncestor(ButtonPane.this));
dialog.addDialogActionListener(new DialogActionAdapter() { dialog.addDialogActionListener(new DialogActionAdapter() {
@ -563,7 +567,7 @@ public class EditToolBar extends BasicPane {
} }
} }
private void populateAppendColumnRow(){ private void populateAppendColumnRow() {
card.show(centerPane, "appendcount"); card.show(centerPane, "appendcount");
count.setValue(((AppendColumnRow) widget).getCount()); count.setValue(((AppendColumnRow) widget).getCount());
} }
@ -584,7 +588,7 @@ public class EditToolBar extends BasicPane {
} }
} }
private void populateEmail(){ private void populateEmail() {
card.show(centerPane, EMAIL); card.show(centerPane, EMAIL);
Email email = (Email) widget; Email email = (Email) widget;
this.customConsignee.setSelected(email.isCustomConsignee()); this.customConsignee.setSelected(email.isCustomConsignee());
@ -592,7 +596,7 @@ public class EditToolBar extends BasicPane {
this.consigneeByRole.setSelected(email.isConsigneeByRole()); this.consigneeByRole.setSelected(email.isConsigneeByRole());
} }
private void populateCustomToolBarButton(){ private void populateCustomToolBarButton() {
card.show(centerPane, "custom"); card.show(centerPane, "custom");
CustomToolBarButton customToolBarButton = (CustomToolBarButton) widget; CustomToolBarButton customToolBarButton = (CustomToolBarButton) widget;
if (customToolBarButton.getJSImpl() != null) { if (customToolBarButton.getJSImpl() != null) {
@ -600,7 +604,7 @@ public class EditToolBar extends BasicPane {
} }
} }
private void populateSubmit(){ private void populateSubmit() {
card.show(centerPane, "submit"); card.show(centerPane, "submit");
Submit submit = ((Submit) widget); Submit submit = ((Submit) widget);
this.isVerify.setSelected(submit.isVerify()); this.isVerify.setSelected(submit.isVerify());
@ -611,7 +615,7 @@ public class EditToolBar extends BasicPane {
this.isCurSheet.setSelected(submit.isOnlySubmitSelect()); this.isCurSheet.setSelected(submit.isOnlySubmitSelect());
} }
private void populateDefault(){ private void populateDefault() {
Button button = (Button) widget; Button button = (Button) widget;
this.icon.setSelected(button.isShowIcon()); this.icon.setSelected(button.isShowIcon());
this.text.setSelected(button.isShowText()); this.text.setSelected(button.isShowText());
@ -648,21 +652,21 @@ public class EditToolBar extends BasicPane {
return widget; return widget;
} }
private void updateDefault(){ private void updateDefault() {
((Button) widget).setShowIcon(this.icon.isSelected()); ((Button) widget).setShowIcon(this.icon.isSelected());
((Button) widget).setShowText(this.text.isSelected()); ((Button) widget).setShowText(this.text.isSelected());
((Button) widget).setText(this.nameField.getText()); ((Button) widget).setText(this.nameField.getText());
((Button) widget).setIconName(this.iconPane.update()); ((Button) widget).setIconName(this.iconPane.update());
} }
private void updateSubmit(){ private void updateSubmit() {
Submit submit = ((Submit) widget); Submit submit = ((Submit) widget);
submit.setVerify(this.isVerify.isSelected()); submit.setVerify(this.isVerify.isSelected());
submit.setFailVerifySubmit(this.failSubmit.isSelected()); submit.setFailVerifySubmit(this.failSubmit.isSelected());
submit.setOnlySubmitSelect(this.isCurSheet.isSelected()); submit.setOnlySubmitSelect(this.isCurSheet.isSelected());
} }
private void updateExport(){ private void updateExport() {
Export export = (Export) widget; Export export = (Export) widget;
export.setPdfAvailable(this.pdf.isSelected()); export.setPdfAvailable(this.pdf.isSelected());
export.setExcelPAvailable(this.excelP.isSelected()); export.setExcelPAvailable(this.excelP.isSelected());
@ -670,14 +674,15 @@ public class EditToolBar extends BasicPane {
export.setExcelSAvailable(this.excelS.isSelected()); export.setExcelSAvailable(this.excelS.isSelected());
export.setWordAvailable(this.word.isSelected()); export.setWordAvailable(this.word.isSelected());
export.setImageAvailable(this.image.isSelected()); export.setImageAvailable(this.image.isSelected());
if(exportToolBarProviders != null){ if (exportToolBarProviders != null) {
for(int i=0; i<exportToolBarProviders.length; i++){ for (int i = 0; i < exportToolBarProviders.length; i++) {
exportToolBarProviders[i].update();; exportToolBarProviders[i].update();
;
} }
} }
} }
private void updateEmail(){ private void updateEmail() {
Email email = ((Email) widget); Email email = ((Email) widget);
email.setCustomConsignee(this.customConsignee.isSelected()); email.setCustomConsignee(this.customConsignee.isSelected());
email.setConsigneeByDepartment(this.consigneeByDepartment.isSelected()); email.setConsigneeByDepartment(this.consigneeByDepartment.isSelected());
@ -689,6 +694,8 @@ public class EditToolBar extends BasicPane {
if (customToolBarButton.getJSImpl() == null) { if (customToolBarButton.getJSImpl() == null) {
this.javaScriptPane = JavaScriptActionPane.createDefault(); this.javaScriptPane = JavaScriptActionPane.createDefault();
} }
javaScriptPane.setResourceInfo(new JavaScriptResourceInfo(JavaScriptResourceInfo.Type.CUSTOM_BUTTON, ((Button) widget).getText()));
customToolBarButton.setJSImpl(this.javaScriptPane.updateBean()); 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.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);

42
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