diff --git a/designer/src/com/fr/design/javascript/ListenerEditPane.java b/designer/src/com/fr/design/javascript/ListenerEditPane.java index 8c76497af1..864ac28aa5 100644 --- a/designer/src/com/fr/design/javascript/ListenerEditPane.java +++ b/designer/src/com/fr/design/javascript/ListenerEditPane.java @@ -6,13 +6,15 @@ import java.awt.Component; import java.awt.FlowLayout; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; -import java.util.ArrayList; -import java.util.List; +import java.util.*; import javax.swing.BorderFactory; import javax.swing.JPanel; +import com.fr.design.ExtraDesignClassManager; 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.ilable.UILabel; 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.write.submit.DBManipulationPane; import com.fr.form.event.Listener; -import com.fr.general.ComparatorUtils; 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.JavaScriptImpl; public class ListenerEditPane extends BasicBeanPane { private UITextField nameText; private UIComboBox styleBox; private CardLayout card; + private List> cards; private JPanel hyperlinkPane; private JavaScriptImplPane javaScriptPane; @@ -45,11 +42,11 @@ public class ListenerEditPane extends BasicBeanPane { // 发送邮件 private EmailPane emailPane; - private static final String JS = Inter.getLocText("JavaScript"); - private static final String FORMSUBMIT = Inter.getLocText("JavaScript-Form_Submit"); - private static final String DBCOMMIT = Inter.getLocText("JavaScript-Commit_to_Database"); - private static final String CUSTOMACTION= Inter.getLocText(new String[]{"Custom", "RWA-Submit"}); - private static final String EMAIL = Inter.getLocText("Email_sentEmail"); + private static final String JS = Inter.getLocText("FR-Designer_JavaScript"); + private static final String FORMSUBMIT = Inter.getLocText("FR-Designer_JavaScript_Form_Submit"); + private static final String DBCOMMIT = Inter.getLocText("FR-Designer_JavaScript_Commit_to_Database"); + private static final String CUSTOMACTION= Inter.getLocText(new String[]{"FR-Designer_JavaScript_Custom", "FR-Designer_RWA_Submit"}); + private static final String EMAIL = Inter.getLocText("FR-Designer_Email_sentEmail"); private Listener listener; @@ -66,6 +63,7 @@ public class ListenerEditPane extends BasicBeanPane { * @param defaultArgs 初始化参数 */ public void initComponents(String[] defaultArgs) { + cards = new ArrayList>(); this.setLayout(FRGUIPaneFactory.createBorderLayout()); JPanel namePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); nameText = new UITextField(8); @@ -74,19 +72,14 @@ public class ListenerEditPane extends BasicBeanPane { String[] style = {JS, DBCOMMIT, CUSTOMACTION,EMAIL}; styleBox = new UIComboBox(style); namePane.add(styleBox); - namePane = GUICoreUtils.createFlowPane(new Component[]{new UILabel(" " + Inter.getLocText("Event_Name") + ":"), nameText, new UILabel(" " + Inter.getLocText("Event_Type") + ":"), styleBox}, FlowLayout.LEFT); - namePane.setBorder(BorderFactory.createTitledBorder(Inter.getLocText("Event_Name_Type"))); + namePane = GUICoreUtils.createFlowPane(new Component[]{new UILabel(" " + Inter.getLocText("FR-Designer_Event_Name") + ":"), nameText, new UILabel(" " + Inter.getLocText("FR-Designer_Event_Type") + ":"), styleBox}, FlowLayout.LEFT); + namePane.setBorder(BorderFactory.createTitledBorder(Inter.getLocText("FR-Designer_Event_Name_Type"))); this.add(namePane, BorderLayout.NORTH); - card = new CardLayout(); hyperlinkPane = FRGUIPaneFactory.createCardLayout_S_Pane(); hyperlinkPane.setLayout(card); - // js javaScriptPane = new JavaScriptImplPane(defaultArgs); hyperlinkPane.add(JS, javaScriptPane); -// formSubmitScriptPane = new FormSubmitJavaScriptPane(JavaScriptActionPane.defaultJavaScriptActionPane -// .createCallButton()); -// hyperlinkPane.add(FORMSUBMIT, formSubmitScriptPane); // 提交入库 List dbmaniList = new ArrayList(); dbmaniList.add(autoCreateDBManipulationPane()); @@ -96,21 +89,37 @@ public class ListenerEditPane extends BasicBeanPane { // 自定义事件 customActionPane = new CustomActionPane(); hyperlinkPane.add(CUSTOMACTION, customActionPane); - // 发送邮件 emailPane = new EmailPane(); hyperlinkPane.add(EMAIL,emailPane); - - hyperlinkPane.setBorder(BorderFactory.createTitledBorder(Inter.getLocText("JavaScript_Set"))); + cards.add(javaScriptPane); + cards.add(commit2DBJavaScriptPane); + cards.add(customActionPane); + cards.add(emailPane); + //其他事件 + addOtherEvent(); + hyperlinkPane.setBorder(BorderFactory.createTitledBorder(Inter.getLocText("FR-Designer_JavaScript_Set"))); this.add(hyperlinkPane); - styleBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { card.show(hyperlinkPane, styleBox.getSelectedItem().toString()); } }); } - + + private void addOtherEvent(){ + Set 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); + } + } + } + /** * 根据有无单元格创建 DBManipulationPane * @return 有单元格。有智能添加单元格等按钮,返回 SmartInsertDBManipulationPane @@ -122,7 +131,7 @@ public class ListenerEditPane extends BasicBeanPane { @Override protected String title4PopupWindow() { - return Inter.getLocText("Event_Set"); + return Inter.getLocText("FR-Designer_Event_Set"); } @Override @@ -131,47 +140,28 @@ public class ListenerEditPane extends BasicBeanPane { if (this.listener == null) { this.listener = new Listener(); } - this.nameText.setText(listener.getEventName()); - JavaScript js = listener.getAction(); - if (js instanceof JavaScriptImpl) { - styleBox.setSelectedItem(JS); - card.show(hyperlinkPane, JS); - javaScriptPane.populateBean((JavaScriptImpl)js); - } else if (js instanceof FormSubmitJavaScript){ - styleBox.setSelectedItem(FORMSUBMIT); - card.show(hyperlinkPane, FORMSUBMIT); - 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); + for (int i = 0; i < this.cards.size(); i++) { + FurtherBasicBeanPane pane = cards.get(i); + if (pane.accept(js)) { + styleBox.setSelectedItem(pane.title4PopupWindow()); + card.show(hyperlinkPane, pane.title4PopupWindow()); + pane.populateBean(js); + return; + } } } - + + public void checkValid() throws Exception{ + this.cards.get(this.styleBox.getSelectedIndex()).checkValid(); + } + @Override public Listener updateBean(){ this.listener.setEventName(this.nameText.getText()); - if (ComparatorUtils.equals(styleBox.getSelectedItem(), JS)) { - this.listener.setAction(javaScriptPane.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()); - } + FurtherBasicBeanPane pane = this.cards.get(this.styleBox.getSelectedIndex()); + this.listener.setAction(pane.updateBean()); return this.listener; } } \ No newline at end of file diff --git a/designer/src/com/fr/design/widget/CellWidgetCardPane.java b/designer/src/com/fr/design/widget/CellWidgetCardPane.java index d1c81d53a4..5d4cf74a53 100644 --- a/designer/src/com/fr/design/widget/CellWidgetCardPane.java +++ b/designer/src/com/fr/design/widget/CellWidgetCardPane.java @@ -51,8 +51,8 @@ public class CellWidgetCardPane extends BasicPane { formPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); eventTabPane = new WidgetEventPane(pane); formPane.add(eventTabPane, BorderLayout.CENTER); - tabbedPane.add(Inter.getLocText("Attribute"), attriPane); - tabbedPane.add(Inter.getLocText("Form-Editing_Listeners"), formPane); + tabbedPane.add(Inter.getLocText("FR-Designer_Attribute"), attriPane); + tabbedPane.add(Inter.getLocText("FR-Designer_Form_Editing_Listeners"), formPane); presPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); cardPaneForPresent = FRGUIPaneFactory.createCardLayout_S_Pane(); @@ -88,7 +88,7 @@ public class CellWidgetCardPane extends BasicPane { widgetPropertyPane = new BasicWidgetPropertySettingPane(); JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); northPane.setBorder(BorderFactory.createEmptyBorder(5, 8, 0, 8)); - JPanel basic = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("Form-Basic_Properties")); + JPanel basic = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Form_Basic_Properties")); northPane.add(basic); basic.add(widgetPropertyPane); attriPane.add(northPane, BorderLayout.NORTH); @@ -155,13 +155,14 @@ public class CellWidgetCardPane extends BasicPane { */ public void checkValid() throws Exception { currentEditorDefinePane.checkValid(); + eventTabPane.checkValid(); } //:jackie 如果选择的项有形态,则将形态面板加入tab面板 private void addPresPane(boolean add) { if (add) { tabbedPane.add(this.presPane, 1); - tabbedPane.setTitleAt(1, Inter.getLocText("DS-Dictionary")); + tabbedPane.setTitleAt(1, Inter.getLocText("FR-Designer_DS_Dictionary")); } else { tabbedPane.remove(presPane); } @@ -170,7 +171,7 @@ public class CellWidgetCardPane extends BasicPane { private void addTreeSettingPane(boolean add) { if (add) { tabbedPane.add(this.cardPaneForTreeSetting, 1); - tabbedPane.setTitleAt(1, Inter.getLocText("Create_Tree")); + tabbedPane.setTitleAt(1, Inter.getLocText("FR-Designer_Create_Tree")); } else { tabbedPane.remove(this.cardPaneForTreeSetting); } diff --git a/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java b/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java index 600481428e..6f2ee4da33 100644 --- a/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java +++ b/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java @@ -299,7 +299,6 @@ public class ProcedureDataPane extends AbstractTableDataPane imp text = StringUtils.EMPTY; } text = text.trim(); - String[] tableName = text.split("\\."); String connectionname = this.connectionTableProcedurePane.getSelectedDatabaseConnnectonName(); try { String procedureText = FRContext.getCurrentEnv().getProcedureText(this.connectionTableProcedurePane.getSelectedDatabaseConnnectonName(), text); @@ -307,16 +306,16 @@ public class ProcedureDataPane extends AbstractTableDataPane imp // 获取参数默认值,例如:NAME in varchar2 default 'SCOTT',默认值为SCOTT String parameterDefaultValue = ""; if (StringUtils.isNotEmpty(procedureText)) { - int index_begin = procedureText.indexOf("BEGIN"); - - //from sam: 默认值只会在begin之前声明, 不然会把所有的存储过程里带'xx'的都作为默认值 - String defaulValueStr = index_begin == -1 ? procedureText : procedureText.substring(0, index_begin); - String[] strs = defaulValueStr.split("\'"); + int index_begin = procedureText.indexOf("BEGIN"); + + //from sam: 默认值只会在begin之前声明, 不然会把所有的存储过程里带'xx'的都作为默认值 + String defaulValueStr = index_begin == -1 ? procedureText : procedureText.substring(0, index_begin); + String[] strs = defaulValueStr.split("\'"); parameterDefaultValue = strs.length > 1 ? strs[1] : parameterDefaultValue; } StoreProcedureParameter[] newparameters; - newparameters = FRContext.getCurrentEnv().getStoreProcedureDeclarationParameters(connectionname, tableName[tableName.length - 1], parameterDefaultValue); + newparameters = FRContext.getCurrentEnv().getStoreProcedureDeclarationParameters(connectionname, text, parameterDefaultValue); editorPane.populate(newparameters); diff --git a/designer_base/src/com/fr/design/gui/frpane/ListenerUpdatePane.java b/designer_base/src/com/fr/design/gui/frpane/ListenerUpdatePane.java index 6ade755f0c..3d96a8e71f 100644 --- a/designer_base/src/com/fr/design/gui/frpane/ListenerUpdatePane.java +++ b/designer_base/src/com/fr/design/gui/frpane/ListenerUpdatePane.java @@ -29,7 +29,7 @@ public abstract class ListenerUpdatePane extends BasicBeanPane { @Override protected String title4PopupWindow() { - return Inter.getLocText("Event"); + return Inter.getLocText("FR-Designer_Event"); } @Override @@ -45,4 +45,9 @@ public abstract class ListenerUpdatePane extends BasicBeanPane { return editing; } + + @Override + public void checkValid() throws Exception{ + actionPane.checkValid(); + } } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/gui/frpane/UIComboBoxPane.java b/designer_base/src/com/fr/design/gui/frpane/UIComboBoxPane.java index 99a126e127..f24ce8a71e 100644 --- a/designer_base/src/com/fr/design/gui/frpane/UIComboBoxPane.java +++ b/designer_base/src/com/fr/design/gui/frpane/UIComboBoxPane.java @@ -133,6 +133,12 @@ public abstract class UIComboBoxPane extends BasicBeanPane { return cards.get(jcb.getSelectedIndex()).updateBean(); } + @Override + public void checkValid() throws Exception { + cards.get(jcb.getSelectedIndex()).checkValid(); + + } + public int getSelectedIndex() { return jcb.getSelectedIndex(); } diff --git a/designer_base/src/com/fr/design/javascript/JavaScriptActionPane.java b/designer_base/src/com/fr/design/javascript/JavaScriptActionPane.java index 52648e444a..85c77c65e1 100644 --- a/designer_base/src/com/fr/design/javascript/JavaScriptActionPane.java +++ b/designer_base/src/com/fr/design/javascript/JavaScriptActionPane.java @@ -43,15 +43,6 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane { contentDBManiPane = new ArrayList(); contentDBManiPane.add(createDBManipulationPane()); 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()); Set javaScriptActionProviders = ExtraDesignClassManager.getInstance().getArray(JavaScriptActionProvider.XML_TAG); if (javaScriptActionProviders != null) { @@ -84,14 +75,14 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane { * @return 返回按钮对象 */ public UIButton createCallButton() { - UIButton callButton = new UIButton(Inter.getLocText("Set_Callback_Function")); + UIButton callButton = new UIButton(Inter.getLocText("FR-Designer_Set_Callback_Function")); callButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final JavaScriptActionPane callPane = new JavaScriptActionPane() { @Override protected String title4PopupWindow() { - return Inter.getLocText("Set_Callback_Function"); + return Inter.getLocText("FR-Designer_Set_Callback_Function"); } @Override @@ -162,7 +153,7 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane { @Override protected String title4PopupWindow() { - return Inter.getLocText("Set_Callback_Function"); + return Inter.getLocText("FR-Designer_Set_Callback_Function"); } @Override @@ -179,10 +170,10 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane { * 生成界面默认的组建 * * @return 返回生成的面板 - */ - public static JavaScriptActionPane createDefault() { - return new JavaScriptActionPane() { + */ + public static JavaScriptActionPane createDefault() { + return new JavaScriptActionPane() { @Override public DBManipulationPane createDBManipulationPane() { return new DBManipulationPane(); @@ -190,7 +181,7 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane { @Override protected String title4PopupWindow() { - return Inter.getLocText("Set_Callback_Function"); + return Inter.getLocText("FR-Designer_Set_Callback_Function"); } @Override diff --git a/designer_base/src/com/fr/design/locale/designer.properties b/designer_base/src/com/fr/design/locale/designer.properties index f1c8fdc714..13613ee578 100644 --- a/designer_base/src/com/fr/design/locale/designer.properties +++ b/designer_base/src/com/fr/design/locale/designer.properties @@ -493,3 +493,18 @@ FR-Designer_Exporting=Exporting FR-Designer_Export-PDF=PDF FR-Designer_Button_OK=OK FR-Designer_Button_Cancel=Cancel +FR-Designer_JavaScript= +FR-Designer_JavaScript_Form_Submit= +FR-Designer_JavaScript_Commit_to_Database= +FR-Designer_JavaScript_Custom= +FR-Designer_RWA_Submit= +FR-Designer_Event_Name= +FR-Designer_Event_Type= +FR-Designer_Event_Name_Type= +FR-Designer_JavaScript_Set= +FR-Designer_Attribute= +FR-Designer_Form_Editing_Listeners= +FR-Designer_Form_Basic_Properties= +FR-Designer_DS_Dictionary= +FR-Designer_Create_Tree= +FR-Designer_Set_Callback_Function= diff --git a/designer_base/src/com/fr/design/locale/designer_en_US.properties b/designer_base/src/com/fr/design/locale/designer_en_US.properties index b4d6932083..ae110ae601 100644 --- a/designer_base/src/com/fr/design/locale/designer_en_US.properties +++ b/designer_base/src/com/fr/design/locale/designer_en_US.properties @@ -493,3 +493,19 @@ FR-Designer_Export-PDF=PDF FR-Designer_Properties_Mobile=MobileProperties FR-Designer_Button_OK=OK FR-Designer_Button_Cancel=Cancel +FR-Designer_JavaScript=JavaScript +FR-Designer_JavaScript_Form_Submit=Form Submit +FR-Designer_JavaScript_Commit_to_Database=Commit to DB +FR-Designer_JavaScript_Custom=Custom +FR-Designer_RWA_Submit=Submit +FR-Designer_Event_Name=Event Name +FR-Designer_Event_Type=Event Type +FR-Designer_Event_Name_Type=Event Name and Type +FR-Designer_JavaScript_Set=JavaScript Set +FR-Designer_Attribute=Attribute +FR-Designer_Form_Editing_Listeners=Event editing +FR-Designer_Form_Basic_Properties=Basic Property +FR-Designer_DS_Dictionary=Data Dictionary +FR-Designer_Create_Tree=Build Tree +FR-Designer_Set_Callback_Function=Set Callback Function + diff --git a/designer_base/src/com/fr/design/locale/designer_ja_JP.properties b/designer_base/src/com/fr/design/locale/designer_ja_JP.properties index 0199703877..fc69c2e921 100644 --- a/designer_base/src/com/fr/design/locale/designer_ja_JP.properties +++ b/designer_base/src/com/fr/design/locale/designer_ja_JP.properties @@ -471,4 +471,19 @@ FR-Designer_Exported_successfully=\u5C0E\u51FA\u6210\u529F FR-Designer_Exporting=\u5C0E\u51FA\u3057\u3066\u3044\u307E\u3059 FR-Designer_Export-PDF=PDF\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8FR-Designer_Button_OK=FR-Designer_Button_OK=\u78BA\u5B9A FR-Designer_Button_Cancel=\u30AD\u30E3\u30F3\u30BB\u30EB -\ \ No newline at end of file +\uFFFD +FR-Designer_JavaScript= +FR-Designer_JavaScript_Form_Submit= +FR-Designer_JavaScript_Commit_to_Database= +FR-Designer_JavaScript_Custom= +FR-Designer_RWA_Submit= +FR-Designer_Event_Name= +FR-Designer_Event_Type= +FR-Designer_Event_Name_Type= +FR-Designer_JavaScript_Set= +FR-Designer_Attribute= +FR-Designer_Form_Editing_Listeners= +FR-Designer_Form_Basic_Properties= +FR-Designer_DS_Dictionary= +FR-Designer_Create_Tree= +FR-Designer_Set_Callback_Function= \ No newline at end of file diff --git a/designer_base/src/com/fr/design/locale/designer_ko_KR.properties b/designer_base/src/com/fr/design/locale/designer_ko_KR.properties index 981cffc7b0..644cdf8f98 100644 --- a/designer_base/src/com/fr/design/locale/designer_ko_KR.properties +++ b/designer_base/src/com/fr/design/locale/designer_ko_KR.properties @@ -466,4 +466,19 @@ FR-Designer_Exported_successfully=\uB0B4\uBCF4\uB0B4\uAE30\uC131\uACF5 FR-Designer_Exporting=\uB0B4\uBCF4\uB0B4\uAE30\uC911 FR-Designer_Export-PDF=PDF\uC11C\uC2DDFR-Designer_Properties=\uFFFD FR-Designer_Button_OK=\uD655\uC778FR-Designer_Button_Cancel=\uCDE8\uC18C -\uFFFD \ No newline at end of file +\uFFFD +FR-Designer_JavaScript= +FR-Designer_JavaScript_Form_Submit= +FR-Designer_JavaScript_Commit_to_Database= +FR-Designer_JavaScript_Custom= +FR-Designer_RWA_Submit= +FR-Designer_Event_Name= +FR-Designer_Event_Type= +FR-Designer_Event_Name_Type= +FR-Designer_JavaScript_Set= +FR-Designer_Attribute= +FR-Designer_Form_Editing_Listeners= +FR-Designer_Form_Basic_Properties= +FR-Designer_DS_Dictionary= +FR-Designer_Create_Tree= +FR-Designer_Set_Callback_Function= \ No newline at end of file diff --git a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties index 77509989cd..7cc34b2b0a 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties +++ b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties @@ -497,3 +497,18 @@ FR-Designer_Export-PDF=PDF\u683C\u5F0F FR-Designer_Properties_Mobile=\u624B\u673A\u5C5E\u6027 FR-Designer_Button_OK=\u786E\u5B9A FR-Designer_Button_Cancel=\u53D6\u6D88 +FR-Designer_JavaScript=JavaScript\u811A\u672C +FR-Designer_JavaScript_Form_Submit=\u8868\u5355\u63D0\u4EA4 +FR-Designer_JavaScript_Commit_to_Database=\u63D0\u4EA4\u5165\u5E93 +FR-Designer_JavaScript_Custom=\u81EA\u5B9A\u4E49 +FR-Designer_RWA_Submit=\u63D0\u4EA4 +FR-Designer_Event_Name=\u4E8B\u4EF6\u540D +FR-Designer_Event_Type=\u4E8B\u4EF6\u7C7B\u578B +FR-Designer_Event_Name_Type=\u4E8B\u4EF6\u540D\u5B57\u548C\u7C7B\u578B +FR-Designer_JavaScript_Set=JS\u8BBE\u7F6E +FR-Designer_Attribute=\u5C5E\u6027 +FR-Designer_Form_Editing_Listeners=\u4E8B\u4EF6\u7F16\u8F91 +FR-Designer_Form_Basic_Properties=\u57FA\u672C\u5C5E\u6027 +FR-Designer_DS_Dictionary=\u6570\u636E\u5B57\u5178 +FR-Designer_Create_Tree=\u6784\u5EFA\u6811 +FR-Designer_Set_Callback_Function=\u8BBE\u7F6E\u56DE\u8C03\u51FD\u6570 diff --git a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties index c9aac5cb35..6d7aa5d172 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties +++ b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties @@ -484,4 +484,19 @@ FR-Designer_Exporting=\u6B63\u5728\u532F\u51FA... FR-Designer_Export-PDF=PDF\u683C\u5F0F FR-Designer_Properties_Mobile=\u624B\u6A5F\u5C6C\u6027 FR-Designer_Button_OK=\u78BA\u5B9A -FR-Designer_Button_Cancel=\u53D6\u6D88 \ No newline at end of file +FR-Designer_Button_Cancel=\u53D6\u6D88 +FR-Designer_JavaScript= +FR-Designer_JavaScript_Form_Submit= +FR-Designer_JavaScript_Commit_to_Database= +FR-Designer_JavaScript_Custom= +FR-Designer_RWA_Submit= +FR-Designer_Event_Name= +FR-Designer_Event_Type= +FR-Designer_Event_Name_Type= +FR-Designer_JavaScript_Set= +FR-Designer_Attribute= +FR-Designer_Form_Editing_Listeners= +FR-Designer_Form_Basic_Properties= +FR-Designer_DS_Dictionary= +FR-Designer_Create_Tree= +FR-Designer_Set_Callback_Function= \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index 12cbef841e..c091c54b99 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -25,13 +25,18 @@ import com.fr.general.*; import com.fr.plugin.PluginCollector; import com.fr.plugin.PluginLicenseManager; import com.fr.plugin.PluginMessage; +import com.fr.design.extra.ChartTypeInterfaceCloseableHandler; +import com.fr.plugin.proxy.PluginInstanceProxyFactory; +import com.fr.plugin.proxy.PluginInvocationHandler; import com.fr.stable.ArrayUtils; import com.fr.stable.EnvChangedListener; import com.fr.stable.StringUtils; +import com.fr.stable.collections.map.CloseableContainedMap; import com.fr.stable.fun.Authorize; import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; import com.fr.stable.plugin.PluginReadListener; import com.fr.stable.plugin.PluginSimplify; +import com.fr.stable.plugin.closeable.Closeable; import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLableReader; @@ -43,13 +48,12 @@ import java.util.*; */ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraChartDesignClassManagerProvider { - - - private static ClassLoader loader = Thread.currentThread().getContextClassLoader(); private static ChartTypeInterfaceManager classManager = null; - private static LinkedHashMap> chartTypeInterfaces = new LinkedHashMap>(); + + private static LinkedHashMap> chartTypeInterfaces = + new LinkedHashMap<>(); public synchronized static ChartTypeInterfaceManager getInstance() { if (classManager == null) { @@ -135,7 +139,8 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh if (chartTypeInterfaces.containsKey(ChartTypeManager.CHART_PRIORITY)){ return; } - LinkedHashMap chartUIList = new LinkedHashMap(); + CloseableContainedMap chartUIList = + new CloseableContainedMap<>(LinkedHashMap.class); chartUIList.put(ChartConstants.COLUMN_CHART, new ColumnIndependentChartInterface()); chartUIList.put(ChartConstants.LINE_CHART, new LineIndependentChartInterface()); chartUIList.put(ChartConstants.BAR_CHART, new BarIndependentChartInterface()); @@ -173,6 +178,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh } private String getIconPath(String priority, String plotID) { + if (chartTypeInterfaces.get(priority) != null && chartTypeInterfaces.get(priority).get(plotID) != null) { return chartTypeInterfaces.get(priority).get(plotID).getIconPath(); }else { @@ -184,11 +190,12 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh if (chartTypeInterfaces != null){ if (!chartTypeInterfaces.containsKey(priority)){ //新建一个具体图表列表 - LinkedHashMap chartUIList = new LinkedHashMap(); + CloseableContainedMap chartUIList + = new CloseableContainedMap<>(LinkedHashMap.class); chartUIList.put(plotID, provider); chartTypeInterfaces.put(priority, chartUIList); }else { - LinkedHashMap chartUIList = chartTypeInterfaces.get(priority); + Map chartUIList = chartTypeInterfaces.get(priority); if (!chartUIList.containsKey(plotID)) { chartUIList.put(plotID, provider); } @@ -210,23 +217,27 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh if (authorize != null) { PluginLicenseManager.getInstance().registerPaid(authorize, simplify); } - IndependentChartUIProvider provider = (IndependentChartUIProvider) clazz.newInstance(); - if (PluginCollector.getCollector().isError(provider, IndependentChartUIProvider.CURRENT_API_LEVEL, simplify.getPluginName()) || !containsChart(plotID)) { + IndependentChartUIProvider provider = getProxyObj(plotID, simplify, clazz); + if (PluginCollector.getCollector().isError(provider, IndependentChartUIProvider.CURRENT_API_LEVEL, simplify.getPluginName())) { PluginMessage.remindUpdate(className); } else { - ChartTypeInterfaceManager.getInstance().addChartTypeInterface(provider, priority, plotID); + addChartTypeInterface(provider, priority, plotID); } } catch (ClassNotFoundException e) { FRLogger.getLogger().error("class not found:" + e.getMessage()); } catch (IllegalAccessException | InstantiationException e) { FRLogger.getLogger().error("object create error:" + e.getMessage()); + } catch (NoSuchMethodException e) { + FRLogger.getLogger().error(e.getMessage()); } } } - //UI对应的chart如果没有加载,UI也不必加进去了 - private boolean containsChart(String plotID) { - return ChartTypeManager.getInstance().containsPlot(plotID); + private IndependentChartUIProvider getProxyObj(String plotID, PluginSimplify simplify, Class clazz) throws IllegalAccessException, InstantiationException, NoSuchMethodException { + + PluginInstanceProxyFactory factory = new PluginInstanceProxyFactory(clazz, simplify); + PluginInvocationHandler handler = new ChartTypeInterfaceCloseableHandler(plotID); + return (IndependentChartUIProvider) factory.addProxy(Closeable.class, handler).getProxyObj(); } @@ -253,8 +264,8 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh return getTitle4PopupWindow(); } String[] names = new String[getChartSize(priority)]; - if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority)){ - HashMap chartUIList = chartTypeInterfaces.get(priority); + if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority)) { + Map chartUIList = chartTypeInterfaces.get(priority); Iterator iterator = chartUIList.entrySet().iterator(); int i = 0; while (iterator.hasNext()){ @@ -273,7 +284,8 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh * @return */ public String getTitle4PopupWindow(String priority, String plotID){ - if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority) && chartTypeInterfaces.get(priority).containsKey(plotID)){ + + if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority) && chartTypeInterfaces.get(priority).containsKey(plotID)) { IndependentChartUIProvider provider = chartTypeInterfaces.get(priority).get(plotID); return provider.getPlotTypeTitle4PopupWindow(); } @@ -415,7 +427,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh private boolean plotInChart(String plotID, String priority) { return chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority) - && chartTypeInterfaces.get(priority).containsKey(plotID); + && chartTypeInterfaces.get(priority).containsKey(plotID); } private AbstractReportDataContentPane getReportDataSourcePane(String priority, Plot plot, ChartDataPane parent) { @@ -467,7 +479,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh while (iterator.hasNext()){ Map.Entry entry = (Map.Entry) iterator.next(); String priority = (String) entry.getKey(); - if (chartTypeInterfaces.get(priority).containsKey(plotID)){ + if (chartTypeInterfaces.get(priority).containsKey(plotID)) { return isUseDefaultPane(priority, plotID); } } @@ -475,7 +487,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh return true; } - private boolean isUseDefaultPane(String priority, String plotID){ + private boolean isUseDefaultPane(String priority, String plotID) { if (chartTypeInterfaces.containsKey(priority) && chartTypeInterfaces.get(priority).containsKey(plotID)) { return chartTypeInterfaces.get(priority).get(plotID).isUseDefaultPane(); diff --git a/designer_chart/src/com/fr/design/extra/ChartTypeInterfaceCloseableHandler.java b/designer_chart/src/com/fr/design/extra/ChartTypeInterfaceCloseableHandler.java new file mode 100644 index 0000000000..8e9715574e --- /dev/null +++ b/designer_chart/src/com/fr/design/extra/ChartTypeInterfaceCloseableHandler.java @@ -0,0 +1,31 @@ +package com.fr.design.extra; + +import com.fr.chart.charttypes.ChartTypeManager; +import com.fr.plugin.proxy.CloseableInvocationHandler; + +/** + * Created by juhaoyu on 2016/12/27. + */ +public class ChartTypeInterfaceCloseableHandler extends CloseableInvocationHandler { + + + private final String plotID; + + public ChartTypeInterfaceCloseableHandler(String plotID) throws NoSuchMethodException { + + super(); + this.plotID = plotID; + } + + @Override + protected boolean invokeIsClosed() { + + //UI对应的chart如果关闭或者不存在,则UI关闭 + return super.invokeIsClosed() || !containsChart(); + } + + private boolean containsChart() { + + return ChartTypeManager.getInstance().containsPlot(plotID); + } +}