From e9b1ad1f909bd10c0b09588f48674ff2ca4f696d Mon Sep 17 00:00:00 2001 From: Starryi Date: Mon, 12 Apr 2021 14:40:37 +0800 Subject: [PATCH 01/11] =?UTF-8?q?REPORT-50809=20frm=E6=A8=A1=E7=89=88?= =?UTF-8?q?=E4=B8=8Ecpt=E6=A8=A1=E7=89=88=E5=9C=A8=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=86=85=E9=A2=84=E8=A7=88=E5=9B=BE=E6=A0=87=E5=A4=A7?= =?UTF-8?q?=E5=B0=8F=E4=B8=8D=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 CPT和FRM文件的预览按钮图标使用了不同的图片。 PagePreview类规定了CPT的分页预览图标为com/fr/design/images/buttonicon/pageb24.png,而 FormPreview类规定了FRM的预览图标为com/fr/design/images/buttonicon/run24.png. 这两个图片大小都为32x32,且图形内容大致相同,但是pageb24图形周围存在透明像素, 所以可见的图形大小小于run24.png 【改动思路】 将run24.png的内容替换为pageb24.png --- .../com/fr/design/images/buttonicon/run24.png | Bin 942 -> 736 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/run24.png b/designer-base/src/main/resources/com/fr/design/images/buttonicon/run24.png index 8ebe92439eba1ae9355d11b8cc1477dcd782cd0f..67127219d8ecf3cdab46e61f8afbbfbbc3819008 100644 GIT binary patch delta 700 zcmV;t0z>_-2jB&eFn8j4^ynE-KbKZS-h6il+hoLoK=m9U$;*G?D7c5k*mVZV_n^CJ~Al?jef#kEYB8Wm8hw_5FFYLHxzSeJp(v#r?1QRkK9 zl5sjO;k0i>UVm$W4L<@c@p4XA2Q+sh3NRHGQM7Ca7~}iVWq`H|b7ltC^f>nK>VW;A z4L_sfn3&BX(R~6%u8USejp;H_Jp;jD5czx_Znt-hbhy8Q{eC}sdi!wm`{A{m1~S~U zR4RpJGFcLLQ)xXO559c*2u9$k`RX8bw6!iI-M?Po)_;{V)jW#zN}+%o58q+2_oN(e z+J$5*laoo+K&#mdt}w5bR>Td@fX~Ol(WQNIf+&Gybx}i`N#XVHLXv7<7e!G-PO?y{ z*N1f3B>w|k#swzu87|kc^=zw=z}xpo^&D5tlL^Be$hX_@>ccn0W~N9U8UF}>#cXT} zTy|QHX@3F32Fhgf_H(%RW)d$)1DK3P!1H-bM8bIbYy=}?VO;i}LSN!JI^(akv@1Eo zpP_5}gGs;JjE}b{u zw!0!;&PNYiM`)=715O9L{Q_8iNl`{FbPXX{pfw9K3=%dkuHJnNOJ*8^^N4EM#u!+Y io3o!+75<<2*MUF3y2bkI9sFndyEFL%yQxSa?|1^5g7IhPYb_%n$oE|N^+n@jkBoBy>6h!byM#R@bW zBXB6mH=P4hG=FNk+#9((UVUTsNadSRu>wkW0Gfi@VF6TX&_TMjt2a^<1;~*R)^UW6 zJw~AAEeMSk4Eu4r-B^vz$8ySPP@xHOO9ggC0iJrGqoV_@y{#xOFGq24C3HIW&e<_H zHwTl+g!cAYR8&+TbbqO04=4%{$YnuqZ!bDKJJHzKh=17FSb^JMFsz9xDk?%lLj#N_ zgIRx}AVv%n1@L=7MLD4FYr(nm)vyuj;5I!3M{qQs*Qe>XJfEpN^HiHV_8c}|D zRRMQo28KsQ`?$%%0|!%{?6A@oXsBc=!w!yhp@@>$5@0WDhQ@n*n;)p(-^@0Q6c z0SplWTiO{sY`G2F($6gx(ag2FibwbFfZ3A_T7MfU@(Q6>0=T6PvJ~?=BW~7Tz~HMs zFpTgZ#Z~7<{YAK3Zj|IEB7W%V`d%T-yNM)!N_ToR)3SR&_-Gr{zh)2>pUmzDfiTZZ zzzq$Sla3>Fx*Nv4biC+)j&MDR@q=|>h+v41W{PjYrc}|y8I=R>t6rJI(#i}}38%xP&BFUtfbI|FVe1%U?ptYSuu97~s_B!4X}snVgHGgQ75* zU4u_k7U-jNC@V}y#QP=*h1WeGVc5n%g(bjJP>Z%F-LTu2p|OriqIXpQmyOm&z+89* iPiJGXkW(!Y@EaMR2b1K<1?T_(002ovP6b4+LSTZpQ=#kt From fb1534f3eaf83f757770648cbde845c75d78e9fe Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Tue, 13 Apr 2021 16:27:22 +0800 Subject: [PATCH 02/11] =?UTF-8?q?CHART-18881=20=E5=8D=95=E5=85=83=E6=A0=BC?= =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E6=9C=89=E6=97=B6=E5=80=99=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E7=82=B9=E5=87=BA=E5=9B=BE=E8=A1=A8=E5=B1=9E=E6=80=A7=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/ChartPropertyPane.java | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java index 190f43864f..c5c2a3fe4d 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java @@ -24,15 +24,9 @@ public class ChartPropertyPane extends BaseChartPropertyPane { * 创建图表属性表实例. */ private synchronized static ChartPropertyPane getInstance() { - //创建新图表时,创建属性表配置面板 - if (singleton == null) { - singleton = new ChartPropertyPane(); - } - return singleton; + return new ChartPropertyPane(); } - private static ChartPropertyPane singleton; - protected TargetComponentContainer container = new TargetComponentContainer(); protected ChartEditPane chartEditPane; @@ -160,8 +154,4 @@ public class ChartPropertyPane extends BaseChartPropertyPane { chartEditPane.setSupportCellData(supportCellData); } } - - public synchronized static void clear() { - singleton = null; - } } \ No newline at end of file From 5f0d39ecb9c8560aa879639088ba682a655c0ef6 Mon Sep 17 00:00:00 2001 From: Yvan Date: Tue, 13 Apr 2021 17:16:59 +0800 Subject: [PATCH 03/11] =?UTF-8?q?REPORT-49686=20=E5=86=B3=E7=AD=96?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E8=87=AA=E9=80=82=E5=BA=94=E5=B8=83=E5=B1=80?= =?UTF-8?q?=EF=BC=8C=E6=B7=BB=E5=8A=A0=E5=8F=82=E6=95=B0=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E6=97=A0=E6=B3=95=E9=80=9A=E8=BF=87=E5=8F=B3?= =?UTF-8?q?=E4=BE=A7=E8=AE=BE=E7=BD=AE=E9=9D=A2=E6=9D=BF=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E7=BB=9D=E5=AF=B9=E7=94=BB=E5=B8=83=E5=9D=97=E7=9A=84=E5=A4=A7?= =?UTF-8?q?=E5=B0=8F=20=E3=80=90=E9=97=AE=E9=A2=98=E5=8E=9F=E5=9B=A0?= =?UTF-8?q?=E3=80=91=E8=BF=99=E9=87=8C=E7=BB=9D=E5=AF=B9=E7=94=BB=E5=B8=83?= =?UTF-8?q?=E5=9D=97=E7=9A=84=E9=AB=98=E5=BA=A6=E8=B0=83=E6=95=B4=E8=A6=81?= =?UTF-8?q?=E5=88=86=E4=B8=BA=E4=B8=A4=E7=A7=8D=E6=96=B9=E5=BC=8F=EF=BC=8C?= =?UTF-8?q?=E4=B8=80=E7=A7=8D=E6=98=AF=E6=8B=96=E6=8B=BD=E6=94=B9=E5=8F=98?= =?UTF-8?q?=EF=BC=8C=E5=8F=A6=E4=B8=80=E7=A7=8D=E6=98=AF=E5=9C=A8=E5=8F=B3?= =?UTF-8?q?=E4=BE=A7=E9=9D=A2=E6=9D=BF=E4=B8=AD=E6=94=B9=E5=8F=98=E9=AB=98?= =?UTF-8?q?=E5=BA=A6=E6=95=B0=E5=80=BC=EF=BC=8C=E9=97=AE=E9=A2=98=E7=9A=84?= =?UTF-8?q?=E5=8E=9F=E5=9B=A0=E6=98=AF=E6=AD=A4=E5=89=8DREPORT-7588?= =?UTF-8?q?=E4=B8=AD=EF=BC=8C=E6=8B=96=E6=8B=BD=E6=97=B6=E4=BC=9A=E8=B5=B0?= =?UTF-8?q?=E5=88=B0FormSelection#fixCreator()=EF=BC=8C=E8=BF=99=E9=87=8C?= =?UTF-8?q?=E9=9D=A2=E4=B8=BA=E7=BB=9D=E5=AF=B9=E7=94=BB=E5=B8=83=E5=9D=97?= =?UTF-8?q?=E5=81=9A=E7=89=B9=E6=AE=8A=E5=A4=84=E7=90=86=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E6=BC=8F=E7=AE=97=E4=BA=86=E5=8F=82=E6=95=B0=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E7=9A=84=E9=AB=98=E5=BA=A6=EF=BC=8C=E7=84=B6=E5=90=8E=E5=9C=A8?= =?UTF-8?q?REPORT-34739=E4=B8=AD=EF=BC=8CFRFitLayoutAdapter#fix()=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E4=B8=AD=E5=A4=84=E7=90=86=E4=BA=86=E4=B8=80=E4=B8=8B?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E9=9D=A2=E6=9D=BF=E9=80=A0=E6=88=90=E7=9A=84?= =?UTF-8?q?=E5=81=8F=E7=A7=BB=EF=BC=8C=E6=89=80=E4=BB=A5=E6=8B=96=E6=8B=BD?= =?UTF-8?q?=E7=9A=84=E9=80=BB=E8=BE=91=E9=83=BD=E6=AD=A3=E5=B8=B8=EF=BC=9B?= =?UTF-8?q?=E4=BD=86=E6=98=AF=E5=A6=82=E6=9E=9C=E5=9C=A8=E5=8F=B3=E4=BE=A7?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E4=B8=AD=E6=94=B9=E5=8F=98=E9=AB=98=E5=BA=A6?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E4=BC=9A=E7=9B=B4=E6=8E=A5=E8=B5=B0=E5=88=B0?= =?UTF-8?q?FRFitLayoutAdapter#fix()=E4=B8=AD=EF=BC=8C=E6=AD=A4=E6=97=B6?= =?UTF-8?q?=E6=98=AF=E6=B2=A1=E6=9C=89=E6=BC=8F=E7=AE=97=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E9=AB=98=E5=BA=A6=E7=9A=84=EF=BC=8C=E5=9B=A0?= =?UTF-8?q?=E6=AD=A4=E7=BB=8F=E8=BF=87=E5=A4=84=E7=90=86=E4=B9=8B=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E5=8F=8D=E8=80=8C=E7=BB=84=E4=BB=B6=E7=9A=84backupBou?= =?UTF-8?q?nd=E4=BC=9A=E5=A4=9A=E4=BA=86=E4=B8=AA=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E9=AB=98=E5=BA=A6=EF=BC=8C=E8=BF=99=E6=A0=B7?= =?UTF-8?q?=E4=BC=9A=E9=80=A0=E6=88=90=E6=AF=8F=E6=AC=A1=E6=94=B9=E5=8F=98?= =?UTF-8?q?=E9=83=BD=E5=8A=A0=E4=B8=8A=E8=BF=99=E4=B8=AA=E9=AB=98=E5=BA=A6?= =?UTF-8?q?=EF=BC=8C=E5=B0=B1=E5=87=BA=E7=8E=B0=E4=BA=86bug=E7=8E=B0?= =?UTF-8?q?=E8=B1=A1=20=E3=80=90=E6=94=B9=E5=8A=A8=E6=80=9D=E8=B7=AF?= =?UTF-8?q?=E3=80=91=E6=8A=8A=E5=88=A4=E6=96=AD=E5=8F=82=E6=95=B0=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E6=98=AF=E5=90=A6=E6=BC=8F=E7=AE=97=E7=9A=84=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E6=94=BE=E5=88=B0FormSelection#fixCreator()=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adapters/layout/FRFitLayoutAdapter.java | 10 +--------- .../com/fr/design/mainframe/FormSelection.java | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java index c0eb392979..22d74d7741 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java @@ -347,15 +347,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { //拖拽组件原大小、位置 Rectangle backupBound = creator.getBackupBound(); backupBound.x -= container.getX(); - // REPORT-34739 对绝对画布块的backupBound.y的调整还需要考虑一下参数面板块的高度造成的偏移 - int paraHeight = 0; - if (creator.acceptType(XWAbsoluteLayout.class)) { - JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - if (jTemplate instanceof JForm) { - paraHeight = ((JForm) jTemplate).getFormDesign().getParaHeight(); - } - } - backupBound.y -= (container.getY() - paraHeight); + backupBound.y -= container.getY(); //当前拖拽组件的位置 int x = creator.getX(); int y = creator.getY(); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java b/designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java index cbebbcba16..97228209a1 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java @@ -12,6 +12,7 @@ import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.creator.cardlayout.XWCardTagLayout; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; +import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.gui.LayoutUtils; import com.fr.form.ui.Widget; @@ -270,7 +271,9 @@ public class FormSelection { LayoutAdapter layoutAdapter = AdapterBus.searchLayoutAdapter(designer, creator); if (layoutAdapter != null) { if (creator.acceptType(XWAbsoluteLayout.class) && recs.size() > i) { - creator.setBackupBound(recs.get(i)); + Rectangle rectangle = recs.get(i); + check4ParaPane(rectangle); + creator.setBackupBound(rectangle); } else { creator.setBackupBound(backupBounds); } @@ -280,6 +283,19 @@ public class FormSelection { } } + /** + * 检查下有没有参数面板,如果存在,处理下参数面板造成的偏移量 + * @param rectangle + */ + private void check4ParaPane(Rectangle rectangle) { + int paraHeight = 0; + JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + if (jTemplate instanceof JForm) { + paraHeight = ((JForm) jTemplate).getFormDesign().getParaHeight(); + } + rectangle.y += paraHeight; + } + private void removeCreatorFromContainer(XCreator creator) { XLayoutContainer parent = XCreatorUtils.getParentXLayoutContainer(creator); if (parent == null) { From 1698c22c07eaf28cfcbce16cdc18de04b3213ff0 Mon Sep 17 00:00:00 2001 From: "Bruce.Deng" Date: Wed, 14 Apr 2021 09:39:47 +0800 Subject: [PATCH 04/11] =?UTF-8?q?REPORT-49067=20=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E7=BC=BA=E5=A4=B1=E5=AD=97=E4=BD=93=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/DesignerFrame.java | 16 +- .../com/fr/design/mainframe/JTemplate.java | 7 +- .../design/mainframe/check/CheckButton.java | 173 ++++++++++++++++++ .../mainframe/check/CheckFontInfoDialog.java | 139 ++++++++++++++ .../com/fr/design/images/buttonicon/check.png | Bin 0 -> 386 bytes .../com/fr/design/images/correct.png | Bin 0 -> 785 bytes .../resources/com/fr/design/images/error.png | Bin 0 -> 768 bytes .../com/fr/design/images/waiting.png | Bin 0 -> 1011 bytes .../fr/design/images/warnings/warning32.png | Bin 0 -> 942 bytes 9 files changed, 333 insertions(+), 2 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/check/CheckFontInfoDialog.java create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/check.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/correct.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/error.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/waiting.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/warnings/warning32.png diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index b826931b61..eec902c4c1 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -84,13 +84,13 @@ import javax.swing.UIManager; import javax.swing.WindowConstants; import javax.swing.border.MatteBorder; import java.awt.BorderLayout; +import java.awt.Component; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Graphics; import java.awt.Insets; import java.awt.Point; import java.awt.Rectangle; -import java.awt.Component; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.dnd.DnDConstants; @@ -701,6 +701,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } } } + //添加检测按钮 + addCheckButton(); //添加分享按钮 addShareButton(); //添加插件中的按钮 @@ -724,6 +726,18 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } } + private void addCheckButton() { + JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + if (jt == null) { + return; + } + combineUp.addSeparator(new Dimension(2, 16)); + UIButton[] checkButtons = jt.createCheckButton(); + for (UIButton checkButton : checkButtons) { + combineUp.add(checkButton); + } + } + private void addShareButton() { JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index caeb32f49f..0ff728580a 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -38,6 +38,7 @@ import com.fr.design.gui.itree.filetree.TemplateFileTree; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.chart.info.ChartInfoCollector; +import com.fr.design.mainframe.check.CheckButton; import com.fr.design.mainframe.template.info.TemplateInfoCollector; import com.fr.design.mainframe.template.info.TemplateProcessInfo; import com.fr.design.mainframe.template.info.TimeConsumeTimer; @@ -82,11 +83,11 @@ import javax.swing.JComponent; import javax.swing.JOptionPane; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.undo.UndoManager; +import java.awt.BorderLayout; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Set; -import java.awt.BorderLayout; /** * 报表设计和表单设计的编辑区域(设计器编辑的IO文件) @@ -1360,6 +1361,10 @@ public abstract class JTemplate> return uiButtons; } + public UIButton[] createCheckButton() { + return new UIButton[]{new CheckButton()}; + } + /** * 由于老版本的模板没有模板ID,当勾选使用参数模板时候,就加一个模板ID attr * diff --git a/designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java b/designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java new file mode 100644 index 0000000000..f42d18d404 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java @@ -0,0 +1,173 @@ +package com.fr.design.mainframe.check; + +import com.fr.base.BaseUtils; +import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.JTemplate; +import com.fr.file.FILE; +import com.fr.file.FileNodeFILE; +import com.fr.log.FineLoggerFactory; +import com.fr.rpc.ExceptionHandler; +import com.fr.rpc.RPCInvokerExceptionInfo; +import com.fr.workspace.WorkContext; +import com.fr.workspace.server.check.TemplateChecker; + +import javax.swing.BoxLayout; +import javax.swing.JDialog; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; +import javax.swing.SwingWorker; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.util.Set; +import java.util.concurrent.ExecutionException; + +import static javax.swing.JOptionPane.OK_CANCEL_OPTION; +import static javax.swing.JOptionPane.OK_OPTION; +import static javax.swing.JOptionPane.WARNING_MESSAGE; + +public class CheckButton extends UIButton { + + private UILabel message; + private UIButton okButton; + private JDialog dialog; + private UILabel uiLabel; + + public CheckButton() { + this.setIcon(BaseUtils.readIcon("/com/fr/design/images/buttonicon/check.png")); + this.setToolTipText(Toolkit.i18nText("Fine_Designer_Check_Font")); + this.set4ToolbarButton(); + this.addActionListener(checkListener); + } + + private ActionListener checkListener = new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + + // Try check + final SwingWorker, Void> checkThread = new SwingWorker, Void>() { + @Override + protected Set doInBackground() throws Exception { + // 返回校验结果 + return check(DesignerContext.getDesignerFrame().getSelectedJTemplate()); + } + + @Override + protected void done() { + try { + Set set = get(); + if (set == null) { + return; + } + if(set.isEmpty()) { + okButton.setEnabled(true); + uiLabel.setIcon(BaseUtils.readIcon("com/fr/design/images/correct.png")); + message.setText("" + Toolkit.i18nText("Fine_Designer_Check_Font_Success") + ""); + } else { + dialog.dispose(); + StringBuilder textBuilder = new StringBuilder(); + textBuilder.append(Toolkit.i18nText("Fine_Designer_Check_Font_Missing_Font")).append("\n"); + for (String font : set) { + textBuilder.append(font).append("\n"); + } + String areaText = textBuilder.toString(); + CheckFontInfoDialog dialog = new CheckFontInfoDialog(DesignerContext.getDesignerFrame(), areaText); + dialog.setVisible(true); + } + } catch (InterruptedException | ExecutionException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + }; + + JTemplate jtemplate = DesignerContext.getDesignerFrame().getSelectedJTemplate(); + if (jtemplate == null || jtemplate.getEditingFILE() == null) { + return; + } + FILE currentTemplate = jtemplate.getEditingFILE(); + if(currentTemplate instanceof FileNodeFILE){ + checkThread.execute(); + }else { + //模板不在报表环境下,提示保存 + int selVal = FineJOptionPane.showConfirmDialog( + DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Basic_Web_Preview_Message"), + Toolkit.i18nText("Fine_Designer_Check_Font"), + OK_CANCEL_OPTION, + WARNING_MESSAGE); + + if (OK_OPTION == selVal) { + //保存成功才执行检测 + if (jtemplate.saveAsTemplate2Env()) { + checkThread.execute(); + } + } + } + initDialogPane(); + okButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + dialog.dispose(); + } + }); + + dialog.addWindowListener(new WindowAdapter() { + public void windowClosed(WindowEvent e) { + checkThread.cancel(true); + } + }); + + dialog.setVisible(true); + dialog.dispose(); + } + }; + + private Set check(JTemplate jtemplate) { + String path = jtemplate.getEditingFILE().getEnvFullName(); + Set fontSet = WorkContext.getCurrent().get(TemplateChecker.class, new ExceptionHandler() { + + @Override + public Void callHandler(RPCInvokerExceptionInfo rpcInvokerExceptionInfo) { + uiLabel.setIcon(BaseUtils.readIcon("com/fr/design/images/error.png")); + message.setText("" + Toolkit.i18nText("Fine_Designer_Check_Font_Upgrade") + ""); + okButton.setEnabled(true); + return null; + } + }).checkFont(path); + return fontSet; + } + + private void initDialogPane() { + message = new UILabel(); + message.setText(Toolkit.i18nText("Fine-Designer_Check_Font_Checking") + "..."); + uiLabel = new UILabel(); + okButton = new UIButton(Toolkit.i18nText("Fine-Design_Report_OK")); + okButton.setEnabled(false); + dialog = new JDialog(); + dialog.setTitle(Toolkit.i18nText("Fine_Designer_Check_Font")); + dialog.setModal(true); + dialog.setSize(new Dimension(268, 118)); + JPanel jp = new JPanel(); + JPanel upPane = new JPanel(); + JPanel downPane = new JPanel(); + uiLabel = new UILabel(BaseUtils.readIcon("com/fr/design/images/waiting.png")); + upPane.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10)); + upPane.add(uiLabel); + upPane.add(message); + downPane.setLayout(new FlowLayout(FlowLayout.CENTER, 6, 0)); + downPane.add(okButton); + jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); + jp.add(upPane); + jp.add(downPane); + dialog.add(jp); + dialog.setResizable(false); + dialog.setLocationRelativeTo(SwingUtilities.getWindowAncestor(this)); + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/check/CheckFontInfoDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/check/CheckFontInfoDialog.java new file mode 100644 index 0000000000..837d48b288 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/check/CheckFontInfoDialog.java @@ -0,0 +1,139 @@ +package com.fr.design.mainframe.check; + +import com.fr.design.dialog.link.MessageWithLink; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.CloudCenter; +import com.fr.general.GeneralContext; +import com.fr.general.IOUtils; + +import javax.swing.BorderFactory; +import javax.swing.JDialog; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.UIManager; +import java.awt.BorderLayout; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.util.Locale; + +/** + * 字体缺失检测的具体结果对话框 + * + */ +public class CheckFontInfoDialog extends JDialog implements ActionListener { + + private JPanel topPanel; + private JPanel upInTopPanel; + private JPanel downInTopPanel; + private JPanel hiddenPanel; + private JPanel bottomPanel; + + private UILabel imageLabel; + private UILabel directUiLabel; + private UILabel detailLabel; + + public CheckFontInfoDialog(Frame parent, String areaText) { + super(parent,true); + //提示信息 + JPanel imagePanel = new JPanel(); + imageLabel = new UILabel(IOUtils.readIcon("com/fr/design/images/warnings/warning32.png")); + imagePanel.add(imageLabel); + + JPanel messagePanel = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true); + MessageWithLink linkMessage = new MessageWithLink(Toolkit.i18nText("Fine_Designer_Check_Font_Message"), + Toolkit.i18nText("Fine_Designer_Check_Font_Install_Font"), + CloudCenter.getInstance().acquireUrlByKind("help.install.font", "https://help.fanruan.com/finereport/doc-view-3999.html")); + linkMessage.setPreferredSize(new Dimension(380, 31)); + messagePanel.add(linkMessage); + + // 查看详情按钮 + directUiLabel = new UILabel(); + directUiLabel.setIcon(UIManager.getIcon("OptionPane.narrow.right")); + detailLabel = new UILabel(); + detailLabel.setText(Toolkit.i18nText("Fine_Designer_Look_Detail")); + + upInTopPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); + upInTopPanel.add(imageLabel, BorderLayout.WEST); + upInTopPanel.add(messagePanel, BorderLayout.CENTER); + + downInTopPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); + downInTopPanel.add(directUiLabel, BorderLayout.WEST); + downInTopPanel.add(detailLabel, BorderLayout.CENTER); + + topPanel = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true); + topPanel.add(upInTopPanel, BorderLayout.NORTH); + topPanel.add(downInTopPanel, BorderLayout.SOUTH); + + //中间的详情展示(可隐藏) + hiddenPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); + hiddenPanel.setBorder(BorderFactory.createEmptyBorder(0,12,0,12)); + JScrollPane scrollPane = new JScrollPane(); + JTextArea checkArea = new JTextArea(areaText); + scrollPane.setViewportView(checkArea); + scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + checkArea.setEnabled(false); + hiddenPanel.add(scrollPane); + hiddenPanel.setVisible(false); + + downInTopPanel.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + if (hiddenPanel.isVisible()) { + hiddenPanel.setVisible(false); + CheckFontInfoDialog.this.setSize(new Dimension(380, 185)); + detailLabel.setText(Toolkit.i18nText("Fine_Designer_Look_Detail")); + directUiLabel.setIcon(UIManager.getIcon("OptionPane.narrow.right")); + } else { + CheckFontInfoDialog.this.setSize(new Dimension(380, 280)); + hiddenPanel.setVisible(true); + detailLabel.setText(Toolkit.i18nText("Fine_Designer_Hide_Detail")); + directUiLabel.setIcon(UIManager.getIcon("OptionPane.narrow.down")); + } + } + + @Override + public void mouseEntered(MouseEvent e) { + detailLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + } + + @Override + public void mouseExited(MouseEvent e) { + detailLabel.setCursor(Cursor.getDefaultCursor()); + } + }); + + //底部的按钮面板 + UIButton okButton = new UIButton(Toolkit.i18nText("Fine-Design_Report_OK")); + JPanel buttonPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); + buttonPanel.setBorder(BorderFactory.createEmptyBorder(0,10,10,10)); + buttonPanel.add(okButton, BorderLayout.EAST); + okButton.addActionListener(this); + bottomPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); + bottomPanel.add(buttonPanel); + + this.setTitle(Toolkit.i18nText("Fine_Designer_Check_Font")); + this.setResizable(false); + + this.add(topPanel, BorderLayout.NORTH); + this.add(hiddenPanel, BorderLayout.CENTER); + this.add(bottomPanel, BorderLayout.SOUTH); + this.setSize(new Dimension(GeneralContext.getLocale().equals(Locale.US)? 400:380, 185)); + + GUICoreUtils.centerWindow(this); + } + + @Override + public void actionPerformed(ActionEvent e) { + this.dispose(); + } +} diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/check.png b/designer-base/src/main/resources/com/fr/design/images/buttonicon/check.png new file mode 100644 index 0000000000000000000000000000000000000000..36c4238a288e7bf5a1336e54a728f898b3bbb197 GIT binary patch literal 386 zcmV-|0e$|7P)FUn!XycSU0!EZqEZJ-?t4KQ-GIIfuX0oY*H0NjFTwbsT=!Ph4mf%nd!3r@6C z!$?%Z+#*o>yVsqKD*n|(Gq%{>NY zqA>6>K+PXeU_J!YS&}45*Uc7)b{Kpa$x&QzG literal 0 HcmV?d00001 diff --git a/designer-base/src/main/resources/com/fr/design/images/correct.png b/designer-base/src/main/resources/com/fr/design/images/correct.png new file mode 100644 index 0000000000000000000000000000000000000000..90f74f7a93b6190568e17fdd1f50d580e230322a GIT binary patch literal 785 zcmV+s1Md8ZP)eg96ue-AJx$?*HUpr{)7l2%4b4wNeu z%p?VLcZT8dxR)es9&QOBBjzAUMR>hD!l8BT1<-XJ@tI!;hk_8&A~y9#YGokbk#JHL z+YTtDGBVj5db>L@`#Xhz-)Hm!iF8&Z^5|F}Y}pmt0I7@!j%5*Cy9T5Y<)VVF4ILoa zPbZQ9boBK^K+|+f5S9RvTr`A8C`!r5o@H5Rnud5HiH$v7C|6X7xdK?00mreZR_6^U zGgyW}$if**09CDmbUq1&ror=`+KYvB7H$`Za#@Aj?J}Ot(#*RwjLM%dQJF>#GQLv@ z_-GyjTm-v3Te0821Adw}-etQ4i+wFBC1k~%kuhK+fF-Q#rc8+j$`2EdAyT9<7)Pi zZSlW9)Q$_$5#yji;^Z!nGzG_!S1fIBN~R;Ds`P-k`)S@Wz>~rl?&M$C&VIP>2ntmh z_hv_pGa99zPY*u7=@{Uga2sFBlePdZ_n*L--b1+d<1uc;pBZO#3S+6k*pOp@gEJQ~ zXVLX0nJIoZ@e-G&9@YbAg=j3~7+~n}-gWlhsr-#yJM4cYxIQ z!ser>&(b1ulP@DgV;znG7WY8CAWZbCD&w%-MfEG15~_`ie<430YHY{U7)Pc?ZidHbZCq P00000NkvXXu0mjfA?{=j literal 0 HcmV?d00001 diff --git a/designer-base/src/main/resources/com/fr/design/images/error.png b/designer-base/src/main/resources/com/fr/design/images/error.png new file mode 100644 index 0000000000000000000000000000000000000000..89601dfb13cc1eca9b46ff255be52404329d7af7 GIT binary patch literal 768 zcmV+b1ONPqP)>wmS%m@J!s9hL%jI=`+ zkf4AB;vs>Us2aB=^pQACow#ulUvyoZDs71pS4tRqhQyJt{eSmA=iCzx07hQErR=*= z5$ij`*;>}c7QmJRO?TkOgwoJ1*xM7S?1KLuU`flu=ktE;`726m5yleE&w>e1wnvmnoy<_=vj`huiHczj$sT1z8f2&le!el67sT#$75v7#)TD{vBLX3W%`_tV!7pi^BVHKyWldJf2M-^{m5S)K&ijq zIlxL+Bp`_*+QT7BOdKA9G(1#u4H)MyV9$-~&X3~7j0RC8@VMO|V`FgLzE!ihz0fr2 zx!u$8$5tD&4@a{=)8ILKX4Q5=ARRmav6$jjWNNa{F@Wb}4BXPvI=gLAiYW1bV*u~5qkw5{Sb*V? z7nV4Kn2nv-a1BRkv3n{mItJLR0~~0wTZso912nw`n%)Iy_Bmh;tEQfWe`~wpvtXm1 yVoo$<8djY;ng(HX1j6_@_=%t3ve}yc5BvdIrr9u~MbMi70000M4-XxpL zqpAW;Q?V@DgQ}Y<1Rbj=vnqgTTDYC>n(+Au2K5EU)3X@@ehtGg2?YG!eZ4dx%_1`W zE0O##VKap)%Qzy88S1ATeUL)eQ%E)9`C4-cZq>C^u8_&*yo_BXgbF`9uJ=U}55L#=D!!R7plO0o zFi2?T44q@|F9r`p(RRIzh(C%Fj3Fy&?8&p3e}4%^X5l$05+$5KmS@2+7F7{C{(UD9UH4HQIsk^dKitga@z7xML;zu)5GZ+(**k!LiPU z0haW@o;MKvN2m<#2dlIqg3_`Rb@!{7!*6d+4=kAie;dJrr?Ar_%wKp5?CM$KnFyc+ zyOD)dZR%^s_(rGT);*v^ccVY@1=6vwul|HnoWK`OAa*>9G%^^cpIe05j6L9bTeb=P zZD_k*!WSPv(L0fqSsZs0{__>g=N14qWfRuDHT^7Dsl!|)nsOT6X2z;rZ56!lfnfGL hS}BRoF0Sc&;9q-O{V<0rcHjU2002ovPDHLkV1oEO;voP4 literal 0 HcmV?d00001 diff --git a/designer-base/src/main/resources/com/fr/design/images/warnings/warning32.png b/designer-base/src/main/resources/com/fr/design/images/warnings/warning32.png new file mode 100644 index 0000000000000000000000000000000000000000..4d2a189b6eba699ce052ec50c27625148f3fb5f8 GIT binary patch literal 942 zcmV;f15x~mP)fKNK>p-v1rJH z@j*neD!!Ri-Pxigp@^-zv$kn4M57p#D%gO8qAiMX=g*Pdi8aaYWM(!Sa$o11@B7_z z&$)L9bG&Gd{V^keY%d0lnh|%>K*`X`%z)G8G$E&w#1 z&kS&rqGgP*5TOB>K~_r5m3+k{GeV#Ie!7te90npZfR&7GWTKyu^ zFQdez+d&`#SHRL^KQidUAff=DP&DJCAhCe}%u~^|5OnVO*a2escK}JQ2itJ^cTVuj z%?g^8xN+VO!WV#dKv?x^KY;p)Vp7W)(7YF2|0n;#?s<2L7hjeKj1{y4&U6sI0G6(9 zV&KqJ5oui)sPZ)z;Njn}&wgCs!>~6;v`asf48T7(&bPDjFaxg?0IWF-T2SKx+`j?) z{O3h{_?{fGtLdHJ|MP;FwgRTEb^zE~ELp_%K`eAHLud3)IL4R7J%~D#_{Fb71B|7j zRT7J<0Ol11SouA~qGlIhmm>uVBC6PHhHK@RV zyCGST*kyp;n6`VXKZUexb3Vkreh575_XhD5IcvO08(>e=EdaMo>T!-kM0G8yRBJUPN$+}zA6A1OQ|(7^B{vFfxH*gLcH$Ye$K5f;Qmmc zG=Q@LJp#Yi@K)!A*ik9i6@z-t;Ky4U+GQ Date: Wed, 14 Apr 2021 10:42:49 +0800 Subject: [PATCH 05/11] =?UTF-8?q?KERNEL-7376=20=E4=BC=98=E5=8C=96=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E4=B8=8A=E4=B8=80=E4=BA=9B=E6=80=A7=E8=83=BD?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/file/HistoryTemplateListCache.java | 2 -- .../java/com/fr/design/module/DesignModuleFactory.java | 8 -------- 2 files changed, 10 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index f6b8f07d52..8742a894f2 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -64,7 +64,6 @@ public class HistoryTemplateListCache implements CallbackEvent { * @param selected 选择的 */ public void closeSelectedReport(JTemplate selected) { - DesignModuleFactory.clearChartPropertyPane(); DesignTableDataManager.closeTemplate(selected); //直接关闭模板的时候(当且仅当设计器tab上只剩一个模板)退出权限编辑 if (DesignModeContext.isAuthorityEditing() && historyList.size() <= 1) { @@ -92,7 +91,6 @@ public class HistoryTemplateListCache implements CallbackEvent { * @param selected 选择的 */ public void closeVirtualSelectedReport(JTemplate selected) { - DesignModuleFactory.clearChartPropertyPane(); DesignTableDataManager.closeTemplate(selected); if (contains(selected) == -1) { return; diff --git a/designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java b/designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java index f3e8c4ebd2..5ff882f642 100644 --- a/designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java +++ b/designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java @@ -243,14 +243,6 @@ public class DesignModuleFactory { return bp; } - - public static void clearChartPropertyPane() { - if (instance.chartPropertyPaneClass != null) { - StableUtils.clearInstance(instance.chartPropertyPaneClass); - } - } - - public static void registerButtonDetailPaneClass(Class clazz) { instance.buttonDetailPaneClass = clazz; } From 7247a789a97ccbb34d0bcad0a5f3ea2701531ee2 Mon Sep 17 00:00:00 2001 From: pengda Date: Wed, 14 Apr 2021 14:13:35 +0800 Subject: [PATCH 06/11] =?UTF-8?q?REPORT-49055=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/datapane/connect/DBCPAttrPane.java | 118 ++++++ .../connect/DatabaseConnectionPane.java | 60 ++- .../data/datapane/connect/JDBCDefPane.java | 392 ++++++++++++------ .../fr/design/layout/TableLayoutHelper.java | 2 +- 4 files changed, 426 insertions(+), 146 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/data/datapane/connect/DBCPAttrPane.java diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DBCPAttrPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DBCPAttrPane.java new file mode 100644 index 0000000000..01af972931 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DBCPAttrPane.java @@ -0,0 +1,118 @@ +package com.fr.design.data.datapane.connect; + +import com.fr.data.impl.JDBCDatabaseConnection; +import com.fr.data.pool.DBCPConnectionPoolAttr; +import com.fr.design.constants.UIConstants; +import com.fr.design.dialog.BasicPane; +import com.fr.design.editor.editor.IntegerEditor; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import java.awt.BorderLayout; +import java.awt.Component; +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.SwingConstants; + +public class DBCPAttrPane extends BasicPane { + public static final int TIME_MULTIPLE = 1000; + // carl:DBCP的一些属性 + private IntegerEditor DBCP_INITIAL_SIZE = new IntegerEditor(); + private IntegerEditor DBCP_MAX_ACTIVE = new IntegerEditor(); + private IntegerEditor DBCP_MAX_IDLE = new IntegerEditor(); + private IntegerEditor DBCP_MIN_IDLE = new IntegerEditor(); + private IntegerEditor DBCP_MAX_WAIT = new IntegerEditor(); + private UITextField DBCP_VALIDATION_QUERY = new UITextField(); + + private UIComboBox DBCP_TESTONBORROW = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Basic_No"), Toolkit.i18nText("Fine-Design_Basic_Yes")}); + private UIComboBox DBCP_TESTONRETURN = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Basic_No"), Toolkit.i18nText("Fine-Design_Basic_Yes")}); + private UIComboBox DBCP_TESTWHILEIDLE = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Basic_No"), Toolkit.i18nText("Fine-Design_Basic_Yes")}); + + private IntegerEditor DBCP_TIMEBETWEENEVICTIONRUNSMILLS = new IntegerEditor(); + private IntegerEditor DBCP_NUMTESTSPEREVICTIONRUN = new IntegerEditor(); + private IntegerEditor DBCP_MINEVICTABLEIDLETIMEMILLIS = new IntegerEditor(); + + public DBCPAttrPane() { + JPanel defaultPane = this; + + // JPanel northFlowPane + JPanel northFlowPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); + defaultPane.add(northFlowPane, BorderLayout.NORTH); + + DBCP_VALIDATION_QUERY.setColumns(15); + // ContextPane + + double f = TableLayout.FILL; + // double p = TableLayout.PREFERRED; + double[] rowSize = {f, f, f, f, f, f, f, f, f, f, f, f}; + double[] columnSize = {f, f}; + Component[][] comps = { + {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Initial_Size") + ":", SwingConstants.RIGHT), DBCP_INITIAL_SIZE}, + {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Max_Active") + ":", SwingConstants.RIGHT), DBCP_MAX_ACTIVE}, + {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Max_Idle") + ":", SwingConstants.RIGHT), DBCP_MAX_IDLE}, + {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Min_Idle") + ":", SwingConstants.RIGHT), DBCP_MIN_IDLE}, + {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Max_Wait_Time") + ":", SwingConstants.RIGHT), DBCP_MAX_WAIT}, + {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Validation_Query") + ":", SwingConstants.RIGHT), DBCP_VALIDATION_QUERY}, + {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_On_Borrow") + ":", SwingConstants.RIGHT), DBCP_TESTONBORROW}, + {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_On_Return") + ":", SwingConstants.RIGHT), DBCP_TESTONRETURN}, + {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_While_Idle") + ":", SwingConstants.RIGHT), DBCP_TESTWHILEIDLE}, + {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Evictionruns_millis") + ":", SwingConstants.RIGHT), + DBCP_TIMEBETWEENEVICTIONRUNSMILLS}, + {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Num_Test_Per_Evction_Run") + ":", SwingConstants.RIGHT), DBCP_NUMTESTSPEREVICTIONRUN}, + {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Mix_Evictable_Idle_Time_Millis") + ":", SwingConstants.RIGHT), + DBCP_MINEVICTABLEIDLETIMEMILLIS}}; + + JPanel contextPane = TableLayoutHelper.createGapTableLayoutPane(comps, rowSize, columnSize, 10, 4); + contextPane.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, UIConstants.LINE_COLOR)); + northFlowPane.add(contextPane); + } + + public void populate(JDBCDatabaseConnection jdbcDatabase) { + DBCPConnectionPoolAttr dbcpAttr = jdbcDatabase.getDbcpAttr(); + if (dbcpAttr == null) { + dbcpAttr = new DBCPConnectionPoolAttr(); + jdbcDatabase.setDbcpAttr(dbcpAttr); + } + this.DBCP_INITIAL_SIZE.setValue(dbcpAttr.getInitialSize()); + this.DBCP_MAX_ACTIVE.setValue(dbcpAttr.getMaxActive()); + this.DBCP_MAX_IDLE.setValue(dbcpAttr.getMaxIdle()); + this.DBCP_MAX_WAIT.setValue(dbcpAttr.getMaxWait()); + this.DBCP_MIN_IDLE.setValue(dbcpAttr.getMinIdle()); + this.DBCP_VALIDATION_QUERY.setText(dbcpAttr.getValidationQuery()); + this.DBCP_TESTONBORROW.setSelectedIndex(dbcpAttr.isTestOnBorrow() ? 1 : 0); + this.DBCP_TESTONRETURN.setSelectedIndex(dbcpAttr.isTestOnReturn() ? 1 : 0); + this.DBCP_TESTWHILEIDLE.setSelectedIndex(dbcpAttr.isTestWhileIdle() ? 1 : 0); + this.DBCP_MINEVICTABLEIDLETIMEMILLIS.setValue(dbcpAttr.getMinEvictableIdleTimeMillis() / TIME_MULTIPLE); + this.DBCP_NUMTESTSPEREVICTIONRUN.setValue(dbcpAttr.getNumTestsPerEvictionRun()); + this.DBCP_TIMEBETWEENEVICTIONRUNSMILLS.setValue(dbcpAttr.getTimeBetweenEvictionRunsMillis()); + } + + public void update(JDBCDatabaseConnection jdbcDatabase) { + DBCPConnectionPoolAttr dbcpAttr = jdbcDatabase.getDbcpAttr(); + if (dbcpAttr == null) { + dbcpAttr = new DBCPConnectionPoolAttr(); + jdbcDatabase.setDbcpAttr(dbcpAttr); + } + dbcpAttr.setInitialSize(this.DBCP_INITIAL_SIZE.getValue().intValue()); + dbcpAttr.setMaxActive(this.DBCP_MAX_ACTIVE.getValue().intValue()); + dbcpAttr.setMaxIdle(this.DBCP_MAX_IDLE.getValue().intValue()); + dbcpAttr.setMaxWait(this.DBCP_MAX_WAIT.getValue().intValue()); + dbcpAttr.setMinIdle(this.DBCP_MIN_IDLE.getValue().intValue()); + dbcpAttr.setValidationQuery(this.DBCP_VALIDATION_QUERY.getText()); + dbcpAttr.setTestOnBorrow(this.DBCP_TESTONBORROW.getSelectedIndex() == 0 ? false : true); + dbcpAttr.setTestOnReturn(this.DBCP_TESTONRETURN.getSelectedIndex() == 0 ? false : true); + dbcpAttr.setTestWhileIdle(this.DBCP_TESTWHILEIDLE.getSelectedIndex() == 0 ? false : true); + dbcpAttr.setMinEvictableIdleTimeMillis(((Number) this.DBCP_MINEVICTABLEIDLETIMEMILLIS.getValue()).intValue() * TIME_MULTIPLE); + dbcpAttr.setNumTestsPerEvictionRun(((Number) this.DBCP_NUMTESTSPEREVICTIONRUN.getValue()).intValue()); + dbcpAttr.setTimeBetweenEvictionRunsMillis(((Number) this.DBCP_TIMEBETWEENEVICTIONRUNSMILLS.getValue()).intValue()); + } + + @Override + protected String title4PopupWindow() { + return Toolkit.i18nText("Fine-Design_Basic_ConnectionPool_Attr"); + } +} diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java index 16c992b0f3..d58b4d727e 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java @@ -12,8 +12,10 @@ import com.fr.data.solution.entity.DriverPage; import com.fr.data.solution.processor.ClassNotFoundExceptionSolutionProcessor; import com.fr.data.solution.processor.SolutionProcessor; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.ActionLabel; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; @@ -245,14 +247,16 @@ public abstract class DatabaseConnectionPane { private static JDBCDefPane jdbcDefPane = new JDBCDefPane(); + private static DBCPAttrPane dbcpAttrPane = new DBCPAttrPane(); @Override protected JPanel mainPanel() { @@ -362,14 +393,21 @@ public abstract class DatabaseConnectionPane jdbcMap = new HashMap(); static { @@ -59,45 +64,38 @@ public class JDBCDefPane extends JPanel { new DriverURLName("COM.cloudscape.JDBCDriver", "jdbc:cloudscape:/cloudscape/"), new DriverURLName("com.internetcds.jdbc.tds.Driver", "jdbc:freetds:sqlserver://localhost/"), new DriverURLName("com.fr.swift.jdbc.Driver", "jdbc:swift:emb://default")}); - jdbcMap.put("Inceptor", new DriverURLName[]{new DriverURLName("org.apache.hive.jdbc.HiveDriver", "jdbc:inceptor2://localhost:10000/default"), - new DriverURLName("org.apache.hadoop.hive.jdbc.HiveDriver", "jdbc:inceptor://localhost:10000/default")}); - jdbcMap.put("Oracle", new DriverURLName[]{new DriverURLName("oracle.jdbc.driver.OracleDriver", "jdbc:oracle:thin:@localhost:1521:databaseName")}); - jdbcMap.put("DB2", new DriverURLName[]{new DriverURLName("com.ibm.db2.jcc.DB2Driver", "jdbc:db2://localhost:50000/")}); - jdbcMap.put("SQL Server", new DriverURLName[]{new DriverURLName("com.microsoft.sqlserver.jdbc.SQLServerDriver", "jdbc:sqlserver://localhost:1433;" + "databaseName=")}); - jdbcMap.put("MySQL", new DriverURLName[]{new DriverURLName("com.mysql.jdbc.Driver", "jdbc:mysql://localhost/"), - new DriverURLName("org.gjt.mm.mysql.Driver", "jdbc:mysql://localhost/")}); - jdbcMap.put("Sybase", new DriverURLName[]{new DriverURLName("com.sybase.jdbc2.jdbc.SybDriver", "jdbc:sybase:Tds:localhost:5000/")}); + jdbcMap.put("Inceptor", new DriverURLName[]{new DriverURLName("org.apache.hive.jdbc.HiveDriver", "jdbc:inceptor2://localhost:port/databaseName"), + new DriverURLName("org.apache.hadoop.hive.jdbc.HiveDriver", "jdbc:inceptor://localhost:port/databaseName")}); + jdbcMap.put("Oracle", new DriverURLName[]{new DriverURLName("oracle.jdbc.driver.OracleDriver", "jdbc:oracle:thin:@localhost:port:databaseName")}); + jdbcMap.put("DB2", new DriverURLName[]{new DriverURLName("com.ibm.db2.jcc.DB2Driver", "jdbc:db2://localhost:port/databaseName")}); + jdbcMap.put("SQL Server", new DriverURLName[]{new DriverURLName("com.microsoft.sqlserver.jdbc.SQLServerDriver", "jdbc:sqlserver://localhost:port;databaseName=databaseName")}); + jdbcMap.put("MySQL", new DriverURLName[]{new DriverURLName("com.mysql.jdbc.Driver", "jdbc:mysql://localhost:port/databaseName"), + new DriverURLName("org.gjt.mm.mysql.Driver", "jdbc:mysql://localhost:port/databaseName")}); + jdbcMap.put("Sybase", new DriverURLName[]{new DriverURLName("com.sybase.jdbc2.jdbc.SybDriver", "jdbc:sybase:Tds:localhost:port/databaseName")}); + jdbcMap.put("Derby", new DriverURLName[]{new DriverURLName("org.apache.derby.jdbc.ClientDriver", "jdbc:derby://localhost:port/databaseName")}); + jdbcMap.put("Postgre", new DriverURLName[]{new DriverURLName("org.postgresql.Driver", "jdbc:postgresql://localhost:port/databaseName")}); + jdbcMap.put("Access", new DriverURLName[]{new DriverURLName("sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=")}); - jdbcMap.put("Derby", new DriverURLName[]{new DriverURLName("org.apache.derby.jdbc.ClientDriver", "jdbc:derby://localhost:1527/")}); - jdbcMap.put("Postgre", new DriverURLName[]{new DriverURLName("org.postgresql.Driver", "jdbc:postgresql://localhost:5432/")}); jdbcMap.put("SQLite", new DriverURLName[]{new DriverURLName("org.sqlite.JDBC", "jdbc:sqlite://${ENV_HOME}/../help/FRDemo.db")}); } private UIButton dbtypeButton; private UIComboBox dbtypeComboBox; private UIComboBox driverComboBox; + private UITextField dbNameTextField; + private UITextField hostTextField; + private UITextField portTextField; private UITextField urlTextField; private UITextField userNameTextField; private JPasswordField passwordTextField; + private UIComboBox charSetComboBox; private ActionLabel odbcTipsLink; + private JPanel centerPanel; + private Component[][] allComponents; + private Component[][] partComponents; // 请不要改动dbtype,只应该最后添加 private final String[] dbtype = {"Oracle", "DB2", "SQL Server", "MySQL", "Sybase", "Access", "Derby", "Postgre", "SQLite", "Inceptor", OTHER_DB}; - // carl:DBCP的一些属性 - private IntegerEditor DBCP_INITIAL_SIZE = new IntegerEditor(); - private IntegerEditor DBCP_MAX_ACTIVE = new IntegerEditor(); - private IntegerEditor DBCP_MAX_IDLE = new IntegerEditor(); - private IntegerEditor DBCP_MIN_IDLE = new IntegerEditor(); - private IntegerEditor DBCP_MAX_WAIT = new IntegerEditor(); - private UITextField DBCP_VALIDATION_QUERY = new UITextField(); - - private UIComboBox DBCP_TESTONBORROW = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Basic_No"), Toolkit.i18nText("Fine-Design_Basic_Yes")}); - private UIComboBox DBCP_TESTONRETURN = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Basic_No"), Toolkit.i18nText("Fine-Design_Basic_Yes")}); - private UIComboBox DBCP_TESTWHILEIDLE = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Basic_No"), Toolkit.i18nText("Fine-Design_Basic_Yes")}); - - private IntegerEditor DBCP_TIMEBETWEENEVICTIONRUNSMILLS = new IntegerEditor(); - private IntegerEditor DBCP_NUMTESTSPEREVICTIONRUN = new IntegerEditor(); - private IntegerEditor DBCP_MINEVICTABLEIDLETIMEMILLIS = new IntegerEditor(); private JDBCDatabaseConnection jdbcDatabase; @@ -118,7 +116,14 @@ public class JDBCDefPane extends JPanel { driverComboBox = new UIComboBox(); driverComboBox.setEditable(true); driverComboBox.addActionListener(driverListener); + dbNameTextField = new UITextField(15); + hostTextField = new UITextField(15); + portTextField = new UITextField(15); + portTextField.addInputMethodListener(portInputMethodListener); + portTextField.addKeyListener(portKeyListener); urlTextField = new UITextField(15); + urlTextField.getDocument().addDocumentListener(updateParaListener); + enableSubDocListener(); userNameTextField = new UITextField(15); userNameTextField.setName(USER_NAME); passwordTextField = new UIPasswordFieldWithFixedLength(15); @@ -130,11 +135,10 @@ public class JDBCDefPane extends JPanel { double f = TableLayout.FILL; JPanel dbtypePane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); dbtypePane.add(new UILabel((Toolkit.i18nText("Fine-Design_Basic_Database") + ":"))); - JPanel dbtypeComPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); Component[][] dbtypeComComponents = {{dbtypeComboBox}}; double[] dbtypeRowSize = {p}; double[] dbtypeColumnSize = {p}; - dbtypeComPane = TableLayoutHelper.createTableLayoutPane(dbtypeComComponents, dbtypeRowSize, dbtypeColumnSize); + JPanel dbtypeComPane = TableLayoutHelper.createTableLayoutPane(dbtypeComComponents, dbtypeRowSize, dbtypeColumnSize); JPanel driverPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); driverPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Driver") + ":")); @@ -161,43 +165,61 @@ public class JDBCDefPane extends JPanel { driverComboBoxAndTips.add(driverComboBox, BorderLayout.WEST); driverComboBoxAndTips.add(odbcTipsPane, BorderLayout.CENTER); + JPanel hostPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); + hostPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Host") + ":")); + Component[][] hostComComponents = {{hostTextField}}; + double[] hostRowSize = {p}; + double[] hostColumnSize = {p}; + JPanel hostComPane = TableLayoutHelper.createTableLayoutPane(hostComComponents, hostRowSize, hostColumnSize); + + JPanel portPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); + portPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Port") + ":")); + Component[][] portComComponents = {{portTextField}}; + double[] portRowSize = {p}; + double[] portColumnSize = {p}; + JPanel portComPane = TableLayoutHelper.createTableLayoutPane(portComComponents, portRowSize, portColumnSize); + + JPanel dbNamePane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); + dbNamePane.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_DatabaseName") + ":")); + Component[][] dbNameComComponents = {{dbNameTextField}}; + double[] dbNameRowSize = {p}; + double[] dbNameColumnSize = {p}; + JPanel dbNameComPane = TableLayoutHelper.createTableLayoutPane(dbNameComComponents, dbNameRowSize, dbNameColumnSize); + JPanel urlPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); urlPane.add(new UILabel("URL:")); - JPanel urlComPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); Component[][] urlComComponents = {{urlTextField, dbtypeButton}}; double[] urlRowSize = {p}; double[] urlColumnSize = {f, 21}; - urlComPane = TableLayoutHelper.createCommonTableLayoutPane(urlComComponents, urlRowSize, urlColumnSize, 4); + JPanel urlComPane = TableLayoutHelper.createCommonTableLayoutPane(urlComComponents, urlRowSize, urlColumnSize, 4); JPanel userPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); userPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Report_UserName") + ":")); - JPanel userComPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); Component[][] userComComponents = {{userNameTextField, new UILabel(Toolkit.i18nText("Fine-Design_Basic_Password") + ":"), passwordTextField}}; double[] userRowSize = {p}; double[] userColumnSize = {f, p, f}; - userComPane = TableLayoutHelper.createCommonTableLayoutPane(userComComponents, userRowSize, userColumnSize, 4); - - JPanel passwordPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); - passwordPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Password") + ":")); - - Component[][] components = {{dbtypePane, dbtypeComPane}, {driverPane, driverComboBoxAndTips}, {urlPane, urlComPane}, {userPane, userComPane},}; - - double[] rowSize = {p, p, p, p}; + JPanel userComPane = TableLayoutHelper.createCommonTableLayoutPane(userComComponents, userRowSize, userColumnSize, 4); + + String[] defaultEncode = new String[]{Toolkit.i18nText("Fine-Design_Encode_Auto")}; + charSetComboBox = new UIComboBox(ArrayUtils.addAll(defaultEncode, EncodeConstants.ENCODING_ARRAY)); + JPanel chartSetPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); + chartSetPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Datasource_Charset") + ":")); + Component[][] charSetComComponents = {{charSetComboBox}}; + double[] charSetRowSize = {p}; + double[] charSetColumnSize = {f}; + JPanel charSetComPane = TableLayoutHelper.createTableLayoutPane(charSetComComponents, charSetRowSize, charSetColumnSize); + + //这边调整的话注意下面的changePane + allComponents = new Component[][]{{dbtypePane, dbtypeComPane}, {driverPane, driverComboBoxAndTips}, {hostPane, hostComPane}, + {portPane, portComPane}, {dbNamePane, dbNameComPane}, {userPane, userComPane}, + {chartSetPane, charSetComPane}, {urlPane, urlComPane}}; + partComponents = new Component[][]{{dbtypePane, dbtypeComPane}, {driverPane, driverComboBoxAndTips}, {urlPane, urlComPane}, + {userPane, userComPane}, {chartSetPane, charSetComPane}}; + double[] rowSize = {p, p, p, p, p, p, p, p}; double[] columnSize = {p, f, 22}; // REPORT-41450 Windows环境的jdk11下dpi为125%时会因为缩放导致显示问题,因此加个水平gap值 - JPanel centerPanel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 6, 6); + centerPanel = TableLayoutHelper.createGapTableLayoutPane(allComponents, rowSize, columnSize, 6, 6); innerthis.add(centerPanel); - JPanel southPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - innerthis.add(southPanel); - southPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 4, 20)); - ActionLabel actionLabel = new ActionLabel(Toolkit.i18nText("Fine-Design_Basic_ConnectionPool_Attr")); - southPanel.add(actionLabel, BorderLayout.EAST); - actionLabel.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent evt) { - JDialog wDialog = createJDialog(); - wDialog.setVisible(true); - } - }); } public void populate(JDBCDatabaseConnection jdbcDatabase) { @@ -231,29 +253,36 @@ public class JDBCDefPane extends JPanel { } } this.dbtypeComboBox.addActionListener(dbtypeActionListener); + this.dbtypeComboBox.setSelectedItem(this.dbtypeComboBox.getSelectedItem()); this.driverComboBox.setSelectedItem(jdbcDatabase.getDriver()); this.urlTextField.setText(jdbcDatabase.getURL()); this.userNameTextField.setText(jdbcDatabase.getUser()); this.passwordTextField.setText(jdbcDatabase.getPassword()); + this.originalCharSet = jdbcDatabase.getOriginalCharsetName(); + if (StringUtils.isBlank(originalCharSet)) { + this.charSetComboBox.setSelectedItem(Toolkit.i18nText("Fine-Design_Encode_Auto")); + } else { + this.charSetComboBox.setSelectedItem(jdbcDatabase.getOriginalCharsetName()); + } + } + + protected JDBCDatabaseConnection getJDBCDatabase() { + return this.jdbcDatabase; + } - DBCPConnectionPoolAttr dbcpAttr = jdbcDatabase.getDbcpAttr(); - if (dbcpAttr == null) { - dbcpAttr = new DBCPConnectionPoolAttr(); - jdbcDatabase.setDbcpAttr(dbcpAttr); - this.jdbcDatabase.setDbcpAttr(dbcpAttr); + private void changePane(Object dbType) { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {p, f, 22}; + if (ComparatorUtils.equals(dbType, OTHER_DB) || ComparatorUtils.equals(dbType, "Access") || ComparatorUtils.equals(dbType, "SQLite")) { + if (this.centerPanel.getComponentCount() != partComponents.length * 2) { + centerPanel.removeAll(); + TableLayoutHelper.addComponent2ResultPane(partComponents, new double[]{p, p, p, p, p}, columnSize, centerPanel); + } + } else if (this.centerPanel.getComponentCount() != allComponents.length * 2) { + centerPanel.removeAll(); + TableLayoutHelper.addComponent2ResultPane(allComponents, new double[]{p, p, p, p, p, p, p, p}, columnSize, centerPanel); } - this.DBCP_INITIAL_SIZE.setValue(dbcpAttr.getInitialSize()); - this.DBCP_MAX_ACTIVE.setValue(dbcpAttr.getMaxActive()); - this.DBCP_MAX_IDLE.setValue(dbcpAttr.getMaxIdle()); - this.DBCP_MAX_WAIT.setValue(dbcpAttr.getMaxWait()); - this.DBCP_MIN_IDLE.setValue(dbcpAttr.getMinIdle()); - this.DBCP_VALIDATION_QUERY.setText(dbcpAttr.getValidationQuery()); - this.DBCP_TESTONBORROW.setSelectedIndex(dbcpAttr.isTestOnBorrow() ? 1 : 0); - this.DBCP_TESTONRETURN.setSelectedIndex(dbcpAttr.isTestOnReturn() ? 1 : 0); - this.DBCP_TESTWHILEIDLE.setSelectedIndex(dbcpAttr.isTestWhileIdle() ? 1 : 0); - this.DBCP_MINEVICTABLEIDLETIMEMILLIS.setValue(dbcpAttr.getMinEvictableIdleTimeMillis() / TIME_MULTIPLE); - this.DBCP_NUMTESTSPEREVICTIONRUN.setValue(dbcpAttr.getNumTestsPerEvictionRun()); - this.DBCP_TIMEBETWEENEVICTIONRUNSMILLS.setValue(dbcpAttr.getTimeBetweenEvictionRunsMillis()); } public JDBCDatabaseConnection update() { @@ -265,25 +294,14 @@ public class JDBCDefPane extends JPanel { jdbcDatabase.setURL(this.urlTextField.getText().trim()); jdbcDatabase.setUser(this.userNameTextField.getText().trim()); jdbcDatabase.setPassword(new String(this.passwordTextField.getPassword()).trim()); - - DBCPConnectionPoolAttr dbcpAttr = jdbcDatabase.getDbcpAttr(); - if (dbcpAttr == null) { - dbcpAttr = new DBCPConnectionPoolAttr(); - jdbcDatabase.setDbcpAttr(dbcpAttr); + jdbcDatabase.setOriginalCharsetName(this.originalCharSet); + if (this.charSetComboBox.getSelectedIndex() == 0) { + jdbcDatabase.setNewCharsetName(null); + jdbcDatabase.setOriginalCharsetName(null); + } else { + jdbcDatabase.setNewCharsetName(EncodeConstants.ENCODING_GBK); + jdbcDatabase.setOriginalCharsetName(((String) this.charSetComboBox.getSelectedItem())); } - dbcpAttr.setInitialSize(this.DBCP_INITIAL_SIZE.getValue().intValue()); - dbcpAttr.setMaxActive(this.DBCP_MAX_ACTIVE.getValue().intValue()); - dbcpAttr.setMaxIdle(this.DBCP_MAX_IDLE.getValue().intValue()); - dbcpAttr.setMaxWait(this.DBCP_MAX_WAIT.getValue().intValue()); - dbcpAttr.setMinIdle(this.DBCP_MIN_IDLE.getValue().intValue()); - dbcpAttr.setValidationQuery(this.DBCP_VALIDATION_QUERY.getText()); - dbcpAttr.setTestOnBorrow(this.DBCP_TESTONBORROW.getSelectedIndex() == 0 ? false : true); - dbcpAttr.setTestOnReturn(this.DBCP_TESTONRETURN.getSelectedIndex() == 0 ? false : true); - dbcpAttr.setTestWhileIdle(this.DBCP_TESTWHILEIDLE.getSelectedIndex() == 0 ? false : true); - dbcpAttr.setMinEvictableIdleTimeMillis(((Number) this.DBCP_MINEVICTABLEIDLETIMEMILLIS.getValue()).intValue() * TIME_MULTIPLE); - dbcpAttr.setNumTestsPerEvictionRun(((Number) this.DBCP_NUMTESTSPEREVICTIONRUN.getValue()).intValue()); - dbcpAttr.setTimeBetweenEvictionRunsMillis(((Number) this.DBCP_TIMEBETWEENEVICTIONRUNSMILLS.getValue()).intValue()); - return jdbcDatabase; } @@ -307,6 +325,7 @@ public class JDBCDefPane extends JPanel { } // 更改数据库类型后 数据库名称置空和之前逻辑保持一致 jdbcDatabase.setDatabase(StringUtils.EMPTY); + changePane(dbtypeComboBox.getSelectedItem()); } }; @@ -365,49 +384,154 @@ public class JDBCDefPane extends JPanel { } }; - private JDialog createJDialog() { - return new DBCPAttrPane().showWindow(SwingUtilities.getWindowAncestor(JDBCDefPane.this)); + InputMethodListener portInputMethodListener = new InputMethodListener() { + @Override + public void inputMethodTextChanged(InputMethodEvent event) { + char ch = event.getText().current(); + if (!(ch >= '0' && ch <= '9')) { + event.consume(); + } + } + + @Override + public void caretPositionChanged(InputMethodEvent event) { + + } + }; + + DocumentListener updateParaListener = new DocumentListener() { + @Override + public void insertUpdate(DocumentEvent e) { + updatePara(); + } + + @Override + public void removeUpdate(DocumentEvent e) { + updatePara(); + } + + @Override + public void changedUpdate(DocumentEvent e) { + updatePara(); + } + }; + + private void updatePara() { + String dbType = dbtypeComboBox.getSelectedItem().toString(); + if (ComparatorUtils.equals(dbType, OTHER_DB) || ComparatorUtils.equals(dbType, "Access") || ComparatorUtils.equals(dbType, "SQLite")) { + return; + } + disableSubDocListener(); + String url = urlTextField.getText().trim(); + Matcher matcher = ORACLE_URL.matcher(url); + if (matcher.find()) { + if (matcher.group(1) != null) { + hostTextField.setText(matcher.group(1)); + } else { + hostTextField.setText(StringUtils.EMPTY); + } + if (matcher.group(3) != null) { + portTextField.setText(matcher.group(3)); + } else { + portTextField.setText(StringUtils.EMPTY); + } + if (matcher.group(5) != null) { + dbNameTextField.setText(matcher.group(5)); + } else { + dbNameTextField.setText(StringUtils.EMPTY); + } + enableSubDocListener(); + return; + } + matcher = GENERAL_URL.matcher(url); + if (matcher.find()) { + if (matcher.group(2) != null) { + hostTextField.setText(matcher.group(2)); + } else { + hostTextField.setText(StringUtils.EMPTY); + } + if (matcher.group(4) != null) { + portTextField.setText(matcher.group(4)); + } else { + portTextField.setText(StringUtils.EMPTY); + } + if (matcher.group(7) != null) { + dbNameTextField.setText(matcher.group(7)); + } else { + dbNameTextField.setText(StringUtils.EMPTY); + } + enableSubDocListener(); + } + } + + private void enableSubDocListener() { + this.dbNameTextField.getDocument().addDocumentListener(updateURLListener); + this.hostTextField.getDocument().addDocumentListener(updateURLListener); + } + + private void disableSubDocListener() { + this.dbNameTextField.getDocument().removeDocumentListener(updateURLListener); + this.hostTextField.getDocument().removeDocumentListener(updateURLListener); + } + + KeyListener portKeyListener = new KeyAdapter() { + @Override + public void keyReleased(KeyEvent e) { + String port = portTextField.getText().trim(); + if (isPortValid(port)) { + updateURL(); + } else { + portTextField.setText(port.replaceAll(e.getKeyChar() + "", "")); + } + } + }; + + private boolean isPortValid(String port) { + return PORT.matcher(port).find(); } - class DBCPAttrPane extends BasicPane { - public DBCPAttrPane() { - JPanel defaultPane = this; - - // JPanel northFlowPane - JPanel northFlowPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); - defaultPane.add(northFlowPane, BorderLayout.NORTH); - - DBCP_VALIDATION_QUERY.setColumns(15); - // ContextPane - - double f = TableLayout.FILL; - // double p = TableLayout.PREFERRED; - double[] rowSize = {f, f, f, f, f, f, f, f, f, f, f, f}; - double[] columnSize = {f, f}; - Component[][] comps = { - {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Initial_Size") + ":", SwingConstants.RIGHT), DBCP_INITIAL_SIZE}, - {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Max_Active") + ":", SwingConstants.RIGHT), DBCP_MAX_ACTIVE}, - {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Max_Idle") + ":", SwingConstants.RIGHT), DBCP_MAX_IDLE}, - {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Min_Idle") + ":", SwingConstants.RIGHT), DBCP_MIN_IDLE}, - {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Max_Wait_Time") + ":", SwingConstants.RIGHT), DBCP_MAX_WAIT}, - {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Validation_Query") + ":", SwingConstants.RIGHT), DBCP_VALIDATION_QUERY}, - {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_On_Borrow") + ":", SwingConstants.RIGHT), DBCP_TESTONBORROW}, - {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_On_Return") + ":", SwingConstants.RIGHT), DBCP_TESTONRETURN}, - {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_While_Idle") + ":", SwingConstants.RIGHT), DBCP_TESTWHILEIDLE}, - {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Evictionruns_millis") + ":", SwingConstants.RIGHT), - DBCP_TIMEBETWEENEVICTIONRUNSMILLS}, - {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Num_Test_Per_Evction_Run") + ":", SwingConstants.RIGHT), DBCP_NUMTESTSPEREVICTIONRUN}, - {new UILabel(Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Mix_Evictable_Idle_Time_Millis") + ":", SwingConstants.RIGHT), - DBCP_MINEVICTABLEIDLETIMEMILLIS}}; - - JPanel contextPane = TableLayoutHelper.createGapTableLayoutPane(comps, rowSize, columnSize, 10, 4); - contextPane.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, UIConstants.LINE_COLOR)); - northFlowPane.add(contextPane); + DocumentListener updateURLListener = new DocumentListener() { + + @Override + public void insertUpdate(DocumentEvent e) { + updateURL(); } @Override - protected String title4PopupWindow() { - return Toolkit.i18nText("Fine-Design_Basic_ConnectionPool_Attr"); + public void removeUpdate(DocumentEvent e) { + updateURL(); + } + + @Override + public void changedUpdate(DocumentEvent e) { + updateURL(); + } + }; + + private void updateURL() { + String dbType = dbtypeComboBox.getSelectedItem().toString(); + if (!ComparatorUtils.equals(dbType, OTHER_DB) && !ComparatorUtils.equals(dbType, "Access") && !ComparatorUtils.equals(dbType, "SQLite")) { + urlTextField.getDocument().removeDocumentListener(updateParaListener); + DriverURLName[] driverURLNames = jdbcMap.get(dbType); + String defaultURL = null; + for (DriverURLName driverURLName : driverURLNames) { + if (ComparatorUtils.equals(driverURLName.getDriver(), driverComboBox.getSelectedItem().toString())) { + defaultURL = driverURLName.getURL(); + } + } + if (defaultURL != null) { + String host = hostTextField.getText().trim(); + String port = portTextField.getText().trim(); + String dbName = dbNameTextField.getText().trim(); + defaultURL = defaultURL.replace("localhost", host).replace(":port", ComparatorUtils.equals(port, "") ? "" : ":" + port); + if (defaultURL.startsWith("jdbc:sqlserver")) { + defaultURL = defaultURL.replace("=databaseName", "=" + dbName); + } else { + defaultURL = defaultURL.replace("databaseName", dbName); + } + } + urlTextField.setText(defaultURL); + urlTextField.getDocument().addDocumentListener(updateParaListener); } } diff --git a/designer-base/src/main/java/com/fr/design/layout/TableLayoutHelper.java b/designer-base/src/main/java/com/fr/design/layout/TableLayoutHelper.java index d394f43ee7..e664524026 100644 --- a/designer-base/src/main/java/com/fr/design/layout/TableLayoutHelper.java +++ b/designer-base/src/main/java/com/fr/design/layout/TableLayoutHelper.java @@ -233,7 +233,7 @@ public class TableLayoutHelper { container.repaint(); } - private static void addComponent2ResultPane(Component[][] components, double[] rowSize, double[] columnSize, JPanel resultPane) { + public static void addComponent2ResultPane(Component[][] components, double[] rowSize, double[] columnSize, JPanel resultPane) { for (int i = 0; i < components.length; i++) { if (i >= rowSize.length) { From a0f2067b79232c0931003a11ce82b7e2ef8e2920 Mon Sep 17 00:00:00 2001 From: pengda Date: Wed, 14 Apr 2021 14:24:52 +0800 Subject: [PATCH 07/11] =?UTF-8?q?REPORT-49055=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/data/datapane/connect/JDBCDefPane.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java index 22c3ac82e9..d999962021 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java @@ -482,6 +482,9 @@ public class JDBCDefPane extends JPanel { updateURL(); } else { portTextField.setText(port.replaceAll(e.getKeyChar() + "", "")); + if (!isPortValid(portTextField.getText())) { + portTextField.setText(""); + } } } }; From 6ad9bceeeb925141cd3fc03e2a60166ac1a9de5d Mon Sep 17 00:00:00 2001 From: pengda Date: Wed, 14 Apr 2021 15:33:26 +0800 Subject: [PATCH 08/11] =?UTF-8?q?REPORT-49055=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/data/datapane/connect/JDBCDefPane.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java index d999962021..3490341f2f 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java @@ -227,7 +227,6 @@ public class JDBCDefPane extends JPanel { jdbcDatabase = new JDBCDatabaseConnection(); } this.jdbcDatabase = jdbcDatabase; - this.dbtypeComboBox.removeActionListener(dbtypeActionListener); if (ComparatorUtils.equals(jdbcDatabase.getDriver(), "sun.jdbc.odbc.JdbcOdbcDriver") && jdbcDatabase.getURL().startsWith("jdbc:odbc:Driver={Microsoft")) { this.dbtypeComboBox.setSelectedItem("Access"); @@ -252,8 +251,6 @@ public class JDBCDefPane extends JPanel { this.dbtypeComboBox.setSelectedItem(OTHER_DB); } } - this.dbtypeComboBox.addActionListener(dbtypeActionListener); - this.dbtypeComboBox.setSelectedItem(this.dbtypeComboBox.getSelectedItem()); this.driverComboBox.setSelectedItem(jdbcDatabase.getDriver()); this.urlTextField.setText(jdbcDatabase.getURL()); this.userNameTextField.setText(jdbcDatabase.getUser()); From 0fa461fb72fcf8ce054353ea4ee3f49eb9b23baa Mon Sep 17 00:00:00 2001 From: xiqiu Date: Thu, 15 Apr 2021 16:21:36 +0800 Subject: [PATCH 09/11] =?UTF-8?q?REPORT-51103=20=E5=8A=A0=E4=B8=8A?= =?UTF-8?q?=E9=81=97=E6=BC=8F=E7=9A=84mysql=E5=8F=A6=E4=B8=80=E7=A7=8D?= =?UTF-8?q?=E9=A9=B1=E5=8A=A8=EF=BC=9B=E4=BC=98=E5=8C=96=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/data/datapane/connect/DatabaseConnectionPane.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java index 16c992b0f3..0a6b10d077 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java @@ -332,10 +332,10 @@ public abstract class DatabaseConnectionPane Date: Thu, 15 Apr 2021 20:46:39 +0800 Subject: [PATCH 10/11] =?UTF-8?q?REPORT-51103=20=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/datapane/connect/DatabaseConnectionPane.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java index 743b2b2868..3e1e1f5315 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java @@ -99,7 +99,7 @@ public abstract class DatabaseConnectionPane Date: Thu, 15 Apr 2021 23:15:43 +0800 Subject: [PATCH 11/11] =?UTF-8?q?REPORT-51103=20=20=E6=94=B9=E4=B8=AA?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E6=96=B9=E4=BE=BF=E5=AE=9A=E4=BD=8D=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/gui/UILookAndFeel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/UILookAndFeel.java b/designer-base/src/main/java/com/fr/design/gui/UILookAndFeel.java index 90bc60a290..b93953a99e 100644 --- a/designer-base/src/main/java/com/fr/design/gui/UILookAndFeel.java +++ b/designer-base/src/main/java/com/fr/design/gui/UILookAndFeel.java @@ -205,7 +205,7 @@ public class UILookAndFeel extends MetalLookAndFeel { "com/fr/design/images/lookandfeel/" + fileName, UILookAndFeel.class); if (url == null) { - FineLoggerFactory.getLogger().error("Icon directory could not be resolved."); + FineLoggerFactory.getLogger().error(fileName + " :Icon directory could not be resolved."); return null; } }