From 82eac484a999c342698b55fc6818b6420afb5d3e Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 29 Nov 2017 15:30:52 +0800 Subject: [PATCH 01/20] =?UTF-8?q?REPORT-5832=20=E8=A1=A8=E5=8D=95=E8=87=AA?= =?UTF-8?q?=E9=80=82=E5=BA=94=E5=88=87=E5=88=B0=E7=BB=9D=E5=AF=B9=E5=B8=83?= =?UTF-8?q?=E5=B1=80=E5=90=8E,=20=E9=9C=80=E8=A6=81=E6=B8=85=E7=90=86?= =?UTF-8?q?=E6=8E=89=E4=B8=80=E4=BA=9B=E7=BB=9D=E5=AF=B9=E5=B8=83=E5=B1=80?= =?UTF-8?q?=E9=87=8C=E6=B2=A1=E6=9C=89=E7=9A=84=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/widget/ui/designer/layout/FRFitLayoutDefinePane.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer_form/src/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java b/designer_form/src/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java index b429ff84b4..be330d2f92 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java @@ -161,6 +161,7 @@ public class FRFitLayoutDefinePane extends AbstractDataModify { wAbsoluteBodyLayout.setCompState(WAbsoluteLayout.STATE_FIXED); Component[] components = xWFitLayout.getComponents(); xWFitLayout.removeAll(); + layout.resetStyle(); XWAbsoluteBodyLayout xwAbsoluteBodyLayout = new XWAbsoluteBodyLayout(wAbsoluteBodyLayout, new Dimension(0, 0)); xWFitLayout.getLayoutAdapter().addBean(xwAbsoluteBodyLayout, 0, 0); for (Component component : components) { From ce67e756d988cf69c83ac71bc262a065f332a236 Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 29 Nov 2017 16:56:08 +0800 Subject: [PATCH 02/20] =?UTF-8?q?REPORT-5832=20=E5=8E=BB=E6=8E=89=E6=97=A0?= =?UTF-8?q?=E7=94=A8=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java | 5 ----- .../designer/properties/FRFitLayoutPropertiesGroupModel.java | 1 - 2 files changed, 6 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java b/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java index 20702ec8f4..c7fbdb7592 100644 --- a/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java +++ b/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java @@ -98,11 +98,6 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr if (row == 0) { if (state == WBodyLayoutType.FIT.getTypeValue()) { return switch2FitBodyLayout(); - } else { - XWFitLayout xfl = (XWFitLayout) xwAbsoluteLayout.getBackupParent(); - if (xfl.toData().removeMargin()) { - DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); - } } } if (row == 1) { diff --git a/designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java b/designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java index d6d7c06c59..9ffad45338 100644 --- a/designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java +++ b/designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java @@ -152,7 +152,6 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel { wAbsoluteBodyLayout.setCompState(WAbsoluteLayout.STATE_FIXED); Component[] components = xfl.getComponents(); xfl.removeAll(); - xfl.toData().removeMargin(); XWAbsoluteBodyLayout xwAbsoluteBodyLayout = new XWAbsoluteBodyLayout(wAbsoluteBodyLayout, new Dimension(0, 0)); xfl.getLayoutAdapter().addBean(xwAbsoluteBodyLayout, 0, 0); for (Component component : components) { From fbcd70a73c04f595db4e9f662eef4ed39e92ac95 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Mon, 4 Dec 2017 00:59:07 +0800 Subject: [PATCH 03/20] =?UTF-8?q?REPORT-5793=20=E3=80=909.0=E3=80=91?= =?UTF-8?q?=E4=BB=8Ealphafine=E8=BF=9B=E5=85=A5=E6=A8=A1=E6=9D=BF=E7=9A=84?= =?UTF-8?q?web=E5=B1=9E=E6=80=A7=EF=BC=8C=E6=98=BE=E7=A4=BA=E7=9A=84?= =?UTF-8?q?=E9=83=BD=E6=98=AF=E4=B8=8A=E4=B8=80=E5=BC=A0=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=9A=84=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../search/manager/RecentSearchManager.java | 9 +++++++-- .../mainframe/toolbar/UpdateActionManager.java | 14 ++++++++++---- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java index c191c0c11e..48cb40d88b 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe.alphafine.search.manager; import com.fr.base.FRContext; import com.fr.base.Utils; +import com.fr.design.actions.UpdateAction; import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.CellType; @@ -233,8 +234,12 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear SearchResult searchResult = new SearchResult(); while (modelIterator.hasNext()) { AlphaCellModel model = modelIterator.next(); - if (model.getType() == CellType.ACTION && !UpdateActionManager.getUpdateActionManager().isEnable(((ActionModel) model).getAction())) { - continue; + if (model.getType() == CellType.ACTION) { + UpdateAction action = UpdateActionManager.getUpdateActionManager().getActionByName(model.getName()); + if (action != null) { + ((ActionModel) model).setAction(action); + searchResult.add(model); + } } else { searchResult.add(model); } diff --git a/designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionManager.java b/designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionManager.java index 845eb3660e..853ff15923 100644 --- a/designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionManager.java +++ b/designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionManager.java @@ -27,12 +27,18 @@ public class UpdateActionManager { this.updateActions = updateActions; } - public boolean isEnable(UpdateAction updateAction) { + /** + * 根据action name获取action对象 + * + * @param name + * @return + */ + public UpdateAction getActionByName(String name) { for (UpdateActionModel action : updateActions) { - if (ComparatorUtils.equals(updateAction.getName(), action.getActionName()) && action.getAction().isEnabled()) { - return true; + if (ComparatorUtils.equals(name, action.getActionName()) && action.getAction().isEnabled()) { + return action.getAction(); } } - return false; + return null; } } From e9bcc8188379852ab030b0c397a83fe8710a3b5d Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 4 Dec 2017 17:09:40 +0800 Subject: [PATCH 04/20] =?UTF-8?q?REPORT-5954=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E6=8A=98=E5=8F=A0=E6=8E=A7=E4=BB=B6=E6=96=87=E5=AD=97=E6=B8=B2?= =?UTF-8?q?=E6=9F=93=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/foldablepane/HeaderPane.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/designer_base/src/com/fr/design/foldablepane/HeaderPane.java b/designer_base/src/com/fr/design/foldablepane/HeaderPane.java index 31cc290324..96980bd9bc 100644 --- a/designer_base/src/com/fr/design/foldablepane/HeaderPane.java +++ b/designer_base/src/com/fr/design/foldablepane/HeaderPane.java @@ -3,6 +3,7 @@ package com.fr.design.foldablepane; import com.fr.base.GraphHelper; import com.fr.design.constants.UIConstants; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxUtilities; +import com.fr.stable.OperatingSystem; import javax.swing.*; import java.awt.*; @@ -55,8 +56,11 @@ public class HeaderPane extends JPanel { @Override protected void paintComponent(Graphics g) { Graphics2D g2d = (Graphics2D) g.create(); - g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, - RenderingHints.VALUE_ANTIALIAS_ON); + //mac下抗锯齿处理 + if(OperatingSystem.isMacOS()){ + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_ON); + } BufferedImage panelImage = createPanelImage(); g2d.drawImage(panelImage, null, 0, 0); GraphHelper.drawString(g2d, this.title, TITLE_X, headHeight - fontSize / 2 - 1); From 989ef0936dc50927cede9e7b7f427c813aad088e Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 4 Dec 2017 17:12:21 +0800 Subject: [PATCH 05/20] =?UTF-8?q?=E4=BF=AE=E6=94=B9import?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/foldablepane/HeaderPane.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/designer_base/src/com/fr/design/foldablepane/HeaderPane.java b/designer_base/src/com/fr/design/foldablepane/HeaderPane.java index 96980bd9bc..f6e182e2b3 100644 --- a/designer_base/src/com/fr/design/foldablepane/HeaderPane.java +++ b/designer_base/src/com/fr/design/foldablepane/HeaderPane.java @@ -5,8 +5,16 @@ import com.fr.design.constants.UIConstants; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxUtilities; import com.fr.stable.OperatingSystem; -import javax.swing.*; -import java.awt.*; +import javax.swing.JFrame; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.RenderingHints; import java.awt.image.BufferedImage; import java.util.Map; From 129739d9e1fd80bab29daa720c1bc25be159d1fc Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 4 Dec 2017 18:54:05 +0800 Subject: [PATCH 06/20] =?UTF-8?q?REPORT-5954=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E6=8A=98=E5=8F=A0=E6=8E=A7=E4=BB=B6=E6=96=87=E5=AD=97=E6=B8=B2?= =?UTF-8?q?=E6=9F=93=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/foldablepane/HeaderPane.java | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/designer_base/src/com/fr/design/foldablepane/HeaderPane.java b/designer_base/src/com/fr/design/foldablepane/HeaderPane.java index f6e182e2b3..506f64ef56 100644 --- a/designer_base/src/com/fr/design/foldablepane/HeaderPane.java +++ b/designer_base/src/com/fr/design/foldablepane/HeaderPane.java @@ -2,9 +2,6 @@ package com.fr.design.foldablepane; import com.fr.base.GraphHelper; import com.fr.design.constants.UIConstants; -import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxUtilities; -import com.fr.stable.OperatingSystem; - import javax.swing.JFrame; import javax.swing.JPanel; import java.awt.BorderLayout; @@ -14,9 +11,7 @@ import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; -import java.awt.RenderingHints; import java.awt.image.BufferedImage; -import java.util.Map; /** * Created by MoMeak on 2017/7/5. @@ -64,29 +59,20 @@ public class HeaderPane extends JPanel { @Override protected void paintComponent(Graphics g) { Graphics2D g2d = (Graphics2D) g.create(); - //mac下抗锯齿处理 - if(OperatingSystem.isMacOS()){ - g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, - RenderingHints.VALUE_ANTIALIAS_ON); - } BufferedImage panelImage = createPanelImage(); g2d.drawImage(panelImage, null, 0, 0); + GraphHelper.applyRenderingHints(g2d); GraphHelper.drawString(g2d, this.title, TITLE_X, headHeight - fontSize / 2 - 1); } private BufferedImage createPanelImage() { BufferedImage panelImage = new BufferedImage(getWidth(), headHeight, BufferedImage.TYPE_INT_ARGB); Graphics2D g2d = panelImage.createGraphics(); - g2d.setColor(isPressed ? UIConstants.POPUP_TITLE_BACKGROUND : UIConstants.COMPONENT_BACKGROUND_COLOR); headWidth = this.getWidth(); g2d.fillRect(0, 0, headWidth, headHeight); g2d.setFont(new Font("SimSun", 0, fontSize)); g2d.setPaint(bgColor); - Map desktopHints = RSyntaxUtilities.getDesktopAntiAliasHints(); - if (desktopHints != null) { - g2d.setRenderingHints(desktopHints); - } int leftWdith = headWidth - LEFT_X; if (this.isShow) { image = UIConstants.DRAG_DOWN_SELECTED_SMALL; From 261feb1394cb5fea5527f49a7c4f2f0286871422 Mon Sep 17 00:00:00 2001 From: MoMeak Date: Tue, 5 Dec 2017 11:55:28 +0800 Subject: [PATCH 07/20] =?UTF-8?q?REPORT-5955=20[Report]=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=82=AC=E6=B5=AE=E5=85=83=E7=B4=A0=E5=90=8E=EF=BC=8C=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E5=8D=A1=E6=AD=BB=20=E4=B9=8B=E5=89=8Dwu?= =?UTF-8?q?=E5=81=9A=E4=BA=86=E9=87=8A=E6=94=BE=E5=86=85=E5=AD=98=EF=BC=8C?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=82=AC=E6=B5=AE=E5=85=83=E7=B4=A0=E4=BC=9A?= =?UTF-8?q?=E6=8A=A5nep=EF=BC=9B=E5=88=A0=E9=99=A4=E6=82=AC=E6=B5=AE?= =?UTF-8?q?=E5=85=83=E7=B4=A0=E9=80=BB=E8=BE=91=E6=94=B9=E4=B8=BA=E5=85=88?= =?UTF-8?q?setSelection=20=E5=86=8D=20remove?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer/src/com/fr/grid/selection/FloatSelection.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer/src/com/fr/grid/selection/FloatSelection.java b/designer/src/com/fr/grid/selection/FloatSelection.java index 534312a0a3..60fe54b7cb 100644 --- a/designer/src/com/fr/grid/selection/FloatSelection.java +++ b/designer/src/com/fr/grid/selection/FloatSelection.java @@ -148,8 +148,8 @@ public class FloatSelection extends Selection { TemplateElementCase ec = ePane.getEditingElementCase(); FloatElement fe = ec.getFloatElement(selectedFloatName); if (fe != null) { - ec.removeFloatElement(fe); ePane.setSelection(new CellSelection(0, 0, 1, 1)); + ec.removeFloatElement(fe); return true; } From 33b935e3d8839ef117ed269c3ac28fde0774132e Mon Sep 17 00:00:00 2001 From: vito Date: Thu, 7 Dec 2017 15:19:26 +0800 Subject: [PATCH 08/20] =?UTF-8?q?REPORT-5004=20=E2=80=9C=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E2=80=9D=E7=BB=9F=E4=B8=80=E6=94=B9=E4=B8=BA=E2=80=9C=E5=86=B3?= =?UTF-8?q?=E7=AD=96=E6=8A=A5=E8=A1=A8=E2=80=9D2/3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/locale/designer.properties | 26 ++++++------- .../design/locale/designer_en_US.properties | 36 +++++++++--------- .../design/locale/designer_zh_CN.properties | 38 +++++++++---------- .../design/locale/designer_zh_TW.properties | 34 ++++++++--------- 4 files changed, 67 insertions(+), 67 deletions(-) diff --git a/designer_base/src/com/fr/design/locale/designer.properties b/designer_base/src/com/fr/design/locale/designer.properties index bbed62b646..017ae2ba55 100644 --- a/designer_base/src/com/fr/design/locale/designer.properties +++ b/designer_base/src/com/fr/design/locale/designer.properties @@ -107,10 +107,10 @@ FR-Designer_Font-Size= FR-Designer_Forbid_Drag_into_Adapt_Pane=Forbid Drag into Para Pane FR-Designer_Forbid_Drag_into_Para_Pane=Forbid Drag into Para Pane FR-Designer_Foreground= -FR-Designer_Form-AuthorityEdited_Cannot_be_Supported=Form authority editing can not be supported +FR-Designer_Form-AuthorityEdited_Cannot_be_Supported=Dashboard authority editing can not be supported FR-Designer_Form-Report= FR-Designer_Form_EmbeddedTD= -FR-Designer_Form_Module=Form Module +FR-Designer_Form_Module=Dashboard Module FR-Designer_Format_explan= FR-Designer_Formula= FR-Designer_Forum= @@ -562,7 +562,7 @@ FR-Designer_DS_TableData=Data Set FR-Designer_Parameter-Formula=Formula FR-Designer_Plugin_Should_Update_Please_Contact_Developer=Plugin version is too low, and is not compatible with current API. Please contact the developer to update. FR-Designer_WidgetOrder=Widget Order -FR-Designer_Mobile_Form_Analysis_Annotation=annotation\: You can use this attribute to control the analysis of the form in the APP. +FR-Designer_Mobile_Form_Analysis_Annotation=annotation: You can use this attribute to control the analysis of the dashboard in the APP. FR-Designer_Mobile_Report_Analysis_Annotation=annotation\: You can use this attribute to control the analysis of the report in the APP, only to support the paging preview, fill in the preview of the property is invalid. FR-Designer_Background_Null= FR-Designer_Background_Color= @@ -620,7 +620,7 @@ Tree-Width=Tree Width alert_word= PageSetup-Paper_Size=Paper Size M-Page_Setup=Page Setup -DashBoard-FormBook=Form +DashBoard-FormBook=Dashboard X-Coordinate=X Coordinate Style-Line_Spacing=Line Spacing FR-Designer_Plugin_Should_Update_Title=Warning @@ -696,7 +696,7 @@ WF-Name=Name RWA-Click_Cell_To_Edit_Value=Click Cell to Edit Value Utils-Row_Height=Row Height ReportD-Excel_Export=ReportD Excel Export -Form-Please_Select_A_Kind_Of_Form_Container=Select Form Container +Form-Please_Select_A_Kind_Of_Form_Container=Select Dashboard Container Column_Does_Not_Exsit=Column Does Not Exsit M_Insert-Hyperlink=Hyperlink can_not_include_underline=can not contain "_" @@ -831,7 +831,7 @@ Values=Values Not_use_a_cell_attribute_table_editing=You may not use a cell attribute table editing Root=Root cycle=cycle -open-new-form-tip=open new form tip +open-new-form-tip=open new dashboard tip Support-Current_Auto_Complete_Shortcut=Current Shortcut GROUPING_MODE=Grouping DBCP_MAX_IDLE=MaxIdle @@ -1088,7 +1088,7 @@ Form-View_Tree=Tree View M_Insert-Chart=Insert Chart HF-Even_Page=Even Page ReportServerP-Report_server_parameter=Report Server Parameter -JavaScript-Form_Submit=Form Submit +JavaScript-Form_Submit=Dashboard Submit Horizontal-Split_Layout=Horizontal Split Layout BorderLayout-Center=Center INFO-Reset_Webapp=Reset Webapp @@ -1439,7 +1439,7 @@ ReportColumns-Columns_after=Columns after FR-Designer_Undo= DBCP_MIN_IDLE=MinIdle M-Data_Analysis_Settings=Data Analysis Settings -M-Form_Preview=Form Preview +M-Form_Preview=Dashboard Preview Form-Basic_Properties=Basic Properties quote= Thu=Thu @@ -1594,7 +1594,7 @@ FS_Report_Type=Report Type HF-New_Line=New Line Privilege=Privilege Export-Offline-Html=Export Offline HTML -FR-Designer_open-new-form-tip=open new form tip +FR-Designer_open-new-form-tip=open new dashboard tip FR-Designer-Widget-Style_Frame_Style= Present-No_Present=No Present FR-Designer_Form-Password=Password @@ -1618,7 +1618,7 @@ Above=Above Utils-The-Chart= FRFont-plain=plain Calculating=Calculating -Form-Object=Form Object +Form-Object=Dashboard Object May=May FR-Designer_Plugin_Normal_Update=Update FR-Hyperlink_Reportlet= @@ -1753,7 +1753,7 @@ ReportServerP-Last=Last FR-Base_Columns= SpecifiedG-Leave_in_their_own_groups=Leave in their own groups LOG-Please_Wait=Please Waiting -Form-ToolBar=Form ToolBar +Form-ToolBar=Dashboard ToolBar FR-Base_sure_remove_item= Component_Scale=Component Scale Hyperlink-Use_CJK_to_encode_parameter=Use CJK to encode parameter @@ -1798,7 +1798,7 @@ Only_selected_cell_can_paste_only=Only selected cell can paste only M_Report-Report_Columns=Report Columns Unit_Hundred=Hundred FR-Designer_DataTable-Build= -Widget-Form_Widget_Config=Form Widget +Widget-Form_Widget_Config=Dashboard Widget Server-version-tip-moreInfo=Your own team of our FineReport Designer version number of the product as well as the deployment server version number is consistent, in order to avoid the problems caused by inconsistent versions of risk.If you open a template produced higher Designer version, may open the error may be missing the original template properties. If you create the template used Designer Version higher than your final deployment with the server version, the server may not be able to properly load the template you create. Actions=Actions FR-Designer-Dependence_Connect_Server_Error=connect error @@ -1951,7 +1951,7 @@ ReportServerP-Import_JavaScript=Import JavaScript Form-TableTree=Table Tree Opened=Opened M_Edit-Delete=Delete -Widget-Form_Widget_Container=Form Container +Widget-Form_Widget_Container=Dashboard Container BindColumn-Summary=Summary Sche-Second=Second Server-Open_Service_Manager=Open Service Manager 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 e5608bf896..19ecfce77e 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 @@ -103,13 +103,13 @@ FR-Designer_Fit-App=App self-adaption FR-Designer_Fit=self-adaption FR-Designer_Font-Family=Font name FR-Designer_Font-Size=Font size -FR-Designer_Forbid_Drag_into_Adapt_Pane=Form body cannot be dragged into the object +FR-Designer_Forbid_Drag_into_Adapt_Pane=Dashboard body cannot be dragged into the object FR-Designer_Forbid_Drag_into_Para_Pane=The object cannot be dragged into the parameter panel FR-Designer_Foreground=Foreground -FR-Designer_Form-AuthorityEdited_Cannot_be_Supported=Form permissions edition is not supported +FR-Designer_Form-AuthorityEdited_Cannot_be_Supported=Dashboard permissions edition is not supported FR-Designer_Form-Report=Report block -FR-Designer_Form_EmbeddedTD=Form(built-in data) -FR-Designer_Form_Module=Form Module +FR-Designer_Form_EmbeddedTD=Dashboard(built-in data) +FR-Designer_Form_Module=Dashboard Module FR-Designer_Format_explan=Format explain FR-Designer_Allow-Blank=Allow Blank FR-Designer_Formula=Formula @@ -500,7 +500,7 @@ 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_Form_Submit=Dashboard Submit FR-Designer_JavaScript_Commit_to_Database=Commit to DB FR-Designer_JavaScript_Custom=Custom FR-Designer_RWA_Submit=Submit @@ -563,7 +563,7 @@ FR-Designer_DS_TableData=Data Set FR-Designer_Parameter-Formula=Formula FR-Designer_Plugin_Should_Update_Please_Contact_Developer=Plugin version is too low, and is not compatible with current API. Please contact the developer to update. FR-Designer_WidgetOrder=Widget Order -FR-Designer_Mobile_Form_Analysis_Annotation=annotation\: You can use this attribute to control the analysis of the form in the APP. +FR-Designer_Mobile_Form_Analysis_Annotation=annotation: You can use this attribute to control the analysis of the dashboard in the APP. FR-Designer_Mobile_Report_Analysis_Annotation=annotation\: You can use this attribute to control the analysis of the report in the APP, only to support the paging preview, fill in the preview of the property is invalid. FR-Designer_Background_Null=No Background FR-Designer_Background_Color=Color @@ -622,7 +622,7 @@ Tree-Width=Tree Width alert_word=Export without fixed height, cell hight will change according to the content and pagination position will different from the preview result. PageSetup-Paper_Size=Paper Size M-Page_Setup=Page Setup -DashBoard-FormBook=Form +DashBoard-FormBook=Dashboard X-Coordinate=Horizontal axis Style-Line_Spacing=Line Spacing FR-Designer_Plugin_Should_Update_Title=Warning @@ -698,7 +698,7 @@ WF-Name=Name RWA-Click_Cell_To_Edit_Value=Click Cell to Edit Value Utils-Row_Height=Row Height ReportD-Excel_Export=Export Attributes -Form-Please_Select_A_Kind_Of_Form_Container=Select A Form Container +Form-Please_Select_A_Kind_Of_Form_Container=Select A Dashboard Container Column_Does_Not_Exsit=Column Does Not Exsit M_Insert-Hyperlink=Hyperlink can_not_include_underline=Can not contain "_" @@ -833,7 +833,7 @@ Values=Values Not_use_a_cell_attribute_table_editing=You may not use a cell attribute table editing Root=Root node cycle=Cycle -open-new-form-tip=open new form tip +open-new-form-tip=open new dashboard tip Support-Current_Auto_Complete_Shortcut=Current Shortcut key GROUPING_MODE=Ordinary Grouping DBCP_MAX_IDLE=Max Idle Connections @@ -1090,7 +1090,7 @@ Form-View_Tree=View Tree M_Insert-Chart=Insert Chart HF-Even_Page=Even Page ReportServerP-Report_server_parameter=Report Server Parameter -JavaScript-Form_Submit=Form Submit +JavaScript-Form_Submit=Dashboard Submit Horizontal-Split_Layout=Horizontal partitioning layout BorderLayout-Center=Center INFO-Reset_Webapp=Reset Application Server @@ -1440,7 +1440,7 @@ ReportColumns-Columns_after=Over FR-Designer_Undo=Undo DBCP_MIN_IDLE=Min Idle Connections M-Data_Analysis_Settings=Data Analysis Settings -M-Form_Preview=Form Preview +M-Form_Preview=Dashboard Preview Form-Basic_Properties=Basic Property quote=quote Thu=Thu @@ -1518,7 +1518,7 @@ FR-Template-Path_chooseRightPath=Please choose a right path FR-Remote_Re_Connect_to_Server=The server is down, whether to reconnect it Nation=Country DBCP_MAX_WAIT=Max wait time -FR-App-Template_Form=Form +FR-App-Template_Form=Dashboard Address=Address Sub_Report=Sub Report FR-Import-Export_Word=Word @@ -1561,7 +1561,7 @@ Sub_Report_Description=The sub-report should exist in the runtime environment of T_Insert-Float=Insert Float Element BackgroundTexture-FishFossil=Fish Fossil My_Computer=My Computer -FORMLET=Path parameter when accessing different forms +FORMLET=Path parameter when accessing different dashboards HF-Undefined=Undefined Widget-User_Defined_Widget_Config=Predefined control Report-Write_Attributes_Group_Warning=Number of cells in each field in all cell group must be the same @@ -1595,7 +1595,7 @@ FS_Report_Type=Report Type HF-New_Line=Line breaks Privilege=Permission Export-Offline-Html=Output offline HTML report -FR-Designer_open-new-form-tip=The form is created by the designer older than 711 vision, it cannot be opened. Please use the corresponding designer. +FR-Designer_open-new-form-tip=The dashboard is created by the designer older than 711 vision, it cannot be opened. Please use the corresponding designer. FR-Designer-Widget-Style_Frame_Style=Frame Style Present-No_Present=Cancel Present Settings FR-Designer_Form-Password=Password @@ -1619,7 +1619,7 @@ Above=Above Version Utils-The-Chart=Chart FRFont-plain=General Calculating=Calculating -Form-Object=Form Object\: +Form-Object=Dashboard Object: May=May FR-Designer_Plugin_Normal_Update=Update FR-Hyperlink_Reportlet=Webreport @@ -1754,7 +1754,7 @@ ReportServerP-Last=Last FR-Base_Columns=Columns SpecifiedG-Leave_in_their_own_groups=Leave in their own groups LOG-Please_Wait=Please Waiting -Form-ToolBar=Form ToolBar +Form-ToolBar=Dashboard ToolBar FR-Base_sure_remove_item=Are you sure to delete the selected item Component_Scale=Component Scale Hyperlink-Use_CJK_to_encode_parameter=Use CJK to process parameter @@ -1799,7 +1799,7 @@ Only_selected_cell_can_paste_only=Paste when cell is selected M_Report-Report_Columns=Multi-columns/lines Unit_Hundred=Hundred FR-Designer_DataTable-Build=Speed layered construction -Widget-Form_Widget_Config=Form control +Widget-Form_Widget_Config=Dashboard control Server-version-tip-moreInfo=Conform the version numbers of FineReport Designer and the deployment server are consistent, in order to avoid the problems caused by inconsistent versions. If you open the template produced by higher designer vision, error may occurs or the original template properties missed. If the Designer Version you used to create the template is higher than the final deployment server version, the server may not be able to properly load the template. Actions=Task FR-Designer-Dependence_Connect_Server_Error=connect error @@ -1952,7 +1952,7 @@ ReportServerP-Import_JavaScript=Reference JavaScript Form-TableTree=Table Tree Opened=Opened M_Edit-Delete=Delete -Widget-Form_Widget_Container=Form Container +Widget-Form_Widget_Container=Dashboard Container BindColumn-Summary=Summary Sche-Second=Second Server-Open_Service_Manager=Open Service Manager 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 f7b8d3a3cd..ee55805e6f 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 @@ -104,13 +104,13 @@ FR-Designer_Fit-App=App\u81EA\u9002\u5E94 FR-Designer_Fit=\u81EA\u9002\u5E94 FR-Designer_Font-Family=\u5B57\u4F53\u540D\u79F0 FR-Designer_Font-Size=\u5B57\u4F53\u5927\u5C0F -FR-Designer_Forbid_Drag_into_Adapt_Pane=\u8BE5\u5BF9\u8C61\u4E0D\u5141\u8BB8\u62D6\u5165\u8868\u5355\u4E3B\u4F53 +FR-Designer_Forbid_Drag_into_Adapt_Pane=\u8BE5\u5BF9\u8C61\u4E0D\u5141\u8BB8\u62D6\u5165\u51B3\u7B56\u62A5\u8868\u4E3B\u4F53 FR-Designer_Forbid_Drag_into_Para_Pane=\u8BE5\u5BF9\u8C61\u4E0D\u80FD\u62D6\u5165\u53C2\u6570\u9762\u677F FR-Designer_Foreground=\u989C\u8272 -FR-Designer_Form-AuthorityEdited_Cannot_be_Supported=\u6682\u4E0D\u652F\u6301\u8868\u5355\u6743\u9650\u7F16\u8F91 +FR-Designer_Form-AuthorityEdited_Cannot_be_Supported=\u6682\u4E0D\u652F\u6301\u51B3\u7B56\u62A5\u8868\u6743\u9650\u7F16\u8F91 FR-Designer_Form-Report=\u62A5\u8868\u5757 -FR-Designer_Form_EmbeddedTD=\u8868\u5355(\u5185\u7F6E\u6570\u636E) -FR-Designer_Form_Module=\u8868\u5355\u6A21\u5757 +FR-Designer_Form_EmbeddedTD=\u51B3\u7B56\u62A5\u8868(\u5185\u7F6E\u6570\u636E) +FR-Designer_Form_Module=\u51B3\u7B56\u62A5\u8868\u6A21\u5757 FR-Designer_Format_explan=\u683C\u5F0F\u8BF4\u660E FR-Designer_Formula=\u516C\u5F0F FR-Designer_Forum=\u8BBA\u575B @@ -119,7 +119,7 @@ FR-Designer_Help=\u5E2E\u52A9 FR-Designer_Hide=\u9690\u85CF FR-Designer_Show=\u663E\u793A FR-Designer_Hyperlink=\u8D85\u7EA7\u94FE\u63A5 -FR-Designer_Hyperlink-Form_link=\u5F53\u524D\u8868\u5355\u5BF9\u8C61 +FR-Designer_Hyperlink-Form_link=\u5F53\u524D\u51B3\u7B56\u62A5\u8868\u5BF9\u8C61 FR-Designer_IDCard=\u8EAB\u4EFD\u8BC1 FR-Designer_Icon=\u56FE\u6807 FR-Designer_Index=\u5217\u8F74/\u6307\u6807 @@ -507,7 +507,7 @@ 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_Form_Submit=\u51B3\u7B56\u62A5\u8868\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 @@ -574,7 +574,7 @@ FR-Designer_DS_TableData=\u6570\u636E\u96C6 FR-Designer_Parameter-Formula=\u516C\u5F0F FR-Designer_Plugin_Should_Update_Please_Contact_Developer=\u63D2\u4EF6\u7248\u672C\u8FC7\u4F4E, \u5B58\u5728API\u4E0D\u517C\u5BB9, \u8BF7\u8054\u7CFB\u5F00\u53D1\u8005\u5347\u7EA7\u63D2\u4EF6 FR-Designer_WidgetOrder=\u63A7\u4EF6\u987A\u5E8F -FR-Designer_Mobile_Form_Analysis_Annotation=\u6CE8\u91CA\uFF1A\u53EF\u4EE5\u901A\u8FC7\u8BE5\u5C5E\u6027\u63A7\u5236\u8868\u5355\u5728APP\u4E2D\u7684\u89E3\u6790\u65B9\u5F0F\u3002 +FR-Designer_Mobile_Form_Analysis_Annotation=\u6CE8\u91CA\uFF1A\u53EF\u4EE5\u901A\u8FC7\u8BE5\u5C5E\u6027\u63A7\u5236\u51B3\u7B56\u62A5\u8868\u5728APP\u4E2D\u7684\u89E3\u6790\u65B9\u5F0F\u3002 FR-Designer_Mobile_Report_Analysis_Annotation=\u6CE8\u91CA: \u53EF\u4EE5\u901A\u8FC7\u8BE5\u5C5E\u6027\u63A7\u5236\u62A5\u8868\u5728APP\u4E2D\u7684\u89E3\u6790\u65B9\u5F0F\uFF0C\u53EA\u652F\u6301\u5206\u9875\u9884\u89C8\uFF0C\u586B\u62A5\u9884\u89C8\u65F6\u5C5E\u6027\u65E0\u6548\u3002 FR-Designer_Background_Null=\u6CA1\u6709\u80CC\u666F FR-Designer_Background_Color=\u989C\u8272 @@ -624,7 +624,7 @@ Tree-Width=\u5BBD\u5EA6 alert_word=\u9009\u62E9\u4E0D\u56FA\u5B9A\u884C\u9AD8\u5BFC\u51FA\u65F6, \u7F16\u8F91\u5BFC\u51FA\u7684word, \u5355\u5143\u683C\u884C\u9AD8\u4F1A\u968F\u7740\u5185\u5BB9\u81EA\u52A8\u62C9\u4F38, \u6B64\u60C5\u51B5\u4E0B\u5BFC\u51FA\u7ED3\u679C\u5206\u9875\u4F4D\u7F6E\u4E0E\u9884\u89C8\u7ED3\u679C\u53EF\u80FD\u4F1A\u4E0D\u518D\u4E00\u81F4. PageSetup-Paper_Size=\u7EB8\u5F20\u5927\u5C0F M-Page_Setup=\u9875\u9762\u8BBE\u7F6E -DashBoard-FormBook=\u8868\u5355 +DashBoard-FormBook=\u51B3\u7B56\u62A5\u8868 X-Coordinate=\u6A2A\u5750\u6807 Style-Line_Spacing=\u884C\u95F4\u8DDD FR-Designer_Plugin_Should_Update_Title=\u63D2\u4EF6\u5347\u7EA7\u63D0\u9192 @@ -700,7 +700,7 @@ WF-Name=\u540D\u79F0 RWA-Click_Cell_To_Edit_Value=\u5355\u51FB\u6A21\u677F\u5355\u5143\u683C\u4FEE\u6539\u503C Utils-Row_Height=\u884C\u9AD8 ReportD-Excel_Export=\u6A21\u677F\u5BFC\u51FA\u5C5E\u6027 -Form-Please_Select_A_Kind_Of_Form_Container=\u8BF7\u9009\u62E9\u4E00\u79CD\u8868\u5355\u5BB9\u5668 +Form-Please_Select_A_Kind_Of_Form_Container=\u8BF7\u9009\u62E9\u4E00\u79CD\u51B3\u7B56\u62A5\u8868\u5BB9\u5668 Column_Does_Not_Exsit=\u5217\u4E0D\u5B58\u5728 M_Insert-Hyperlink=\u8D85\u7EA7\u94FE\u63A5 can_not_include_underline=\u4E0D\u80FD\u5305\u542B"_" @@ -835,7 +835,7 @@ Values=\u503C Not_use_a_cell_attribute_table_editing=\u60A8\u4E0D\u53EF\u4EE5\u7528\u5355\u5143\u683C\u5C5E\u6027\u8868\u7F16\u8F91 Root=\u6839\u8282\u70B9 cycle=\u5468\u671F -open-new-form-tip=\u5F53\u524D\u6A21\u677F\u4E3A711\u4EE5\u4E0B\u7248\u672C\u5236\u4F5C\uFF0C\u65E0\u6CD5\u517C\u5BB9\uFF0C\u4E0D\u80FD\u6253\u5F00\u3002\u5047\u5982\u60F3\u6253\u5F00\u4FEE\u6539\u6B64\u8868\u5355\uFF0C\u8BF7\u4F7F\u7528\u5BF9\u5E94\u7248\u672C\u8BBE\u8BA1\u5668\u6253\u5F00\u3002 +open-new-form-tip=\u5F53\u524D\u6A21\u677F\u4E3A711\u4EE5\u4E0B\u7248\u672C\u5236\u4F5C\uFF0C\u65E0\u6CD5\u517C\u5BB9\uFF0C\u4E0D\u80FD\u6253\u5F00\u3002\u5047\u5982\u60F3\u6253\u5F00\u4FEE\u6539\u6B64\u51B3\u7B56\u62A5\u8868\uFF0C\u8BF7\u4F7F\u7528\u5BF9\u5E94\u7248\u672C\u8BBE\u8BA1\u5668\u6253\u5F00\u3002 Support-Current_Auto_Complete_Shortcut=\u5F53\u524D\u5FEB\u6377\u952E GROUPING_MODE=\u666E\u901A\u5206\u7EC4 DBCP_MAX_IDLE=\u6700\u5927\u7A7A\u95F2\u8FDE\u63A5\u6570 @@ -1092,7 +1092,7 @@ Form-View_Tree=\u89C6\u56FE\u6811 M_Insert-Chart=\u63D2\u5165\u56FE\u8868 HF-Even_Page=\u5076\u6570\u9875 ReportServerP-Report_server_parameter=\u62A5\u8868\u670D\u52A1\u5668\u53C2\u6570 -JavaScript-Form_Submit=\u8868\u5355\u63D0\u4EA4 +JavaScript-Form_Submit=\u51B3\u7B56\u62A5\u8868\u63D0\u4EA4 Horizontal-Split_Layout=\u6C34\u5E73\u5206\u5272\u5E03\u5C40 BorderLayout-Center=\u4E2D INFO-Reset_Webapp=\u91CD\u7F6E\u5E94\u7528\u670D\u52A1\u5668 @@ -1442,7 +1442,7 @@ ReportColumns-Columns_after=\u8D85\u8FC7 FR-Designer_Undo=\u64A4\u9500 DBCP_MIN_IDLE=\u6700\u5C0F\u7A7A\u95F2\u8FDE\u63A5\u6570 M-Data_Analysis_Settings=\u6570\u636E\u5206\u6790\u8BBE\u7F6E -M-Form_Preview=\u8868\u5355\u9884\u89C8 +M-Form_Preview=\u51B3\u7B56\u62A5\u8868\u9884\u89C8 Form-Basic_Properties=\u57FA\u672C\u5C5E\u6027 quote=\u5F15\u7528 Thu=\u56DB @@ -1519,7 +1519,7 @@ FR-Template-Path_chooseRightPath=\u8BF7\u9009\u62E9\u6B63\u786E\u8DEF\u5F84 FR-Remote_Re_Connect_to_Server=\u670D\u52A1\u5668\u5DF2\u5173\u95ED\uFF0C\u662F\u5426\u91CD\u65B0\u8FDE\u63A5\u670D\u52A1\u5668? Nation=\u56FD\u5BB6 DBCP_MAX_WAIT=\u6700\u5927\u7B49\u5F85\u65F6\u95F4 -FR-App-Template_Form=\u8868\u5355 +FR-App-Template_Form=\u51B3\u7B56\u62A5\u8868 Address=\u5730\u5740 Sub_Report=\u5B50\u62A5\u8868 FR-Import-Export_Word=Word\u683C\u5F0F @@ -1562,7 +1562,7 @@ Sub_Report_Description=\u5B50\u62A5\u8868\u9700\u8981\u5B58\u5728\u4E8E\u7236\u8 T_Insert-Float=\u63D2\u5165\u60AC\u6D6E\u5143\u7D20 BackgroundTexture-FishFossil=\u9C7C\u7C7B\u5316\u77F3 My_Computer=\u6211\u7684\u7535\u8111 -FORMLET=\u8BBF\u95EE\u4E0D\u540C\u8868\u5355\u7684\u8DEF\u5F84\u7684\u53C2\u6570 +FORMLET=\u8BBF\u95EE\u4E0D\u540C\u51B3\u7B56\u62A5\u8868\u7684\u8DEF\u5F84\u7684\u53C2\u6570 HF-Undefined=\u6CA1\u6709\u5B9A\u4E49 Widget-User_Defined_Widget_Config=\u9884\u5B9A\u4E49\u63A7\u4EF6 Report-Write_Attributes_Group_Warning=\u8BBE\u7F6E\u4E3A\u5355\u5143\u683C\u7EC4\u7684\u5404\u5B57\u6BB5\u4E2D\u7684\u5355\u5143\u683C\u4E2A\u6570\u5FC5\u987B\u76F8\u540C @@ -1596,7 +1596,7 @@ FS_Report_Type=\u7C7B\u578B HF-New_Line=\u6362\u884C\u7B26 Privilege=\u6743\u9650 Export-Offline-Html=\u8F93\u51FA\u79BB\u7EBFhtml\u62A5\u8868 -FR-Designer_open-new-form-tip=\u5F53\u524D\u6A21\u677F\u4E3A711\u4EE5\u4E0B\u7248\u672C\u5236\u4F5C\uFF0C\u65E0\u6CD5\u517C\u5BB9\uFF0C\u4E0D\u80FD\u6253\u5F00\u3002\u5047\u5982\u60F3\u6253\u5F00\u4FEE\u6539\u6B64\u8868\u5355\uFF0C\u8BF7\u4F7F\u7528\u5BF9\u5E94\u7248\u672C\u8BBE\u8BA1\u5668\u6253\u5F00\u3002 +FR-Designer_open-new-form-tip=\u5F53\u524D\u6A21\u677F\u4E3A711\u4EE5\u4E0B\u7248\u672C\u5236\u4F5C\uFF0C\u65E0\u6CD5\u517C\u5BB9\uFF0C\u4E0D\u80FD\u6253\u5F00\u3002\u5047\u5982\u60F3\u6253\u5F00\u4FEE\u6539\u6B64\u51B3\u7B56\u62A5\u8868\uFF0C\u8BF7\u4F7F\u7528\u5BF9\u5E94\u7248\u672C\u8BBE\u8BA1\u5668\u6253\u5F00\u3002 FR-Designer-Widget-Style_Frame_Style=\u6846\u67B6\u6837\u5F0F Present-No_Present=\u53D6\u6D88\u5F62\u6001\u8BBE\u7F6E FR-Designer_Form-Password=\u5BC6\u7801 @@ -1620,7 +1620,7 @@ Above=\u4EE5\u4E0A\u7248\u672C Utils-The-Chart=\u56FE\u8868 FRFont-plain=\u5E38\u89C4 Calculating=\u5904\u7406\u4E2D -Form-Object=\u8868\u5355\u5BF9\u8C61\: +Form-Object=\u51B3\u7B56\u62A5\u8868\u5BF9\u8C61\: May=\u4E94\u6708 FR-Designer_Plugin_Normal_Update=\u66F4\u65B0 FR-Hyperlink_Reportlet=\u7F51\u7EDC\u62A5\u8868 @@ -1755,7 +1755,7 @@ ReportServerP-Last=\u672B\u9875 FR-Base_Columns=\u5217 SpecifiedG-Leave_in_their_own_groups=\u7559\u5728\u5404\u81EA\u7684\u7EC4\u5185 LOG-Please_Wait=\u8BF7\u7A0D\u5019 -Form-ToolBar=\u8868\u5355\u5DE5\u5177\u680F +Form-ToolBar=\u51B3\u7B56\u62A5\u8868\u5DE5\u5177\u680F FR-Base_sure_remove_item=\u4F60\u786E\u5B9E\u51B3\u5B9A\u5220\u9664\u9009\u4E2D\u7684\u9879 Component_Scale=\u7EC4\u4EF6\u7F29\u653E Hyperlink-Use_CJK_to_encode_parameter=\u4F7F\u7528CJK\u5904\u7406\u53C2\u6570 @@ -1800,7 +1800,7 @@ Only_selected_cell_can_paste_only=\u53EA\u6709\u9009\u4E2D\u5355\u5143\u683C\u65 M_Report-Report_Columns=\u62A5\u8868\u5206\u680F Unit_Hundred=\u767E FR-Designer_DataTable-Build=\u6781\u901F\u5206\u5C42\u6784\u5EFA -Widget-Form_Widget_Config=\u8868\u5355\u63A7\u4EF6 +Widget-Form_Widget_Config=\u51B3\u7B56\u62A5\u8868\u63A7\u4EF6 Server-version-tip-moreInfo=\u5EFA\u8BAE\u60A8\u6240\u5C5E\u56E2\u961F\u4F7F\u7528\u7684\u6211\u65B9FineReport\u4EA7\u54C1\u7684\u8BBE\u8BA1\u5668\u7248\u672C\u53F7\u4EE5\u53CA\u90E8\u7F72\u7684\u670D\u52A1\u5668\u7248\u672C\u53F7\u4FDD\u6301\u4E00\u81F4\uFF0C\u4EE5\u907F\u514D\u7248\u672C\u4E0D\u4E00\u81F4\u9020\u6210\u7684\u95EE\u9898\u98CE\u9669\u3002\n\u5047\u5982\u60A8\u6253\u5F00\u66F4\u9AD8\u8BBE\u8BA1\u5668\u7248\u672C\u5236\u4F5C\u7684\u6A21\u677F\uFF0C\u53EF\u80FD\u6253\u5F00\u51FA\u9519\uFF0C\u4E5F\u53EF\u80FD\u4E22\u5931\u539F\u6709\u6A21\u677F\u5C5E\u6027\u3002\u5047\u5982\u60A8\u5236\u4F5C\u7684\u6A21\u677F\u4F7F\u7528\u7684\u8BBE\u8BA1\u5668\u7248\u672C\u9AD8\u4E8E\u60A8\u6700\u7EC8\u90E8\u7F72\u6240\u7528\u7684\u670D\u52A1\u5668\u7248\u672C\uFF0C\u670D\u52A1\u5668\u53EF\u80FD\u65E0\u6CD5\u6B63\u5E38\u8F7D\u5165\u60A8\u5236\u4F5C\u7684\u6A21\u677F\u3002 Actions=\u4EFB\u52A1 FR-Designer-Dependence_Connect_Server_Error=\u65E0\u6CD5\u8FDE\u63A5\u670D\u52A1\u5668\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5 @@ -1953,7 +1953,7 @@ ReportServerP-Import_JavaScript=\u5F15\u7528JavaScript Form-TableTree=\u8868\u683C\u6811 Opened=\u5DF2\u5F00\u542F M_Edit-Delete=\u5220\u9664(D) -Widget-Form_Widget_Container=\u8868\u5355\u5BB9\u5668 +Widget-Form_Widget_Container=\u51B3\u7B56\u62A5\u8868\u5BB9\u5668 BindColumn-Summary=\u6C47\u603B Sche-Second=\u79D2 Server-Open_Service_Manager=\u6253\u5F00\u670D\u52A1\u7BA1\u7406\u5668 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 42817879ea..340ba8a946 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 @@ -103,10 +103,10 @@ FR-Designer_Fit-App=App\u81EA\u9069\u61C9 FR-Designer_Fit=\u81EA\u9069\u61C9 FR-Designer_Font-Family=\u5B57\u9AD4\u540D\u7A31 FR-Designer_Font-Size=\u5B57\u9AD4\u5927\u5C0F -FR-Designer_Forbid_Drag_into_Adapt_Pane=\u8A72\u5C0D\u8C61\u4E0D\u5141\u8A31\u62D6\u5165\u8868\u55AE\u4E3B\u9AD4 +FR-Designer_Forbid_Drag_into_Adapt_Pane=\u8A72\u5C0D\u8C61\u4E0D\u5141\u8A31\u62D6\u5165\u6C7A\u7B56\u5831\u8868\u4E3B\u9AD4 FR-Designer_Forbid_Drag_into_Para_Pane=\u8A72\u5C0D\u8C61\u4E0D\u80FD\u62D6\u5165\u53C3\u6578\u9762\u677F FR-Designer_Foreground=\u984F\u8272 -FR-Designer_Form-AuthorityEdited_Cannot_be_Supported=\u66AB\u4E0D\u652F\u6301\u8868\u55AE\u6B0A\u9650\u7DE8\u8F2F +FR-Designer_Form-AuthorityEdited_Cannot_be_Supported=\u66AB\u4E0D\u652F\u6301\u6C7A\u7B56\u5831\u8868\u6B0A\u9650\u7DE8\u8F2F FR-Designer_Form-Report=\u5831\u8868\u683C\u5F0F FR-Designer_Form_EmbeddedTD=\u5167\u5D01\u683C\u5F0F FR-Designer_Form_Module=\u6A21\u7D44\u683C\u5F0F @@ -117,7 +117,7 @@ FR-Designer_Get-Cube=\u6B63\u5728\u7372\u53D6cube FR-Designer_Help=\u8AAA\u660E FR-Designer_Hide=\u96B1\u85CF FR-Designer_Hyperlink=\u8D85\u7D1A\u93C8\u63A5 -FR-Designer_Hyperlink-Form_link=\u7576\u524D\u8868\u55AE\u5C0D\u8C61 +FR-Designer_Hyperlink-Form_link=\u7576\u524D\u6C7A\u7B56\u5831\u8868\u5C0D\u8C61 FR-Designer_IDCard=\u8EAB\u4EFD\u8B49 FR-Designer_Icon=\u5716\u793A FR-Designer_Index=\u7D22\u5F15 @@ -493,7 +493,7 @@ FR-Designer_Properties_Mobile=\u624B\u6A5F\u5C6C\u6027 FR-Designer_Button_OK=\u78BA\u5B9A FR-Designer_Button_Cancel=\u53D6\u6D88 FR-Designer_JavaScript=JavaScript\u8173\u672C -FR-Designer_JavaScript_Form_Submit=\u8868\u55AE\u63D0\u4EA4 +FR-Designer_JavaScript_Form_Submit=\u6C7A\u7B56\u5831\u8868\u63D0\u4EA4 FR-Designer_JavaScript_Commit_to_Database=\u63D0\u4EA4\u5165\u5EAB FR-Designer_JavaScript_Custom=\u81EA\u5B9A\u7FA9 FR-Designer_RWA_Submit=\u63D0\u4EA4 @@ -560,7 +560,7 @@ FR-Designer_DS_TableData=\u8CC7\u6599\u96C6 FR-Designer_Parameter-Formula=\u516C\u5F0F FR-Designer_Plugin_Should_Update_Please_Contact_Developer=\u633F\u4EF6\u7248\u672C\u904E\u4F4E\uFF0C\u5B58\u5728API\u4E0D\u76F8\u5BB9\uFF0C\u8ACB\u806F\u7CFB\u958B\u767C\u8005\u965E\u7D1A\u633F\u4EF6 FR-Designer_WidgetOrder=\u63A7\u4EF6\u9806\u5E8F -FR-Designer_Mobile_Form_Analysis_Annotation=\u6CE8\u91CB\uFF1A\u53EF\u4EE5\u901A\u904E\u8A72\u5C6C\u6027\u63A7\u5236\u8868\u55AE\u5728APP\u4E2D\u7684\u89E3\u6790\u65B9\u5F0F\u3002 +FR-Designer_Mobile_Form_Analysis_Annotation=\u6CE8\u91CB\uFF1A\u53EF\u4EE5\u901A\u904E\u8A72\u5C6C\u6027\u63A7\u5236\u6C7A\u7B56\u5831\u8868\u5728APP\u4E2D\u7684\u89E3\u6790\u65B9\u5F0F\u3002 FR-Designer_Mobile_Report_Analysis_Annotation=\u6CE8\u91CB\uFF1A\u53EF\u4EE5\u901A\u904E\u8A72\u5C6C\u6027\u63A7\u5236\u5831\u8868\u5728APP\u4E2D\u7684\u89E3\u6790\u65B9\u5F0F\uFF0C\u53EA\u652F\u6301\u5206\u9801\u9810\u89BD\uFF0C\u586B\u5831\u9810\u89BD\u6642\u5C6C\u6027\u7121\u6548\u3002 FR-Designer_Background_Null=\u6C92\u6709\u80CC\u666F FR-Designer_Background_Color=\u984F\u8272 @@ -622,7 +622,7 @@ Tree-Width=\u5BEC\u5EA6 alert_word=\u9078\u64C7\u4E0D\u56FA\u5B9A\u5217\u9AD8\u532F\u51FA\u6642, \u7DE8\u8F2F\u532F\u51FA\u7684word, \u5132\u5B58\u683C\u5217\u9AD8\u6703\u96A8\u8457\u5167\u5BB9\u81EA\u52D5\u62C9\u4F38, \u6B64\u60C5\u6CC1\u4E0B\u532F\u51FA\u7D50\u679C\u8207\u9810\u89BD\u7D50\u679C\u53EF\u80FD\u6703\u4E0D\u518D\u4E00\u81F4. PageSetup-Paper_Size=\u7D19\u5F35\u5927\u5C0F M-Page_Setup=\u9801\u9762\u8A2D\u5B9A -DashBoard-FormBook=\u8868\u55AE +DashBoard-FormBook=\u6C7A\u7B56\u5831\u8868 X-Coordinate=\u6A6B\u5EA7\u6A19 Style-Line_Spacing=\u5217\u9593\u8DDD FR-Designer_Plugin_Should_Update_Title=Warning @@ -698,7 +698,7 @@ WF-Name=\u540D\u7A31 RWA-Click_Cell_To_Edit_Value=\u55AE\u64CA\u6A21\u677F\u5132\u5B58\u683C\u4FEE\u6539\u503C Utils-Row_Height=\u5217\u9AD8 ReportD-Excel_Export=\u5831\u8868\u532F\u51FA\u5C6C\u6027 -Form-Please_Select_A_Kind_Of_Form_Container=\u8ACB\u9078\u64C7\u4E00\u7A2E\u8868\u55AE\u5BB9\u5668 +Form-Please_Select_A_Kind_Of_Form_Container=\u8ACB\u9078\u64C7\u4E00\u7A2E\u6C7A\u7B56\u5831\u8868\u5BB9\u5668 Column_Does_Not_Exsit=\u6B04\u4E0D\u5B58\u5728 M_Insert-Hyperlink=\u8D85\u7D1A\u93C8\u63A5 can_not_include_underline=\u4E0D\u80FD\u5305\u542B"_" @@ -833,7 +833,7 @@ Values=\u503C Not_use_a_cell_attribute_table_editing=\u60A8\u4E0D\u53EF\u4EE5\u7528\u5132\u5B58\u683C\u5C6C\u6027\u8868\u7DE8\u8F2F Root=\u6839\u7BC0\u9EDE cycle=\u5468\u671F -open-new-form-tip=\u7576\u524D\u6A21\u677F\u70BA711\u4EE5\u4E0B\u7248\u672C\u88FD\u4F5C, \u7121\u6CD5\u517C\u5BB9, \u4E0D\u80FD\u6253\u958B. \u5047\u5982\u60F3\u6253\u958B\u4FEE\u6539\u6B64\u8868\u55AE, \u8ACB\u4F7F\u7528\u5C0D\u61C9\u7248\u672C\u8A2D\u8A08\u5668\u6253\u958B. +open-new-form-tip=\u7576\u524D\u6A21\u677F\u70BA711\u4EE5\u4E0B\u7248\u672C\u88FD\u4F5C, \u7121\u6CD5\u517C\u5BB9, \u4E0D\u80FD\u6253\u958B. \u5047\u5982\u60F3\u6253\u958B\u4FEE\u6539\u6B64\u6C7A\u7B56\u5831\u8868, \u8ACB\u4F7F\u7528\u5C0D\u61C9\u7248\u672C\u8A2D\u8A08\u5668\u6253\u958B. Support-Current_Auto_Complete_Shortcut=Current Shortcut GROUPING_MODE=\u666E\u901A\u5206\u7D44 DBCP_MAX_IDLE=\u6700\u5927\u7A7A\u9591\u9023\u63A5\u6578 @@ -1090,7 +1090,7 @@ Form-View_Tree=\u6AA2\u8996\u8868\u6A39 M_Insert-Chart=\u63D2\u5165\u5716\u8868 HF-Even_Page=\u5076\u6578\u9801 ReportServerP-Report_server_parameter=\u5831\u8868\u4F3A\u670D\u5668\u53C3\u6578 -JavaScript-Form_Submit=\u8868\u55AE\u63D0\u4EA4 +JavaScript-Form_Submit=\u6C7A\u7B56\u5831\u8868\u63D0\u4EA4 Horizontal-Split_Layout=\u6C34\u5E73\u5206\u5272\u5E03\u5C40 BorderLayout-Center=\u4E2D INFO-Reset_Webapp=\u91CD\u7F6E\u61C9\u7528\u4F3A\u670D\u5668 @@ -1439,7 +1439,7 @@ ReportColumns-Columns_after=\u8D85\u904E FR-Designer_Undo=\u5FA9\u539F DBCP_MIN_IDLE=\u6700\u5C0F\u7A7A\u9591\u9023\u63A5\u6578 M-Data_Analysis_Settings=\u8CC7\u6599\u5206\u6790\u8A2D\u5B9A -M-Form_Preview=\u8868\u55AE\u9810\u89BD +M-Form_Preview=\u6C7A\u7B56\u5831\u8868\u9810\u89BD Form-Basic_Properties=\u57FA\u672C\u5C6C\u6027 quote=\u5F15\u7528 Thu=\u56DB @@ -1517,7 +1517,7 @@ FR-Template-Path_chooseRightPath=\u8ACB\u9078\u64C7\u6B63\u78BA\u8DEF\u5F91 FR-Remote_Re_Connect_to_Server=\u4F3A\u670D\u5668\u5DF2\u95DC\u9589\uFF0C\u662F\u5426\u91CD\u65B0\u9023\u63A5\u4F3A\u670D\u5668? Nation=\u570B\u5BB6 DBCP_MAX_WAIT=\u6700\u5927\u7B49\u5F85\u6642\u9593 -FR-App-Template_Form=\u8868\u55AE +FR-App-Template_Form=\u6C7A\u7B56\u5831\u8868 Address=\u5730\u5740 Sub_Report=\u5B50\u5831\u8868 FR-Import-Export_Word=Word\u683C\u5F0F @@ -1560,7 +1560,7 @@ Sub_Report_Description=\u5B50\u5831\u8868\u9700\u8981\u5B58\u5728\u65BC\u7236\u8 T_Insert-Float=\u63D2\u5165\u61F8\u6D6E\u5143\u7D20 BackgroundTexture-FishFossil=\u9B5A\u985E\u5316\u77F3 My_Computer=\u6211\u7684\u96FB\u8166 -FORMLET=\u8A2A\u554F\u4E0D\u540C\u8868\u55AE\u7684\u8DEF\u5F91\u7684\u53C3\u6578 +FORMLET=\u8A2A\u554F\u4E0D\u540C\u6C7A\u7B56\u5831\u8868\u7684\u8DEF\u5F91\u7684\u53C3\u6578 HF-Undefined=\u6C92\u6709\u5B9A\u7FA9 Widget-User_Defined_Widget_Config=\u9810\u5B9A\u7FA9\u63A7\u5236\u9805 Report-Write_Attributes_Group_Warning=\u8A2D\u5B9A\u7232\u5132\u5B58\u683C\u7D44\u7684\u5404\u6B04\u4F4D\u4E2D\u7684\u5132\u5B58\u683C\u500B\u6578\u5FC5\u9808\u76F8\u540C @@ -1594,7 +1594,7 @@ FS_Report_Type=\u985E\u578B HF-New_Line=\u63DB\u5217\u7B26 Privilege=\u6B0A\u9650 Export-Offline-Html=\u8F38\u51FA\u96E2\u7DDAhtml\u5831\u8868 -FR-Designer_open-new-form-tip=\u7576\u524D\u6A21\u677F\u70BA711\u4EE5\u4E0B\u7248\u672C\u88FD\u4F5C, \u7121\u6CD5\u517C\u5BB9, \u4E0D\u80FD\u6253\u958B. \u5047\u5982\u60F3\u6253\u958B\u4FEE\u6539\u6B64\u8868\u55AE, \u8ACB\u4F7F\u7528\u5C0D\u61C9\u7248\u672C\u8A2D\u8A08\u5668\u6253\u958B. +FR-Designer_open-new-form-tip=\u7576\u524D\u6A21\u677F\u70BA711\u4EE5\u4E0B\u7248\u672C\u88FD\u4F5C, \u7121\u6CD5\u517C\u5BB9, \u4E0D\u80FD\u6253\u958B. \u5047\u5982\u60F3\u6253\u958B\u4FEE\u6539\u6B64\u6C7A\u7B56\u5831\u8868, \u8ACB\u4F7F\u7528\u5C0D\u61C9\u7248\u672C\u8A2D\u8A08\u5668\u6253\u958B. FR-Designer-Widget-Style_Frame_Style=\u6846\u67B6\u6A23\u5F0F Present-No_Present=\u53D6\u6D88\u6A21\u5F0F\u8A2D\u5B9A FR-Designer_Form-Password=\u5BC6\u78BC @@ -1618,7 +1618,7 @@ Above=\u4EE5\u4E0A\u7248\u672C Utils-The-Chart=\u5716\u8868 FRFont-plain=\u5E38\u898F Calculating=\u8655\u7406\u4E2D -Form-Object=\u8868\u55AE\u5C0D\u8C61 +Form-Object=\u6C7A\u7B56\u5831\u8868\u5C0D\u8C61 May=\u4E94\u6708 FR-Designer_Plugin_Normal_Update=Update FR-Hyperlink_Reportlet=\u7DB2\u8DEF\u5831\u8868 @@ -1753,7 +1753,7 @@ ReportServerP-Last=\u672B\u9801 FR-Base_Columns=\u6B04 SpecifiedG-Leave_in_their_own_groups=\u7559\u5728\u5404\u81EA\u7684\u7D44\u5167 LOG-Please_Wait=\u8ACB\u7A0D\u5019 -Form-ToolBar=\u8868\u55AE\u5DE5\u5177\u6B04 +Form-ToolBar=\u6C7A\u7B56\u5831\u8868\u5DE5\u5177\u6B04 FR-Base_sure_remove_item=\u4F60\u78BA\u5BE6\u6C7A\u5B9A\u522A\u9664\u9078\u4E2D\u7684\u9805 Component_Scale=\u5143\u4EF6\u7E2E\u653E Hyperlink-Use_CJK_to_encode_parameter=\u4F7F\u7528CJK\u8655\u7406\u53C3\u6578 @@ -1798,7 +1798,7 @@ Only_selected_cell_can_paste_only=\u53EA\u6709\u9078\u4E2D\u5132\u5B58\u683C\u66 M_Report-Report_Columns=\u5831\u8868\u5206\u6B04 Unit_Hundred=\u4F70 FR-Designer_DataTable-Build=\u6975\u901F\u5206\u5C64\u69CB\u5EFA -Widget-Form_Widget_Config=\u8868\u55AE\u63A7\u5236\u9805 +Widget-Form_Widget_Config=\u6C7A\u7B56\u5831\u8868\u63A7\u5236\u9805 Server-version-tip-moreInfo=\u5EFA\u8B70\u60A8\u6240\u5C6C\u5718\u968A\u4F7F\u7528\u7684\u6211\u65B9FineReport\u7522\u54C1\u7684\u8A2D\u8A08\u5668\u7248\u672C\u865F\u4EE5\u53CA\u90E8\u7F72\u7684\u4F3A\u670D\u5668\u7248\u672C\u865F\u4FDD\u6301\u4E00\u81F4\uFF0C\u4EE5\u907F\u514D\u7248\u672C\u4E0D\u4E00\u81F4\u9020\u6210\u7684\u554F\u984C\u98A8\u96AA\u3002\u5047\u5982\u60A8\u6253\u958B\u66F4\u9AD8\u8A2D\u8A08\u5668\u7248\u672C\u88FD\u4F5C\u7684\u6A21\u677F\uFF0C\u53EF\u80FD\u6253\u958B\u51FA\u932F\uFF0C\u4E5F\u53EF\u80FD\u4E1F\u5931\u539F\u6709\u6A21\u677F\u5C6C\u6027\u3002\u5047\u5982\u60A8\u88FD\u4F5C\u7684\u6A21\u677F\u4F7F\u7528\u7684\u8A2D\u8A08\u5668\u7248\u672C\u9AD8\u65BC\u60A8\u6700\u7D42\u90E8\u7F72\u6240\u7528\u7684\u4F3A\u670D\u5668\u7248\u672C\uFF0C\u4F3A\u670D\u5668\u53EF\u80FD\u7121\u6CD5\u6B63\u5E38\u8F09\u5165\u60A8\u88FD\u4F5C\u7684\u6A21\u677F Actions=\u4EFB\u52D9 FR-Designer-Dependence_Connect_Server_Error=\u7121\u6CD5\u9023\u63A5\u670D\u52D9\u5668\uFF0C\u8ACB\u7A0D\u5F8C\u518D\u8A66 @@ -1951,7 +1951,7 @@ ReportServerP-Import_JavaScript=\u5F15\u7528JavaScript Form-TableTree=\u8868\u683C\u6A39 Opened=\u5DF2\u958B\u5553 M_Edit-Delete=\u522A\u9664(D) -Widget-Form_Widget_Container=\u8868\u55AE\u5BB9\u5668 +Widget-Form_Widget_Container=\u6C7A\u7B56\u5831\u8868\u5BB9\u5668 BindColumn-Summary=\u532F\u7E3D Sche-Second=\u79D2 Server-Open_Service_Manager=\u6253\u958B\u4F3A\u670D\u5668\u7BA1\u7406\u5668 From f7a5ea2a5c2ae26c434be433b7c3f8de0de57975 Mon Sep 17 00:00:00 2001 From: ju Date: Thu, 7 Dec 2017 17:21:00 +0800 Subject: [PATCH 09/20] =?UTF-8?q?REPORT-6001=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?bat=E5=90=AF=E5=8A=A8=EF=BC=8C=E8=BF=9C=E7=A8=8B=E5=88=B0?= =?UTF-8?q?=E8=BF=9C=E7=A8=8B=E6=9C=8D=E5=8A=A1=E5=99=A8=EF=BC=8C=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E9=87=8C=E6=8A=9B=E9=94=99finedb=E8=A2=AB=E9=94=81?= =?UTF-8?q?=E4=BD=8F=20=E8=BF=9C=E7=A8=8B=E7=8E=AF=E5=A2=83=E4=B8=8D?= =?UTF-8?q?=E8=AE=A9=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer/src/com/fr/design/mainframe/InformationCollector.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer/src/com/fr/design/mainframe/InformationCollector.java b/designer/src/com/fr/design/mainframe/InformationCollector.java index 7cc6eb6c44..5b80c2ecd9 100644 --- a/designer/src/com/fr/design/mainframe/InformationCollector.java +++ b/designer/src/com/fr/design/mainframe/InformationCollector.java @@ -344,7 +344,8 @@ public class InformationCollector implements XMLReadable, XMLWriter { } private void sendUserInfoInOtherThread(){ - if (!DesignerEnvManager.getEnvManager().isJoinProductImprove() || !FRContext.isChineseEnv()) { + + if (!DesignerEnvManager.getEnvManager().isJoinProductImprove() || !FRContext.isChineseEnv() || !FRContext.getCurrentEnv().isLocalEnv()) { return; } From 7eff901f2c27b7971ef00a0c22fcf2cb757e705b Mon Sep 17 00:00:00 2001 From: rinoux Date: Fri, 8 Dec 2017 14:03:35 +0800 Subject: [PATCH 10/20] =?UTF-8?q?REPORT-5942=209.0=E6=80=A7=E8=83=BD?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E5=86=85=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../write/submit/SubmitVisitorListPane.java | 2 + .../batch/BatchCommit2DBJavaScript.java | 170 +++ .../batch/BatchCommit2DBJavaScriptPane.java | 186 +++ .../submit/batch/BatchCommitTabbedPane.java | 529 ++++++++ .../batch/BatchJavaScriptActionProvider.java | 23 + .../write/submit/batch/BatchSubmitPane.java | 1089 +++++++++++++++++ .../submit/batch/BatchSubmitProvider.java | 42 + .../batch/SmartInsertBatchSubmitPane.java | 591 +++++++++ .../batch/service/BatchDBCommitService.java | 288 +++++ 9 files changed, 2920 insertions(+) create mode 100644 designer/src/com/fr/design/write/submit/batch/BatchCommit2DBJavaScript.java create mode 100644 designer/src/com/fr/design/write/submit/batch/BatchCommit2DBJavaScriptPane.java create mode 100644 designer/src/com/fr/design/write/submit/batch/BatchCommitTabbedPane.java create mode 100644 designer/src/com/fr/design/write/submit/batch/BatchJavaScriptActionProvider.java create mode 100644 designer/src/com/fr/design/write/submit/batch/BatchSubmitPane.java create mode 100644 designer/src/com/fr/design/write/submit/batch/BatchSubmitProvider.java create mode 100644 designer/src/com/fr/design/write/submit/batch/SmartInsertBatchSubmitPane.java create mode 100644 designer/src/com/fr/design/write/submit/batch/service/BatchDBCommitService.java diff --git a/designer/src/com/fr/design/write/submit/SubmitVisitorListPane.java b/designer/src/com/fr/design/write/submit/SubmitVisitorListPane.java index 3dfea6c15b..2b18427bdc 100644 --- a/designer/src/com/fr/design/write/submit/SubmitVisitorListPane.java +++ b/designer/src/com/fr/design/write/submit/SubmitVisitorListPane.java @@ -13,6 +13,7 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.scrollruler.ModLineBorder; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.design.write.submit.batch.BatchSubmitProvider; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.general.Inter; @@ -177,6 +178,7 @@ public class SubmitVisitorListPane extends ObjectJControlPane { for (SubmitProvider provider : providers) { addSubmitPane(provider); } + addSubmitPane(BatchSubmitProvider.getInstance()); configTypes = new ArrayList<>(); for (Map.Entry entry : customSubmitPanes.entrySet()) { diff --git a/designer/src/com/fr/design/write/submit/batch/BatchCommit2DBJavaScript.java b/designer/src/com/fr/design/write/submit/batch/BatchCommit2DBJavaScript.java new file mode 100644 index 0000000000..d44a43722d --- /dev/null +++ b/designer/src/com/fr/design/write/submit/batch/BatchCommit2DBJavaScript.java @@ -0,0 +1,170 @@ +package com.fr.design.write.submit.batch; + +import com.fr.general.ComparatorUtils; +import com.fr.general.xml.GeneralXMLTools; +import com.fr.js.AbstractJavaScript; +import com.fr.js.Callback; +import com.fr.js.JavaScript; +import com.fr.js.JavaScriptXMLUtils; +import com.fr.json.JSONObject; +import com.fr.stable.ParameterProvider; +import com.fr.stable.StringUtils; +import com.fr.stable.web.Repository; +import com.fr.stable.xml.XMLPrintWriter; +import com.fr.stable.xml.XMLableReader; +import com.fr.write.batch.SubmitMain; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by loy on 16/8/22. + */ +public class BatchCommit2DBJavaScript extends AbstractJavaScript implements Callback { + + public static String RECALCULATE_TAG = "shouldRecalculate"; + + /** + * 回调函数标识 + */ + public static final String CALLBACK = "callback"; + + /** + * 回调参数标识 + */ + public static final String FEEDBACKMAP = "feedbackMap"; + + /** + * javascript所使用的参数 + */ + protected ParameterProvider[] parameters; + //这个MAP里放的是提交过程生成的参数,比如提交入库,在所有回调事件里,都会将其传递进去,以供解析。 + protected Map paraMap = new HashMap(); + + private boolean recalculate; + + private List dbManipulationList = new ArrayList(); + //回调函数 + private JavaScript callBack; + + /** + * 获取数据入库配置信息 + */ + public List getDBManipulation() { + return dbManipulationList; + } + + /** + * 设置数据入库配置信息 + * + * @param dbManipulationList 数据库配置信息 + */ + public void setDBManipulation(List dbManipulationList) { + this.dbManipulationList = dbManipulationList; + } + + /** + * 回调函数,该函数将在主函数执行完毕以后开始执行 + */ + public JavaScript getCallBack() { + return callBack; + } + + /** + * 设置回调函数 + * + * @param callback 回调函数 + */ + public void setCallBack(JavaScript callback) { + this.callBack = callback; + } + + /** + * JS响应 + * + * @param repo 环境 + * @return 返回生成的JS字符串 + */ + public String actionJS(Repository repo) { + String dmlconf = GeneralXMLTools.writeXMLableAsString(this); + if (!this.paraMap.isEmpty() && callBack != null) { + callBack.addParameterMap(paraMap); + } + String js = "var fm = this.options.form;if(fm == null) {fm = new FR.BatchForm()};fm.batchCommit({" + + "xmlconf" + ":" + JSONObject.quote(dmlconf) + + (callBack != null ? "," + CALLBACK + ":" + JSONObject.quote(GeneralXMLTools.writeXMLableAsString(callBack)) : "") + + (this.paraMap.isEmpty() ? "" : "," + FEEDBACKMAP + ":" + new JSONObject(paraMap).toString()) + + "},this)"; + return js; + } + + /** + * 转化为字符串 + * + * @return 返回字符串形式 + */ + public String toString() { + return (dbManipulationList == null) ? StringUtils.EMPTY : dbManipulationList.toString(); + } + + public void writeXML(XMLPrintWriter writer) { + super.writeXML(writer); + + if (this.dbManipulationList != null) { + for (int i = 0; i < dbManipulationList.size(); i++) { + ((SubmitMain) this.dbManipulationList.get(i)).writeXML(writer); + } + + } + + if (this.callBack != null) { + GeneralXMLTools.writeXMLable(writer, this.callBack, JavaScript.XML_TAG); + } + } + + public void readXML(XMLableReader reader) { + super.readXML(reader); + + if (reader.isAttr()) { + dbManipulationList = new ArrayList(); + } else if (reader.isChildNode()) { + String tagName = reader.getTagName(); + if (JavaScript.XML_TAG.equals(tagName)) { + this.callBack = JavaScriptXMLUtils.readJavaScript(reader); + } else { + if ("Attributes".equals(tagName)) { + dbManipulationList.add(new SubmitMain()); + } + if (dbManipulationList.size() > 0) { + ((SubmitMain) dbManipulationList.get(dbManipulationList.size() - 1)).readXML(reader); + } + } + } + + } + + public boolean equals(Object obj) { + return obj instanceof BatchCommit2DBJavaScript + && super.equals(obj) + && ComparatorUtils.equals(((BatchCommit2DBJavaScript) obj).callBack, this.callBack) + && ComparatorUtils.equals(((BatchCommit2DBJavaScript) obj).dbManipulationList, this.dbManipulationList); + } + + public Object clone() throws CloneNotSupportedException { + BatchCommit2DBJavaScript cloned = (BatchCommit2DBJavaScript) super.clone(); + if (this.dbManipulationList != null) { + cloned.dbManipulationList = new ArrayList(); + for (int i = 0; i < this.dbManipulationList.size(); i++) { + cloned.dbManipulationList.add(((SubmitMain) this.dbManipulationList.get(i)).clone()); + } + } + + if (this.callBack != null) { + cloned.callBack = (JavaScript) this.callBack.clone(); + } + + return cloned; + } +} diff --git a/designer/src/com/fr/design/write/submit/batch/BatchCommit2DBJavaScriptPane.java b/designer/src/com/fr/design/write/submit/batch/BatchCommit2DBJavaScriptPane.java new file mode 100644 index 0000000000..f451d09078 --- /dev/null +++ b/designer/src/com/fr/design/write/submit/batch/BatchCommit2DBJavaScriptPane.java @@ -0,0 +1,186 @@ +package com.fr.design.write.submit.batch; + +import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.javascript.JavaScriptActionPane; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.general.Inter; +import com.fr.write.batch.SubmitMain; + +import javax.swing.*; +import java.awt.*; +import java.util.ArrayList; +import java.util.List; + +/** + * Created by loy on 16/8/22. + */ +public class BatchCommit2DBJavaScriptPane extends FurtherBasicBeanPane { + private List dbmPaneList = new ArrayList(); + private BatchCommitTabbedPane commitTabbedPane; + private JavaScriptActionPane javaScriptActionPane; + private UIButton addCallbackButton; + + private JPanel cardPane; + private String[] cardNames; + + /** + * 构造函数,控件事件的提交入库面板 + */ + public BatchCommit2DBJavaScriptPane() { + init(null); + } + + // public BatchCommit2DBJavaScriptPane(final JavaScriptActionPane javaScriptActionPane, List dbManipulationPaneList) { + public BatchCommit2DBJavaScriptPane(final JavaScriptActionPane javaScriptActionPane) { +// this.dbmPaneList=dbManipulationPaneList; + init(javaScriptActionPane); + } + + private void init(final JavaScriptActionPane javaScriptActionPane) { + this.dbmPaneList.add(new BatchSubmitPane()); + this.javaScriptActionPane = javaScriptActionPane; + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + commitTabbedPane = new BatchCommitTabbedPane(this, dbmPaneList); + commitTabbedPane.setPreferredSize(new Dimension(commitTabbedPane.getWidth(), 20)); + this.add(commitTabbedPane, BorderLayout.NORTH); + + cardPane = new JPanel(new CardLayout()); + cardNames = new String[dbmPaneList.size()]; + for (int i = 0; i < this.dbmPaneList.size(); i++) { + if (((BatchSubmitPane) this.dbmPaneList.get(i)).getSubMitName() == null) { + cardNames[i] = ""; + } else { + cardNames[i] = ((BatchSubmitPane) this.dbmPaneList.get(i)).getSubMitName(); + } + cardPane.add((BatchSubmitPane) this.dbmPaneList.get(i), cardNames[i]); + } + this.add(cardPane, BorderLayout.CENTER); + + JPanel btPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + this.add(btPane, BorderLayout.SOUTH); + + if (javaScriptActionPane != null) { + addCallbackButton = javaScriptActionPane.createCallButton(); + btPane.add(addCallbackButton); + } + } + + + /** + * 更新DBManipulationPane + */ + public void updateCardPane() { + cardNames = new String[dbmPaneList.size()]; + for (int i = 0; i < this.dbmPaneList.size(); i++) { + if (((BatchSubmitPane) this.dbmPaneList.get(i)).getSubMitName() == null) { + cardNames[i] = ""; + } else { + cardNames[i] = ((BatchSubmitPane) this.dbmPaneList.get(i)).getSubMitName(); + } + cardPane.add((BatchSubmitPane) this.dbmPaneList.get(i), cardNames[i]); + } + CardLayout cardLayout = (CardLayout) cardPane.getLayout(); + cardLayout.show(cardPane, cardNames[commitTabbedPane.getSelectedIndex()]); + } + + public void setList(List list) { + this.dbmPaneList = list; + } + + /** + * 新建DBManipulationPane + * + * @return 新建的DBManipulationPane + */ + public BatchSubmitPane createDBManipulationPane() { + BatchSubmitPane db = new BatchSubmitPane(); +// BatchSubmitPane db = javaScriptActionPane.createDBManipulationPane(); + db.populateBean(null); + dbmPaneList.add(db); + return db; + + } + + /** + * 窗口名称 + * + * @return 返回窗口名称 + */ + public String title4PopupWindow() { + return Inter.getLocText("Performance-plugin_submitbatch_name"); + } + + /** + * 界面重置 + */ + public void reset() { + if (javaScriptActionPane != null) { + this.javaScriptActionPane.setCall(null); + } + //重置后只保留,只留第一个tab + while (dbmPaneList.size() > 1) { + dbmPaneList.remove(1); + } + ((BatchSubmitPane) dbmPaneList.get(0)).populateBean(null); + } + + @Override + /** + * 将JavaBean内的数据输出至界面上 + */ + public void populateBean(BatchCommit2DBJavaScript commit2db) { + if (commit2db == null) { + reset(); + return; + } + //先把原来的list清除,然后再根据传入参数重新add + dbmPaneList.clear(); + if (javaScriptActionPane != null) { + this.javaScriptActionPane.setCall(commit2db.getCallBack()); + } + for (int i = 0; i < commit2db.getDBManipulation().size(); i++) { + BatchSubmitPane dbmp = new BatchSubmitPane(); +// BatchSubmitPane dbmp = javaScriptActionPane.createDBManipulationPane(); + dbmp.populateBean((SubmitMain) commit2db.getDBManipulation().get(i)); + dbmPaneList.add(dbmp); + } + commitTabbedPane.refreshTab(); + } + + /** + * 更新数据层JavaBean + * + * @return 返回JavaBean + */ + public BatchCommit2DBJavaScript updateBean() { + BatchCommit2DBJavaScript commit2dbJavaScript = new BatchCommit2DBJavaScript(); + + List dbmaniList = new ArrayList(); + for (int i = 0; i < this.dbmPaneList.size(); i++) { + BatchSubmitPane dbmpane = (BatchSubmitPane) this.dbmPaneList.get(i); + if (i > dbmPaneList.size() - 1) { + dbmPaneList.add(dbmpane); + } + SubmitMain dbManipulation = dbmpane.updateBean(); + dbmaniList.add(dbManipulation); + } + commit2dbJavaScript.setDBManipulation(dbmaniList); + + if (javaScriptActionPane != null) { + commit2dbJavaScript.setCallBack(this.javaScriptActionPane.getCall()); + } + + return commit2dbJavaScript; + } + + /** + * 判断是否是能接受的数据类型 + * + * @param ob 对象 + * @return 返回是否是能接受的数据类型 + */ + public boolean accept(Object ob) { + return ob instanceof BatchCommit2DBJavaScript; + } +} diff --git a/designer/src/com/fr/design/write/submit/batch/BatchCommitTabbedPane.java b/designer/src/com/fr/design/write/submit/batch/BatchCommitTabbedPane.java new file mode 100644 index 0000000000..4c1bcaddae --- /dev/null +++ b/designer/src/com/fr/design/write/submit/batch/BatchCommitTabbedPane.java @@ -0,0 +1,529 @@ +package com.fr.design.write.submit.batch; + +import com.fr.base.BaseUtils; +import com.fr.design.constants.UIConstants; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.general.ComparatorUtils; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.*; +import java.awt.geom.*; + +/** + * Created by loy on 16/8/22. + */ +public class BatchCommitTabbedPane extends JComponent implements MouseListener, MouseMotionListener { + private Icon closeIcon = BaseUtils.readIcon("com/fr/design/images/gui/tab_delete.png"); + private static final Icon ADD_NORMAL = BaseUtils.readIcon("com/fr/design/images/gui/tab_add_normal.png"); + private static final Icon ADD_OVER = BaseUtils.readIcon("com/fr/design/images/gui/tab_add_hover.png"); + private static final Icon ADD_CLICK = BaseUtils.readIcon("com/fr/design/images/gui/tab_add_click.png"); + private static final Image DESIGN_IMAGE = BaseUtils.readImage("com/fr/design/images/sheet/left_right_btn.png"); + private static final Icon LEFT_ICON = BaseUtils.createIcon(DESIGN_IMAGE, 0, 0, 14, 14); + private static final Icon RIGHT_ICON = BaseUtils.createIcon(DESIGN_IMAGE, 14, 0, 14, 14); + private static final Icon DISABLED_LEFT_ICON = BaseUtils.createIcon(DESIGN_IMAGE, 0, 14, 14, 14); + private static final Icon DISABLED_RIGHT_ICON = BaseUtils.createIcon(DESIGN_IMAGE, 14, 14, 14, 14); + private Icon addIcon = ADD_NORMAL; + + private static final int TOOLBAR_HEIGHT = 16; // 按钮高度 + private static final int GAP = 5; //间隔 + private static final int SMALLGAP = 3; + + private static final int FIRST_TAB_POSITION = 20; + + + // 左移和右移按钮 + private UIButton leftButton; + private UIButton rightButton; + + private JPanel buttonPane; + + private java.util.List dbManipulationPaneList ; + + private BatchCommit2DBJavaScriptPane commit2DBJavaScriptPane; + + // 能显示的tab个数 + private int showCount = 0; + + //选了30度和60度的特殊角度的x,y作为经过的两个点的坐标 + private double specialLocation1 = 2.5; + private double specialLocation2 = 4.330127; + + private int mouseOveredIndex = -1; + + private int selectedIndex = -1; + + private static final double CORNOR_RADIUS = 5.0; + + + //tab栏可以放下的每个tab的实际宽度 + private int tabWidth = 70; + + + //当前标签页栏存放的所有标签页的index + private int scrollIndex = 0; + private int lastOneIndex = 0; + + //添加标签位置 + private int addX = -1; + private int addY = -1; + + + //各删除标签位置 + private int[] closeIconStartX; + + + public BatchCommitTabbedPane(BatchCommit2DBJavaScriptPane commit2DBJavaScriptPane, java.util.List dbManipulationPaneList ){ + this.commit2DBJavaScriptPane = commit2DBJavaScriptPane; + this.dbManipulationPaneList = dbManipulationPaneList; + this.setLayout(new BorderLayout(0, 0)); + this.addMouseListener(this); + this.addMouseMotionListener(this); + this.setBorder(null); + this.setForeground(new Color(99, 99, 99)); + leftButton = new UIButton(LEFT_ICON) { + public Dimension getPreferredSize() { + return new Dimension(super.getPreferredSize().width, TOOLBAR_HEIGHT); + } + }; + leftButton.set4ToolbarButton(); + leftButton.setDisabledIcon(DISABLED_LEFT_ICON); + rightButton = new UIButton(RIGHT_ICON) { + public Dimension getPreferredSize() { + return new Dimension(super.getPreferredSize().width, TOOLBAR_HEIGHT); + } + }; + rightButton.set4ToolbarButton(); + rightButton.setDisabledIcon(DISABLED_RIGHT_ICON); + buttonPane = new JPanel(new BorderLayout(3, 0)); + buttonPane.add(rightButton, BorderLayout.EAST); + buttonPane.add(leftButton, BorderLayout.CENTER); + this.add(buttonPane, BorderLayout.EAST); + leftButton.addActionListener(createLeftButtonActionListener()); + rightButton.addActionListener(createRightButtonActionListener()); + + } + + private ActionListener createRightButtonActionListener(){ + return new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + int tabCount = getTabCount(); + if (lastOneIndex < tabCount && lastOneIndex + showCount <= tabCount) { + scrollIndex += showCount; + lastOneIndex += showCount; + selectedIndex = lastOneIndex; + } else if(lastOneIndex < tabCount && lastOneIndex + showCount > tabCount){ + lastOneIndex = tabCount -1; + scrollIndex = lastOneIndex - showCount; + selectedIndex = lastOneIndex; + } + repaint(); + } + }; + } + + private ActionListener createLeftButtonActionListener() { + return new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + if(scrollIndex >= showCount) { + scrollIndex -= showCount; + selectedIndex = scrollIndex; + lastOneIndex -= showCount; + } else if (scrollIndex > 0 && scrollIndex< showCount){ + scrollIndex =0; + selectedIndex = 0; + lastOneIndex = showCount; + + } + repaint(); + } + }; + } + + private void checkButton(boolean buttonEnabled) { + leftButton.setEnabled(buttonEnabled); + rightButton.setEnabled(buttonEnabled); + } + + public int getSelectedIndex(){ + return selectedIndex; + } + + public void paintComponent(Graphics g){ + super.paintComponent(g); + double maxWidth = getWidth() - buttonPane.getWidth(); + Graphics2D g2d = (Graphics2D) g; + paintBackgroundAndLine(g2d, maxWidth); + + } + + private void paintBackgroundAndLine(Graphics2D g2d, double maxWidth) { + //能画的个数 + showCount = (int) (maxWidth) / tabWidth; + //计算开始画的最小模板index和最大模板index + if (selectedIndex >= dbManipulationPaneList.size()) { + selectedIndex = dbManipulationPaneList.size() - 1; + } + if (selectedIndex < 0) { + selectedIndex = 0; + } + calMinAndMaxIndex(); + closeIconStartX = new int[lastOneIndex - scrollIndex + 1]; + + int startX = 0; + //从可以开始展示在tab面板上的tab开始画 + for (int i = scrollIndex; i <= lastOneIndex; i++) { + BatchSubmitPane dbManipulationPane = (BatchSubmitPane)dbManipulationPaneList.get(i); + String name ; + if (dbManipulationPane.getSubMitName() != null){ + name = dbManipulationPane.getSubMitName(); + } else { + name = createName(); + dbManipulationPane.setSubMitName(name); + } + if (i == selectedIndex) { + closeIconStartX[i - scrollIndex] = paintSelectedTab(g2d, startX,name, i); + } else { + closeIconStartX[i - scrollIndex] = paintUnSelectedTab(g2d,startX,name,i); + } + startX += tabWidth; + } + paintUnderLine(startX, maxWidth, g2d); + addX = startX + GAP; + addIcon.paintIcon(this,g2d,addX,0); + checkButton(getTabCount() > showCount); + } + + public int getTabCount(){ + return dbManipulationPaneList.size(); + } + + private String createName(){ + String prefix = Inter.getLocText("FR-Designer-CommitTab_Submit"); + int count = getTabCount(); + while (true) { + //从提交1开始 + count = count == 0 ? 1 : count; + String newName = prefix + count; + boolean repeated = false; + for (int i= 0;i < getTabCount();i++) { + if (ComparatorUtils.equals( ((BatchSubmitPane)dbManipulationPaneList.get(i)).getSubMitName(), newName)) { + repeated = true; + break; + } + } + + if (!repeated) { + return newName; + } + + count++; + } + } + + + + private void paintUnderLine(double startX, double maxWidth, Graphics2D g2d) { + //画下面的那条线 + if (startX < maxWidth) { + GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, 2); + generalPath.moveTo((float) startX, (float) (getHeight() - 1)); + generalPath.lineTo((float) maxWidth, (float) (getHeight() - 1)); + g2d.fill(generalPath); + g2d.setPaint(UIConstants.LINE_COLOR); + g2d.draw(new Line2D.Double((float) startX, (float) (getHeight() - 1), (float) maxWidth , (float) (getHeight() - 1))); + } + } + + + private void calMinAndMaxIndex() { //如果个数大于最多能容纳的个数,则多余的进行处理 + + if (dbManipulationPaneList.size() > showCount) { + + if (selectedIndex >= lastOneIndex) { //所点击列表中的标签页处在标签页栏最后一个标签页之后,则标签页栏左移至所点击标签页出现 + scrollIndex = selectedIndex - showCount + 1; + lastOneIndex = selectedIndex; + if (scrollIndex <= 0) { + scrollIndex = 0; + lastOneIndex = showCount - 1; + } + } else if (selectedIndex <= scrollIndex) { //所点击列表中的标签页处在标签页栏第一个标签页之前,则标签页栏右移至所点击标签页出现 + + scrollIndex = selectedIndex; + lastOneIndex = scrollIndex + showCount - 1; + if (lastOneIndex > dbManipulationPaneList.size() - 1) { + lastOneIndex = dbManipulationPaneList.size() - 1; + } + } else { + if (selectedIndex >= dbManipulationPaneList.size() - 1) { + selectedIndex = dbManipulationPaneList.size() - 1; + lastOneIndex = selectedIndex; + scrollIndex = selectedIndex - showCount + 1; + } else { + lastOneIndex = scrollIndex + showCount - 1; + if (lastOneIndex > dbManipulationPaneList.size() - 1) { + lastOneIndex = dbManipulationPaneList.size() - 1; + } + } + } + } else { + scrollIndex = 0; + lastOneIndex = dbManipulationPaneList.size() - 1; + } + } + + + /** + * 画选中的tab + * + * @param g2d + * @param sheetName + * @return + */ + private int paintSelectedTab(Graphics2D g2d,int startX, String sheetName, int selfIndex) { + double[] x = {startX, startX, startX + tabWidth, startX + tabWidth, startX}; + double[] y = {-1, getHeight(), getHeight(), -1, -1}; + RoundRectangle2D.Double rect1 = new RoundRectangle2D.Double(startX, 1, this.getWidth(), this.getHeight(), 7, 7); + g2d.setPaint(new GradientPaint(1, 1, new Color(255, 255, 255), 1, getHeight() - 1, UIConstants.NORMAL_BACKGROUND)); + + GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, x.length); + generalPath.moveTo((float) x[0] + CORNOR_RADIUS, (float) y[0]); + generalPath.curveTo(((float) x[0] + CORNOR_RADIUS - specialLocation1), (y[0] + CORNOR_RADIUS - specialLocation2), ((float) x[0] + CORNOR_RADIUS - specialLocation2), (y[0] + CORNOR_RADIUS - specialLocation1), (double) x[0], y[0] + CORNOR_RADIUS); + + for (int index = 1; index <= 2; index++) { + generalPath.lineTo((float) x[index], (float) y[index]); + } + + generalPath.lineTo((float) x[3], (float) y[3] + CORNOR_RADIUS); + generalPath.curveTo(((float) x[3] - CORNOR_RADIUS + specialLocation1), ((float) y[3] + CORNOR_RADIUS - specialLocation2), ((float) x[3] - CORNOR_RADIUS + specialLocation2), ((float) y[3] + CORNOR_RADIUS - specialLocation1), (float) x[3] - CORNOR_RADIUS, (float) y[3]); + generalPath.lineTo((float) x[0] + CORNOR_RADIUS, (float) y[0]); + + generalPath.closePath(); + g2d.fill(generalPath); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + g2d.setPaint(UIConstants.LINE_COLOR); + g2d.draw(new Arc2D.Double(x[0], y[0], CORNOR_RADIUS * 2, CORNOR_RADIUS * 2, 90, 90, 0)); + g2d.draw(new Line2D.Double(x[0], y[0] + CORNOR_RADIUS, x[1], y[1])); + g2d.draw(new Line2D.Double(x[1], y[1], x[2], y[2])); + g2d.draw(new Line2D.Double(x[2], y[2], x[3], y[3] + CORNOR_RADIUS)); + g2d.draw(new Line2D.Double(x[0] + 3 ,0,x[2] - 3,0)); + g2d.draw(new Arc2D.Double(x[3] - CORNOR_RADIUS * 2, y[3], CORNOR_RADIUS * 2, CORNOR_RADIUS * 2, 90, -90, 0)); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); + // 画字符 + g2d.setPaint(getForeground()); + g2d.drawString(sheetName, startX + 2 * GAP, getHeight()-GAP); + int closePosition = startX + tabWidth - closeIcon.getIconWidth() - SMALLGAP; + int closeY = (getHeight() - closeIcon.getIconHeight()) / 2; + if (canClose() && mouseOveredIndex == selfIndex){ + closeIcon.paintIcon(this, g2d, closePosition, closeY); + } + return closePosition; + + } + + /** + * 画没有选中的tab + * + * @param g2d + * @param startX + * @param sheetName + * @return + */ + private int paintUnSelectedTab(Graphics2D g2d, int startX, String sheetName, int selfIndex) { + double[] x = {startX, startX, startX + tabWidth, startX + tabWidth, startX}; + double[] y = {-1, getHeight() - 1, getHeight() - 1, -1, -1}; + if (selfIndex == mouseOveredIndex) { + g2d.setPaint(new GradientPaint(1, 1, new Color(255, 255, 255), 1, getHeight() - 1, UIConstants.NORMAL_BACKGROUND)); + } else { + g2d.setPaint(new GradientPaint(1, 1, UIConstants.NORMAL_BACKGROUND, 1, getHeight() - 1, UIConstants.NORMAL_BACKGROUND)); + } + + + GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, x.length); + generalPath.moveTo((float) x[0] + CORNOR_RADIUS, (float) y[0]); + generalPath.curveTo(((float) x[0] + CORNOR_RADIUS - specialLocation1), (y[0] + CORNOR_RADIUS - specialLocation2), ((float) x[0] + CORNOR_RADIUS - specialLocation2), (y[0] + CORNOR_RADIUS - specialLocation1), (double) x[0], y[0] + CORNOR_RADIUS); + + for (int index = 1; index <= 2; index++) { + generalPath.lineTo((float) x[index], (float) y[index]); + } + + generalPath.lineTo((float) x[3], (float) y[3] + CORNOR_RADIUS); + generalPath.curveTo(((float) x[3] - CORNOR_RADIUS + specialLocation1), ((float) y[3] + CORNOR_RADIUS - specialLocation2), ((float) x[3] - CORNOR_RADIUS + specialLocation2), ((float) y[3] + CORNOR_RADIUS - specialLocation1), (float) x[3] - CORNOR_RADIUS, (float) y[3]); + generalPath.lineTo((float) x[0] + CORNOR_RADIUS, (float) y[0]); + + generalPath.closePath(); + + g2d.fill(generalPath); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + g2d.setPaint(UIConstants.LINE_COLOR); + + g2d.draw(new Arc2D.Double(x[0], y[0], CORNOR_RADIUS * 2, CORNOR_RADIUS * 2, 90, 90, 0)); + g2d.draw(new Line2D.Double(x[0], y[0] + CORNOR_RADIUS, x[1], y[1])); + g2d.draw(new Line2D.Double(x[1], y[1], x[2], y[2])); + g2d.draw(new Line2D.Double(x[2], y[2], x[3], y[3] + CORNOR_RADIUS)); + g2d.draw(new Line2D.Double(x[0] + 3 ,0,x[2] - 3,0)); + g2d.draw(new Arc2D.Double(x[3] - CORNOR_RADIUS * 2, y[3], CORNOR_RADIUS * 2, CORNOR_RADIUS * 2, 90, -90, 0)); + + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); + // 画字符 + g2d.setPaint(getForeground()); + g2d.drawString(sheetName, startX + 2 * GAP, getHeight() - GAP ); + int closeY = (getHeight() - closeIcon.getIconHeight()) / 2; + int closePosition = startX + tabWidth - closeIcon.getIconWidth() - SMALLGAP; + if (canClose() && mouseOveredIndex == selfIndex){ + closeIcon.paintIcon(this, g2d, closePosition, closeY); + } + return closePosition; + } + + + /** + * 鼠标按下 + * @param e 事件 + */ + public void mouseClicked(MouseEvent e) { + } + + /** + * 鼠标按下 + * @param e 事件 + */ + public void mousePressed(MouseEvent e) { + int x = e.getX(), y = e.getY(); + if (addX!= -1 && isOverAddIcon(x, y)){ + addIcon = ADD_CLICK; + commit2DBJavaScriptPane.createDBManipulationPane(); + selectedIndex = dbManipulationPaneList.size()-1; + commit2DBJavaScriptPane.updateCardPane(); + } else if (isOverCloseIcon(x)){ + int re = JOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(this), Inter.getLocText("FR-Designer-CommitTab_SureToDelete")+ "?", Inter.getLocText("FR-Designer-CommitTab_Remove") + , JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); + if (re == JOptionPane.OK_OPTION) { + dbManipulationPaneList.remove(getTabIndex(x)); + commit2DBJavaScriptPane.setList(dbManipulationPaneList); + // 删除tab以后,获得第一个tab,再刷新一下,否则画面会停留在已删除的tab上,第一个tab是不可删除的 + selectedIndex = getTabIndex(FIRST_TAB_POSITION); + commit2DBJavaScriptPane.updateCardPane(); + + } + } else if (selectedIndex != getTabIndex(x)){ + selectedIndex = getTabIndex(x); + commit2DBJavaScriptPane.updateCardPane(); + } + repaint(); + } + + /** + * 鼠标离开 + * @param e 事件 + */ + public void mouseReleased(MouseEvent e) { + if(addX != -1 && isOverAddIcon(e.getX(), e.getY())){ + addIcon = ADD_NORMAL; + } + } + + /** + * 鼠标进入 + * @param e 事件 + */ + public void mouseEntered(MouseEvent e) { + } + + /** + * 鼠标离开 + * @param e 事件 + */ + public void mouseExited(MouseEvent e) { + mouseOveredIndex = -1; + repaint(); + } + + /** + * 鼠标拖动 + * @param e 事件 + */ + public void mouseDragged(MouseEvent e) { + } + + /** + * 鼠标移动 + * @param e 事件 + */ + public void mouseMoved(MouseEvent e) { + if(addX!= -1 && isOverAddIcon(e.getX(), e.getY())){ + addIcon = ADD_OVER; + } else { + mouseOveredIndex = getTabIndex(e.getX()); + addIcon = ADD_NORMAL; + } + repaint(); + } + + + /** + * 判断鼠标所在Tab + * @param evtX + * @return index + */ + private int getTabIndex ( int evtX ){ + int x = 0; + for( int i = scrollIndex;i <= lastOneIndex;i++){ + if(evtX > x && evtX <= x + tabWidth ){ + return i; + } + x = x + tabWidth; + } + return -1; + } + + /** + * 判断鼠标是否在添加按钮上 + * @param x 鼠标坐标x + * @param y 鼠标坐标y + * @return 返回鼠标是否在添加按钮上 + */ + private boolean isOverAddIcon(int x, int y){ + int addWidth = addIcon.getIconWidth(),addHeight = addIcon.getIconHeight(); + return x >= addX && x <= addX + addWidth && y > addY && y <= addY + addHeight; + } + + + /** + * 判断鼠标是否在关闭按钮上 + * @param evtX x + * @return 返回鼠标是否在关闭按钮上 + */ + private boolean isOverCloseIcon(int evtX) { + boolean isOverCloseIcon = false; + if( canClose()){ + for (int i = 0; i < closeIconStartX.length; i++) { + if (evtX >= closeIconStartX[i] && evtX <= closeIconStartX[i] + closeIcon.getIconWidth()) { + isOverCloseIcon = true; + break; + } + } + } + return isOverCloseIcon; + } + + /** + * 如果tab只剩下最后一个,则不画删除按钮 + * @return 返回当前tab还可否关闭 + */ + private boolean canClose(){ + return closeIconStartX.length > 1; + } + + /** + * 刷新tab,停留在第一个tab上面 + */ + public void refreshTab(){ + selectedIndex = getTabIndex(FIRST_TAB_POSITION); + commit2DBJavaScriptPane.updateCardPane(); + } +} diff --git a/designer/src/com/fr/design/write/submit/batch/BatchJavaScriptActionProvider.java b/designer/src/com/fr/design/write/submit/batch/BatchJavaScriptActionProvider.java new file mode 100644 index 0000000000..b0d9a2003e --- /dev/null +++ b/designer/src/com/fr/design/write/submit/batch/BatchJavaScriptActionProvider.java @@ -0,0 +1,23 @@ +package com.fr.design.write.submit.batch; + +import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.fun.impl.AbstractJavaScriptActionProvider; +import com.fr.design.javascript.JavaScriptActionPane; +import com.fr.js.JavaScript; + +/** + * Created by loy on 16/8/22. + */ +public class BatchJavaScriptActionProvider extends AbstractJavaScriptActionProvider { + + @Override + public FurtherBasicBeanPane getJavaScriptActionPane() { + return new BatchCommit2DBJavaScriptPane(); + } + + @Override + public FurtherBasicBeanPane getJavaScriptActionPane(JavaScriptActionPane pane) { + return new BatchCommit2DBJavaScriptPane(pane); + } + +} diff --git a/designer/src/com/fr/design/write/submit/batch/BatchSubmitPane.java b/designer/src/com/fr/design/write/submit/batch/BatchSubmitPane.java new file mode 100644 index 0000000000..1d944194a3 --- /dev/null +++ b/designer/src/com/fr/design/write/submit/batch/BatchSubmitPane.java @@ -0,0 +1,1089 @@ +package com.fr.design.write.submit.batch; + +import com.fr.base.BaseUtils; +import com.fr.base.Formula; +import com.fr.base.Parameter; +import com.fr.data.DataConstants; +import com.fr.data.condition.JoinCondition; +import com.fr.data.condition.ListCondition; +import com.fr.data.core.db.dml.Table; +import com.fr.design.actions.UpdateAction; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.condition.DSColumnLiteConditionPane; +import com.fr.design.constants.UIConstants; +import com.fr.design.data.datapane.ChoosePaneSupportFormula; +import com.fr.design.data.datapane.DataBaseItems; +import com.fr.design.data.tabledata.tabledatapane.FormatExplanationPane; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.BasicPane; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.editor.ValueEditorPane; +import com.fr.design.editor.ValueEditorPaneFactory; +import com.fr.design.editor.editor.Editor; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.icombobox.UIComboBoxRenderer; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ilist.CheckBoxList; +import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; +import com.fr.design.javascript.JavaScriptActionPane; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.scrollruler.ModLineBorder; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.design.write.submit.SubmitJobListPane; +import com.fr.general.ComparatorUtils; +import com.fr.general.DateUtils; +import com.fr.general.Inter; +import com.fr.general.data.Condition; +import com.fr.stable.ColumnRow; +import com.fr.stable.ColumnRowGroup; +import com.fr.stable.fun.Level; +import com.fr.write.NameSubmitJob; +import com.fr.write.batch.SubmitMain; +import com.fr.write.config.*; + +import javax.swing.*; +import javax.swing.table.AbstractTableModel; +import javax.swing.table.DefaultTableCellRenderer; +import javax.swing.table.TableCellEditor; +import javax.swing.table.TableColumn; +import javax.swing.tree.DefaultTreeCellRenderer; +import javax.swing.tree.DefaultTreeModel; +import java.awt.*; +import java.awt.event.*; +import java.util.ArrayList; +import java.util.Date; +import java.util.EventObject; + +/** + * Created by loy on 16/8/12. + */ +public class BatchSubmitPane extends BasicBeanPane implements Level { + private static final Image ICODS_IMAGE = BaseUtils.readImage("/com/fr/web/core/css/images/icons.png"); + private static final Icon HEIP_ICON = BaseUtils.createIcon(ICODS_IMAGE, 193, 1, 14, 14); + private static final int DEFAULT_RETURN_VALUE = 4; + public BatchSubmitPane.KeyColumnNameValueTable keyColumnValuesTable; + private UIComboBox columnsComboBox; // 用于编辑ColumnName的Editor + private UICheckBox UpdateCheckBox; + private JPanel checkBoxUpdatePane; + /* + * 记录当前选取的DS & Table对应的ColumnName[] + * alex:以前每当tableNameComboBox改变就刷新columnsComboBox,这样每输入一个文字就会刷一遍,很不好 + */ + private BatchSubmitPane.ColumnName[] currentColumnNames = null; + + // 支持公式输入的数据表选择面板 + private ChoosePaneSupportFormula chooseTable; + + private UIComboBox dmlConfigComboBox = null; + + // 提交事件 + private NameSubmitJob[] jobs = null; + + // 提交条件 + private Condition condition = null; + + private JTree conditionsTree; + + private Editor[] v_Types; + + protected JavaScriptActionPane parentPane; + + private int keyColumnWidth = 100; + private int resizeColumnCount = 4; + private int btnWidth = 110; + private int btnHeight = 20; + private String subMitName; + + private static final String[] DML_CONFIG_TYPES = new String[]{ + Inter.getLocText(new String[]{"Smart", "Submit"}), + Inter.getLocText(new String[]{"Delete", "Submit"}), + Inter.getLocText(new String[]{"Insert", "Submit"}), + Inter.getLocText(new String[]{"Update", "Submit"})}; + + /** + * 无单元格。没有智能添加单元格等按钮 + * 有单元格的参见其子类SmartInsertDBManipulationPane + */ + public BatchSubmitPane() { + this(ValueEditorPaneFactory.extendedCellGroupEditors()); + } + + public BatchSubmitPane(Editor[] v_Types) { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.v_Types = v_Types; + + JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + this.add(northPane, BorderLayout.NORTH); + + dmlConfigComboBox = new UIComboBox(DML_CONFIG_TYPES); + + JPanel typePane = GUICoreUtils.createFlowPane(new Component[]{new UILabel(Inter.getLocText(new String[]{"Choose", "Type"}) + ":"), dmlConfigComboBox}, + FlowLayout.LEFT, 10); + typePane.setBorder(BorderFactory.createTitledBorder(new ModLineBorder(ModLineBorder.TOP), Inter.getLocText(new String[]{"Submit", "Type"}))); + northPane.add(typePane, BorderLayout.NORTH); + + chooseTable = new ChoosePaneSupportFormula(); + chooseTable.setBorder(BorderFactory.createTitledBorder(new ModLineBorder(ModLineBorder.TOP), Inter.getLocText("FR-Base_Table"))); + chooseTable.setTableNameComboBoxPopSize(160, 320); + + northPane.add(chooseTable, BorderLayout.CENTER); + + // peter:编辑的TablePane + JPanel editTablePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + this.add(editTablePane, BorderLayout.CENTER); + editTablePane.setBorder(BorderFactory.createTitledBorder(new ModLineBorder(ModLineBorder.TOP), Inter.getLocText("FR-Base_Value"))); + + keyColumnValuesTable = new BatchSubmitPane.KeyColumnNameValueTable(); + editTablePane.add(new JScrollPane(this.keyColumnValuesTable), BorderLayout.CENTER); + keyColumnValuesTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); + keyColumnValuesTable.setPreferredScrollableViewportSize(new Dimension(280, 180)); + keyColumnValuesTable.setShowHorizontalLines(true); + + initJTableColumn(); + + addButtons(editTablePane); + + addBottomPane(); + + addListeners(); + } + + public void setSubMitName(String subMitName) { + this.subMitName = subMitName; + } + + public String getSubMitName() { + return this.subMitName; + } + + private void addButtons(JPanel editTablePane) { + // alex:添加操作按钮 + UpdateAction[] actions = this.getActions(); + if (actions != null && actions.length > 0) { + JPanel controlBtnPane = new JPanel(new GridLayout(actions.length + 1, 1, 4, 4)); + editTablePane.add(GUICoreUtils.createBorderPane(controlBtnPane, BorderLayout.NORTH), BorderLayout.EAST); + + for (int i = 0; i < actions.length; i++) { + controlBtnPane.add(new UIButton(actions[i])); + } + checkBoxUpdatePane = new JPanel(new BorderLayout(0, 0)); + checkBoxUpdatePane.setPreferredSize(new Dimension(120, 20)); + controlBtnPane.add(checkBoxUpdatePane); + + UpdateCheckBox = new UICheckBox(Inter.getLocText("RWA-NotChange_Unmodified")); + UIButton helpButton = new UIButton(HEIP_ICON); + helpButton.setToolTipText(Inter.getLocText("FR-Base_Help")); + helpButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + FormatExplanationPane formatExplanation = new FormatExplanationPane(Inter.getLocText("FR-Base_Help"), Inter.getLocText("FR-Designer_RWA-Help"), 12f); + BasicDialog dlg = formatExplanation.showMediumWindow(SwingUtilities.getWindowAncestor(BatchSubmitPane.this), + new DialogActionAdapter() { + }); + dlg.setVisible(true); + } + }); + helpButton.set4ToolbarButton(); + checkBoxUpdatePane.add(UpdateCheckBox, BorderLayout.WEST); + checkBoxUpdatePane.add(helpButton, BorderLayout.EAST); + } + } + + protected void updateUpdateCheckBoxEnable() { + BatchSubmitPane.KeyColumnTableModel model = (BatchSubmitPane.KeyColumnTableModel) keyColumnValuesTable.getModel(); + if (model.getRowCount() == 0) { + setUpdateCheckBoxEnable(false); + UpdateCheckBox.setSelected(true); + return; + } + ArrayList columnObjects = new ArrayList(); + for (int i = 0; i < model.getRowCount(); i++) { + columnObjects.add(model.getKeyColumnNameValue(i).cv.getObj()); + } + for (int i = 0; i < columnObjects.size(); i++) { + Object ob = columnObjects.get(i); + if (!(ob instanceof ColumnRow || ob instanceof ColumnRowGroup)) { + setUpdateCheckBoxEnable(false); + UpdateCheckBox.setSelected(false); + return; + } + } + setUpdateCheckBoxEnable(true); + } + + private void setUpdateCheckBoxEnable(boolean b) { + UpdateCheckBox.setEnabled(b); + } + + private void addBottomPane() { + JPanel eventPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + eventPane.add(addEventButton()); + + JPanel conditionPane = this.createConditionPane(); + + JPanel btPane = new JPanel(FRGUIPaneFactory.createBorderLayout()); + btPane.add(eventPane, BorderLayout.CENTER); + btPane.add(conditionPane, BorderLayout.NORTH); + this.add(btPane, BorderLayout.SOUTH); + } + + private UIButton addEventButton() { + UIButton addSubmitEventButton = new UIButton(Inter.getLocText("FR-Designer_Set_Submit_Event")); + addSubmitEventButton.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + final SubmitJobListPane jobsPane = createSubmitJobListPane(); + + jobsPane.populate(jobs); + BasicDialog dialog = jobsPane.showWindow(SwingUtilities.getWindowAncestor(BatchSubmitPane.this), new DialogActionAdapter() { + @Override + public void doOk() { + super.doOk(); + jobs = jobsPane.updateDBManipulation(); + } + }); + dialog.setVisible(true); + } + + }); + return addSubmitEventButton; + } + + private JPanel createConditionPane() { + JPanel conditionPane = new JPanel(); + conditionPane.setPreferredSize(createConditionPanePreferredSize()); + + setBorderAndLayout(conditionPane); + + conditionsTree = new JTree(new DefaultTreeModel(new ExpandMutableTreeNode())); + conditionsTree.setRootVisible(false); + conditionsTree.setShowsRootHandles(true); + conditionsTree.setBackground(UIConstants.NORMAL_BACKGROUND); + conditionsTree.setForeground(UIConstants.NORMAL_BACKGROUND); + DefaultTreeCellRenderer cr = (DefaultTreeCellRenderer) conditionsTree.getCellRenderer(); + cr.setForeground(UIConstants.NORMAL_BACKGROUND); + JScrollPane jp = new JScrollPane(conditionsTree); + addComponent(conditionPane, jp); + + UIButton addSubmitConditionButton = new UIButton(Inter.getLocText("FR-Designer_Set_Submit_Condition")); + addSubmitConditionButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + final DSColumnLiteConditionPane conditionPane = new DSColumnLiteConditionPane(); + String[] columns = chooseTable.currentColumnNames(); + if (columns != null && columns.length > 0) { + conditionPane.populateColumns(chooseTable.currentColumnNames()); + } + + conditionPane.populateBean(condition); + BasicDialog dialog = conditionPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { + @Override + public void doOk() { + super.doOk(); + condition = conditionPane.updateBean(); + refreshConditionList(); + } + }); + dialog.setVisible(true); + } + }); + + JPanel controlBtnPane = new JPanel(new GridLayout(1, 1, 4, 4)); + controlBtnPane.setPreferredSize(createControlBtnPanePreferredSize()); + conditionPane.add(GUICoreUtils.createBorderPane(controlBtnPane, BorderLayout.NORTH), setControlBtnPanePosition()); + controlBtnPane.add(addSubmitConditionButton); + + return conditionPane; + } + + protected void setBorderAndLayout(JPanel jPanel) { + jPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); + jPanel.setBorder(BorderFactory.createTitledBorder( + new ModLineBorder(ModLineBorder.TOP), Inter.getLocText(new String[]{"Submit", "Condition"}))); + } + + protected void addComponent(JPanel mainPane, JScrollPane addPane) { + mainPane.add(addPane, BorderLayout.CENTER); + } + + + protected Dimension createConditionPanePreferredSize() { + return new Dimension(454, 80); + } + + protected Dimension createControlBtnPanePreferredSize() { + return new Dimension(110, 20); + } + + protected String setControlBtnPanePosition() { + return BorderLayout.EAST; + } + + private void refreshConditionList() { + DefaultTreeModel defaultTreeModel = (DefaultTreeModel) conditionsTree.getModel(); + ExpandMutableTreeNode rootTreeNode = (ExpandMutableTreeNode) defaultTreeModel.getRoot(); + rootTreeNode.setUserObject(new JoinCondition(DataConstants.AND, new ListCondition())); + rootTreeNode.removeAllChildren(); + Condition liteCondition = this.condition == null ? new ListCondition() : this.condition; + if (liteCondition instanceof ListCondition) { + ListCondition listCondition = (ListCondition) liteCondition; + int joinConditionCount = listCondition.getJoinConditionCount(); + for (int i = 0; i < joinConditionCount; i++) { + addLiteConditionToListCondition(rootTreeNode, listCondition.getJoinCondition(i)); + } + } else { + ExpandMutableTreeNode newTreeNode = new ExpandMutableTreeNode(new JoinCondition(DataConstants.AND, liteCondition)); + rootTreeNode.add(newTreeNode); + } + defaultTreeModel.reload(rootTreeNode); + rootTreeNode.expandCurrentTreeNode(conditionsTree); + } + + private void addLiteConditionToListCondition(ExpandMutableTreeNode parentTreeNode, JoinCondition joinCondition) { + ExpandMutableTreeNode newTreeNode = new ExpandMutableTreeNode(joinCondition); + parentTreeNode.add(newTreeNode); + Condition liteCondition = joinCondition.getCondition(); + if (liteCondition instanceof ListCondition) { + ListCondition listCondition = (ListCondition) liteCondition; + int joinConditionCount = listCondition.getJoinConditionCount(); + for (int i = 0; i < joinConditionCount; i++) { + addLiteConditionToListCondition(newTreeNode, listCondition.getJoinCondition(i)); + } + } + } + + private void addListeners() { + dmlConfigComboBox.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + Object ob = e.getItem(); + if ((ComparatorUtils.equals(ob, DML_CONFIG_TYPES[0])) || ComparatorUtils.equals(ob, DML_CONFIG_TYPES[3])) { + checkBoxUpdatePane.setVisible(true); + } else if ((ComparatorUtils.equals(ob, DML_CONFIG_TYPES[1])) || ComparatorUtils.equals(ob, DML_CONFIG_TYPES[2])) { + checkBoxUpdatePane.setVisible(false); + } + } + } + }); + + /* + * 当DS & Table改变时要刷新ColumnsComboBox.model,不能用ItemListener, + * 因为tableNameComboBox是可以编辑的,每写一个文字就要连,太频繁了 + * 也不能在tableNameComboBox.focusLost事件时,好像没用 + */ + keyColumnValuesTable.addFocusListener(new FocusAdapter() { + + public void focusGained(FocusEvent e) { + refreshColumnsComboBox(); + } + + }); + } + + protected UpdateAction[] getActions() { + return new UpdateAction[]{new BatchSubmitPane.SmartAddFieldsAction(), new BatchSubmitPane.AddFieldAction(), new BatchSubmitPane.RemoveFieldAction()}; + } + + protected SubmitJobListPane createSubmitJobListPane() { + return new SubmitJobListPane(); + } + + public void setParentJavaScriptActionPane(JavaScriptActionPane jsPane) { + this.parentPane = jsPane; + } + + @Override + protected String title4PopupWindow() { + return "DB"; + } + + @Override + public int currentAPILevel() { + return 1; + } + + protected class SmartAddFieldsAction extends UpdateAction { + public SmartAddFieldsAction() { + this.setName(Inter.getLocText("RWA-Smart_Add_Fields")); + } + + public void actionPerformed(ActionEvent evt) { + + BasicPane bPane = new BasicPane() { + @Override + protected String title4PopupWindow() { + return Inter.getLocText("RWA-Smart_Add_Fields"); + } + }; + bPane.setLayout(FRGUIPaneFactory.createBorderLayout()); + + final CheckBoxList list = new CheckBoxList(currentColumnNames(), CheckBoxList.SelectedState.ALL, Inter.getLocText("FR-Designer_Chart_Field_Name")) { + public String value2Text(Object value) { + if (value instanceof BatchSubmitPane.ColumnName) { + return ((BatchSubmitPane.ColumnName) value).name; + } + + return super.value2Text(value); + } + }; + bPane.add(new JScrollPane(list), BorderLayout.CENTER); + + BasicDialog dlg = bPane.showSmallWindow(SwingUtilities.getWindowAncestor(BatchSubmitPane.this), new DialogActionAdapter() { + public void doOk() { + addFields(list); + updateUpdateCheckBoxEnable(); + } + }); + dlg.setVisible(true); + } + } + + private void addFields(CheckBoxList list) { + BatchSubmitPane.KeyColumnTableModel model = (BatchSubmitPane.KeyColumnTableModel) keyColumnValuesTable.getModel(); + java.util.List keyColumnNameValueList = new ArrayList(); + keyColumnNameValueList.clear(); + for (int i = 0; i < model.getRowCount(); i++) { + keyColumnNameValueList.add(model.getKeyColumnNameValue(i)); + } + model.removeAllKeyColumnNameValue(); + Object[] selected = list.getSelectedValues(); + // Richie:用了存储新的KeyColumnNameValue的List. + java.util.List newKeyColumnNameValueList = new ArrayList(); + if (!keyColumnNameValueList.isEmpty()) { + for (int i = 0; i < selected.length; i++) { + // Richie:先填上空的. + newKeyColumnNameValueList.add(new BatchSubmitPane.KeyColumnNameValue(false, (BatchSubmitPane.ColumnName) selected[i], new BatchSubmitPane.ColumnValue(""), false)); + } + } + // Richie:初始化 + int returnValue = DEFAULT_RETURN_VALUE; + int coverNumber = 0; + for (int i = 0; i < selected.length; i++) { + if (returnValue == 0 || returnValue == 3) { + break; + } + for (int j = 0; j < keyColumnNameValueList.size(); j++) { + if (ComparatorUtils.equals(selected[i], keyColumnNameValueList.get(j).cn)) { + Object[] options = {Inter.getLocText("FR-Designer_Covered_All"), Inter.getLocText("FR-Base_Yes"), Inter.getLocText("FR-Base_No"), Inter.getLocText("FR-Designer_Cover_None")}; + returnValue = JOptionPane.showOptionDialog(BatchSubmitPane.this, keyColumnNameValueList.get(j).cn.name + + Inter.getLocText(new String[]{"Has_Existed", "Want_To_Cover_It"}, new String[]{",", "?"}), + "", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, options, options[0]); + // Richie:全部覆盖 + if (returnValue == 0) { + break; + // Richie:覆盖指定行 + } else if (returnValue == 1) { + coverNumber = i; + // Richie:不覆盖制定行 + } else if (returnValue == 2) { + coverNumber = i; + newKeyColumnNameValueList.remove(i); + newKeyColumnNameValueList.add(i, keyColumnNameValueList.get(j)); + // Richie:全部不覆盖 + } else if (returnValue == 3) { + coverNumber = i; + break; + } + } + } + } + checkTableModel(returnValue, coverNumber, model, selected, keyColumnNameValueList, newKeyColumnNameValueList); + } + + private void checkTableModel(int returnValue, int coverNumber, BatchSubmitPane.KeyColumnTableModel model, Object[] selected, java.util.List keyColumnNameValueList, java.util.List newKeyColumnNameValueList) { + if (returnValue == 0) { + model.removeAllKeyColumnNameValue(); + // Richie:全部覆盖,按selected的长度添加默认的行 + for (int i = 0; i < selected.length; i++) { + model.addKeyColumnNameValue(newKeyColumnNameValueList.get(i)); + } + + } else if (returnValue == 3) { + model.removeAllKeyColumnNameValue(); + // Richie:全部不覆盖,已经存在的就保留,不存在的添加默认行 + for (int i = coverNumber; i < selected.length; i++) { + for (int j = 0; j < keyColumnNameValueList.size(); j++) { + if (ComparatorUtils.equals(selected[i], keyColumnNameValueList.get(j).cn)) { + newKeyColumnNameValueList.remove(i); + newKeyColumnNameValueList.add(i, keyColumnNameValueList.get(j)); + } + } + + } + + for (int i = 0; i < selected.length; i++) { + model.addKeyColumnNameValue(newKeyColumnNameValueList.get(i)); + } + + } else if (returnValue == 1 || returnValue == 2) { + for (int i = 0; i < selected.length; i++) { + model.addKeyColumnNameValue(newKeyColumnNameValueList.get(i)); + } + } + + // Richie:初始化 + if (keyColumnNameValueList.isEmpty()) { + model.removeAllKeyColumnNameValue(); + for (int i = 0; i < selected.length; i++) { + model.addKeyColumnNameValue(new BatchSubmitPane.KeyColumnNameValue(false, (BatchSubmitPane.ColumnName) selected[i], new BatchSubmitPane.ColumnValue(""), false)); + } + } + model.fireTableDataChanged(); + keyColumnValuesTable.validate(); + } + + protected class AddFieldAction extends UpdateAction { + public AddFieldAction() { + this.setName(Inter.getLocText("RWA-Add_Field")); + } + + public void actionPerformed(ActionEvent e) { + + BatchSubmitPane.KeyColumnTableModel model = (BatchSubmitPane.KeyColumnTableModel) keyColumnValuesTable.getModel(); + + model.addKeyColumnNameValue(new BatchSubmitPane.KeyColumnNameValue(false, new BatchSubmitPane.ColumnName(""), new BatchSubmitPane.ColumnValue(""), false)); + updateUpdateCheckBoxEnable(); + model.fireTableDataChanged(); + + keyColumnValuesTable.getSelectionModel().setSelectionInterval(model.getRowCount() - 1, model.getRowCount() - 1); + } + } + + protected class RemoveFieldAction extends UpdateAction { + public RemoveFieldAction() { + this.setName(Inter.getLocText("RWA-Remove_Field")); + } + + public void actionPerformed(ActionEvent evt) { + // DBManipulationPane target = this.getDBManipulationPane(); + + int[] selectedRows = keyColumnValuesTable.getSelectedRows(); + if (selectedRows == null || selectedRows.length == 0) { + return; + } + + int returnVal = JOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(BatchSubmitPane.this), + Inter.getLocText("FR-Base_sure_remove_item") + "?", Inter.getLocText("FR-Base_Remove"), JOptionPane.OK_CANCEL_OPTION, + JOptionPane.QUESTION_MESSAGE); + if (returnVal == JOptionPane.OK_OPTION) { + BatchSubmitPane.KeyColumnTableModel keyColumnNameValueTableModel = (BatchSubmitPane.KeyColumnTableModel) keyColumnValuesTable.getModel(); + + // 把selectedRows从小到大排个序,先删大的再删小的 + java.util.Arrays.sort(selectedRows); + for (int i = selectedRows.length - 1; i >= 0; i--) { + keyColumnNameValueTableModel.removeKeyColumnNameValue(selectedRows[i]); + } + updateUpdateCheckBoxEnable(); + keyColumnNameValueTableModel.fireTableDataChanged(); + + // select other one. + if (keyColumnNameValueTableModel.getRowCount() > selectedRows[0]) { + keyColumnValuesTable.getSelectionModel().setSelectionInterval(selectedRows[0], selectedRows[0]); + } else if (keyColumnNameValueTableModel.getRowCount() > 0) { + keyColumnValuesTable.getSelectionModel().setSelectionInterval(0, 0); + } + } + } + } + + /* + * 刷新columnsComboBox + */ + private void refreshColumnsComboBox() { + DefaultComboBoxModel model = (DefaultComboBoxModel) this.columnsComboBox.getModel(); + model.removeAllElements(); + + BatchSubmitPane.ColumnName[] columnNames = currentColumnNames(); + for (int i = 0; i < columnNames.length; i++) { + model.addElement(columnNames[i]); + } + } + + // 得到当前的ColumnName[] + private BatchSubmitPane.ColumnName[] currentColumnNames() { + // ben:清除原有的 + if (currentColumnNames != null) { + currentColumnNames = null; + } + String[] colNames = this.chooseTable.currentColumnNames(); + int len = colNames.length; + currentColumnNames = new BatchSubmitPane.ColumnName[len]; + for (int i = 0; i < len; i++) { + currentColumnNames[i] = new BatchSubmitPane.ColumnName(colNames[i]); + } + if (currentColumnNames == null) { + currentColumnNames = new BatchSubmitPane.ColumnName[0]; + } + return currentColumnNames; + } + + /* + * 设置JTable的Column + */ + private void initJTableColumn() { + TableColumn column0 = this.keyColumnValuesTable.getColumnModel().getColumn(0); + column0.setMaxWidth(50); + + TableColumn column1 = this.keyColumnValuesTable.getColumnModel().getColumn(1); + column1.setCellRenderer(new BatchSubmitPane.ColumnNameTableCellRenderer()); + + TableColumn column2 = this.keyColumnValuesTable.getColumnModel().getColumn(2); + column2.setCellRenderer(new BatchSubmitPane.ColumnValueTableCellRenderer()); + + // 设置column1的editor + columnsComboBox = new UIComboBox(new DefaultComboBoxModel()); + columnsComboBox.setRenderer(new UIComboBoxRenderer() { + + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + + if (value instanceof BatchSubmitPane.ColumnName) { + this.setText(((BatchSubmitPane.ColumnName) value).name); + } + + return this; + } + + }); + column1.setCellEditor(new DefaultCellEditor(columnsComboBox) { + public boolean stopCellEditing() { + if (super.stopCellEditing()) { + return true; + } + + return false; + } + }); + ((DefaultCellEditor) column1.getCellEditor()).setClickCountToStart(2); + + //设置Column 2的Editor + column2.setCellEditor(new BatchSubmitPane.ColumnValueEditor()); + } + + @Override + public void populateBean(SubmitMain submitMain) { + if (submitMain == null) { + submitMain = new SubmitMain(); + } + subMitName = submitMain.getName(); + DMLConfig dmlConfig = submitMain.getDmlConfig(); + + if (dmlConfig != null) { + if (dmlConfig instanceof IntelliDMLConfig) { + dmlConfigComboBox.setSelectedIndex(0); + } else if (dmlConfig instanceof DeleteConfig) { + dmlConfigComboBox.setSelectedIndex(1); + } else if (dmlConfig instanceof InsertConfig) { + dmlConfigComboBox.setSelectedIndex(2); + } else if (dmlConfig instanceof UpdateConfig) { + dmlConfigComboBox.setSelectedIndex(3); + } else { + dmlConfigComboBox.setSelectedIndex(0); + } + jobs = new NameSubmitJob[dmlConfig == null ? 0 : dmlConfig.getSubmitJobCount()]; + for (int i = 0; i < jobs.length; i++) { + jobs[i] = dmlConfig.getSubmitJob(i); + } + condition = dmlConfig.getCondition(); + UpdateCheckBox.setSelected(dmlConfig.isUpdateSelected()); + } else { + jobs = null; + condition = null; + dmlConfigComboBox.setSelectedIndex(0); + UpdateCheckBox.setSelected(false); + } + + String schema = null; + String tableName = null; + Table table = null; + if (dmlConfig != null && dmlConfig.getOriTable() != null) { + table = dmlConfig.getOriTable(); + if (table != null) { + schema = table.getSchema(); + tableName = table.getName(); + } + } + chooseTable.populateBean(new DataBaseItems(submitMain.getDBName(), schema, tableName)); + + populateKeyColumnValueTable(dmlConfig); + + updateUpdateCheckBoxEnable(); + refreshConditionList(); + } + + private void populateKeyColumnValueTable(DMLConfig dmlConfig) { + BatchSubmitPane.KeyColumnTableModel keyColumnNameValueTableModel = (BatchSubmitPane.KeyColumnTableModel) this.keyColumnValuesTable.getModel(); + keyColumnNameValueTableModel.removeAllKeyColumnNameValue(); + + if (dmlConfig != null) { + boolean acceptPara = false; + for (int i = 0; i < v_Types.length; i++) { + if (v_Types[i].accept(new Parameter())) { + acceptPara = true; + break; + } + } + for (int i = 0; i < dmlConfig.getColumnConfigCount(); i++) { + ColumnConfig column = dmlConfig.getColumnConfig(i); + String columnName = column.getColumnName(); + if (!acceptPara && column.getColumnValue() instanceof Parameter) { + // 表单中,将以前的参数转换为公式 + column.setColumnValue(new Formula(((Parameter) column.getColumnValue()).getName())); + } + + BatchSubmitPane.KeyColumnNameValue newColumnNameValue = new BatchSubmitPane.KeyColumnNameValue(column.isKey(), new BatchSubmitPane.ColumnName(columnName), new BatchSubmitPane.ColumnValue(column.getColumnValue()), + column.isSkipUnmodified()); + keyColumnNameValueTableModel.addKeyColumnNameValue(newColumnNameValue); + } + } + keyColumnNameValueTableModel.fireTableDataChanged(); + + // 选择第一个 + if (keyColumnNameValueTableModel.getRowCount() > 0) { + keyColumnValuesTable.getSelectionModel().setSelectionInterval(0, 0); + } + } + + @Override + public SubmitMain updateBean() { + DataBaseItems para = chooseTable.updateBean(true); + SubmitMain submitMain = new SubmitMain(); + submitMain.setName(subMitName); + submitMain.setDBName(para.getDatabaseName()); + + DMLConfig dmlConfig = new IntelliDMLConfig(); + if (dmlConfigComboBox.getSelectedIndex() == 1) { + dmlConfig = new DeleteConfig(); + } else if (dmlConfigComboBox.getSelectedIndex() == 2) { + dmlConfig = new InsertConfig(); + } else if (dmlConfigComboBox.getSelectedIndex() == 3) { + dmlConfig = new UpdateConfig(); + } + + submitMain.setDmlConfig(dmlConfig); + + dmlConfig.setTable(new Table(para.getSchemaName(), para.getTableName())); + + BatchSubmitPane.KeyColumnTableModel keyColumnNameValueTableModel = (BatchSubmitPane.KeyColumnTableModel) this.keyColumnValuesTable.getModel(); + int rowCount = keyColumnNameValueTableModel.keyColumnNameValueList.size(); + for (int i = 0; i < rowCount; i++) { + BatchSubmitPane.KeyColumnNameValue newKeyColumnNameValue = keyColumnNameValueTableModel.keyColumnNameValueList.get(i); + // peter:先添加key column name. + + dmlConfig.addColumnConfig(new ColumnConfig(newKeyColumnNameValue.cn.name, newKeyColumnNameValue.cv.obj, newKeyColumnNameValue.isKey, false)); + } + dmlConfig.setUpdateSelected(UpdateCheckBox.isSelected()); + + if (jobs != null) { + for (int i = 0; i < jobs.length; i++) { + dmlConfig.addSubmitJob(jobs[i]); + } + } + dmlConfig.setCondition(condition); + + return submitMain; + } + + protected class ValuePane extends BasicBeanPane { + ValueEditorPane vPane; + + public ValuePane() { + this(v_Types); + } + + public ValuePane(Editor[] types) { + vPane = new ValueEditorPane(types); + this.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 45)); + this.add(vPane); + vPane.setPreferredSize(new Dimension(220, 25)); + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("FR-Designer_Values-Editor"); + } + + public void populateBean(Object object) { + vPane.populate(object); + } + + @Override + public Object updateBean() { + return vPane.update(); + } + + } + + /* + * alex:ColumnValue的编辑器,弹出对话框来编辑...个人觉得不大好 + */ + protected class ColumnValueEditor extends AbstractCellEditor implements TableCellEditor { + /** + * The Swing component being edited. + */ + private UILabel textLabel; + private BatchSubmitPane.ValuePane vPane; + private BasicDialog vPaneDLG; + + protected ColumnValueEditor() { + this(v_Types); + } + + protected ColumnValueEditor(Editor[] types) { + textLabel = new UILabel(); + textLabel.addMouseListener(new MouseAdapter() { + public void mousePressed(MouseEvent e) { + vPaneDLG.setVisible(true); + + } + }); + + vPane = new BatchSubmitPane.ValuePane(types); + vPaneDLG = vPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { + public void doOk() { + fireEditingStopped(); // Make the renderer + // reappear. + updateUpdateCheckBoxEnable(); + } + + public void doCancel() { + fireEditingCanceled(); + } + }); + } + + /* + * 双击以编辑 + */ + public boolean isCellEditable(EventObject anEvent) { + if (anEvent instanceof MouseEvent) { + return ((MouseEvent) anEvent).getClickCount() >= 2; + } + return true; + } + + public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { + if (value instanceof BatchSubmitPane.ColumnValue) { + vPane.populateBean(((BatchSubmitPane.ColumnValue) value).obj); + + if (((BatchSubmitPane.ColumnValue) value).obj != null) { + textLabel.setText(((BatchSubmitPane.ColumnValue) value).obj.toString()); + } else { + textLabel.setText(""); + } + } + + return textLabel; + } + + public Object getCellEditorValue() { + return new BatchSubmitPane.ColumnValue(vPane.updateBean()); + } + } + + public static class ColumnName { + public String name; + + public ColumnName(String name) { + this.name = name; + } + + public boolean equals(Object obj) { + if (!(obj instanceof BatchSubmitPane.ColumnName)) { + return false; + } + + return ComparatorUtils.equals(this.name, ((BatchSubmitPane.ColumnName) obj).name); + } + } + + public static class ColumnValue { + public Object obj; + + public ColumnValue(Object obj) { + this.obj = obj; + } + + public Object getObj() { + return obj; + } + + public boolean equals(Object obj) { + if (!(obj instanceof BatchSubmitPane.ColumnValue)) { + return false; + } + + return ComparatorUtils.equals(this.obj, ((BatchSubmitPane.ColumnValue) obj).obj); + } + } + + protected static class KeyColumnNameValueTable extends JTable { + + public KeyColumnNameValueTable() { + super(new BatchSubmitPane.KeyColumnValueTableModel(null)); + } + + + public BatchSubmitPane.KeyColumnTableModel getTableModel4SmartAddCell() { + return new BatchSubmitPane.KeyColumnValueTableModel((BatchSubmitPane.KeyColumnTableModel) this.getModel()); + } + + } + + protected abstract static class KeyColumnTableModel extends AbstractTableModel { + public static final String RAW_KEY = Inter.getLocText("FR-Base_RWA-Key"); + public static final String COLUMN = Inter.getLocText("FR-Base_Column"); + public static final String VALUE = Inter.getLocText("FR-Base_Value"); + + public static final String[] COLUMN_NAMES = new String[]{RAW_KEY, COLUMN, VALUE}; + + protected java.util.List keyColumnNameValueList = new ArrayList(); + + public KeyColumnTableModel(BatchSubmitPane.KeyColumnTableModel model) { + if (model != null) { + this.keyColumnNameValueList.addAll(model.keyColumnNameValueList); + } + } + + public String getColumnName(int col) { + return COLUMN_NAMES[col]; + } + + public int getColumnCount() { + return COLUMN_NAMES.length; + } + + public int getRowCount() { + return keyColumnNameValueList.size(); + } + + public void addKeyColumnNameValue(BatchSubmitPane.KeyColumnNameValue keyColumnNameValue) { + this.keyColumnNameValueList.add(keyColumnNameValue); + } + + public void removeKeyColumnNameValue(int index) { + this.keyColumnNameValueList.remove(index); + } + + public BatchSubmitPane.KeyColumnNameValue getKeyColumnNameValue(int index) { + return this.keyColumnNameValueList.get(index); + } + + public void removeAllKeyColumnNameValue() { + this.keyColumnNameValueList.clear(); + } + } + + protected static class KeyColumnValueTableModel extends BatchSubmitPane.KeyColumnTableModel { + + public KeyColumnValueTableModel(BatchSubmitPane.KeyColumnTableModel model) { + super(model); + } + + public Object getValueAt(int row, int col) { + BatchSubmitPane.KeyColumnNameValue knv = keyColumnNameValueList.get(row); + + switch (col) { + case 0: + return knv.isKey; + case 1: + return knv.cn; + case 2: + return knv.cv; + } + return null; + } + + public void setValueAt(Object value, int row, int col) { + BatchSubmitPane.KeyColumnNameValue knv = keyColumnNameValueList.get(row); + + if (col == 0 && value instanceof Boolean) { + knv.isKey = ((Boolean) value).booleanValue(); + } else if (col == 1 && value instanceof BatchSubmitPane.ColumnName) { + knv.cn = (BatchSubmitPane.ColumnName) value; + } else if (col == 2 && value instanceof BatchSubmitPane.ColumnValue) { + knv.cv = (BatchSubmitPane.ColumnValue) value; + } + } + + public Class getColumnClass(int c) { + switch (c) { + case 0: + return Boolean.class; + case 1: + return BatchSubmitPane.ColumnName.class; + case 2: + return BatchSubmitPane.ColumnValue.class; + } + return String.class; + } + + public boolean isCellEditable(int row, int col) { + return true; + } + } + + + public static class KeyColumnNameValue { + private boolean isKey = false; + private BatchSubmitPane.ColumnName cn; + public BatchSubmitPane.ColumnValue cv; + + public KeyColumnNameValue(boolean isKey, BatchSubmitPane.ColumnName cn, BatchSubmitPane.ColumnValue cv, boolean skip) { + this.isKey = isKey; + this.cn = cn; + this.cv = cv; + } + + /** + * 字符串 + * + * @return 字符串z + */ + public String toString() { + return (isKey ? "* " : "") + cn + ":" + cv; + } + } + + /* + * ColumnNameTableCellRenderer + */ + public class ColumnNameTableCellRenderer extends DefaultTableCellRenderer { + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { + super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); + + if (value instanceof BatchSubmitPane.ColumnName) { + this.setText(((BatchSubmitPane.ColumnName) value).name); + } + + return this; + } + } + + /* + * ColumnValueTableCellRenderer + */ + private class ColumnValueTableCellRenderer extends DefaultTableCellRenderer { + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { + super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); + + if (value instanceof BatchSubmitPane.ColumnValue) { + if (((BatchSubmitPane.ColumnValue) value).obj != null) { + if (((BatchSubmitPane.ColumnValue) value).obj instanceof Date) { + this.setText(DateUtils.DATEFORMAT2.format(((BatchSubmitPane.ColumnValue) value).obj)); + } else { + this.setText(((BatchSubmitPane.ColumnValue) value).obj.toString()); + } + } else { + this.setText(""); + } + } + + return this; + } + } +} diff --git a/designer/src/com/fr/design/write/submit/batch/BatchSubmitProvider.java b/designer/src/com/fr/design/write/submit/batch/BatchSubmitProvider.java new file mode 100644 index 0000000000..4044626645 --- /dev/null +++ b/designer/src/com/fr/design/write/submit/batch/BatchSubmitProvider.java @@ -0,0 +1,42 @@ +package com.fr.design.write.submit.batch; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.fun.impl.AbstractSubmitProvider; +import com.fr.general.Inter; + +/** + * Created by loy on 16/8/13. + */ +public class BatchSubmitProvider extends AbstractSubmitProvider { + private volatile static BatchSubmitProvider instance; + + public static BatchSubmitProvider getInstance() { + if (instance == null) { + synchronized (BatchSubmitProvider.class) { + if (instance == null) { + instance = new BatchSubmitProvider(); + } + } + } + return instance; + } + @Override + public BasicBeanPane appearanceForSubmit() { + return new SmartInsertBatchSubmitPane(); + } + + @Override + public String dataForSubmit() { + return Inter.getLocText("Performance-plugin_submitbatch_name"); + } + + @Override + public String keyForSubmit() { + return "submitbatch"; + } + + @Override + public int currentAPILevel() { + return 1; + } +} diff --git a/designer/src/com/fr/design/write/submit/batch/SmartInsertBatchSubmitPane.java b/designer/src/com/fr/design/write/submit/batch/SmartInsertBatchSubmitPane.java new file mode 100644 index 0000000000..791f801ede --- /dev/null +++ b/designer/src/com/fr/design/write/submit/batch/SmartInsertBatchSubmitPane.java @@ -0,0 +1,591 @@ +package com.fr.design.write.submit.batch; + +import com.fr.cache.list.IntList; +import com.fr.data.ClassSubmitJob; +import com.fr.design.actions.UpdateAction; +import com.fr.design.cell.smartaction.AbstractSmartJTablePaneAction; +import com.fr.design.cell.smartaction.SmartJTablePane; +import com.fr.design.cell.smartaction.SmartJTablePaneAction; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.BasicPane; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.editor.ValueEditorPaneFactory; +import com.fr.design.gui.controlpane.NameObjectCreator; +import com.fr.design.gui.controlpane.NameableCreator; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UIBasicSpinner; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.ElementCasePane; +import com.fr.design.mainframe.JTemplate; +import com.fr.design.mainframe.JWorkBook; +import com.fr.design.selection.SelectionEvent; +import com.fr.design.selection.SelectionListener; +import com.fr.design.write.submit.CustomSubmitJobPane; +import com.fr.design.write.submit.SmartInsertDMLJobPane; +import com.fr.design.write.submit.SubmitJobListPane; +import com.fr.general.Inter; +import com.fr.grid.selection.CellSelection; +import com.fr.grid.selection.FloatSelection; +import com.fr.grid.selection.Selection; +import com.fr.stable.ColumnRow; +import com.fr.stable.ColumnRowGroup; +import com.fr.write.DMLConfigJob; + +import javax.swing.*; +import javax.swing.table.DefaultTableCellRenderer; +import javax.swing.table.TableCellRenderer; +import javax.swing.table.TableColumn; +import java.awt.*; +import java.awt.event.ActionEvent; + +/** + * Created by loy on 16/8/16. + */ +public class SmartInsertBatchSubmitPane extends BatchSubmitPane { + private static final Selection NO_SELECTION = new CellSelection(-1, -1, -1, -1); + private ElementCasePane ePane; + private static int CELL_GROUP_LIMIT = 6; + + public SmartInsertBatchSubmitPane(ElementCasePane ePane) { + super(ValueEditorPaneFactory.extendedCellGroupEditors()); + this.ePane = ePane; + } + + public SmartInsertBatchSubmitPane() { + super(ValueEditorPaneFactory.extendedCellGroupEditors()); + JTemplate jTemplate = DesignerContext.getDesignerFrame().getSelectedJTemplate(); + this.ePane = ((JWorkBook) jTemplate).getEditingElementCasePane(); + } + + @Override + protected SubmitJobListPane createSubmitJobListPane() { + return new SmartInsertSubmitJobListPane(); + } + + class SmartInsertSubmitJobListPane extends SubmitJobListPane { + + public SmartInsertSubmitJobListPane() { + super(ePane); + } + + public void hideParentDialog() { + hideDialog4AddCellAction(); + } + + public void showParentDialog() { + showDialogAfterAddCellAction(); + } + + @Override + public NameableCreator[] createNameableCreators() { + return new NameableCreator[] { + new NameObjectCreator(Inter.getLocText(new String[]{"Submit", "Event"}), + "/com/fr/web/images/reportlet.png", + DMLConfigJob.class, + SmartInsertDMLJobPane.class), + new NameObjectCreator(Inter.getLocText(new String[]{"Custom", "Event"}), + "/com/fr/web/images/reportlet.png", + ClassSubmitJob.class, + CustomSubmitJobPane.class) }; + } + } + + @Override + protected UpdateAction[] getActions() { + return new UpdateAction[] { + new BatchSubmitPane.SmartAddFieldsAction(), + new BatchSubmitPane.AddFieldAction(), + new SmartAddCellAction(), + new SmartAddCellGroupAction(), + new BatchModCellAction(), + new BatchSubmitPane.RemoveFieldAction() + }; + } + + public class BatchModCellAction extends UpdateAction { + public BatchModCellAction() { + this.setName(Inter.getLocText("RWA-Batch_Modify_Cells")); + } + + /** + * 执行事件 + * @param evt 事件对象 + */ + public void actionPerformed(ActionEvent evt) { + BasicPane bPane = new BasicPane() { + @Override + protected String title4PopupWindow() { + return Inter.getLocText("RWA-Batch_Modify_Cells"); + } + }; + bPane.setLayout(FRGUIPaneFactory.createBorderLayout()); + bPane.setBorder(BorderFactory.createEmptyBorder(30, 0, 0, 0)); + final UIBasicSpinner columnSpinner = new UIBasicSpinner(); + final UIBasicSpinner rowSpinner = new UIBasicSpinner(); + Component[][] coms = new Component[][] { { new UILabel(Inter.getLocText("RWA-Row_Offset")), rowSpinner },{ new UILabel(Inter.getLocText("RWA-Column_Offset")), columnSpinner } }; + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + bPane.add(TableLayoutHelper.createTableLayoutPane(coms, new double[]{p, p}, new double[]{p, f}), BorderLayout.NORTH); + BasicDialog dlg = bPane.showSmallWindow(SwingUtilities.getWindowAncestor(SmartInsertBatchSubmitPane.this), new DialogActionAdapter() { + public void doOk() { + int row_offset = ((Number)rowSpinner.getValue()).intValue(); + int column_offset = ((Number)columnSpinner.getValue()).intValue(); + BatchSubmitPane.KeyColumnTableModel model = (BatchSubmitPane.KeyColumnTableModel)keyColumnValuesTable.getModel(); + int[] selectedRows = keyColumnValuesTable.getSelectedRows(); + // 如果一行都没选中,取所有的行 + if (selectedRows.length == 0) { + selectedRows = IntList.range(model.getRowCount()); + } + for (int i = 0; i < selectedRows.length; i++) { + int row = selectedRows[i]; + BatchSubmitPane.KeyColumnNameValue kcnv = model.getKeyColumnNameValue(row); + if (kcnv.cv.obj instanceof ColumnRow) { + ColumnRow or = (ColumnRow)kcnv.cv.obj; + int n_column = or.getColumn() + column_offset; + if (n_column < 0) { + n_column = 0; + } + int n_row = or.getRow() + row_offset; + if (n_row < 0) { + n_row = 0; + } + kcnv.cv.obj = ColumnRow.valueOf(n_column, n_row); + } + } + model.fireTableDataChanged(); + keyColumnValuesTable.validate(); + for (int i = 0; i < selectedRows.length; i++) { + keyColumnValuesTable.addRowSelectionInterval(selectedRows[i], selectedRows[i]); + } + } + }); + dlg.setVisible(true); + } + } + + public class SmartAddCellAction extends UpdateAction { + public SmartAddCellAction() { + this.setName(Inter.getLocText("RWA-Smart_Add_Cells")); + } + + /** + * 执行事件 + * @param evt 事件s + */ + public void actionPerformed(ActionEvent evt) { + + // Grid.GridSelectionListener + if (ePane == null) { + return; + } + + /* + * 布局 + */ + BasicPane bPane = new SmartJTablePane4DB(keyColumnValuesTable.getTableModel4SmartAddCell(), ePane); + + // ReportWriteAttrDialog.this.setVisible(false); + hideDialog4AddCellAction(); + /* + * 当前的ReportPane不可编辑,不可切换Sheet,加GridSelectionChangeListener + */ + ePane.setSelection(NO_SELECTION); + ePane.setEditable(false); + ePane.getGrid().setNotShowingTableSelectPane(false); + + BasicDialog dlg = bPane.showWindow(SwingUtilities.getWindowAncestor(SmartInsertBatchSubmitPane.this)); + + dlg.setModal(false); + dlg.setVisible(true); + } + } + + public class SmartAddCellGroupAction extends UpdateAction { + public SmartAddCellGroupAction() { + this.setName(Inter.getLocText("RWA-Smart_Add_Cell_Group")); + } + + /** + * 智能添加单元格组 + * @param e 事件s + */ + public void actionPerformed(ActionEvent e) { + if (ePane == null) { + return; + } + + BasicPane bPane = new SmartJTablePane4DB(keyColumnValuesTable.getTableModel4SmartAddCell(), ePane, true); + + // ReportWriteAttrDialog.this.setVisible(false); + hideDialog4AddCellAction(); + /* + * 当前的ReportPane不可编辑,不可切换Sheet,加GridSelectionChangeListener + */ + ePane.setSelection(NO_SELECTION); + ePane.setEditable(false); + ePane.getGrid().setNotShowingTableSelectPane(false); + + BasicDialog dlg = bPane.showWindow(SwingUtilities.getWindowAncestor(SmartInsertBatchSubmitPane.this)); + + dlg.setModal(false); + dlg.setVisible(true); + } + } + + private void showDialogAfterAddCellAction() { + Container dialog = this; + if (parentPane != null && parentPane.getContentDBManiPane() instanceof SmartInsertBatchSubmitPane && parentPane.getContentDBManiPane() != this) { + ((SmartInsertBatchSubmitPane)parentPane.getContentDBManiPane()).showDialogAfterAddCellAction(); + } + while (dialog.getParent() != null) { + dialog = dialog.getParent(); + if (dialog instanceof SmartInsertSubmitJobListPane) { + ((SmartInsertSubmitJobListPane)dialog).showParentDialog(); + } else if (dialog instanceof Dialog) { + dialog.setVisible(true); + } + } + } + + private void hideDialog4AddCellAction() { + Container dialog = this; + if (parentPane != null && parentPane.getContentDBManiPane() instanceof SmartInsertBatchSubmitPane && parentPane.getContentDBManiPane() != this) { + ((SmartInsertBatchSubmitPane)parentPane.getContentDBManiPane()).hideDialog4AddCellAction(); + } + while (dialog.getParent() != null) { + dialog = dialog.getParent(); + if (dialog instanceof SmartInsertSubmitJobListPane) { + ((SmartInsertSubmitJobListPane)dialog).hideParentDialog(); + } else if (dialog instanceof Dialog) { + // 条件属性中添加的控件的话有两层dialog,需要都隐藏 + dialog.setVisible(false); + } + } + } + + /** + * 检测是否合法 + * @throws Exception + */ + public void checkValid() throws Exception { + BatchSubmitPane.KeyColumnTableModel model = (BatchSubmitPane.KeyColumnTableModel)keyColumnValuesTable.getModel(); + int cnt = model.getRowCount(); + int groupLength = -1; + for (int i=0; i= model.getRowCount()) { + return; + } + BatchSubmitPane.KeyColumnNameValue kcv = model.getKeyColumnNameValue(editingRowIndex); + ElementCasePane currentReportPane = (ElementCasePane)e.getSource(); + Selection selection = currentReportPane.getSelection(); + if (selection == NO_SELECTION || selection instanceof FloatSelection) { + return; + } + CellSelection cellselection = (CellSelection)selection; + kcv.cv.obj = ColumnRow.valueOf(cellselection.getColumn(), cellselection.getRow()); + + if (editingRowIndex >= model.getRowCount() - 1) { + setEditingRowIndex(0); + } else { + setEditingRowIndex(editingRowIndex + 1); + } + + model.fireTableDataChanged(); + + } + + }; + + /** + * 单元格组的点选格子事件 + */ + private SelectionListener groupListener = new SelectionListener() { + @Override + public void selectionChanged(SelectionEvent e) { + BatchSubmitPane.KeyColumnTableModel model = (BatchSubmitPane.KeyColumnTableModel)table.getModel(); + if (editingRowIndex < 0 || editingRowIndex >= model.getRowCount()) { + return; + } + BatchSubmitPane.KeyColumnNameValue kcv = model.getKeyColumnNameValue(editingRowIndex); + ElementCasePane currentReportPane = (ElementCasePane)e.getSource(); + Selection selection = currentReportPane.getSelection(); + if (selection == NO_SELECTION || selection instanceof FloatSelection) { + return; + } + CellSelection cellselection = (CellSelection)selection; + Object oriValue = kcv.cv.obj; + ColumnRowGroup newValue = getColumnRowGroupValue(oriValue); + + // 要考虑多选的情况 要结合之前的看看 可能是增加 也可能需要减少 + ColumnRowGroup add = new ColumnRowGroup(); + int removeCount = 0; + if (oriCellSelection != null && sameStartPoint(cellselection, oriCellSelection)) { + removeCount = dealDragSelection(add, cellselection); + } else if (cellselection.getSelectedType() == CellSelection.CHOOSE_ROW || cellselection.getSelectedType() == CellSelection.CHOOSE_COLUMN) { + dealSelectColRow(add, cellselection); + } else { + add.addColumnRow(ColumnRow.valueOf(cellselection.getColumn(), cellselection.getRow())); + } + + if (add.getSize() > 0) { + newValue.addAll(add); + } else if (removeCount > 0) { + newValue.splice(newValue.getSize()-removeCount, removeCount); + } + + kcv.cv.obj = newValue; + + model.fireTableDataChanged(); + + oriCellSelection = cellselection; + } + + private ColumnRowGroup getColumnRowGroupValue(Object oriValue) { + ColumnRowGroup newValue = new ColumnRowGroup(); + if (oriValue instanceof ColumnRowGroup) { + newValue.addAll((ColumnRowGroup)oriValue); + } else if (oriValue instanceof ColumnRow) { + newValue.addColumnRow((ColumnRow) oriValue); + } + return newValue; + } + + private boolean sameStartPoint(CellSelection cs1, CellSelection cs2) { + return cs1.getColumn() == cs2.getColumn() && cs1.getRow() == cs2.getRow(); + } + + private int dealDragSelection(ColumnRowGroup add, CellSelection cellselection) { + int removeCount = 0; + if (cellselection.getRowSpan() == oriCellSelection.getRowSpan() + 1) { + for (int i=0; i= CELL_GROUP_LIMIT) { + text.setText("[" + Inter.getLocText(new String[]{"Has_Selected", "Classifier-Ge", "Cell"}, + new String[]{((ColumnRowGroup)cv).getSize()+"", ""}) + "]"); + tip = cv.toString() + " " + tip; + } else if (cv != null) { + text.setText(cv.toString()); + } else { + text.setText(""); + } + } + + if (row == SmartJTablePane4DB.this.editingRowIndex) { + pane.setBackground(Color.cyan); + } else { + pane.setBackground(Color.white); + } + + pane.setToolTipText(tip); + pane.add(text); + + return pane; + } + } + + private class ColumnRowGroupCellRenderer2 extends DefaultTableCellRenderer { + @Override + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { + super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); + + String tip = Inter.getLocText("FR-Designer_Double_Click_Edit_OR_Clear"); + + if (value instanceof BatchSubmitPane.ColumnValue) { + Object cv = ((BatchSubmitPane.ColumnValue) value).obj; + if (cv instanceof ColumnRowGroup && ((ColumnRowGroup)cv).getSize() >= CELL_GROUP_LIMIT) { + this.setText("[" + Inter.getLocText(new String[]{"Has_Selected", "Classifier-Ge", "Cell"}, + new String[]{((ColumnRowGroup)cv).getSize()+"", ""}) + "]"); + tip = cv.toString() + " " + tip; + } else if (cv != null) { + this.setText(cv.toString()); + } else { + this.setText(""); + } + } + + this.setToolTipText(tip); + + if (row == SmartJTablePane4DB.this.editingRowIndex) { + this.setBackground(Color.cyan); + } else { + this.setBackground(Color.white); + } + + return this; + } + } + } +} diff --git a/designer/src/com/fr/design/write/submit/batch/service/BatchDBCommitService.java b/designer/src/com/fr/design/write/submit/batch/service/BatchDBCommitService.java new file mode 100644 index 0000000000..01ac8a155b --- /dev/null +++ b/designer/src/com/fr/design/write/submit/batch/service/BatchDBCommitService.java @@ -0,0 +1,288 @@ +package com.fr.design.write.submit.batch.service; + +import com.fr.base.*; +import com.fr.data.NetworkHelper; +import com.fr.data.core.db.DBUtils; +import com.fr.data.impl.NameDatabaseConnection; +import com.fr.design.write.submit.batch.BatchCommit2DBJavaScript; +import com.fr.form.ui.WebContentUtils; +import com.fr.general.xml.GeneralXMLTools; +import com.fr.js.JavaScript; +import com.fr.json.JSONException; +import com.fr.json.JSONFunction; +import com.fr.json.JSONObject; +import com.fr.script.Calculator; +import com.fr.stable.ColumnRow; +import com.fr.stable.ParameterProvider; +import com.fr.stable.StringUtils; +import com.fr.stable.UtilEvalError; +import com.fr.stable.fun.impl.NoSessionIDOPService; +import com.fr.stable.script.NameSpace; +import com.fr.web.RepositoryDeal; +import com.fr.web.core.ReportSessionIDInfor; +import com.fr.web.core.SessionDealWith; +import com.fr.web.core.SessionIDInfor; +import com.fr.web.utils.WebUtils; +import com.fr.write.batch.SubmitMain; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.sql.Connection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +/** + * Created by loy on 16/8/23. + */ +public class BatchDBCommitService extends NoSessionIDOPService { + private static BatchDBCommitService service = null; + + public static final String ARG_XMLCONF = "xmlconf"; + public static final String ARG_SESSIONID = "sessionID"; + + /** + * 构造 + * + * @return + */ + public static BatchDBCommitService getInstance() { + if (service == null) { + service = new BatchDBCommitService(); + } + + return service; + } + + /** + * OP值 + * + * @return 返回OP值 + */ + public String actionOP() { + return "batchcommit"; + } + + private Map sessionMap = new HashMap(); + + /** + * 提交入库请求处理 + * + * @param req 请求 + * @param res 响应 + * @throws Exception 抛出异常 + */ + public void process(HttpServletRequest req, HttpServletResponse res) throws Exception { + String sessionID = WebUtils.getHTTPRequestParameter(req, ARG_SESSIONID); + CountLock lock = getCountLock(sessionID); + try { + synchronized (lock) { + process0(req, res); + } + } finally { + releaseLock(sessionID, lock); + } + + } + + private void releaseLock(String sessionID, CountLock lock) { + synchronized (sessionMap) { + lock.reduce(); + if (lock.getCount() == 0) { + sessionMap.remove(sessionID); + } + } + } + + private CountLock getCountLock(String sessionID) { + CountLock lock; + synchronized (sessionMap) { + lock = (CountLock) sessionMap.get(sessionID); + if (lock == null) { + lock = new CountLock(); + sessionMap.put(sessionID, lock); + } + lock.increase(); + } + return lock; + } + + private void process0(HttpServletRequest req, HttpServletResponse res) throws Exception { + String dbManiXML = NetworkHelper.getHTTPRequestEncodeParameter(req, ARG_XMLCONF, false); + if (dbManiXML != null) { + BatchCommit2DBJavaScript commit2DBJS = (BatchCommit2DBJavaScript) GeneralXMLTools.readStringAsXMLable(dbManiXML); + Calculator ca = Calculator.createCalculator(); + RepositoryDeal repo = prepareRepository(req, ca); + NameSpace ns = ParameterMapNameSpace.create(WebUtils.parameters4SessionIDInfor(req)); + ca.pushNameSpace(ns); + Map feedbackMap = prepareFeedBackMap(req, ca); + boolean success = true; + JSONObject fr_submitinfo = new JSONObject(); + Map connectionMap = new HashMap(); + try { + String location = WebUtils.getHTTPRequestParameter(req, "location"); + ColumnRow cr = ColumnRow.valueOf(location); + for (int i = 0; i < commit2DBJS.getDBManipulation().size(); i++) { + if (cr != ColumnRow.ERROR) { + ca.setCurrentFromColumnRow(cr);// commit的时候, 也会去set关联格子的ColumnRow, 为防止上一个提交对下一个造成影响, 这边每次重置 + } + SubmitMain dbManipulation = (SubmitMain) commit2DBJS.getDBManipulation().get(i); + if (dbManipulation != null && dbManipulation.getDmlConfig() != null) { + String dbName = dbManipulation.getDBName(ca); + Connection conn = createConnection(dbName, connectionMap); + ca.putConnection(dbName, conn); + dbManipulation.doJob(ca); + connectionMap.put(dbName, conn); + } + } + } catch (Exception e) { + FRContext.getLogger().error(e.getMessage(), e); + Iterator iter = connectionMap.entrySet().iterator(); + while (iter.hasNext()) { + DBUtils.rollback((Connection) ((Map.Entry) iter.next()).getValue()); + } + success = false; + fr_submitinfo.put("failinfo", e.getMessage()); + } finally { + DBUtils.commitConnections(connectionMap); + } + ca.removeNameSpace(ns); + JSONObject jo = new JSONObject(); + createJo(req, jo, feedbackMap, success, fr_submitinfo, repo); + java.io.PrintWriter writer = WebUtils.createPrintWriter(res); + writer.write(jo.toString()); + writer.flush(); + writer.close(); + } + } + + private Connection createConnection(String dbName, Map connectionMap) throws Exception { + Connection conn = null; + if (connectionMap.containsKey(dbName)) { + return connectionMap.get(dbName); + } else { + NameDatabaseConnection db = new NameDatabaseConnection(dbName); + return db.createConnection(); + } + } + + private RepositoryDeal prepareRepository(HttpServletRequest req, Calculator ca) { + String sessionID = WebUtils.getHTTPRequestParameter(req, ARG_SESSIONID); + SessionIDInfor sessionIDInfor = SessionDealWith.getSessionIDInfor(sessionID); + + RepositoryDeal repo = null; + if (sessionIDInfor != null) { + repo = new RepositoryDeal(req, sessionIDInfor); + if (sessionIDInfor instanceof ReportSessionIDInfor) { + dealWithParaForCa(req, ca, (ReportSessionIDInfor) sessionIDInfor); + } + + NameSpace sessionNamespace = sessionIDInfor.asNameSpace(sessionID); + ca.pushNameSpace(sessionNamespace); + } + + return repo; + } + + private Map prepareFeedBackMap(HttpServletRequest req, Calculator ca) { + String feedback = WebUtils.getHTTPRequestParameter(req, "feedbackMap"); + Map feedbackMap = null; + if (StringUtils.isNotEmpty(feedback)) { + try { + feedbackMap = new JSONObject(feedback).toMap(); + } catch (JSONException e) { + FRContext.getLogger().error(e.getMessage()); + } + NameSpace feedbackNS = ParameterMapNameSpace.create(feedbackMap); + ca.pushNameSpace(feedbackNS); + } + + return feedbackMap; + } + + private void dealWithParaForCa(HttpServletRequest req, Calculator ca, ReportSessionIDInfor sessionIDInfor) { + ca.setAttribute(Calculator.SHEET_NUMBER_KEY, WebUtils.getHTTPRequestParameter(req, "sheetNum")); + sessionIDInfor.setUpAttribute4dbCommit(ca); + + // 提交入库可能用当前模板的参数 + NameSpace paras = ParameterMapNameSpace.create(sessionIDInfor.getParameterMap4Execute()); + ca.pushNameSpace(paras); + } + + private void createJo(HttpServletRequest req, JSONObject jo, Map feedbackMap, + boolean success, JSONObject fr_submitinfo, RepositoryDeal repo) throws Exception { + // 生成的时候没有encode的,用没有进行urldecode的方法获取callback语句,防止+和%出错 + String callBackXML = NetworkHelper.getHTTPRequestEncodeParameter(req, "callback", false); + JavaScript callBack = (JavaScript) GeneralXMLTools.readStringAsXMLable(callBackXML); + fr_submitinfo.put("success", success); + + if (callBack != null) { + dealWithSuccessPara(callBack, fr_submitinfo, repo); + if (feedbackMap != null) { + callBack.addParameterMap(feedbackMap); + } + jo.put("callback", new JSONFunction(new String[]{"res"}, callBack.createJS(repo), repo.getDevice())); + } + } + + private void dealWithSuccessPara(JavaScript callBack, JSONObject fr_submitinfo, RepositoryDeal repo) { + Map submitInfo = new HashMap(); + submitInfo.put(WebContentUtils.FR_SUBMITINFO, fr_submitinfo); + if (callBack != null) { + callBack.addParameterMap(submitInfo); + ParameterProvider[] ps = new ParameterProvider[callBack.getParameters().length + 1]; + int len = callBack.getParameters().length; + for (int i = 0; i < len; i++) { + ps[i] = callBack.getParameters()[i]; + } + ps[len] = new Parameter(WebContentUtils.FR_SUBMITINFO, fr_submitinfo); + callBack.setParameters(ps); + } + + // if the parameter contains "fr_submitinfo" then recalculate it + ParameterProvider[] paras; + if (callBack != null) { + paras = callBack.getParameters(); + } else { + paras = new Parameter[0]; + } + Calculator ca = Calculator.createCalculator(); + if (repo != null) { + NameSpace ns = ParameterMapNameSpace.create(repo.getReportParameterMap()); + ca.pushNameSpace(ns); + } + ca.pushNameSpace(ParameterMapNameSpace.create(submitInfo)); + + for (int i = 0; i < paras.length; i++) { + Object obj = paras[i].getValue(); + if (obj instanceof Formula && needToRecalculate(paras[i])) { + try { + ((Formula) obj).setResult(ca.eval((Formula) obj)); + } catch (UtilEvalError utilEvalError) { + + } + } + } + } + + private boolean needToRecalculate(ParameterProvider p) { + return Utils.objectToString(p.getValue()).toLowerCase().indexOf(WebContentUtils.FR_SUBMITINFO) != -1; + } +} + + +class CountLock { + private int count; + + public void increase() { + count++; + } + + public void reduce() { + count--; + } + + public int getCount() { + return count; + } +} From 07156f69ac5b9be63153eb744443d222c2406a22 Mon Sep 17 00:00:00 2001 From: ju Date: Fri, 8 Dec 2017 17:37:47 +0800 Subject: [PATCH 11/20] =?UTF-8?q?REPORT-5885=20=E6=8F=92=E4=BB=B6=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E5=8D=B8=E8=BD=BD=E2=80=94=E2=80=94frm=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8=E7=95=8C=E9=9D=A2=E5=9B=BE=E6=A0=87=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E5=AE=9E=E6=97=B6=E5=88=B7=E6=96=B0=20=E4=B8=8D=E5=BA=94?= =?UTF-8?q?=E8=AF=A5=E6=98=AF=E5=9C=A8=E4=B8=94=E7=8E=AF=E5=A2=83=E6=97=B6?= =?UTF-8?q?=E5=88=B7=E6=96=B0=E5=BD=93=E5=89=8D=E7=9A=84=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=EF=BC=8C=E8=80=8C=E6=98=AF=E5=9C=A8=E5=8C=85=E5=90=AB=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8=E7=9A=84=E6=8F=92=E4=BB=B6=E5=8F=98=E5=8A=A8=E6=97=B6?= =?UTF-8?q?=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/ChartTypeInterfaceManager.java | 21 +++++++++++++++++-- .../design/mainframe/FormParaWidgetPane.java | 10 ++++++--- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index d11733e0c9..5aa68bc63a 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -81,8 +81,12 @@ import com.fr.plugin.chart.treemap.VanChartTreeMapPlot; import com.fr.plugin.chart.vanchart.imgevent.design.DesignImageEvent; import com.fr.plugin.chart.wordcloud.VanChartWordCloudPlot; import com.fr.plugin.chart.wordcloud.designer.WordCloudIndependentVanChartInterface; +import com.fr.plugin.context.PluginContext; import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.injectable.PluginSingleInjection; +import com.fr.plugin.manage.PluginFilter; +import com.fr.plugin.observer.PluginEvent; +import com.fr.plugin.observer.PluginEventListener; import com.fr.plugin.solution.closeable.CloseableContainedMap; import com.fr.stable.ArrayUtils; import com.fr.stable.EnvChangedListener; @@ -125,12 +129,25 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr GeneralContext.addEnvChangedListener(new EnvChangedListener() { @Override public void envChanged() { - //重新注册designModuleFactory - DesignModuleFactory.registerExtraWidgetOptions(initWidgetOption()); DesignImageEvent.registerDefaultCallbackEvent(HistoryTemplateListPane.getInstance()); DesignImageEvent.registerDownloadSourcesEvent(new DownloadOnlineSourcesHelper()); } }); + GeneralContext.listenPluginRunningChanged(new PluginEventListener(1) { + + @Override + public void on(PluginEvent event) { + //重新注册designModuleFactory + DesignModuleFactory.registerExtraWidgetOptions(initWidgetOption()); + } + }, new PluginFilter() { + + @Override + public boolean accept(PluginContext context) { + //图表插件变化时 + return context.contain(PluginModule.ExtraChartType); + } + }); } private static WidgetOption[] initWidgetOption() { diff --git a/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java b/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java index d28233d051..25c71bd32f 100644 --- a/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java @@ -16,7 +16,11 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.module.DesignModuleFactory; import com.fr.design.utils.gui.LayoutUtils; -import com.fr.form.ui.*; +import com.fr.form.ui.UserDefinedWidgetConfig; +import com.fr.form.ui.Widget; +import com.fr.form.ui.WidgetConfig; +import com.fr.form.ui.WidgetManager; +import com.fr.form.ui.WidgetManagerProvider; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; import com.fr.general.Inter; @@ -83,8 +87,8 @@ public class FormParaWidgetPane extends JPanel { @Override public boolean accept(PluginContext context) { - - return context.contain(PluginModule.ExtraDesign, FormWidgetOptionProvider.XML_TAG); + + return context.contain(PluginModule.ExtraDesign, FormWidgetOptionProvider.XML_TAG) || context.contain(PluginModule.ExtraChartType); } }); } From dbcf42a4ec911a3f03c8a30a13f6a031954189de Mon Sep 17 00:00:00 2001 From: mengao <283296419@qq.com> Date: Mon, 11 Dec 2017 18:57:03 +0800 Subject: [PATCH 12/20] =?UTF-8?q?=E5=9B=BE=E7=89=87=E6=98=AF=E5=9C=A8?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E6=97=B6=E7=94=A8=E7=9A=84=EF=BC=8C=E6=94=BE?= =?UTF-8?q?=E5=9C=A8chart=E6=A8=A1=E5=9D=97=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/plugin/chart/map/images/marker-icon.png | Bin 1466 -> 0 bytes .../fr/plugin/chart/map/images/marker-iconx2.png | Bin 1845 -> 0 bytes .../com/fr/plugin/chart/map/images/point-map.png | Bin 1294 -> 0 bytes .../src/com/fr/plugin/chart/map/images/point.png | Bin 336 -> 0 bytes 4 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 designer_chart/src/com/fr/plugin/chart/map/images/marker-icon.png delete mode 100644 designer_chart/src/com/fr/plugin/chart/map/images/marker-iconx2.png delete mode 100644 designer_chart/src/com/fr/plugin/chart/map/images/point-map.png delete mode 100644 designer_chart/src/com/fr/plugin/chart/map/images/point.png diff --git a/designer_chart/src/com/fr/plugin/chart/map/images/marker-icon.png b/designer_chart/src/com/fr/plugin/chart/map/images/marker-icon.png deleted file mode 100644 index 950edf24677ded147df13b26f91baa2b0fa70513..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1466 zcmV;r1x5OaP)P001cn1^@s6z>|W`000GnNklGNuHDcIX17Zdjl&3`L?0sTjIws<{((Dh&g-s0<@jYQyl?D*X^?%13;ml^gy> ziMrY_^1WI=(g@LMizu=zCoA>C`6|QEq1eV92k*7m>G65*&@&6)aC&e}G zI)pf-Za|N`DT&Cn1J|o`19mumxW~hiKiKyc-P`S@q)rdTo84@QI@;0yXrG%9uhI>A zG5QHb6s4=<6xy{1 z@NMxEkryp{LS44%z$3lP^cX!9+2-;CTt3wM4(k*#C{aiIiLuB>jJj;KPhPzIC00bL zU3a#;aJld94lCW=`4&aAy8M7PY=HQ>O%$YEP4c4UY#CRxfgbE~(|uiI=YS8q;O9y6 zmIkXzR`}p7ti|PrM3a}WMnR=3NVnWdAAR>b9X@)DKL6=YsvmH%?I24wdq?Gh54_;# z$?_LvgjEdspdQlft#4CQ z`2Zyvy?*)N1Ftw|{_hakhG9WjS?Az@I@+IZ8JbWewR!XUK4&6346+d#~gsE0SY(LX8&JfY>Aj)RxGy96nwhs2rv zzW6pTnMpFkDSkT*a*6Dx|u@ds6ISVn0@^RmIsKZ5Y;bazbc;tTSq(kg(=481ODrPyNB6n z-$+U}(w$m6U6H$w17Bw+wDaFIe~GvNMYvnw31MpY0eQKT9l>SU``8k7w4)z!GZKMI z#_cEKq7k~i%nlK@6c-K?+R;B#5$?T#YpKD`t_4bAs^#E+@5QW$@OX3*`;(#{U^d-vY)&xEE>n5lYl&T?Am+~P){n@MTvZf4_r7J`do#(jP12^;)(x!+mQw5@qJIPzD)`GEZiq?+Q9+~>3#~QS zx^K`bF2x0Z2vU_|MZ`a%C{2rPDbx*GZQ3Lz%{0l(y#3vKJ?D)XXVOVBBjT^QaCkHK z-gCZtw(q{jlv2>_Sljny7h`OR;;NfTHf9=X_}k65oM}dv%>}e>`xna@==U*DcjMkA zT;smZxlE+wQb?OIJ^~6pl1ja||H+$=whXj(<2#(?mu_NA^>yZQ%E>wz$F{-Hcy*7E z0=yssx9mler6MRPpI619r}|&oAe#bO)Az;28iS8b)4aTQ(W0zw=nx4BiBJ$rg#ZdP z&cHy?aifXgQp7McJnBYKd;&vz`~EHKf1MR*?Y6x)0q1+?&zr}4x)&H;q`->=%$3Qk zsexlMC=|w%!uYrVDevg-yX~`vK$L8d(ed-nTaveI2PT6A64`vQ=;&eI(jf?a7&<-Z zYJxBSVf(Fvw8rapis*yRj+|v#HWbPc#EHbXt2zM+8-w&YeU0{$o@H8)@9fkC7avZU zt^%#uvga<1s~fty7iA`V0it5FDu&KszGFgH&V+nMOP}ds*5)~(t4 z$%bm^uI}6C@F*NxeEu>lD;r7}vf9ys;jlCb#j|IiR4zjlCtzZM4D?W)w>k;Sx^c^Rc{i37j|Sp!#GQ{p8_!^Ruf2wF_tyOLCJLttfb*#*l@#@aPRe( zSJy7+?tsVFuY~1`=fMm64nz0SOF@g#3Gt6U*~{1#Byn+dnj@vy^@f?XBTBx4s^~fc zuUv$@$>E;smN%@l^{Xy~3m0U;oj9BJQ>{MPBfDh3QVdG1%UBLpjl%MWs_2SC7zVKV zk{;lU%~;mgT-FN-mNf0D)hByom+YsZlQMBCl!9eCohh*6vz9(<|JayEkXQ_- z#@LS~SWX^(8y<&me>&9=yH z6}mQ3FzA@j+7c~#*yVWI&R!E<{rnI-v*&y0o!<$g6J@MQY}%fSz|7`htQ13SdJWE3?Ma)hj^a^r86ArP=_U>#i2~5ELAjAhy(l7+OsC$w zt%G#O)a2;NgGXMwe{GfPl#E|06^48Zxr+hR#hMaJ#)c;%7!NcEST22zU{r{Dq^jRf z`edg#b~?b5J(o8B6i}k;dm#?6NG9!!felzgC$%F;1WcpChUJcSKqO(wHu>H<_CEH? z0}(dV8}7u2ZyQ=&nYJQR{8%mw`b^3fr>^z7`$#cuXIL8JGW3w+Gz=%SES9c8y|5(h6t(u@6))TMf^*6uk#bPBBb7rerN?_~Jj&DmUTD7Ws|?>@rr`0mg! zD?D|@tAB+4(>$$X*KJPs{~MsRWHb71DWdVnEnu#+x+0+5(7X`QSjN=epUuvkKq*%# zxk*e81ax}ND=#4QB!;GWrsU>EpDHZ@rKM|WAK?qkP~wfIUZiiL!~*UJz1R%V`dl`e z0;1F62iX&{G#KE01{thEddl*tkTbP$E^nIpw5)E#++X#`+sE|IWmkZ+2$cJ$5~WkW z9NqcgmCfikyYFOMn3YHaqo$`;aXE00000NkvXXu0mjfKKYD0 diff --git a/designer_chart/src/com/fr/plugin/chart/map/images/point-map.png b/designer_chart/src/com/fr/plugin/chart/map/images/point-map.png deleted file mode 100644 index 9c77308d26ffbcecb97078913e6a1888a01746fc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1294 zcmV+p1@ZccP)400009a7bBm000XU z000XU0RWnu7ytkO8FWQhbW?9;ba!ELWdK2BZ(?O2No`?gWm08fWO;GPWjp`?1e-}j zK~#9!?3(*;+f)?CZ*1q;JnW{}fh{!cprc|fYY_vfnh@IG9sw6rB5G@*Gli5)+&v!Qh~PU6H#Z=ff#BKbPU z{`h;(x#wI3n~yA=0Zp_$HWJLN1;9k`N;7W@5b!^-9nc-n9ZqCD#2$=V zy;g$=A~_cjlf%4#X<`cm(sva1GB1URU?Fj$}foPc{fg_U)W+R_CPocrWA>?z#H^B1MAu88oZ>cj=_Oc)W$$X$x@l4{Sa3`F z@ZRvkuQ76r;gK!DW@&%A2%L>A7K?`>#KX!+9#aep{PuaxN< z&uO>Az;T>rOQw^+<1ch>d^@{pKUI$-yGi)%wSCE3=`^H`H$mXp*L~@E6DFkU@iW>( zPe8wwvdcxr4|=jc)%tsfNw|B|M+KkPOL!So?u!hvS&UPZ%(@x)n zMa_nR%Br3`K>dIrA`OF@niUMC%;zQk*w;bL24a?~Hp@JAZmM22S?LoN)<8r$Qep<= zM5^(i27{g(AIMz%`>1oZ-b)5rht1%N~+FOq2{!IH&ath zD+5llzm$b+IH=UZ3F8CIca>sQQgfmf6)&;VV2KaHvBTi+c1p2IPb-bPZS0I%HRbrb z#7-5zq1j52?ew59sif+Oe)_ChC4Xk;q_m^1bZrXgey=^YpDbM65}P*Wnp!odxdqjb zO#_wf?L)e+|E=or{=%1P6OWqdx-FnjdMt^}s;X5}p0d>@o^1t{?cEW>g@05%)<>OH zt0t6{Q7PL?>N7qUbtOgV@IE)Url#Vlv`#_=D%*QU%onJk diff --git a/designer_chart/src/com/fr/plugin/chart/map/images/point.png b/designer_chart/src/com/fr/plugin/chart/map/images/point.png deleted file mode 100644 index 4e7cd2a68d8b5959cbe67bc5370651df88915282..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 336 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9GG!XV7ZFl&wkP*AeO zHKHUqKdq!Zu_%?nF(p4KRlzeiF+DXXH8G{K@MNkDP|;ma7srr_TS*BD3~|=8xE@SS zKeBKkL&xVviDf^T1@ajlIbHm_-2QUSq0qF-D1eV+s$T-0~gF$#!Q=QE$$pw0| z`meG&+!k%PQfqQs&FN*8%6kKc*h0o5364S`4x4$O+-D6qtnaXwjhWA(hHs-w}J7bk#%>FLu6bbzwWipsKq-f?!PC{xWt~$(6965NbyolY From 8c13f7b3b14ae0c7e1ba21a3e82bf848f556e03c Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Tue, 12 Dec 2017 16:10:56 +0800 Subject: [PATCH 13/20] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=EF=BC=8C8?= =?UTF-8?q?=20->=209?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/present/BarCodePane.java | 56 +++++++++++-------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/designer/src/com/fr/design/present/BarCodePane.java b/designer/src/com/fr/design/present/BarCodePane.java index 04a9667860..2c10de3f80 100644 --- a/designer/src/com/fr/design/present/BarCodePane.java +++ b/designer/src/com/fr/design/present/BarCodePane.java @@ -8,7 +8,6 @@ import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBoxRenderer; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.ispinner.UIBasicSpinner; import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.itextfield.UINumberField; import com.fr.design.layout.FRGUIPaneFactory; @@ -22,11 +21,18 @@ import com.fr.report.cell.painter.barcode.BarcodeImpl; import com.fr.report.cell.painter.barcode.core.BarCodeUtils; import com.fr.stable.pinyin.ChineseHelper; -import javax.swing.*; +import javax.swing.JList; +import javax.swing.JPanel; import javax.swing.border.TitledBorder; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.awt.font.FontRenderContext; @@ -49,10 +55,10 @@ public class BarCodePane extends FurtherBasicBeanPane { private UIComboBox typeComboBox; private UISpinner barWidthSpinner; private UISpinner barHeightSpinner; - private UISpinner RCodesizespinner; + private UISpinner sizeSpinner; private UICheckBox drawingTextCheckBox; - private UIComboBox RCodeVersionComboBox; - private UIComboBox RCodeErrorCorrectComboBox; + private UIComboBox versionComboBox; + private UIComboBox errorCorrectComboBox; private UILabel typeSetLabel; private String testText = "12345"; @@ -74,9 +80,9 @@ public class BarCodePane extends FurtherBasicBeanPane { borderPane.add(barCodePreviewPane, BorderLayout.CENTER); setTypeComboBox(); setSome(); - RCodesizespinner = new UISpinner(1,6,1,2); - RCodeVersionComboBox = new UIComboBox(); - RCodeErrorCorrectComboBox = new UIComboBox(); + sizeSpinner = new UISpinner(1,6,1,2); + versionComboBox = new UIComboBox(); + errorCorrectComboBox = new UIComboBox(); typeSetLabel = new UILabel(Inter.getLocText("FR-Designer_Type_Set"), UILabel.LEFT); initVersionComboBox(); initErrorCorrectComboBox(); @@ -170,13 +176,13 @@ public class BarCodePane extends FurtherBasicBeanPane { int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}}; UILabel uiLabel = new UILabel(Inter.getLocText("RCodeVersion"), UILabel.LEFT); uiLabel.setPreferredSize(typeSetLabel.getPreferredSize()); - RCodeVersionComboBox.setPreferredSize(new Dimension(155,20)); - RCodeErrorCorrectComboBox.setPreferredSize(new Dimension(155,20)); - RCodesizespinner.setPreferredSize(new Dimension(155,20)); + versionComboBox.setPreferredSize(new Dimension(155,20)); + errorCorrectComboBox.setPreferredSize(new Dimension(155,20)); + sizeSpinner.setPreferredSize(new Dimension(155,20)); Component[][] components_special = new Component[][]{ - new Component[]{uiLabel, RCodeVersionComboBox}, - new Component[]{new UILabel(Inter.getLocText("RCodeErrorCorrect"), UILabel.LEFT), RCodeErrorCorrectComboBox}, - new Component[]{new UILabel(Inter.getLocText("RCodeDrawPix"), UILabel.LEFT), RCodesizespinner} + new Component[]{uiLabel, versionComboBox}, + new Component[]{new UILabel(Inter.getLocText("RCodeErrorCorrect"), UILabel.LEFT), errorCorrectComboBox}, + new Component[]{new UILabel(Inter.getLocText("RCodeDrawPix"), UILabel.LEFT), sizeSpinner} }; JPanel specialPane = TableLayoutHelper.createGapTableLayoutPane(components_special, rowSize, columnSize, rowCount, LayoutConstants.VGAP_HUGER, LayoutConstants.VGAP_LARGE); @@ -184,17 +190,17 @@ public class BarCodePane extends FurtherBasicBeanPane { } private void addlistener() { - RCodesizespinner.addChangeListener(new ChangeListener() { + sizeSpinner.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { repaintPreviewBarCode(); } }); - RCodeVersionComboBox.addItemListener(new ItemListener() { + versionComboBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { repaintPreviewBarCode(); } }); - RCodeErrorCorrectComboBox.addItemListener(new ItemListener() { + errorCorrectComboBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { repaintPreviewBarCode(); } @@ -227,12 +233,12 @@ public class BarCodePane extends FurtherBasicBeanPane { private void initVersionComboBox() { String[] array = {Inter.getLocText(new String[]{"Auto", "Choose"}), "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16"}; - initcombobox(this.RCodeVersionComboBox, array, 0); + initcombobox(this.versionComboBox, array, 0); } private void initErrorCorrectComboBox() { String[] array = {"L" + Inter.getLocText("Level") + "7%", "M" + Inter.getLocText("Level") + "15%", "Q" + Inter.getLocText("Level") + "25%", "H" + Inter.getLocText("Level") + "30%"}; - initcombobox(this.RCodeErrorCorrectComboBox, array, 1); + initcombobox(this.errorCorrectComboBox, array, 1); } private void initcombobox(UIComboBox combobox, String[] array, int index) { @@ -270,10 +276,12 @@ public class BarCodePane extends FurtherBasicBeanPane { } this.setTestText(BarCodeUtils.getTestTextByBarCode(barcodeAttr.getType())); this.typeComboBox.setSelectedIndex(barcodeAttr.getType()); + this.versionComboBox.setSelectedIndex(barcodeAttr.getRCodeVersion()); + this.errorCorrectComboBox.setSelectedIndex(barcodeAttr.getRCodeErrorCorrect()); this.barWidthSpinner.setValue(new Double(barcodeAttr.getBarWidth()) * 10); this.barHeightSpinner.setValue(new Integer(barcodeAttr.getBarHeight())); this.drawingTextCheckBox.setSelected(barcodeAttr.isDrawingText()); - this.RCodesizespinner.setValue(new Integer(barcodeAttr.getRcodeDrawPix())); + this.sizeSpinner.setValue(new Integer(barcodeAttr.getRcodeDrawPix())); this.repaintPreviewBarCode(); } @@ -281,9 +289,9 @@ public class BarCodePane extends FurtherBasicBeanPane { public BarcodePresent updateBean() { BarcodeAttr barcodeAttr = new BarcodeAttr(); if ((typeComboBox.getSelectedIndex() == NUM16)) { - barcodeAttr.setRCodeVersion(this.RCodeVersionComboBox.getSelectedIndex()); - barcodeAttr.setRCodeErrorCorrect(this.RCodeErrorCorrectComboBox.getSelectedIndex()); - barcodeAttr.setRcodeDrawPix((int) this.RCodesizespinner.getValue()); + barcodeAttr.setRCodeVersion(this.versionComboBox.getSelectedIndex()); + barcodeAttr.setRCodeErrorCorrect(this.errorCorrectComboBox.getSelectedIndex()); + barcodeAttr.setRcodeDrawPix((int) this.sizeSpinner.getValue()); } barcodeAttr.setType(this.typeComboBox.getSelectedIndex()); barcodeAttr.setBarWidth(((Double) this.barWidthSpinner.getValue()).doubleValue() / 10); From d627183a08a6392a80c25853689b935f9c76ca5d Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 12 Dec 2017 16:42:57 +0800 Subject: [PATCH 14/20] =?UTF-8?q?REPORT-5945=20=E8=A1=A8=E5=8D=95=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E5=88=B0=E7=BB=9D=E5=AF=B9=E5=B8=83=E5=B1=80=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E7=BB=84=E4=BB=B6=E7=BC=A9=E6=94=BE=E9=87=8D=E7=BD=AE?= =?UTF-8?q?=E4=B8=BA=E5=8F=8C=E5=90=91=E8=87=AA=E9=80=82=E5=BA=94=3D>9.0?= =?UTF-8?q?=E5=9B=A0=E4=BB=A3=E7=A0=81=E7=BB=93=E6=9E=84=E5=8F=98=E5=8A=A8?= =?UTF-8?q?=EF=BC=8C=E5=88=87=E6=8D=A2=E4=B8=8D=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer_form/src/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java b/designer_form/src/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java index 246bcb7f15..c11ad24691 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java @@ -100,6 +100,7 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane { } if (layoutType == WBodyLayoutType.ABSOLUTE) { + ((XWFitLayout)creator.getBackupParent()).toData().resetStyle(); if (state == WBodyLayoutType.FIT.getTypeValue()) { switch2FitBodyLayout(); } From caea2b6275afecd5f005811af68012e6d806ab00 Mon Sep 17 00:00:00 2001 From: mengao <283296419@qq.com> Date: Tue, 12 Dec 2017 17:02:11 +0800 Subject: [PATCH 15/20] =?UTF-8?q?CHART-1844=20=20=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/condition/ConditionAttributesPane.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/designer_base/src/com/fr/design/condition/ConditionAttributesPane.java b/designer_base/src/com/fr/design/condition/ConditionAttributesPane.java index 9737856ddf..ed7d472231 100644 --- a/designer_base/src/com/fr/design/condition/ConditionAttributesPane.java +++ b/designer_base/src/com/fr/design/condition/ConditionAttributesPane.java @@ -11,10 +11,12 @@ import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.Inter; import javax.swing.*; +import java.awt.*; import java.util.HashMap; import java.util.Iterator; public abstract class ConditionAttributesPane extends BasicBeanPane { + private static final int MIN_HEIGHT = 60; protected CellHighlightAddMenuDef menuDef; protected JPanel selectedItemPane; @@ -61,6 +63,7 @@ public abstract class ConditionAttributesPane extends BasicBeanPane { JScrollPane selectedItemScrollPane = new JScrollPane(); selectedItemScrollPane.setViewportView(selectedItemPane); selectedItemScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + selectedItemScrollPane.setMinimumSize(new Dimension((int) selectedItemScrollPane.getPreferredSize().getWidth(), MIN_HEIGHT)); propertyChangePane.add(selectedItemScrollPane); } From bf73cefa8c4ed83d383bb0b33d970a62b9d25894 Mon Sep 17 00:00:00 2001 From: rinoux Date: Wed, 13 Dec 2017 17:02:54 +0800 Subject: [PATCH 16/20] =?UTF-8?q?REPORT-5942=20=E5=9B=9E=E6=BB=9A=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=EF=BC=8C=E6=94=B9=E6=8F=90=E4=BA=A4=E5=88=B0dev?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../write/submit/SubmitVisitorListPane.java | 10 +- .../batch/BatchCommit2DBJavaScript.java | 170 --- .../batch/BatchCommit2DBJavaScriptPane.java | 186 --- .../submit/batch/BatchCommitTabbedPane.java | 529 -------- .../batch/BatchJavaScriptActionProvider.java | 23 - .../write/submit/batch/BatchSubmitPane.java | 1089 ----------------- .../submit/batch/BatchSubmitProvider.java | 42 - .../batch/SmartInsertBatchSubmitPane.java | 591 --------- .../batch/service/BatchDBCommitService.java | 288 ----- 9 files changed, 4 insertions(+), 2924 deletions(-) delete mode 100644 designer/src/com/fr/design/write/submit/batch/BatchCommit2DBJavaScript.java delete mode 100644 designer/src/com/fr/design/write/submit/batch/BatchCommit2DBJavaScriptPane.java delete mode 100644 designer/src/com/fr/design/write/submit/batch/BatchCommitTabbedPane.java delete mode 100644 designer/src/com/fr/design/write/submit/batch/BatchJavaScriptActionProvider.java delete mode 100644 designer/src/com/fr/design/write/submit/batch/BatchSubmitPane.java delete mode 100644 designer/src/com/fr/design/write/submit/batch/BatchSubmitProvider.java delete mode 100644 designer/src/com/fr/design/write/submit/batch/SmartInsertBatchSubmitPane.java delete mode 100644 designer/src/com/fr/design/write/submit/batch/service/BatchDBCommitService.java diff --git a/designer/src/com/fr/design/write/submit/SubmitVisitorListPane.java b/designer/src/com/fr/design/write/submit/SubmitVisitorListPane.java index 2b18427bdc..8990170030 100644 --- a/designer/src/com/fr/design/write/submit/SubmitVisitorListPane.java +++ b/designer/src/com/fr/design/write/submit/SubmitVisitorListPane.java @@ -13,7 +13,6 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.scrollruler.ModLineBorder; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.design.write.submit.batch.BatchSubmitProvider; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.general.Inter; @@ -69,7 +68,7 @@ public class SubmitVisitorListPane extends ObjectJControlPane { return; } - List nameObjectList = new ArrayList<>(); + List nameObjectList = new ArrayList(); int submiterCount = reportWriteAttr.getSubmitVisitorCount(); for (int i = 0; i < submiterCount; i++) { @@ -170,17 +169,16 @@ public class SubmitVisitorListPane extends ObjectJControlPane { public CustomPane() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); customCardPane = FRGUIPaneFactory.createCardLayout_S_Pane(); - customSubmitPanes = new HashMap<>(); - comboItemsMap = new HashMap<>(); + customSubmitPanes = new HashMap(); + comboItemsMap = new HashMap(); Set providers = ExtraDesignClassManager.getInstance().getArray(SubmitProvider.MARK_STRING); addSubmitPane(new DefaultSubmit()); for (SubmitProvider provider : providers) { addSubmitPane(provider); } - addSubmitPane(BatchSubmitProvider.getInstance()); - configTypes = new ArrayList<>(); + configTypes = new ArrayList(); for (Map.Entry entry : customSubmitPanes.entrySet()) { String key = entry.getKey(); configTypes.add(comboItemsMap.get(key)); diff --git a/designer/src/com/fr/design/write/submit/batch/BatchCommit2DBJavaScript.java b/designer/src/com/fr/design/write/submit/batch/BatchCommit2DBJavaScript.java deleted file mode 100644 index d44a43722d..0000000000 --- a/designer/src/com/fr/design/write/submit/batch/BatchCommit2DBJavaScript.java +++ /dev/null @@ -1,170 +0,0 @@ -package com.fr.design.write.submit.batch; - -import com.fr.general.ComparatorUtils; -import com.fr.general.xml.GeneralXMLTools; -import com.fr.js.AbstractJavaScript; -import com.fr.js.Callback; -import com.fr.js.JavaScript; -import com.fr.js.JavaScriptXMLUtils; -import com.fr.json.JSONObject; -import com.fr.stable.ParameterProvider; -import com.fr.stable.StringUtils; -import com.fr.stable.web.Repository; -import com.fr.stable.xml.XMLPrintWriter; -import com.fr.stable.xml.XMLableReader; -import com.fr.write.batch.SubmitMain; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Created by loy on 16/8/22. - */ -public class BatchCommit2DBJavaScript extends AbstractJavaScript implements Callback { - - public static String RECALCULATE_TAG = "shouldRecalculate"; - - /** - * 回调函数标识 - */ - public static final String CALLBACK = "callback"; - - /** - * 回调参数标识 - */ - public static final String FEEDBACKMAP = "feedbackMap"; - - /** - * javascript所使用的参数 - */ - protected ParameterProvider[] parameters; - //这个MAP里放的是提交过程生成的参数,比如提交入库,在所有回调事件里,都会将其传递进去,以供解析。 - protected Map paraMap = new HashMap(); - - private boolean recalculate; - - private List dbManipulationList = new ArrayList(); - //回调函数 - private JavaScript callBack; - - /** - * 获取数据入库配置信息 - */ - public List getDBManipulation() { - return dbManipulationList; - } - - /** - * 设置数据入库配置信息 - * - * @param dbManipulationList 数据库配置信息 - */ - public void setDBManipulation(List dbManipulationList) { - this.dbManipulationList = dbManipulationList; - } - - /** - * 回调函数,该函数将在主函数执行完毕以后开始执行 - */ - public JavaScript getCallBack() { - return callBack; - } - - /** - * 设置回调函数 - * - * @param callback 回调函数 - */ - public void setCallBack(JavaScript callback) { - this.callBack = callback; - } - - /** - * JS响应 - * - * @param repo 环境 - * @return 返回生成的JS字符串 - */ - public String actionJS(Repository repo) { - String dmlconf = GeneralXMLTools.writeXMLableAsString(this); - if (!this.paraMap.isEmpty() && callBack != null) { - callBack.addParameterMap(paraMap); - } - String js = "var fm = this.options.form;if(fm == null) {fm = new FR.BatchForm()};fm.batchCommit({" + - "xmlconf" + ":" + JSONObject.quote(dmlconf) + - (callBack != null ? "," + CALLBACK + ":" + JSONObject.quote(GeneralXMLTools.writeXMLableAsString(callBack)) : "") + - (this.paraMap.isEmpty() ? "" : "," + FEEDBACKMAP + ":" + new JSONObject(paraMap).toString()) + - "},this)"; - return js; - } - - /** - * 转化为字符串 - * - * @return 返回字符串形式 - */ - public String toString() { - return (dbManipulationList == null) ? StringUtils.EMPTY : dbManipulationList.toString(); - } - - public void writeXML(XMLPrintWriter writer) { - super.writeXML(writer); - - if (this.dbManipulationList != null) { - for (int i = 0; i < dbManipulationList.size(); i++) { - ((SubmitMain) this.dbManipulationList.get(i)).writeXML(writer); - } - - } - - if (this.callBack != null) { - GeneralXMLTools.writeXMLable(writer, this.callBack, JavaScript.XML_TAG); - } - } - - public void readXML(XMLableReader reader) { - super.readXML(reader); - - if (reader.isAttr()) { - dbManipulationList = new ArrayList(); - } else if (reader.isChildNode()) { - String tagName = reader.getTagName(); - if (JavaScript.XML_TAG.equals(tagName)) { - this.callBack = JavaScriptXMLUtils.readJavaScript(reader); - } else { - if ("Attributes".equals(tagName)) { - dbManipulationList.add(new SubmitMain()); - } - if (dbManipulationList.size() > 0) { - ((SubmitMain) dbManipulationList.get(dbManipulationList.size() - 1)).readXML(reader); - } - } - } - - } - - public boolean equals(Object obj) { - return obj instanceof BatchCommit2DBJavaScript - && super.equals(obj) - && ComparatorUtils.equals(((BatchCommit2DBJavaScript) obj).callBack, this.callBack) - && ComparatorUtils.equals(((BatchCommit2DBJavaScript) obj).dbManipulationList, this.dbManipulationList); - } - - public Object clone() throws CloneNotSupportedException { - BatchCommit2DBJavaScript cloned = (BatchCommit2DBJavaScript) super.clone(); - if (this.dbManipulationList != null) { - cloned.dbManipulationList = new ArrayList(); - for (int i = 0; i < this.dbManipulationList.size(); i++) { - cloned.dbManipulationList.add(((SubmitMain) this.dbManipulationList.get(i)).clone()); - } - } - - if (this.callBack != null) { - cloned.callBack = (JavaScript) this.callBack.clone(); - } - - return cloned; - } -} diff --git a/designer/src/com/fr/design/write/submit/batch/BatchCommit2DBJavaScriptPane.java b/designer/src/com/fr/design/write/submit/batch/BatchCommit2DBJavaScriptPane.java deleted file mode 100644 index f451d09078..0000000000 --- a/designer/src/com/fr/design/write/submit/batch/BatchCommit2DBJavaScriptPane.java +++ /dev/null @@ -1,186 +0,0 @@ -package com.fr.design.write.submit.batch; - -import com.fr.design.beans.FurtherBasicBeanPane; -import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.javascript.JavaScriptActionPane; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.general.Inter; -import com.fr.write.batch.SubmitMain; - -import javax.swing.*; -import java.awt.*; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by loy on 16/8/22. - */ -public class BatchCommit2DBJavaScriptPane extends FurtherBasicBeanPane { - private List dbmPaneList = new ArrayList(); - private BatchCommitTabbedPane commitTabbedPane; - private JavaScriptActionPane javaScriptActionPane; - private UIButton addCallbackButton; - - private JPanel cardPane; - private String[] cardNames; - - /** - * 构造函数,控件事件的提交入库面板 - */ - public BatchCommit2DBJavaScriptPane() { - init(null); - } - - // public BatchCommit2DBJavaScriptPane(final JavaScriptActionPane javaScriptActionPane, List dbManipulationPaneList) { - public BatchCommit2DBJavaScriptPane(final JavaScriptActionPane javaScriptActionPane) { -// this.dbmPaneList=dbManipulationPaneList; - init(javaScriptActionPane); - } - - private void init(final JavaScriptActionPane javaScriptActionPane) { - this.dbmPaneList.add(new BatchSubmitPane()); - this.javaScriptActionPane = javaScriptActionPane; - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - commitTabbedPane = new BatchCommitTabbedPane(this, dbmPaneList); - commitTabbedPane.setPreferredSize(new Dimension(commitTabbedPane.getWidth(), 20)); - this.add(commitTabbedPane, BorderLayout.NORTH); - - cardPane = new JPanel(new CardLayout()); - cardNames = new String[dbmPaneList.size()]; - for (int i = 0; i < this.dbmPaneList.size(); i++) { - if (((BatchSubmitPane) this.dbmPaneList.get(i)).getSubMitName() == null) { - cardNames[i] = ""; - } else { - cardNames[i] = ((BatchSubmitPane) this.dbmPaneList.get(i)).getSubMitName(); - } - cardPane.add((BatchSubmitPane) this.dbmPaneList.get(i), cardNames[i]); - } - this.add(cardPane, BorderLayout.CENTER); - - JPanel btPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - this.add(btPane, BorderLayout.SOUTH); - - if (javaScriptActionPane != null) { - addCallbackButton = javaScriptActionPane.createCallButton(); - btPane.add(addCallbackButton); - } - } - - - /** - * 更新DBManipulationPane - */ - public void updateCardPane() { - cardNames = new String[dbmPaneList.size()]; - for (int i = 0; i < this.dbmPaneList.size(); i++) { - if (((BatchSubmitPane) this.dbmPaneList.get(i)).getSubMitName() == null) { - cardNames[i] = ""; - } else { - cardNames[i] = ((BatchSubmitPane) this.dbmPaneList.get(i)).getSubMitName(); - } - cardPane.add((BatchSubmitPane) this.dbmPaneList.get(i), cardNames[i]); - } - CardLayout cardLayout = (CardLayout) cardPane.getLayout(); - cardLayout.show(cardPane, cardNames[commitTabbedPane.getSelectedIndex()]); - } - - public void setList(List list) { - this.dbmPaneList = list; - } - - /** - * 新建DBManipulationPane - * - * @return 新建的DBManipulationPane - */ - public BatchSubmitPane createDBManipulationPane() { - BatchSubmitPane db = new BatchSubmitPane(); -// BatchSubmitPane db = javaScriptActionPane.createDBManipulationPane(); - db.populateBean(null); - dbmPaneList.add(db); - return db; - - } - - /** - * 窗口名称 - * - * @return 返回窗口名称 - */ - public String title4PopupWindow() { - return Inter.getLocText("Performance-plugin_submitbatch_name"); - } - - /** - * 界面重置 - */ - public void reset() { - if (javaScriptActionPane != null) { - this.javaScriptActionPane.setCall(null); - } - //重置后只保留,只留第一个tab - while (dbmPaneList.size() > 1) { - dbmPaneList.remove(1); - } - ((BatchSubmitPane) dbmPaneList.get(0)).populateBean(null); - } - - @Override - /** - * 将JavaBean内的数据输出至界面上 - */ - public void populateBean(BatchCommit2DBJavaScript commit2db) { - if (commit2db == null) { - reset(); - return; - } - //先把原来的list清除,然后再根据传入参数重新add - dbmPaneList.clear(); - if (javaScriptActionPane != null) { - this.javaScriptActionPane.setCall(commit2db.getCallBack()); - } - for (int i = 0; i < commit2db.getDBManipulation().size(); i++) { - BatchSubmitPane dbmp = new BatchSubmitPane(); -// BatchSubmitPane dbmp = javaScriptActionPane.createDBManipulationPane(); - dbmp.populateBean((SubmitMain) commit2db.getDBManipulation().get(i)); - dbmPaneList.add(dbmp); - } - commitTabbedPane.refreshTab(); - } - - /** - * 更新数据层JavaBean - * - * @return 返回JavaBean - */ - public BatchCommit2DBJavaScript updateBean() { - BatchCommit2DBJavaScript commit2dbJavaScript = new BatchCommit2DBJavaScript(); - - List dbmaniList = new ArrayList(); - for (int i = 0; i < this.dbmPaneList.size(); i++) { - BatchSubmitPane dbmpane = (BatchSubmitPane) this.dbmPaneList.get(i); - if (i > dbmPaneList.size() - 1) { - dbmPaneList.add(dbmpane); - } - SubmitMain dbManipulation = dbmpane.updateBean(); - dbmaniList.add(dbManipulation); - } - commit2dbJavaScript.setDBManipulation(dbmaniList); - - if (javaScriptActionPane != null) { - commit2dbJavaScript.setCallBack(this.javaScriptActionPane.getCall()); - } - - return commit2dbJavaScript; - } - - /** - * 判断是否是能接受的数据类型 - * - * @param ob 对象 - * @return 返回是否是能接受的数据类型 - */ - public boolean accept(Object ob) { - return ob instanceof BatchCommit2DBJavaScript; - } -} diff --git a/designer/src/com/fr/design/write/submit/batch/BatchCommitTabbedPane.java b/designer/src/com/fr/design/write/submit/batch/BatchCommitTabbedPane.java deleted file mode 100644 index 4c1bcaddae..0000000000 --- a/designer/src/com/fr/design/write/submit/batch/BatchCommitTabbedPane.java +++ /dev/null @@ -1,529 +0,0 @@ -package com.fr.design.write.submit.batch; - -import com.fr.base.BaseUtils; -import com.fr.design.constants.UIConstants; -import com.fr.design.gui.ibutton.UIButton; -import com.fr.general.ComparatorUtils; -import com.fr.general.Inter; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.*; -import java.awt.geom.*; - -/** - * Created by loy on 16/8/22. - */ -public class BatchCommitTabbedPane extends JComponent implements MouseListener, MouseMotionListener { - private Icon closeIcon = BaseUtils.readIcon("com/fr/design/images/gui/tab_delete.png"); - private static final Icon ADD_NORMAL = BaseUtils.readIcon("com/fr/design/images/gui/tab_add_normal.png"); - private static final Icon ADD_OVER = BaseUtils.readIcon("com/fr/design/images/gui/tab_add_hover.png"); - private static final Icon ADD_CLICK = BaseUtils.readIcon("com/fr/design/images/gui/tab_add_click.png"); - private static final Image DESIGN_IMAGE = BaseUtils.readImage("com/fr/design/images/sheet/left_right_btn.png"); - private static final Icon LEFT_ICON = BaseUtils.createIcon(DESIGN_IMAGE, 0, 0, 14, 14); - private static final Icon RIGHT_ICON = BaseUtils.createIcon(DESIGN_IMAGE, 14, 0, 14, 14); - private static final Icon DISABLED_LEFT_ICON = BaseUtils.createIcon(DESIGN_IMAGE, 0, 14, 14, 14); - private static final Icon DISABLED_RIGHT_ICON = BaseUtils.createIcon(DESIGN_IMAGE, 14, 14, 14, 14); - private Icon addIcon = ADD_NORMAL; - - private static final int TOOLBAR_HEIGHT = 16; // 按钮高度 - private static final int GAP = 5; //间隔 - private static final int SMALLGAP = 3; - - private static final int FIRST_TAB_POSITION = 20; - - - // 左移和右移按钮 - private UIButton leftButton; - private UIButton rightButton; - - private JPanel buttonPane; - - private java.util.List dbManipulationPaneList ; - - private BatchCommit2DBJavaScriptPane commit2DBJavaScriptPane; - - // 能显示的tab个数 - private int showCount = 0; - - //选了30度和60度的特殊角度的x,y作为经过的两个点的坐标 - private double specialLocation1 = 2.5; - private double specialLocation2 = 4.330127; - - private int mouseOveredIndex = -1; - - private int selectedIndex = -1; - - private static final double CORNOR_RADIUS = 5.0; - - - //tab栏可以放下的每个tab的实际宽度 - private int tabWidth = 70; - - - //当前标签页栏存放的所有标签页的index - private int scrollIndex = 0; - private int lastOneIndex = 0; - - //添加标签位置 - private int addX = -1; - private int addY = -1; - - - //各删除标签位置 - private int[] closeIconStartX; - - - public BatchCommitTabbedPane(BatchCommit2DBJavaScriptPane commit2DBJavaScriptPane, java.util.List dbManipulationPaneList ){ - this.commit2DBJavaScriptPane = commit2DBJavaScriptPane; - this.dbManipulationPaneList = dbManipulationPaneList; - this.setLayout(new BorderLayout(0, 0)); - this.addMouseListener(this); - this.addMouseMotionListener(this); - this.setBorder(null); - this.setForeground(new Color(99, 99, 99)); - leftButton = new UIButton(LEFT_ICON) { - public Dimension getPreferredSize() { - return new Dimension(super.getPreferredSize().width, TOOLBAR_HEIGHT); - } - }; - leftButton.set4ToolbarButton(); - leftButton.setDisabledIcon(DISABLED_LEFT_ICON); - rightButton = new UIButton(RIGHT_ICON) { - public Dimension getPreferredSize() { - return new Dimension(super.getPreferredSize().width, TOOLBAR_HEIGHT); - } - }; - rightButton.set4ToolbarButton(); - rightButton.setDisabledIcon(DISABLED_RIGHT_ICON); - buttonPane = new JPanel(new BorderLayout(3, 0)); - buttonPane.add(rightButton, BorderLayout.EAST); - buttonPane.add(leftButton, BorderLayout.CENTER); - this.add(buttonPane, BorderLayout.EAST); - leftButton.addActionListener(createLeftButtonActionListener()); - rightButton.addActionListener(createRightButtonActionListener()); - - } - - private ActionListener createRightButtonActionListener(){ - return new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - int tabCount = getTabCount(); - if (lastOneIndex < tabCount && lastOneIndex + showCount <= tabCount) { - scrollIndex += showCount; - lastOneIndex += showCount; - selectedIndex = lastOneIndex; - } else if(lastOneIndex < tabCount && lastOneIndex + showCount > tabCount){ - lastOneIndex = tabCount -1; - scrollIndex = lastOneIndex - showCount; - selectedIndex = lastOneIndex; - } - repaint(); - } - }; - } - - private ActionListener createLeftButtonActionListener() { - return new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - if(scrollIndex >= showCount) { - scrollIndex -= showCount; - selectedIndex = scrollIndex; - lastOneIndex -= showCount; - } else if (scrollIndex > 0 && scrollIndex< showCount){ - scrollIndex =0; - selectedIndex = 0; - lastOneIndex = showCount; - - } - repaint(); - } - }; - } - - private void checkButton(boolean buttonEnabled) { - leftButton.setEnabled(buttonEnabled); - rightButton.setEnabled(buttonEnabled); - } - - public int getSelectedIndex(){ - return selectedIndex; - } - - public void paintComponent(Graphics g){ - super.paintComponent(g); - double maxWidth = getWidth() - buttonPane.getWidth(); - Graphics2D g2d = (Graphics2D) g; - paintBackgroundAndLine(g2d, maxWidth); - - } - - private void paintBackgroundAndLine(Graphics2D g2d, double maxWidth) { - //能画的个数 - showCount = (int) (maxWidth) / tabWidth; - //计算开始画的最小模板index和最大模板index - if (selectedIndex >= dbManipulationPaneList.size()) { - selectedIndex = dbManipulationPaneList.size() - 1; - } - if (selectedIndex < 0) { - selectedIndex = 0; - } - calMinAndMaxIndex(); - closeIconStartX = new int[lastOneIndex - scrollIndex + 1]; - - int startX = 0; - //从可以开始展示在tab面板上的tab开始画 - for (int i = scrollIndex; i <= lastOneIndex; i++) { - BatchSubmitPane dbManipulationPane = (BatchSubmitPane)dbManipulationPaneList.get(i); - String name ; - if (dbManipulationPane.getSubMitName() != null){ - name = dbManipulationPane.getSubMitName(); - } else { - name = createName(); - dbManipulationPane.setSubMitName(name); - } - if (i == selectedIndex) { - closeIconStartX[i - scrollIndex] = paintSelectedTab(g2d, startX,name, i); - } else { - closeIconStartX[i - scrollIndex] = paintUnSelectedTab(g2d,startX,name,i); - } - startX += tabWidth; - } - paintUnderLine(startX, maxWidth, g2d); - addX = startX + GAP; - addIcon.paintIcon(this,g2d,addX,0); - checkButton(getTabCount() > showCount); - } - - public int getTabCount(){ - return dbManipulationPaneList.size(); - } - - private String createName(){ - String prefix = Inter.getLocText("FR-Designer-CommitTab_Submit"); - int count = getTabCount(); - while (true) { - //从提交1开始 - count = count == 0 ? 1 : count; - String newName = prefix + count; - boolean repeated = false; - for (int i= 0;i < getTabCount();i++) { - if (ComparatorUtils.equals( ((BatchSubmitPane)dbManipulationPaneList.get(i)).getSubMitName(), newName)) { - repeated = true; - break; - } - } - - if (!repeated) { - return newName; - } - - count++; - } - } - - - - private void paintUnderLine(double startX, double maxWidth, Graphics2D g2d) { - //画下面的那条线 - if (startX < maxWidth) { - GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, 2); - generalPath.moveTo((float) startX, (float) (getHeight() - 1)); - generalPath.lineTo((float) maxWidth, (float) (getHeight() - 1)); - g2d.fill(generalPath); - g2d.setPaint(UIConstants.LINE_COLOR); - g2d.draw(new Line2D.Double((float) startX, (float) (getHeight() - 1), (float) maxWidth , (float) (getHeight() - 1))); - } - } - - - private void calMinAndMaxIndex() { //如果个数大于最多能容纳的个数,则多余的进行处理 - - if (dbManipulationPaneList.size() > showCount) { - - if (selectedIndex >= lastOneIndex) { //所点击列表中的标签页处在标签页栏最后一个标签页之后,则标签页栏左移至所点击标签页出现 - scrollIndex = selectedIndex - showCount + 1; - lastOneIndex = selectedIndex; - if (scrollIndex <= 0) { - scrollIndex = 0; - lastOneIndex = showCount - 1; - } - } else if (selectedIndex <= scrollIndex) { //所点击列表中的标签页处在标签页栏第一个标签页之前,则标签页栏右移至所点击标签页出现 - - scrollIndex = selectedIndex; - lastOneIndex = scrollIndex + showCount - 1; - if (lastOneIndex > dbManipulationPaneList.size() - 1) { - lastOneIndex = dbManipulationPaneList.size() - 1; - } - } else { - if (selectedIndex >= dbManipulationPaneList.size() - 1) { - selectedIndex = dbManipulationPaneList.size() - 1; - lastOneIndex = selectedIndex; - scrollIndex = selectedIndex - showCount + 1; - } else { - lastOneIndex = scrollIndex + showCount - 1; - if (lastOneIndex > dbManipulationPaneList.size() - 1) { - lastOneIndex = dbManipulationPaneList.size() - 1; - } - } - } - } else { - scrollIndex = 0; - lastOneIndex = dbManipulationPaneList.size() - 1; - } - } - - - /** - * 画选中的tab - * - * @param g2d - * @param sheetName - * @return - */ - private int paintSelectedTab(Graphics2D g2d,int startX, String sheetName, int selfIndex) { - double[] x = {startX, startX, startX + tabWidth, startX + tabWidth, startX}; - double[] y = {-1, getHeight(), getHeight(), -1, -1}; - RoundRectangle2D.Double rect1 = new RoundRectangle2D.Double(startX, 1, this.getWidth(), this.getHeight(), 7, 7); - g2d.setPaint(new GradientPaint(1, 1, new Color(255, 255, 255), 1, getHeight() - 1, UIConstants.NORMAL_BACKGROUND)); - - GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, x.length); - generalPath.moveTo((float) x[0] + CORNOR_RADIUS, (float) y[0]); - generalPath.curveTo(((float) x[0] + CORNOR_RADIUS - specialLocation1), (y[0] + CORNOR_RADIUS - specialLocation2), ((float) x[0] + CORNOR_RADIUS - specialLocation2), (y[0] + CORNOR_RADIUS - specialLocation1), (double) x[0], y[0] + CORNOR_RADIUS); - - for (int index = 1; index <= 2; index++) { - generalPath.lineTo((float) x[index], (float) y[index]); - } - - generalPath.lineTo((float) x[3], (float) y[3] + CORNOR_RADIUS); - generalPath.curveTo(((float) x[3] - CORNOR_RADIUS + specialLocation1), ((float) y[3] + CORNOR_RADIUS - specialLocation2), ((float) x[3] - CORNOR_RADIUS + specialLocation2), ((float) y[3] + CORNOR_RADIUS - specialLocation1), (float) x[3] - CORNOR_RADIUS, (float) y[3]); - generalPath.lineTo((float) x[0] + CORNOR_RADIUS, (float) y[0]); - - generalPath.closePath(); - g2d.fill(generalPath); - g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - g2d.setPaint(UIConstants.LINE_COLOR); - g2d.draw(new Arc2D.Double(x[0], y[0], CORNOR_RADIUS * 2, CORNOR_RADIUS * 2, 90, 90, 0)); - g2d.draw(new Line2D.Double(x[0], y[0] + CORNOR_RADIUS, x[1], y[1])); - g2d.draw(new Line2D.Double(x[1], y[1], x[2], y[2])); - g2d.draw(new Line2D.Double(x[2], y[2], x[3], y[3] + CORNOR_RADIUS)); - g2d.draw(new Line2D.Double(x[0] + 3 ,0,x[2] - 3,0)); - g2d.draw(new Arc2D.Double(x[3] - CORNOR_RADIUS * 2, y[3], CORNOR_RADIUS * 2, CORNOR_RADIUS * 2, 90, -90, 0)); - g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); - // 画字符 - g2d.setPaint(getForeground()); - g2d.drawString(sheetName, startX + 2 * GAP, getHeight()-GAP); - int closePosition = startX + tabWidth - closeIcon.getIconWidth() - SMALLGAP; - int closeY = (getHeight() - closeIcon.getIconHeight()) / 2; - if (canClose() && mouseOveredIndex == selfIndex){ - closeIcon.paintIcon(this, g2d, closePosition, closeY); - } - return closePosition; - - } - - /** - * 画没有选中的tab - * - * @param g2d - * @param startX - * @param sheetName - * @return - */ - private int paintUnSelectedTab(Graphics2D g2d, int startX, String sheetName, int selfIndex) { - double[] x = {startX, startX, startX + tabWidth, startX + tabWidth, startX}; - double[] y = {-1, getHeight() - 1, getHeight() - 1, -1, -1}; - if (selfIndex == mouseOveredIndex) { - g2d.setPaint(new GradientPaint(1, 1, new Color(255, 255, 255), 1, getHeight() - 1, UIConstants.NORMAL_BACKGROUND)); - } else { - g2d.setPaint(new GradientPaint(1, 1, UIConstants.NORMAL_BACKGROUND, 1, getHeight() - 1, UIConstants.NORMAL_BACKGROUND)); - } - - - GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, x.length); - generalPath.moveTo((float) x[0] + CORNOR_RADIUS, (float) y[0]); - generalPath.curveTo(((float) x[0] + CORNOR_RADIUS - specialLocation1), (y[0] + CORNOR_RADIUS - specialLocation2), ((float) x[0] + CORNOR_RADIUS - specialLocation2), (y[0] + CORNOR_RADIUS - specialLocation1), (double) x[0], y[0] + CORNOR_RADIUS); - - for (int index = 1; index <= 2; index++) { - generalPath.lineTo((float) x[index], (float) y[index]); - } - - generalPath.lineTo((float) x[3], (float) y[3] + CORNOR_RADIUS); - generalPath.curveTo(((float) x[3] - CORNOR_RADIUS + specialLocation1), ((float) y[3] + CORNOR_RADIUS - specialLocation2), ((float) x[3] - CORNOR_RADIUS + specialLocation2), ((float) y[3] + CORNOR_RADIUS - specialLocation1), (float) x[3] - CORNOR_RADIUS, (float) y[3]); - generalPath.lineTo((float) x[0] + CORNOR_RADIUS, (float) y[0]); - - generalPath.closePath(); - - g2d.fill(generalPath); - g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - g2d.setPaint(UIConstants.LINE_COLOR); - - g2d.draw(new Arc2D.Double(x[0], y[0], CORNOR_RADIUS * 2, CORNOR_RADIUS * 2, 90, 90, 0)); - g2d.draw(new Line2D.Double(x[0], y[0] + CORNOR_RADIUS, x[1], y[1])); - g2d.draw(new Line2D.Double(x[1], y[1], x[2], y[2])); - g2d.draw(new Line2D.Double(x[2], y[2], x[3], y[3] + CORNOR_RADIUS)); - g2d.draw(new Line2D.Double(x[0] + 3 ,0,x[2] - 3,0)); - g2d.draw(new Arc2D.Double(x[3] - CORNOR_RADIUS * 2, y[3], CORNOR_RADIUS * 2, CORNOR_RADIUS * 2, 90, -90, 0)); - - g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); - // 画字符 - g2d.setPaint(getForeground()); - g2d.drawString(sheetName, startX + 2 * GAP, getHeight() - GAP ); - int closeY = (getHeight() - closeIcon.getIconHeight()) / 2; - int closePosition = startX + tabWidth - closeIcon.getIconWidth() - SMALLGAP; - if (canClose() && mouseOveredIndex == selfIndex){ - closeIcon.paintIcon(this, g2d, closePosition, closeY); - } - return closePosition; - } - - - /** - * 鼠标按下 - * @param e 事件 - */ - public void mouseClicked(MouseEvent e) { - } - - /** - * 鼠标按下 - * @param e 事件 - */ - public void mousePressed(MouseEvent e) { - int x = e.getX(), y = e.getY(); - if (addX!= -1 && isOverAddIcon(x, y)){ - addIcon = ADD_CLICK; - commit2DBJavaScriptPane.createDBManipulationPane(); - selectedIndex = dbManipulationPaneList.size()-1; - commit2DBJavaScriptPane.updateCardPane(); - } else if (isOverCloseIcon(x)){ - int re = JOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(this), Inter.getLocText("FR-Designer-CommitTab_SureToDelete")+ "?", Inter.getLocText("FR-Designer-CommitTab_Remove") - , JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); - if (re == JOptionPane.OK_OPTION) { - dbManipulationPaneList.remove(getTabIndex(x)); - commit2DBJavaScriptPane.setList(dbManipulationPaneList); - // 删除tab以后,获得第一个tab,再刷新一下,否则画面会停留在已删除的tab上,第一个tab是不可删除的 - selectedIndex = getTabIndex(FIRST_TAB_POSITION); - commit2DBJavaScriptPane.updateCardPane(); - - } - } else if (selectedIndex != getTabIndex(x)){ - selectedIndex = getTabIndex(x); - commit2DBJavaScriptPane.updateCardPane(); - } - repaint(); - } - - /** - * 鼠标离开 - * @param e 事件 - */ - public void mouseReleased(MouseEvent e) { - if(addX != -1 && isOverAddIcon(e.getX(), e.getY())){ - addIcon = ADD_NORMAL; - } - } - - /** - * 鼠标进入 - * @param e 事件 - */ - public void mouseEntered(MouseEvent e) { - } - - /** - * 鼠标离开 - * @param e 事件 - */ - public void mouseExited(MouseEvent e) { - mouseOveredIndex = -1; - repaint(); - } - - /** - * 鼠标拖动 - * @param e 事件 - */ - public void mouseDragged(MouseEvent e) { - } - - /** - * 鼠标移动 - * @param e 事件 - */ - public void mouseMoved(MouseEvent e) { - if(addX!= -1 && isOverAddIcon(e.getX(), e.getY())){ - addIcon = ADD_OVER; - } else { - mouseOveredIndex = getTabIndex(e.getX()); - addIcon = ADD_NORMAL; - } - repaint(); - } - - - /** - * 判断鼠标所在Tab - * @param evtX - * @return index - */ - private int getTabIndex ( int evtX ){ - int x = 0; - for( int i = scrollIndex;i <= lastOneIndex;i++){ - if(evtX > x && evtX <= x + tabWidth ){ - return i; - } - x = x + tabWidth; - } - return -1; - } - - /** - * 判断鼠标是否在添加按钮上 - * @param x 鼠标坐标x - * @param y 鼠标坐标y - * @return 返回鼠标是否在添加按钮上 - */ - private boolean isOverAddIcon(int x, int y){ - int addWidth = addIcon.getIconWidth(),addHeight = addIcon.getIconHeight(); - return x >= addX && x <= addX + addWidth && y > addY && y <= addY + addHeight; - } - - - /** - * 判断鼠标是否在关闭按钮上 - * @param evtX x - * @return 返回鼠标是否在关闭按钮上 - */ - private boolean isOverCloseIcon(int evtX) { - boolean isOverCloseIcon = false; - if( canClose()){ - for (int i = 0; i < closeIconStartX.length; i++) { - if (evtX >= closeIconStartX[i] && evtX <= closeIconStartX[i] + closeIcon.getIconWidth()) { - isOverCloseIcon = true; - break; - } - } - } - return isOverCloseIcon; - } - - /** - * 如果tab只剩下最后一个,则不画删除按钮 - * @return 返回当前tab还可否关闭 - */ - private boolean canClose(){ - return closeIconStartX.length > 1; - } - - /** - * 刷新tab,停留在第一个tab上面 - */ - public void refreshTab(){ - selectedIndex = getTabIndex(FIRST_TAB_POSITION); - commit2DBJavaScriptPane.updateCardPane(); - } -} diff --git a/designer/src/com/fr/design/write/submit/batch/BatchJavaScriptActionProvider.java b/designer/src/com/fr/design/write/submit/batch/BatchJavaScriptActionProvider.java deleted file mode 100644 index b0d9a2003e..0000000000 --- a/designer/src/com/fr/design/write/submit/batch/BatchJavaScriptActionProvider.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.fr.design.write.submit.batch; - -import com.fr.design.beans.FurtherBasicBeanPane; -import com.fr.design.fun.impl.AbstractJavaScriptActionProvider; -import com.fr.design.javascript.JavaScriptActionPane; -import com.fr.js.JavaScript; - -/** - * Created by loy on 16/8/22. - */ -public class BatchJavaScriptActionProvider extends AbstractJavaScriptActionProvider { - - @Override - public FurtherBasicBeanPane getJavaScriptActionPane() { - return new BatchCommit2DBJavaScriptPane(); - } - - @Override - public FurtherBasicBeanPane getJavaScriptActionPane(JavaScriptActionPane pane) { - return new BatchCommit2DBJavaScriptPane(pane); - } - -} diff --git a/designer/src/com/fr/design/write/submit/batch/BatchSubmitPane.java b/designer/src/com/fr/design/write/submit/batch/BatchSubmitPane.java deleted file mode 100644 index 1d944194a3..0000000000 --- a/designer/src/com/fr/design/write/submit/batch/BatchSubmitPane.java +++ /dev/null @@ -1,1089 +0,0 @@ -package com.fr.design.write.submit.batch; - -import com.fr.base.BaseUtils; -import com.fr.base.Formula; -import com.fr.base.Parameter; -import com.fr.data.DataConstants; -import com.fr.data.condition.JoinCondition; -import com.fr.data.condition.ListCondition; -import com.fr.data.core.db.dml.Table; -import com.fr.design.actions.UpdateAction; -import com.fr.design.beans.BasicBeanPane; -import com.fr.design.condition.DSColumnLiteConditionPane; -import com.fr.design.constants.UIConstants; -import com.fr.design.data.datapane.ChoosePaneSupportFormula; -import com.fr.design.data.datapane.DataBaseItems; -import com.fr.design.data.tabledata.tabledatapane.FormatExplanationPane; -import com.fr.design.dialog.BasicDialog; -import com.fr.design.dialog.BasicPane; -import com.fr.design.dialog.DialogActionAdapter; -import com.fr.design.editor.ValueEditorPane; -import com.fr.design.editor.ValueEditorPaneFactory; -import com.fr.design.editor.editor.Editor; -import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.gui.icombobox.UIComboBox; -import com.fr.design.gui.icombobox.UIComboBoxRenderer; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.ilist.CheckBoxList; -import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; -import com.fr.design.javascript.JavaScriptActionPane; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.mainframe.DesignerContext; -import com.fr.design.scrollruler.ModLineBorder; -import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.design.write.submit.SubmitJobListPane; -import com.fr.general.ComparatorUtils; -import com.fr.general.DateUtils; -import com.fr.general.Inter; -import com.fr.general.data.Condition; -import com.fr.stable.ColumnRow; -import com.fr.stable.ColumnRowGroup; -import com.fr.stable.fun.Level; -import com.fr.write.NameSubmitJob; -import com.fr.write.batch.SubmitMain; -import com.fr.write.config.*; - -import javax.swing.*; -import javax.swing.table.AbstractTableModel; -import javax.swing.table.DefaultTableCellRenderer; -import javax.swing.table.TableCellEditor; -import javax.swing.table.TableColumn; -import javax.swing.tree.DefaultTreeCellRenderer; -import javax.swing.tree.DefaultTreeModel; -import java.awt.*; -import java.awt.event.*; -import java.util.ArrayList; -import java.util.Date; -import java.util.EventObject; - -/** - * Created by loy on 16/8/12. - */ -public class BatchSubmitPane extends BasicBeanPane implements Level { - private static final Image ICODS_IMAGE = BaseUtils.readImage("/com/fr/web/core/css/images/icons.png"); - private static final Icon HEIP_ICON = BaseUtils.createIcon(ICODS_IMAGE, 193, 1, 14, 14); - private static final int DEFAULT_RETURN_VALUE = 4; - public BatchSubmitPane.KeyColumnNameValueTable keyColumnValuesTable; - private UIComboBox columnsComboBox; // 用于编辑ColumnName的Editor - private UICheckBox UpdateCheckBox; - private JPanel checkBoxUpdatePane; - /* - * 记录当前选取的DS & Table对应的ColumnName[] - * alex:以前每当tableNameComboBox改变就刷新columnsComboBox,这样每输入一个文字就会刷一遍,很不好 - */ - private BatchSubmitPane.ColumnName[] currentColumnNames = null; - - // 支持公式输入的数据表选择面板 - private ChoosePaneSupportFormula chooseTable; - - private UIComboBox dmlConfigComboBox = null; - - // 提交事件 - private NameSubmitJob[] jobs = null; - - // 提交条件 - private Condition condition = null; - - private JTree conditionsTree; - - private Editor[] v_Types; - - protected JavaScriptActionPane parentPane; - - private int keyColumnWidth = 100; - private int resizeColumnCount = 4; - private int btnWidth = 110; - private int btnHeight = 20; - private String subMitName; - - private static final String[] DML_CONFIG_TYPES = new String[]{ - Inter.getLocText(new String[]{"Smart", "Submit"}), - Inter.getLocText(new String[]{"Delete", "Submit"}), - Inter.getLocText(new String[]{"Insert", "Submit"}), - Inter.getLocText(new String[]{"Update", "Submit"})}; - - /** - * 无单元格。没有智能添加单元格等按钮 - * 有单元格的参见其子类SmartInsertDBManipulationPane - */ - public BatchSubmitPane() { - this(ValueEditorPaneFactory.extendedCellGroupEditors()); - } - - public BatchSubmitPane(Editor[] v_Types) { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.v_Types = v_Types; - - JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - this.add(northPane, BorderLayout.NORTH); - - dmlConfigComboBox = new UIComboBox(DML_CONFIG_TYPES); - - JPanel typePane = GUICoreUtils.createFlowPane(new Component[]{new UILabel(Inter.getLocText(new String[]{"Choose", "Type"}) + ":"), dmlConfigComboBox}, - FlowLayout.LEFT, 10); - typePane.setBorder(BorderFactory.createTitledBorder(new ModLineBorder(ModLineBorder.TOP), Inter.getLocText(new String[]{"Submit", "Type"}))); - northPane.add(typePane, BorderLayout.NORTH); - - chooseTable = new ChoosePaneSupportFormula(); - chooseTable.setBorder(BorderFactory.createTitledBorder(new ModLineBorder(ModLineBorder.TOP), Inter.getLocText("FR-Base_Table"))); - chooseTable.setTableNameComboBoxPopSize(160, 320); - - northPane.add(chooseTable, BorderLayout.CENTER); - - // peter:编辑的TablePane - JPanel editTablePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - this.add(editTablePane, BorderLayout.CENTER); - editTablePane.setBorder(BorderFactory.createTitledBorder(new ModLineBorder(ModLineBorder.TOP), Inter.getLocText("FR-Base_Value"))); - - keyColumnValuesTable = new BatchSubmitPane.KeyColumnNameValueTable(); - editTablePane.add(new JScrollPane(this.keyColumnValuesTable), BorderLayout.CENTER); - keyColumnValuesTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); - keyColumnValuesTable.setPreferredScrollableViewportSize(new Dimension(280, 180)); - keyColumnValuesTable.setShowHorizontalLines(true); - - initJTableColumn(); - - addButtons(editTablePane); - - addBottomPane(); - - addListeners(); - } - - public void setSubMitName(String subMitName) { - this.subMitName = subMitName; - } - - public String getSubMitName() { - return this.subMitName; - } - - private void addButtons(JPanel editTablePane) { - // alex:添加操作按钮 - UpdateAction[] actions = this.getActions(); - if (actions != null && actions.length > 0) { - JPanel controlBtnPane = new JPanel(new GridLayout(actions.length + 1, 1, 4, 4)); - editTablePane.add(GUICoreUtils.createBorderPane(controlBtnPane, BorderLayout.NORTH), BorderLayout.EAST); - - for (int i = 0; i < actions.length; i++) { - controlBtnPane.add(new UIButton(actions[i])); - } - checkBoxUpdatePane = new JPanel(new BorderLayout(0, 0)); - checkBoxUpdatePane.setPreferredSize(new Dimension(120, 20)); - controlBtnPane.add(checkBoxUpdatePane); - - UpdateCheckBox = new UICheckBox(Inter.getLocText("RWA-NotChange_Unmodified")); - UIButton helpButton = new UIButton(HEIP_ICON); - helpButton.setToolTipText(Inter.getLocText("FR-Base_Help")); - helpButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - FormatExplanationPane formatExplanation = new FormatExplanationPane(Inter.getLocText("FR-Base_Help"), Inter.getLocText("FR-Designer_RWA-Help"), 12f); - BasicDialog dlg = formatExplanation.showMediumWindow(SwingUtilities.getWindowAncestor(BatchSubmitPane.this), - new DialogActionAdapter() { - }); - dlg.setVisible(true); - } - }); - helpButton.set4ToolbarButton(); - checkBoxUpdatePane.add(UpdateCheckBox, BorderLayout.WEST); - checkBoxUpdatePane.add(helpButton, BorderLayout.EAST); - } - } - - protected void updateUpdateCheckBoxEnable() { - BatchSubmitPane.KeyColumnTableModel model = (BatchSubmitPane.KeyColumnTableModel) keyColumnValuesTable.getModel(); - if (model.getRowCount() == 0) { - setUpdateCheckBoxEnable(false); - UpdateCheckBox.setSelected(true); - return; - } - ArrayList columnObjects = new ArrayList(); - for (int i = 0; i < model.getRowCount(); i++) { - columnObjects.add(model.getKeyColumnNameValue(i).cv.getObj()); - } - for (int i = 0; i < columnObjects.size(); i++) { - Object ob = columnObjects.get(i); - if (!(ob instanceof ColumnRow || ob instanceof ColumnRowGroup)) { - setUpdateCheckBoxEnable(false); - UpdateCheckBox.setSelected(false); - return; - } - } - setUpdateCheckBoxEnable(true); - } - - private void setUpdateCheckBoxEnable(boolean b) { - UpdateCheckBox.setEnabled(b); - } - - private void addBottomPane() { - JPanel eventPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - eventPane.add(addEventButton()); - - JPanel conditionPane = this.createConditionPane(); - - JPanel btPane = new JPanel(FRGUIPaneFactory.createBorderLayout()); - btPane.add(eventPane, BorderLayout.CENTER); - btPane.add(conditionPane, BorderLayout.NORTH); - this.add(btPane, BorderLayout.SOUTH); - } - - private UIButton addEventButton() { - UIButton addSubmitEventButton = new UIButton(Inter.getLocText("FR-Designer_Set_Submit_Event")); - addSubmitEventButton.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent e) { - final SubmitJobListPane jobsPane = createSubmitJobListPane(); - - jobsPane.populate(jobs); - BasicDialog dialog = jobsPane.showWindow(SwingUtilities.getWindowAncestor(BatchSubmitPane.this), new DialogActionAdapter() { - @Override - public void doOk() { - super.doOk(); - jobs = jobsPane.updateDBManipulation(); - } - }); - dialog.setVisible(true); - } - - }); - return addSubmitEventButton; - } - - private JPanel createConditionPane() { - JPanel conditionPane = new JPanel(); - conditionPane.setPreferredSize(createConditionPanePreferredSize()); - - setBorderAndLayout(conditionPane); - - conditionsTree = new JTree(new DefaultTreeModel(new ExpandMutableTreeNode())); - conditionsTree.setRootVisible(false); - conditionsTree.setShowsRootHandles(true); - conditionsTree.setBackground(UIConstants.NORMAL_BACKGROUND); - conditionsTree.setForeground(UIConstants.NORMAL_BACKGROUND); - DefaultTreeCellRenderer cr = (DefaultTreeCellRenderer) conditionsTree.getCellRenderer(); - cr.setForeground(UIConstants.NORMAL_BACKGROUND); - JScrollPane jp = new JScrollPane(conditionsTree); - addComponent(conditionPane, jp); - - UIButton addSubmitConditionButton = new UIButton(Inter.getLocText("FR-Designer_Set_Submit_Condition")); - addSubmitConditionButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - final DSColumnLiteConditionPane conditionPane = new DSColumnLiteConditionPane(); - String[] columns = chooseTable.currentColumnNames(); - if (columns != null && columns.length > 0) { - conditionPane.populateColumns(chooseTable.currentColumnNames()); - } - - conditionPane.populateBean(condition); - BasicDialog dialog = conditionPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { - @Override - public void doOk() { - super.doOk(); - condition = conditionPane.updateBean(); - refreshConditionList(); - } - }); - dialog.setVisible(true); - } - }); - - JPanel controlBtnPane = new JPanel(new GridLayout(1, 1, 4, 4)); - controlBtnPane.setPreferredSize(createControlBtnPanePreferredSize()); - conditionPane.add(GUICoreUtils.createBorderPane(controlBtnPane, BorderLayout.NORTH), setControlBtnPanePosition()); - controlBtnPane.add(addSubmitConditionButton); - - return conditionPane; - } - - protected void setBorderAndLayout(JPanel jPanel) { - jPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); - jPanel.setBorder(BorderFactory.createTitledBorder( - new ModLineBorder(ModLineBorder.TOP), Inter.getLocText(new String[]{"Submit", "Condition"}))); - } - - protected void addComponent(JPanel mainPane, JScrollPane addPane) { - mainPane.add(addPane, BorderLayout.CENTER); - } - - - protected Dimension createConditionPanePreferredSize() { - return new Dimension(454, 80); - } - - protected Dimension createControlBtnPanePreferredSize() { - return new Dimension(110, 20); - } - - protected String setControlBtnPanePosition() { - return BorderLayout.EAST; - } - - private void refreshConditionList() { - DefaultTreeModel defaultTreeModel = (DefaultTreeModel) conditionsTree.getModel(); - ExpandMutableTreeNode rootTreeNode = (ExpandMutableTreeNode) defaultTreeModel.getRoot(); - rootTreeNode.setUserObject(new JoinCondition(DataConstants.AND, new ListCondition())); - rootTreeNode.removeAllChildren(); - Condition liteCondition = this.condition == null ? new ListCondition() : this.condition; - if (liteCondition instanceof ListCondition) { - ListCondition listCondition = (ListCondition) liteCondition; - int joinConditionCount = listCondition.getJoinConditionCount(); - for (int i = 0; i < joinConditionCount; i++) { - addLiteConditionToListCondition(rootTreeNode, listCondition.getJoinCondition(i)); - } - } else { - ExpandMutableTreeNode newTreeNode = new ExpandMutableTreeNode(new JoinCondition(DataConstants.AND, liteCondition)); - rootTreeNode.add(newTreeNode); - } - defaultTreeModel.reload(rootTreeNode); - rootTreeNode.expandCurrentTreeNode(conditionsTree); - } - - private void addLiteConditionToListCondition(ExpandMutableTreeNode parentTreeNode, JoinCondition joinCondition) { - ExpandMutableTreeNode newTreeNode = new ExpandMutableTreeNode(joinCondition); - parentTreeNode.add(newTreeNode); - Condition liteCondition = joinCondition.getCondition(); - if (liteCondition instanceof ListCondition) { - ListCondition listCondition = (ListCondition) liteCondition; - int joinConditionCount = listCondition.getJoinConditionCount(); - for (int i = 0; i < joinConditionCount; i++) { - addLiteConditionToListCondition(newTreeNode, listCondition.getJoinCondition(i)); - } - } - } - - private void addListeners() { - dmlConfigComboBox.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - Object ob = e.getItem(); - if ((ComparatorUtils.equals(ob, DML_CONFIG_TYPES[0])) || ComparatorUtils.equals(ob, DML_CONFIG_TYPES[3])) { - checkBoxUpdatePane.setVisible(true); - } else if ((ComparatorUtils.equals(ob, DML_CONFIG_TYPES[1])) || ComparatorUtils.equals(ob, DML_CONFIG_TYPES[2])) { - checkBoxUpdatePane.setVisible(false); - } - } - } - }); - - /* - * 当DS & Table改变时要刷新ColumnsComboBox.model,不能用ItemListener, - * 因为tableNameComboBox是可以编辑的,每写一个文字就要连,太频繁了 - * 也不能在tableNameComboBox.focusLost事件时,好像没用 - */ - keyColumnValuesTable.addFocusListener(new FocusAdapter() { - - public void focusGained(FocusEvent e) { - refreshColumnsComboBox(); - } - - }); - } - - protected UpdateAction[] getActions() { - return new UpdateAction[]{new BatchSubmitPane.SmartAddFieldsAction(), new BatchSubmitPane.AddFieldAction(), new BatchSubmitPane.RemoveFieldAction()}; - } - - protected SubmitJobListPane createSubmitJobListPane() { - return new SubmitJobListPane(); - } - - public void setParentJavaScriptActionPane(JavaScriptActionPane jsPane) { - this.parentPane = jsPane; - } - - @Override - protected String title4PopupWindow() { - return "DB"; - } - - @Override - public int currentAPILevel() { - return 1; - } - - protected class SmartAddFieldsAction extends UpdateAction { - public SmartAddFieldsAction() { - this.setName(Inter.getLocText("RWA-Smart_Add_Fields")); - } - - public void actionPerformed(ActionEvent evt) { - - BasicPane bPane = new BasicPane() { - @Override - protected String title4PopupWindow() { - return Inter.getLocText("RWA-Smart_Add_Fields"); - } - }; - bPane.setLayout(FRGUIPaneFactory.createBorderLayout()); - - final CheckBoxList list = new CheckBoxList(currentColumnNames(), CheckBoxList.SelectedState.ALL, Inter.getLocText("FR-Designer_Chart_Field_Name")) { - public String value2Text(Object value) { - if (value instanceof BatchSubmitPane.ColumnName) { - return ((BatchSubmitPane.ColumnName) value).name; - } - - return super.value2Text(value); - } - }; - bPane.add(new JScrollPane(list), BorderLayout.CENTER); - - BasicDialog dlg = bPane.showSmallWindow(SwingUtilities.getWindowAncestor(BatchSubmitPane.this), new DialogActionAdapter() { - public void doOk() { - addFields(list); - updateUpdateCheckBoxEnable(); - } - }); - dlg.setVisible(true); - } - } - - private void addFields(CheckBoxList list) { - BatchSubmitPane.KeyColumnTableModel model = (BatchSubmitPane.KeyColumnTableModel) keyColumnValuesTable.getModel(); - java.util.List keyColumnNameValueList = new ArrayList(); - keyColumnNameValueList.clear(); - for (int i = 0; i < model.getRowCount(); i++) { - keyColumnNameValueList.add(model.getKeyColumnNameValue(i)); - } - model.removeAllKeyColumnNameValue(); - Object[] selected = list.getSelectedValues(); - // Richie:用了存储新的KeyColumnNameValue的List. - java.util.List newKeyColumnNameValueList = new ArrayList(); - if (!keyColumnNameValueList.isEmpty()) { - for (int i = 0; i < selected.length; i++) { - // Richie:先填上空的. - newKeyColumnNameValueList.add(new BatchSubmitPane.KeyColumnNameValue(false, (BatchSubmitPane.ColumnName) selected[i], new BatchSubmitPane.ColumnValue(""), false)); - } - } - // Richie:初始化 - int returnValue = DEFAULT_RETURN_VALUE; - int coverNumber = 0; - for (int i = 0; i < selected.length; i++) { - if (returnValue == 0 || returnValue == 3) { - break; - } - for (int j = 0; j < keyColumnNameValueList.size(); j++) { - if (ComparatorUtils.equals(selected[i], keyColumnNameValueList.get(j).cn)) { - Object[] options = {Inter.getLocText("FR-Designer_Covered_All"), Inter.getLocText("FR-Base_Yes"), Inter.getLocText("FR-Base_No"), Inter.getLocText("FR-Designer_Cover_None")}; - returnValue = JOptionPane.showOptionDialog(BatchSubmitPane.this, keyColumnNameValueList.get(j).cn.name - + Inter.getLocText(new String[]{"Has_Existed", "Want_To_Cover_It"}, new String[]{",", "?"}), - "", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, options, options[0]); - // Richie:全部覆盖 - if (returnValue == 0) { - break; - // Richie:覆盖指定行 - } else if (returnValue == 1) { - coverNumber = i; - // Richie:不覆盖制定行 - } else if (returnValue == 2) { - coverNumber = i; - newKeyColumnNameValueList.remove(i); - newKeyColumnNameValueList.add(i, keyColumnNameValueList.get(j)); - // Richie:全部不覆盖 - } else if (returnValue == 3) { - coverNumber = i; - break; - } - } - } - } - checkTableModel(returnValue, coverNumber, model, selected, keyColumnNameValueList, newKeyColumnNameValueList); - } - - private void checkTableModel(int returnValue, int coverNumber, BatchSubmitPane.KeyColumnTableModel model, Object[] selected, java.util.List keyColumnNameValueList, java.util.List newKeyColumnNameValueList) { - if (returnValue == 0) { - model.removeAllKeyColumnNameValue(); - // Richie:全部覆盖,按selected的长度添加默认的行 - for (int i = 0; i < selected.length; i++) { - model.addKeyColumnNameValue(newKeyColumnNameValueList.get(i)); - } - - } else if (returnValue == 3) { - model.removeAllKeyColumnNameValue(); - // Richie:全部不覆盖,已经存在的就保留,不存在的添加默认行 - for (int i = coverNumber; i < selected.length; i++) { - for (int j = 0; j < keyColumnNameValueList.size(); j++) { - if (ComparatorUtils.equals(selected[i], keyColumnNameValueList.get(j).cn)) { - newKeyColumnNameValueList.remove(i); - newKeyColumnNameValueList.add(i, keyColumnNameValueList.get(j)); - } - } - - } - - for (int i = 0; i < selected.length; i++) { - model.addKeyColumnNameValue(newKeyColumnNameValueList.get(i)); - } - - } else if (returnValue == 1 || returnValue == 2) { - for (int i = 0; i < selected.length; i++) { - model.addKeyColumnNameValue(newKeyColumnNameValueList.get(i)); - } - } - - // Richie:初始化 - if (keyColumnNameValueList.isEmpty()) { - model.removeAllKeyColumnNameValue(); - for (int i = 0; i < selected.length; i++) { - model.addKeyColumnNameValue(new BatchSubmitPane.KeyColumnNameValue(false, (BatchSubmitPane.ColumnName) selected[i], new BatchSubmitPane.ColumnValue(""), false)); - } - } - model.fireTableDataChanged(); - keyColumnValuesTable.validate(); - } - - protected class AddFieldAction extends UpdateAction { - public AddFieldAction() { - this.setName(Inter.getLocText("RWA-Add_Field")); - } - - public void actionPerformed(ActionEvent e) { - - BatchSubmitPane.KeyColumnTableModel model = (BatchSubmitPane.KeyColumnTableModel) keyColumnValuesTable.getModel(); - - model.addKeyColumnNameValue(new BatchSubmitPane.KeyColumnNameValue(false, new BatchSubmitPane.ColumnName(""), new BatchSubmitPane.ColumnValue(""), false)); - updateUpdateCheckBoxEnable(); - model.fireTableDataChanged(); - - keyColumnValuesTable.getSelectionModel().setSelectionInterval(model.getRowCount() - 1, model.getRowCount() - 1); - } - } - - protected class RemoveFieldAction extends UpdateAction { - public RemoveFieldAction() { - this.setName(Inter.getLocText("RWA-Remove_Field")); - } - - public void actionPerformed(ActionEvent evt) { - // DBManipulationPane target = this.getDBManipulationPane(); - - int[] selectedRows = keyColumnValuesTable.getSelectedRows(); - if (selectedRows == null || selectedRows.length == 0) { - return; - } - - int returnVal = JOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(BatchSubmitPane.this), - Inter.getLocText("FR-Base_sure_remove_item") + "?", Inter.getLocText("FR-Base_Remove"), JOptionPane.OK_CANCEL_OPTION, - JOptionPane.QUESTION_MESSAGE); - if (returnVal == JOptionPane.OK_OPTION) { - BatchSubmitPane.KeyColumnTableModel keyColumnNameValueTableModel = (BatchSubmitPane.KeyColumnTableModel) keyColumnValuesTable.getModel(); - - // 把selectedRows从小到大排个序,先删大的再删小的 - java.util.Arrays.sort(selectedRows); - for (int i = selectedRows.length - 1; i >= 0; i--) { - keyColumnNameValueTableModel.removeKeyColumnNameValue(selectedRows[i]); - } - updateUpdateCheckBoxEnable(); - keyColumnNameValueTableModel.fireTableDataChanged(); - - // select other one. - if (keyColumnNameValueTableModel.getRowCount() > selectedRows[0]) { - keyColumnValuesTable.getSelectionModel().setSelectionInterval(selectedRows[0], selectedRows[0]); - } else if (keyColumnNameValueTableModel.getRowCount() > 0) { - keyColumnValuesTable.getSelectionModel().setSelectionInterval(0, 0); - } - } - } - } - - /* - * 刷新columnsComboBox - */ - private void refreshColumnsComboBox() { - DefaultComboBoxModel model = (DefaultComboBoxModel) this.columnsComboBox.getModel(); - model.removeAllElements(); - - BatchSubmitPane.ColumnName[] columnNames = currentColumnNames(); - for (int i = 0; i < columnNames.length; i++) { - model.addElement(columnNames[i]); - } - } - - // 得到当前的ColumnName[] - private BatchSubmitPane.ColumnName[] currentColumnNames() { - // ben:清除原有的 - if (currentColumnNames != null) { - currentColumnNames = null; - } - String[] colNames = this.chooseTable.currentColumnNames(); - int len = colNames.length; - currentColumnNames = new BatchSubmitPane.ColumnName[len]; - for (int i = 0; i < len; i++) { - currentColumnNames[i] = new BatchSubmitPane.ColumnName(colNames[i]); - } - if (currentColumnNames == null) { - currentColumnNames = new BatchSubmitPane.ColumnName[0]; - } - return currentColumnNames; - } - - /* - * 设置JTable的Column - */ - private void initJTableColumn() { - TableColumn column0 = this.keyColumnValuesTable.getColumnModel().getColumn(0); - column0.setMaxWidth(50); - - TableColumn column1 = this.keyColumnValuesTable.getColumnModel().getColumn(1); - column1.setCellRenderer(new BatchSubmitPane.ColumnNameTableCellRenderer()); - - TableColumn column2 = this.keyColumnValuesTable.getColumnModel().getColumn(2); - column2.setCellRenderer(new BatchSubmitPane.ColumnValueTableCellRenderer()); - - // 设置column1的editor - columnsComboBox = new UIComboBox(new DefaultComboBoxModel()); - columnsComboBox.setRenderer(new UIComboBoxRenderer() { - - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - - if (value instanceof BatchSubmitPane.ColumnName) { - this.setText(((BatchSubmitPane.ColumnName) value).name); - } - - return this; - } - - }); - column1.setCellEditor(new DefaultCellEditor(columnsComboBox) { - public boolean stopCellEditing() { - if (super.stopCellEditing()) { - return true; - } - - return false; - } - }); - ((DefaultCellEditor) column1.getCellEditor()).setClickCountToStart(2); - - //设置Column 2的Editor - column2.setCellEditor(new BatchSubmitPane.ColumnValueEditor()); - } - - @Override - public void populateBean(SubmitMain submitMain) { - if (submitMain == null) { - submitMain = new SubmitMain(); - } - subMitName = submitMain.getName(); - DMLConfig dmlConfig = submitMain.getDmlConfig(); - - if (dmlConfig != null) { - if (dmlConfig instanceof IntelliDMLConfig) { - dmlConfigComboBox.setSelectedIndex(0); - } else if (dmlConfig instanceof DeleteConfig) { - dmlConfigComboBox.setSelectedIndex(1); - } else if (dmlConfig instanceof InsertConfig) { - dmlConfigComboBox.setSelectedIndex(2); - } else if (dmlConfig instanceof UpdateConfig) { - dmlConfigComboBox.setSelectedIndex(3); - } else { - dmlConfigComboBox.setSelectedIndex(0); - } - jobs = new NameSubmitJob[dmlConfig == null ? 0 : dmlConfig.getSubmitJobCount()]; - for (int i = 0; i < jobs.length; i++) { - jobs[i] = dmlConfig.getSubmitJob(i); - } - condition = dmlConfig.getCondition(); - UpdateCheckBox.setSelected(dmlConfig.isUpdateSelected()); - } else { - jobs = null; - condition = null; - dmlConfigComboBox.setSelectedIndex(0); - UpdateCheckBox.setSelected(false); - } - - String schema = null; - String tableName = null; - Table table = null; - if (dmlConfig != null && dmlConfig.getOriTable() != null) { - table = dmlConfig.getOriTable(); - if (table != null) { - schema = table.getSchema(); - tableName = table.getName(); - } - } - chooseTable.populateBean(new DataBaseItems(submitMain.getDBName(), schema, tableName)); - - populateKeyColumnValueTable(dmlConfig); - - updateUpdateCheckBoxEnable(); - refreshConditionList(); - } - - private void populateKeyColumnValueTable(DMLConfig dmlConfig) { - BatchSubmitPane.KeyColumnTableModel keyColumnNameValueTableModel = (BatchSubmitPane.KeyColumnTableModel) this.keyColumnValuesTable.getModel(); - keyColumnNameValueTableModel.removeAllKeyColumnNameValue(); - - if (dmlConfig != null) { - boolean acceptPara = false; - for (int i = 0; i < v_Types.length; i++) { - if (v_Types[i].accept(new Parameter())) { - acceptPara = true; - break; - } - } - for (int i = 0; i < dmlConfig.getColumnConfigCount(); i++) { - ColumnConfig column = dmlConfig.getColumnConfig(i); - String columnName = column.getColumnName(); - if (!acceptPara && column.getColumnValue() instanceof Parameter) { - // 表单中,将以前的参数转换为公式 - column.setColumnValue(new Formula(((Parameter) column.getColumnValue()).getName())); - } - - BatchSubmitPane.KeyColumnNameValue newColumnNameValue = new BatchSubmitPane.KeyColumnNameValue(column.isKey(), new BatchSubmitPane.ColumnName(columnName), new BatchSubmitPane.ColumnValue(column.getColumnValue()), - column.isSkipUnmodified()); - keyColumnNameValueTableModel.addKeyColumnNameValue(newColumnNameValue); - } - } - keyColumnNameValueTableModel.fireTableDataChanged(); - - // 选择第一个 - if (keyColumnNameValueTableModel.getRowCount() > 0) { - keyColumnValuesTable.getSelectionModel().setSelectionInterval(0, 0); - } - } - - @Override - public SubmitMain updateBean() { - DataBaseItems para = chooseTable.updateBean(true); - SubmitMain submitMain = new SubmitMain(); - submitMain.setName(subMitName); - submitMain.setDBName(para.getDatabaseName()); - - DMLConfig dmlConfig = new IntelliDMLConfig(); - if (dmlConfigComboBox.getSelectedIndex() == 1) { - dmlConfig = new DeleteConfig(); - } else if (dmlConfigComboBox.getSelectedIndex() == 2) { - dmlConfig = new InsertConfig(); - } else if (dmlConfigComboBox.getSelectedIndex() == 3) { - dmlConfig = new UpdateConfig(); - } - - submitMain.setDmlConfig(dmlConfig); - - dmlConfig.setTable(new Table(para.getSchemaName(), para.getTableName())); - - BatchSubmitPane.KeyColumnTableModel keyColumnNameValueTableModel = (BatchSubmitPane.KeyColumnTableModel) this.keyColumnValuesTable.getModel(); - int rowCount = keyColumnNameValueTableModel.keyColumnNameValueList.size(); - for (int i = 0; i < rowCount; i++) { - BatchSubmitPane.KeyColumnNameValue newKeyColumnNameValue = keyColumnNameValueTableModel.keyColumnNameValueList.get(i); - // peter:先添加key column name. - - dmlConfig.addColumnConfig(new ColumnConfig(newKeyColumnNameValue.cn.name, newKeyColumnNameValue.cv.obj, newKeyColumnNameValue.isKey, false)); - } - dmlConfig.setUpdateSelected(UpdateCheckBox.isSelected()); - - if (jobs != null) { - for (int i = 0; i < jobs.length; i++) { - dmlConfig.addSubmitJob(jobs[i]); - } - } - dmlConfig.setCondition(condition); - - return submitMain; - } - - protected class ValuePane extends BasicBeanPane { - ValueEditorPane vPane; - - public ValuePane() { - this(v_Types); - } - - public ValuePane(Editor[] types) { - vPane = new ValueEditorPane(types); - this.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 45)); - this.add(vPane); - vPane.setPreferredSize(new Dimension(220, 25)); - } - - @Override - protected String title4PopupWindow() { - return Inter.getLocText("FR-Designer_Values-Editor"); - } - - public void populateBean(Object object) { - vPane.populate(object); - } - - @Override - public Object updateBean() { - return vPane.update(); - } - - } - - /* - * alex:ColumnValue的编辑器,弹出对话框来编辑...个人觉得不大好 - */ - protected class ColumnValueEditor extends AbstractCellEditor implements TableCellEditor { - /** - * The Swing component being edited. - */ - private UILabel textLabel; - private BatchSubmitPane.ValuePane vPane; - private BasicDialog vPaneDLG; - - protected ColumnValueEditor() { - this(v_Types); - } - - protected ColumnValueEditor(Editor[] types) { - textLabel = new UILabel(); - textLabel.addMouseListener(new MouseAdapter() { - public void mousePressed(MouseEvent e) { - vPaneDLG.setVisible(true); - - } - }); - - vPane = new BatchSubmitPane.ValuePane(types); - vPaneDLG = vPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { - public void doOk() { - fireEditingStopped(); // Make the renderer - // reappear. - updateUpdateCheckBoxEnable(); - } - - public void doCancel() { - fireEditingCanceled(); - } - }); - } - - /* - * 双击以编辑 - */ - public boolean isCellEditable(EventObject anEvent) { - if (anEvent instanceof MouseEvent) { - return ((MouseEvent) anEvent).getClickCount() >= 2; - } - return true; - } - - public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { - if (value instanceof BatchSubmitPane.ColumnValue) { - vPane.populateBean(((BatchSubmitPane.ColumnValue) value).obj); - - if (((BatchSubmitPane.ColumnValue) value).obj != null) { - textLabel.setText(((BatchSubmitPane.ColumnValue) value).obj.toString()); - } else { - textLabel.setText(""); - } - } - - return textLabel; - } - - public Object getCellEditorValue() { - return new BatchSubmitPane.ColumnValue(vPane.updateBean()); - } - } - - public static class ColumnName { - public String name; - - public ColumnName(String name) { - this.name = name; - } - - public boolean equals(Object obj) { - if (!(obj instanceof BatchSubmitPane.ColumnName)) { - return false; - } - - return ComparatorUtils.equals(this.name, ((BatchSubmitPane.ColumnName) obj).name); - } - } - - public static class ColumnValue { - public Object obj; - - public ColumnValue(Object obj) { - this.obj = obj; - } - - public Object getObj() { - return obj; - } - - public boolean equals(Object obj) { - if (!(obj instanceof BatchSubmitPane.ColumnValue)) { - return false; - } - - return ComparatorUtils.equals(this.obj, ((BatchSubmitPane.ColumnValue) obj).obj); - } - } - - protected static class KeyColumnNameValueTable extends JTable { - - public KeyColumnNameValueTable() { - super(new BatchSubmitPane.KeyColumnValueTableModel(null)); - } - - - public BatchSubmitPane.KeyColumnTableModel getTableModel4SmartAddCell() { - return new BatchSubmitPane.KeyColumnValueTableModel((BatchSubmitPane.KeyColumnTableModel) this.getModel()); - } - - } - - protected abstract static class KeyColumnTableModel extends AbstractTableModel { - public static final String RAW_KEY = Inter.getLocText("FR-Base_RWA-Key"); - public static final String COLUMN = Inter.getLocText("FR-Base_Column"); - public static final String VALUE = Inter.getLocText("FR-Base_Value"); - - public static final String[] COLUMN_NAMES = new String[]{RAW_KEY, COLUMN, VALUE}; - - protected java.util.List keyColumnNameValueList = new ArrayList(); - - public KeyColumnTableModel(BatchSubmitPane.KeyColumnTableModel model) { - if (model != null) { - this.keyColumnNameValueList.addAll(model.keyColumnNameValueList); - } - } - - public String getColumnName(int col) { - return COLUMN_NAMES[col]; - } - - public int getColumnCount() { - return COLUMN_NAMES.length; - } - - public int getRowCount() { - return keyColumnNameValueList.size(); - } - - public void addKeyColumnNameValue(BatchSubmitPane.KeyColumnNameValue keyColumnNameValue) { - this.keyColumnNameValueList.add(keyColumnNameValue); - } - - public void removeKeyColumnNameValue(int index) { - this.keyColumnNameValueList.remove(index); - } - - public BatchSubmitPane.KeyColumnNameValue getKeyColumnNameValue(int index) { - return this.keyColumnNameValueList.get(index); - } - - public void removeAllKeyColumnNameValue() { - this.keyColumnNameValueList.clear(); - } - } - - protected static class KeyColumnValueTableModel extends BatchSubmitPane.KeyColumnTableModel { - - public KeyColumnValueTableModel(BatchSubmitPane.KeyColumnTableModel model) { - super(model); - } - - public Object getValueAt(int row, int col) { - BatchSubmitPane.KeyColumnNameValue knv = keyColumnNameValueList.get(row); - - switch (col) { - case 0: - return knv.isKey; - case 1: - return knv.cn; - case 2: - return knv.cv; - } - return null; - } - - public void setValueAt(Object value, int row, int col) { - BatchSubmitPane.KeyColumnNameValue knv = keyColumnNameValueList.get(row); - - if (col == 0 && value instanceof Boolean) { - knv.isKey = ((Boolean) value).booleanValue(); - } else if (col == 1 && value instanceof BatchSubmitPane.ColumnName) { - knv.cn = (BatchSubmitPane.ColumnName) value; - } else if (col == 2 && value instanceof BatchSubmitPane.ColumnValue) { - knv.cv = (BatchSubmitPane.ColumnValue) value; - } - } - - public Class getColumnClass(int c) { - switch (c) { - case 0: - return Boolean.class; - case 1: - return BatchSubmitPane.ColumnName.class; - case 2: - return BatchSubmitPane.ColumnValue.class; - } - return String.class; - } - - public boolean isCellEditable(int row, int col) { - return true; - } - } - - - public static class KeyColumnNameValue { - private boolean isKey = false; - private BatchSubmitPane.ColumnName cn; - public BatchSubmitPane.ColumnValue cv; - - public KeyColumnNameValue(boolean isKey, BatchSubmitPane.ColumnName cn, BatchSubmitPane.ColumnValue cv, boolean skip) { - this.isKey = isKey; - this.cn = cn; - this.cv = cv; - } - - /** - * 字符串 - * - * @return 字符串z - */ - public String toString() { - return (isKey ? "* " : "") + cn + ":" + cv; - } - } - - /* - * ColumnNameTableCellRenderer - */ - public class ColumnNameTableCellRenderer extends DefaultTableCellRenderer { - public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { - super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); - - if (value instanceof BatchSubmitPane.ColumnName) { - this.setText(((BatchSubmitPane.ColumnName) value).name); - } - - return this; - } - } - - /* - * ColumnValueTableCellRenderer - */ - private class ColumnValueTableCellRenderer extends DefaultTableCellRenderer { - public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { - super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); - - if (value instanceof BatchSubmitPane.ColumnValue) { - if (((BatchSubmitPane.ColumnValue) value).obj != null) { - if (((BatchSubmitPane.ColumnValue) value).obj instanceof Date) { - this.setText(DateUtils.DATEFORMAT2.format(((BatchSubmitPane.ColumnValue) value).obj)); - } else { - this.setText(((BatchSubmitPane.ColumnValue) value).obj.toString()); - } - } else { - this.setText(""); - } - } - - return this; - } - } -} diff --git a/designer/src/com/fr/design/write/submit/batch/BatchSubmitProvider.java b/designer/src/com/fr/design/write/submit/batch/BatchSubmitProvider.java deleted file mode 100644 index 4044626645..0000000000 --- a/designer/src/com/fr/design/write/submit/batch/BatchSubmitProvider.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.fr.design.write.submit.batch; - -import com.fr.design.beans.BasicBeanPane; -import com.fr.design.fun.impl.AbstractSubmitProvider; -import com.fr.general.Inter; - -/** - * Created by loy on 16/8/13. - */ -public class BatchSubmitProvider extends AbstractSubmitProvider { - private volatile static BatchSubmitProvider instance; - - public static BatchSubmitProvider getInstance() { - if (instance == null) { - synchronized (BatchSubmitProvider.class) { - if (instance == null) { - instance = new BatchSubmitProvider(); - } - } - } - return instance; - } - @Override - public BasicBeanPane appearanceForSubmit() { - return new SmartInsertBatchSubmitPane(); - } - - @Override - public String dataForSubmit() { - return Inter.getLocText("Performance-plugin_submitbatch_name"); - } - - @Override - public String keyForSubmit() { - return "submitbatch"; - } - - @Override - public int currentAPILevel() { - return 1; - } -} diff --git a/designer/src/com/fr/design/write/submit/batch/SmartInsertBatchSubmitPane.java b/designer/src/com/fr/design/write/submit/batch/SmartInsertBatchSubmitPane.java deleted file mode 100644 index 791f801ede..0000000000 --- a/designer/src/com/fr/design/write/submit/batch/SmartInsertBatchSubmitPane.java +++ /dev/null @@ -1,591 +0,0 @@ -package com.fr.design.write.submit.batch; - -import com.fr.cache.list.IntList; -import com.fr.data.ClassSubmitJob; -import com.fr.design.actions.UpdateAction; -import com.fr.design.cell.smartaction.AbstractSmartJTablePaneAction; -import com.fr.design.cell.smartaction.SmartJTablePane; -import com.fr.design.cell.smartaction.SmartJTablePaneAction; -import com.fr.design.dialog.BasicDialog; -import com.fr.design.dialog.BasicPane; -import com.fr.design.dialog.DialogActionAdapter; -import com.fr.design.editor.ValueEditorPaneFactory; -import com.fr.design.gui.controlpane.NameObjectCreator; -import com.fr.design.gui.controlpane.NameableCreator; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.ispinner.UIBasicSpinner; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.ElementCasePane; -import com.fr.design.mainframe.JTemplate; -import com.fr.design.mainframe.JWorkBook; -import com.fr.design.selection.SelectionEvent; -import com.fr.design.selection.SelectionListener; -import com.fr.design.write.submit.CustomSubmitJobPane; -import com.fr.design.write.submit.SmartInsertDMLJobPane; -import com.fr.design.write.submit.SubmitJobListPane; -import com.fr.general.Inter; -import com.fr.grid.selection.CellSelection; -import com.fr.grid.selection.FloatSelection; -import com.fr.grid.selection.Selection; -import com.fr.stable.ColumnRow; -import com.fr.stable.ColumnRowGroup; -import com.fr.write.DMLConfigJob; - -import javax.swing.*; -import javax.swing.table.DefaultTableCellRenderer; -import javax.swing.table.TableCellRenderer; -import javax.swing.table.TableColumn; -import java.awt.*; -import java.awt.event.ActionEvent; - -/** - * Created by loy on 16/8/16. - */ -public class SmartInsertBatchSubmitPane extends BatchSubmitPane { - private static final Selection NO_SELECTION = new CellSelection(-1, -1, -1, -1); - private ElementCasePane ePane; - private static int CELL_GROUP_LIMIT = 6; - - public SmartInsertBatchSubmitPane(ElementCasePane ePane) { - super(ValueEditorPaneFactory.extendedCellGroupEditors()); - this.ePane = ePane; - } - - public SmartInsertBatchSubmitPane() { - super(ValueEditorPaneFactory.extendedCellGroupEditors()); - JTemplate jTemplate = DesignerContext.getDesignerFrame().getSelectedJTemplate(); - this.ePane = ((JWorkBook) jTemplate).getEditingElementCasePane(); - } - - @Override - protected SubmitJobListPane createSubmitJobListPane() { - return new SmartInsertSubmitJobListPane(); - } - - class SmartInsertSubmitJobListPane extends SubmitJobListPane { - - public SmartInsertSubmitJobListPane() { - super(ePane); - } - - public void hideParentDialog() { - hideDialog4AddCellAction(); - } - - public void showParentDialog() { - showDialogAfterAddCellAction(); - } - - @Override - public NameableCreator[] createNameableCreators() { - return new NameableCreator[] { - new NameObjectCreator(Inter.getLocText(new String[]{"Submit", "Event"}), - "/com/fr/web/images/reportlet.png", - DMLConfigJob.class, - SmartInsertDMLJobPane.class), - new NameObjectCreator(Inter.getLocText(new String[]{"Custom", "Event"}), - "/com/fr/web/images/reportlet.png", - ClassSubmitJob.class, - CustomSubmitJobPane.class) }; - } - } - - @Override - protected UpdateAction[] getActions() { - return new UpdateAction[] { - new BatchSubmitPane.SmartAddFieldsAction(), - new BatchSubmitPane.AddFieldAction(), - new SmartAddCellAction(), - new SmartAddCellGroupAction(), - new BatchModCellAction(), - new BatchSubmitPane.RemoveFieldAction() - }; - } - - public class BatchModCellAction extends UpdateAction { - public BatchModCellAction() { - this.setName(Inter.getLocText("RWA-Batch_Modify_Cells")); - } - - /** - * 执行事件 - * @param evt 事件对象 - */ - public void actionPerformed(ActionEvent evt) { - BasicPane bPane = new BasicPane() { - @Override - protected String title4PopupWindow() { - return Inter.getLocText("RWA-Batch_Modify_Cells"); - } - }; - bPane.setLayout(FRGUIPaneFactory.createBorderLayout()); - bPane.setBorder(BorderFactory.createEmptyBorder(30, 0, 0, 0)); - final UIBasicSpinner columnSpinner = new UIBasicSpinner(); - final UIBasicSpinner rowSpinner = new UIBasicSpinner(); - Component[][] coms = new Component[][] { { new UILabel(Inter.getLocText("RWA-Row_Offset")), rowSpinner },{ new UILabel(Inter.getLocText("RWA-Column_Offset")), columnSpinner } }; - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - bPane.add(TableLayoutHelper.createTableLayoutPane(coms, new double[]{p, p}, new double[]{p, f}), BorderLayout.NORTH); - BasicDialog dlg = bPane.showSmallWindow(SwingUtilities.getWindowAncestor(SmartInsertBatchSubmitPane.this), new DialogActionAdapter() { - public void doOk() { - int row_offset = ((Number)rowSpinner.getValue()).intValue(); - int column_offset = ((Number)columnSpinner.getValue()).intValue(); - BatchSubmitPane.KeyColumnTableModel model = (BatchSubmitPane.KeyColumnTableModel)keyColumnValuesTable.getModel(); - int[] selectedRows = keyColumnValuesTable.getSelectedRows(); - // 如果一行都没选中,取所有的行 - if (selectedRows.length == 0) { - selectedRows = IntList.range(model.getRowCount()); - } - for (int i = 0; i < selectedRows.length; i++) { - int row = selectedRows[i]; - BatchSubmitPane.KeyColumnNameValue kcnv = model.getKeyColumnNameValue(row); - if (kcnv.cv.obj instanceof ColumnRow) { - ColumnRow or = (ColumnRow)kcnv.cv.obj; - int n_column = or.getColumn() + column_offset; - if (n_column < 0) { - n_column = 0; - } - int n_row = or.getRow() + row_offset; - if (n_row < 0) { - n_row = 0; - } - kcnv.cv.obj = ColumnRow.valueOf(n_column, n_row); - } - } - model.fireTableDataChanged(); - keyColumnValuesTable.validate(); - for (int i = 0; i < selectedRows.length; i++) { - keyColumnValuesTable.addRowSelectionInterval(selectedRows[i], selectedRows[i]); - } - } - }); - dlg.setVisible(true); - } - } - - public class SmartAddCellAction extends UpdateAction { - public SmartAddCellAction() { - this.setName(Inter.getLocText("RWA-Smart_Add_Cells")); - } - - /** - * 执行事件 - * @param evt 事件s - */ - public void actionPerformed(ActionEvent evt) { - - // Grid.GridSelectionListener - if (ePane == null) { - return; - } - - /* - * 布局 - */ - BasicPane bPane = new SmartJTablePane4DB(keyColumnValuesTable.getTableModel4SmartAddCell(), ePane); - - // ReportWriteAttrDialog.this.setVisible(false); - hideDialog4AddCellAction(); - /* - * 当前的ReportPane不可编辑,不可切换Sheet,加GridSelectionChangeListener - */ - ePane.setSelection(NO_SELECTION); - ePane.setEditable(false); - ePane.getGrid().setNotShowingTableSelectPane(false); - - BasicDialog dlg = bPane.showWindow(SwingUtilities.getWindowAncestor(SmartInsertBatchSubmitPane.this)); - - dlg.setModal(false); - dlg.setVisible(true); - } - } - - public class SmartAddCellGroupAction extends UpdateAction { - public SmartAddCellGroupAction() { - this.setName(Inter.getLocText("RWA-Smart_Add_Cell_Group")); - } - - /** - * 智能添加单元格组 - * @param e 事件s - */ - public void actionPerformed(ActionEvent e) { - if (ePane == null) { - return; - } - - BasicPane bPane = new SmartJTablePane4DB(keyColumnValuesTable.getTableModel4SmartAddCell(), ePane, true); - - // ReportWriteAttrDialog.this.setVisible(false); - hideDialog4AddCellAction(); - /* - * 当前的ReportPane不可编辑,不可切换Sheet,加GridSelectionChangeListener - */ - ePane.setSelection(NO_SELECTION); - ePane.setEditable(false); - ePane.getGrid().setNotShowingTableSelectPane(false); - - BasicDialog dlg = bPane.showWindow(SwingUtilities.getWindowAncestor(SmartInsertBatchSubmitPane.this)); - - dlg.setModal(false); - dlg.setVisible(true); - } - } - - private void showDialogAfterAddCellAction() { - Container dialog = this; - if (parentPane != null && parentPane.getContentDBManiPane() instanceof SmartInsertBatchSubmitPane && parentPane.getContentDBManiPane() != this) { - ((SmartInsertBatchSubmitPane)parentPane.getContentDBManiPane()).showDialogAfterAddCellAction(); - } - while (dialog.getParent() != null) { - dialog = dialog.getParent(); - if (dialog instanceof SmartInsertSubmitJobListPane) { - ((SmartInsertSubmitJobListPane)dialog).showParentDialog(); - } else if (dialog instanceof Dialog) { - dialog.setVisible(true); - } - } - } - - private void hideDialog4AddCellAction() { - Container dialog = this; - if (parentPane != null && parentPane.getContentDBManiPane() instanceof SmartInsertBatchSubmitPane && parentPane.getContentDBManiPane() != this) { - ((SmartInsertBatchSubmitPane)parentPane.getContentDBManiPane()).hideDialog4AddCellAction(); - } - while (dialog.getParent() != null) { - dialog = dialog.getParent(); - if (dialog instanceof SmartInsertSubmitJobListPane) { - ((SmartInsertSubmitJobListPane)dialog).hideParentDialog(); - } else if (dialog instanceof Dialog) { - // 条件属性中添加的控件的话有两层dialog,需要都隐藏 - dialog.setVisible(false); - } - } - } - - /** - * 检测是否合法 - * @throws Exception - */ - public void checkValid() throws Exception { - BatchSubmitPane.KeyColumnTableModel model = (BatchSubmitPane.KeyColumnTableModel)keyColumnValuesTable.getModel(); - int cnt = model.getRowCount(); - int groupLength = -1; - for (int i=0; i= model.getRowCount()) { - return; - } - BatchSubmitPane.KeyColumnNameValue kcv = model.getKeyColumnNameValue(editingRowIndex); - ElementCasePane currentReportPane = (ElementCasePane)e.getSource(); - Selection selection = currentReportPane.getSelection(); - if (selection == NO_SELECTION || selection instanceof FloatSelection) { - return; - } - CellSelection cellselection = (CellSelection)selection; - kcv.cv.obj = ColumnRow.valueOf(cellselection.getColumn(), cellselection.getRow()); - - if (editingRowIndex >= model.getRowCount() - 1) { - setEditingRowIndex(0); - } else { - setEditingRowIndex(editingRowIndex + 1); - } - - model.fireTableDataChanged(); - - } - - }; - - /** - * 单元格组的点选格子事件 - */ - private SelectionListener groupListener = new SelectionListener() { - @Override - public void selectionChanged(SelectionEvent e) { - BatchSubmitPane.KeyColumnTableModel model = (BatchSubmitPane.KeyColumnTableModel)table.getModel(); - if (editingRowIndex < 0 || editingRowIndex >= model.getRowCount()) { - return; - } - BatchSubmitPane.KeyColumnNameValue kcv = model.getKeyColumnNameValue(editingRowIndex); - ElementCasePane currentReportPane = (ElementCasePane)e.getSource(); - Selection selection = currentReportPane.getSelection(); - if (selection == NO_SELECTION || selection instanceof FloatSelection) { - return; - } - CellSelection cellselection = (CellSelection)selection; - Object oriValue = kcv.cv.obj; - ColumnRowGroup newValue = getColumnRowGroupValue(oriValue); - - // 要考虑多选的情况 要结合之前的看看 可能是增加 也可能需要减少 - ColumnRowGroup add = new ColumnRowGroup(); - int removeCount = 0; - if (oriCellSelection != null && sameStartPoint(cellselection, oriCellSelection)) { - removeCount = dealDragSelection(add, cellselection); - } else if (cellselection.getSelectedType() == CellSelection.CHOOSE_ROW || cellselection.getSelectedType() == CellSelection.CHOOSE_COLUMN) { - dealSelectColRow(add, cellselection); - } else { - add.addColumnRow(ColumnRow.valueOf(cellselection.getColumn(), cellselection.getRow())); - } - - if (add.getSize() > 0) { - newValue.addAll(add); - } else if (removeCount > 0) { - newValue.splice(newValue.getSize()-removeCount, removeCount); - } - - kcv.cv.obj = newValue; - - model.fireTableDataChanged(); - - oriCellSelection = cellselection; - } - - private ColumnRowGroup getColumnRowGroupValue(Object oriValue) { - ColumnRowGroup newValue = new ColumnRowGroup(); - if (oriValue instanceof ColumnRowGroup) { - newValue.addAll((ColumnRowGroup)oriValue); - } else if (oriValue instanceof ColumnRow) { - newValue.addColumnRow((ColumnRow) oriValue); - } - return newValue; - } - - private boolean sameStartPoint(CellSelection cs1, CellSelection cs2) { - return cs1.getColumn() == cs2.getColumn() && cs1.getRow() == cs2.getRow(); - } - - private int dealDragSelection(ColumnRowGroup add, CellSelection cellselection) { - int removeCount = 0; - if (cellselection.getRowSpan() == oriCellSelection.getRowSpan() + 1) { - for (int i=0; i= CELL_GROUP_LIMIT) { - text.setText("[" + Inter.getLocText(new String[]{"Has_Selected", "Classifier-Ge", "Cell"}, - new String[]{((ColumnRowGroup)cv).getSize()+"", ""}) + "]"); - tip = cv.toString() + " " + tip; - } else if (cv != null) { - text.setText(cv.toString()); - } else { - text.setText(""); - } - } - - if (row == SmartJTablePane4DB.this.editingRowIndex) { - pane.setBackground(Color.cyan); - } else { - pane.setBackground(Color.white); - } - - pane.setToolTipText(tip); - pane.add(text); - - return pane; - } - } - - private class ColumnRowGroupCellRenderer2 extends DefaultTableCellRenderer { - @Override - public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { - super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); - - String tip = Inter.getLocText("FR-Designer_Double_Click_Edit_OR_Clear"); - - if (value instanceof BatchSubmitPane.ColumnValue) { - Object cv = ((BatchSubmitPane.ColumnValue) value).obj; - if (cv instanceof ColumnRowGroup && ((ColumnRowGroup)cv).getSize() >= CELL_GROUP_LIMIT) { - this.setText("[" + Inter.getLocText(new String[]{"Has_Selected", "Classifier-Ge", "Cell"}, - new String[]{((ColumnRowGroup)cv).getSize()+"", ""}) + "]"); - tip = cv.toString() + " " + tip; - } else if (cv != null) { - this.setText(cv.toString()); - } else { - this.setText(""); - } - } - - this.setToolTipText(tip); - - if (row == SmartJTablePane4DB.this.editingRowIndex) { - this.setBackground(Color.cyan); - } else { - this.setBackground(Color.white); - } - - return this; - } - } - } -} diff --git a/designer/src/com/fr/design/write/submit/batch/service/BatchDBCommitService.java b/designer/src/com/fr/design/write/submit/batch/service/BatchDBCommitService.java deleted file mode 100644 index 01ac8a155b..0000000000 --- a/designer/src/com/fr/design/write/submit/batch/service/BatchDBCommitService.java +++ /dev/null @@ -1,288 +0,0 @@ -package com.fr.design.write.submit.batch.service; - -import com.fr.base.*; -import com.fr.data.NetworkHelper; -import com.fr.data.core.db.DBUtils; -import com.fr.data.impl.NameDatabaseConnection; -import com.fr.design.write.submit.batch.BatchCommit2DBJavaScript; -import com.fr.form.ui.WebContentUtils; -import com.fr.general.xml.GeneralXMLTools; -import com.fr.js.JavaScript; -import com.fr.json.JSONException; -import com.fr.json.JSONFunction; -import com.fr.json.JSONObject; -import com.fr.script.Calculator; -import com.fr.stable.ColumnRow; -import com.fr.stable.ParameterProvider; -import com.fr.stable.StringUtils; -import com.fr.stable.UtilEvalError; -import com.fr.stable.fun.impl.NoSessionIDOPService; -import com.fr.stable.script.NameSpace; -import com.fr.web.RepositoryDeal; -import com.fr.web.core.ReportSessionIDInfor; -import com.fr.web.core.SessionDealWith; -import com.fr.web.core.SessionIDInfor; -import com.fr.web.utils.WebUtils; -import com.fr.write.batch.SubmitMain; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.sql.Connection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -/** - * Created by loy on 16/8/23. - */ -public class BatchDBCommitService extends NoSessionIDOPService { - private static BatchDBCommitService service = null; - - public static final String ARG_XMLCONF = "xmlconf"; - public static final String ARG_SESSIONID = "sessionID"; - - /** - * 构造 - * - * @return - */ - public static BatchDBCommitService getInstance() { - if (service == null) { - service = new BatchDBCommitService(); - } - - return service; - } - - /** - * OP值 - * - * @return 返回OP值 - */ - public String actionOP() { - return "batchcommit"; - } - - private Map sessionMap = new HashMap(); - - /** - * 提交入库请求处理 - * - * @param req 请求 - * @param res 响应 - * @throws Exception 抛出异常 - */ - public void process(HttpServletRequest req, HttpServletResponse res) throws Exception { - String sessionID = WebUtils.getHTTPRequestParameter(req, ARG_SESSIONID); - CountLock lock = getCountLock(sessionID); - try { - synchronized (lock) { - process0(req, res); - } - } finally { - releaseLock(sessionID, lock); - } - - } - - private void releaseLock(String sessionID, CountLock lock) { - synchronized (sessionMap) { - lock.reduce(); - if (lock.getCount() == 0) { - sessionMap.remove(sessionID); - } - } - } - - private CountLock getCountLock(String sessionID) { - CountLock lock; - synchronized (sessionMap) { - lock = (CountLock) sessionMap.get(sessionID); - if (lock == null) { - lock = new CountLock(); - sessionMap.put(sessionID, lock); - } - lock.increase(); - } - return lock; - } - - private void process0(HttpServletRequest req, HttpServletResponse res) throws Exception { - String dbManiXML = NetworkHelper.getHTTPRequestEncodeParameter(req, ARG_XMLCONF, false); - if (dbManiXML != null) { - BatchCommit2DBJavaScript commit2DBJS = (BatchCommit2DBJavaScript) GeneralXMLTools.readStringAsXMLable(dbManiXML); - Calculator ca = Calculator.createCalculator(); - RepositoryDeal repo = prepareRepository(req, ca); - NameSpace ns = ParameterMapNameSpace.create(WebUtils.parameters4SessionIDInfor(req)); - ca.pushNameSpace(ns); - Map feedbackMap = prepareFeedBackMap(req, ca); - boolean success = true; - JSONObject fr_submitinfo = new JSONObject(); - Map connectionMap = new HashMap(); - try { - String location = WebUtils.getHTTPRequestParameter(req, "location"); - ColumnRow cr = ColumnRow.valueOf(location); - for (int i = 0; i < commit2DBJS.getDBManipulation().size(); i++) { - if (cr != ColumnRow.ERROR) { - ca.setCurrentFromColumnRow(cr);// commit的时候, 也会去set关联格子的ColumnRow, 为防止上一个提交对下一个造成影响, 这边每次重置 - } - SubmitMain dbManipulation = (SubmitMain) commit2DBJS.getDBManipulation().get(i); - if (dbManipulation != null && dbManipulation.getDmlConfig() != null) { - String dbName = dbManipulation.getDBName(ca); - Connection conn = createConnection(dbName, connectionMap); - ca.putConnection(dbName, conn); - dbManipulation.doJob(ca); - connectionMap.put(dbName, conn); - } - } - } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); - Iterator iter = connectionMap.entrySet().iterator(); - while (iter.hasNext()) { - DBUtils.rollback((Connection) ((Map.Entry) iter.next()).getValue()); - } - success = false; - fr_submitinfo.put("failinfo", e.getMessage()); - } finally { - DBUtils.commitConnections(connectionMap); - } - ca.removeNameSpace(ns); - JSONObject jo = new JSONObject(); - createJo(req, jo, feedbackMap, success, fr_submitinfo, repo); - java.io.PrintWriter writer = WebUtils.createPrintWriter(res); - writer.write(jo.toString()); - writer.flush(); - writer.close(); - } - } - - private Connection createConnection(String dbName, Map connectionMap) throws Exception { - Connection conn = null; - if (connectionMap.containsKey(dbName)) { - return connectionMap.get(dbName); - } else { - NameDatabaseConnection db = new NameDatabaseConnection(dbName); - return db.createConnection(); - } - } - - private RepositoryDeal prepareRepository(HttpServletRequest req, Calculator ca) { - String sessionID = WebUtils.getHTTPRequestParameter(req, ARG_SESSIONID); - SessionIDInfor sessionIDInfor = SessionDealWith.getSessionIDInfor(sessionID); - - RepositoryDeal repo = null; - if (sessionIDInfor != null) { - repo = new RepositoryDeal(req, sessionIDInfor); - if (sessionIDInfor instanceof ReportSessionIDInfor) { - dealWithParaForCa(req, ca, (ReportSessionIDInfor) sessionIDInfor); - } - - NameSpace sessionNamespace = sessionIDInfor.asNameSpace(sessionID); - ca.pushNameSpace(sessionNamespace); - } - - return repo; - } - - private Map prepareFeedBackMap(HttpServletRequest req, Calculator ca) { - String feedback = WebUtils.getHTTPRequestParameter(req, "feedbackMap"); - Map feedbackMap = null; - if (StringUtils.isNotEmpty(feedback)) { - try { - feedbackMap = new JSONObject(feedback).toMap(); - } catch (JSONException e) { - FRContext.getLogger().error(e.getMessage()); - } - NameSpace feedbackNS = ParameterMapNameSpace.create(feedbackMap); - ca.pushNameSpace(feedbackNS); - } - - return feedbackMap; - } - - private void dealWithParaForCa(HttpServletRequest req, Calculator ca, ReportSessionIDInfor sessionIDInfor) { - ca.setAttribute(Calculator.SHEET_NUMBER_KEY, WebUtils.getHTTPRequestParameter(req, "sheetNum")); - sessionIDInfor.setUpAttribute4dbCommit(ca); - - // 提交入库可能用当前模板的参数 - NameSpace paras = ParameterMapNameSpace.create(sessionIDInfor.getParameterMap4Execute()); - ca.pushNameSpace(paras); - } - - private void createJo(HttpServletRequest req, JSONObject jo, Map feedbackMap, - boolean success, JSONObject fr_submitinfo, RepositoryDeal repo) throws Exception { - // 生成的时候没有encode的,用没有进行urldecode的方法获取callback语句,防止+和%出错 - String callBackXML = NetworkHelper.getHTTPRequestEncodeParameter(req, "callback", false); - JavaScript callBack = (JavaScript) GeneralXMLTools.readStringAsXMLable(callBackXML); - fr_submitinfo.put("success", success); - - if (callBack != null) { - dealWithSuccessPara(callBack, fr_submitinfo, repo); - if (feedbackMap != null) { - callBack.addParameterMap(feedbackMap); - } - jo.put("callback", new JSONFunction(new String[]{"res"}, callBack.createJS(repo), repo.getDevice())); - } - } - - private void dealWithSuccessPara(JavaScript callBack, JSONObject fr_submitinfo, RepositoryDeal repo) { - Map submitInfo = new HashMap(); - submitInfo.put(WebContentUtils.FR_SUBMITINFO, fr_submitinfo); - if (callBack != null) { - callBack.addParameterMap(submitInfo); - ParameterProvider[] ps = new ParameterProvider[callBack.getParameters().length + 1]; - int len = callBack.getParameters().length; - for (int i = 0; i < len; i++) { - ps[i] = callBack.getParameters()[i]; - } - ps[len] = new Parameter(WebContentUtils.FR_SUBMITINFO, fr_submitinfo); - callBack.setParameters(ps); - } - - // if the parameter contains "fr_submitinfo" then recalculate it - ParameterProvider[] paras; - if (callBack != null) { - paras = callBack.getParameters(); - } else { - paras = new Parameter[0]; - } - Calculator ca = Calculator.createCalculator(); - if (repo != null) { - NameSpace ns = ParameterMapNameSpace.create(repo.getReportParameterMap()); - ca.pushNameSpace(ns); - } - ca.pushNameSpace(ParameterMapNameSpace.create(submitInfo)); - - for (int i = 0; i < paras.length; i++) { - Object obj = paras[i].getValue(); - if (obj instanceof Formula && needToRecalculate(paras[i])) { - try { - ((Formula) obj).setResult(ca.eval((Formula) obj)); - } catch (UtilEvalError utilEvalError) { - - } - } - } - } - - private boolean needToRecalculate(ParameterProvider p) { - return Utils.objectToString(p.getValue()).toLowerCase().indexOf(WebContentUtils.FR_SUBMITINFO) != -1; - } -} - - -class CountLock { - private int count; - - public void increase() { - count++; - } - - public void reduce() { - count--; - } - - public int getCount() { - return count; - } -} From 473bb799abba1bf962cdd546b401843eb554acc2 Mon Sep 17 00:00:00 2001 From: ju Date: Thu, 14 Dec 2017 16:24:30 +0800 Subject: [PATCH 17/20] =?UTF-8?q?REPORT-5885=20=E6=8F=92=E4=BB=B6=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E5=8D=B8=E8=BD=BD=E2=80=94=E2=80=94frm=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8=E7=95=8C=E9=9D=A2=E5=9B=BE=E6=A0=87=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E5=AE=9E=E6=97=B6=E5=88=B7=E6=96=B0=20=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E5=92=8C=E6=8F=92=E4=BB=B6=E5=8F=98=E6=9B=B4=E6=97=B6=E9=83=BD?= =?UTF-8?q?=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index 5aa68bc63a..5b7a7bccc8 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -129,6 +129,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr GeneralContext.addEnvChangedListener(new EnvChangedListener() { @Override public void envChanged() { + DesignModuleFactory.registerExtraWidgetOptions(initWidgetOption()); DesignImageEvent.registerDefaultCallbackEvent(HistoryTemplateListPane.getInstance()); DesignImageEvent.registerDownloadSourcesEvent(new DownloadOnlineSourcesHelper()); } From e26f3bbd522e956ddae2e01e0b166dbdda807f15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Thu, 14 Dec 2017 19:32:29 +0800 Subject: [PATCH 18/20] =?UTF-8?q?MOBILE-7081=20=E4=BF=AE=E5=A4=8D9.0?= =?UTF-8?q?=E8=A1=A8=E5=8D=95body=E9=87=8C=E7=A7=BB=E5=8A=A8=E7=AB=AF?= =?UTF-8?q?=E7=9A=84=E6=8E=A7=E4=BB=B6=E9=A1=BA=E5=BA=8F=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E6=8B=96=E5=8A=A8=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/mainframe/MobileWidgetTable.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/MobileWidgetTable.java b/designer_form/src/com/fr/design/mainframe/MobileWidgetTable.java index 982f5aad0d..3188630689 100644 --- a/designer_form/src/com/fr/design/mainframe/MobileWidgetTable.java +++ b/designer_form/src/com/fr/design/mainframe/MobileWidgetTable.java @@ -258,8 +258,6 @@ public class MobileWidgetTable extends JTable { return new String[0][0]; } - body.setSorted(false); - if (body.getWidgetCount() > 0 && body.getWidget(0).acceptType(WAbsoluteBodyLayout.class)) { WAbsoluteBodyLayout absoluteBodyLayout = (WAbsoluteBodyLayout) ((WAbsoluteLayout.BoundsWidget) body.getWidget(0)).getWidget(); mobileWidgetList = absoluteBodyLayout.getOrderedMobileWidgetList(); @@ -272,7 +270,6 @@ public class MobileWidgetTable extends JTable { widgetName[i + 1][0] = mobileWidgetList.get(i); } - body.setSorted(true); return widgetName; } From 199a9931859268a8d9bb24298ee058d78440213c Mon Sep 17 00:00:00 2001 From: MoMeak Date: Fri, 15 Dec 2017 10:53:59 +0800 Subject: [PATCH 19/20] =?UTF-8?q?REPORT-6090=20=E5=8D=95=E5=85=83=E6=A0=BC?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=B6=85=E9=93=BE=E6=8E=A5-=E6=82=AC?= =?UTF-8?q?=E6=B5=AE=E7=AA=97=E5=9B=BE=E8=A1=A8=E5=92=8C=E8=B6=85=E9=93=BE?= =?UTF-8?q?=E6=8E=A5-=E6=82=AC=E6=B5=AE=E5=85=83=E7=B4=A0=E6=9C=89?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/ChartHyperRelateFloatLinkPane.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperRelateFloatLinkPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperRelateFloatLinkPane.java index 0ad4b8d321..c30e3af1c1 100644 --- a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperRelateFloatLinkPane.java +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperRelateFloatLinkPane.java @@ -19,6 +19,7 @@ import javax.swing.border.Border; import javax.swing.border.LineBorder; import javax.swing.border.TitledBorder; import java.awt.*; +import java.util.Arrays; import java.util.HashMap; import java.util.List; @@ -92,9 +93,16 @@ public class ChartHyperRelateFloatLinkPane extends AbstractHyperLinkPane Date: Fri, 15 Dec 2017 11:56:26 +0800 Subject: [PATCH 20/20] =?UTF-8?q?REPORT-6096=20Tab=E9=A1=B5=E4=B8=AD?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=9C=A8=E5=A4=8D=E5=88=B6=E7=B2=98=E8=B4=B4?= =?UTF-8?q?=E5=90=8E=E4=BC=9A=E4=BD=8D=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/FormSelectionUtils.java | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormSelectionUtils.java b/designer_form/src/com/fr/design/mainframe/FormSelectionUtils.java index ebf7328a2f..275691f880 100644 --- a/designer_form/src/com/fr/design/mainframe/FormSelectionUtils.java +++ b/designer_form/src/com/fr/design/mainframe/FormSelectionUtils.java @@ -12,6 +12,7 @@ import com.fr.design.designer.creator.XWAbsoluteLayout; import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWScaleLayout; import com.fr.design.designer.creator.XWTitleLayout; +import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.utils.ComponentUtils; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WTitleLayout; @@ -107,6 +108,7 @@ public class FormSelectionUtils { designer.showMessageDialog(Inter.getLocText("FR-Designer_Too_Large_To_Paste")); return; } + resetTabSub2RealSize(copiedCreator); boolean addSuccess = adapter.addBean(copiedCreator, point.x, point.y); if (addSuccess) { designer.getSelectionModel().getSelection().addSelectedCreator(copiedCreator); @@ -121,6 +123,27 @@ public class FormSelectionUtils { } + /** + * REPORT-6096 复制得到的是显示的大小,如果因屏幕分辨率问题存在缩放的话,显示大小和实际大小会有区别,粘贴后tab内部调整大小时会再次缩放导致问题。 + * 因此在粘贴之前将tab内部的组件调整成实际的大小。 + * + * @param copiedCreator 复制的组件 + */ + private static void resetTabSub2RealSize(XCreator copiedCreator) { + ArrayList childrenList = copiedCreator.getTargetChildrenList(); + if (!childrenList.isEmpty()) { + for (Object aChildrenList : childrenList) { + XWTabFitLayout tabLayout = (XWTabFitLayout) aChildrenList; + double percent = tabLayout.getContainerPercent(); + Component[] components = tabLayout.getComponents(); + for (Component component : components) { + Rectangle show = component.getBounds(); + component.setBounds(new Rectangle((int) (show.x * percent), (int) (show.y * percent), (int) (show.width * percent), (int) (show.height * percent))); + } + } + } + } + /** * 相对布局粘贴 */ @@ -178,9 +201,9 @@ public class FormSelectionUtils { */ private static Point getPasteLocation(AbstractLayoutAdapter layoutAdapter, XCreator copiedCreator, int x, int y) { //当宽度为奇数时 设置偏移 - int xoffset = (copiedCreator.getWidth() & 1) == 1 ? 1 : 0; + int xoffset = copiedCreator.getWidth() & 1; //当高度为奇数时 设置偏移 - int yoffset = (copiedCreator.getHeight() & 1) == 1 ? 1 : 0; + int yoffset = copiedCreator.getHeight() & 1; if (!layoutAdapter.accept(copiedCreator, x, y)) { XLayoutContainer container = layoutAdapter.getContainer();