From 0478434302a6101f799ac20cb7a4273e53068c93 Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Tue, 9 Oct 2018 09:04:07 +0800 Subject: [PATCH 01/35] =?UTF-8?q?REPORT-11709=20AlphaFine=E6=95=B4?= =?UTF-8?q?=E5=90=88=E5=B0=8F=E5=B8=86=E8=A7=86=E8=A7=89=E9=AA=8C=E6=94=B6?= =?UTF-8?q?=20REPORT-11692=20alphafine=E5=88=86=E8=AF=8D=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E7=BB=93=E6=9E=9C=E4=B8=AD=E5=8C=85=E5=90=AB=E4=BA=86=E8=BF=9E?= =?UTF-8?q?=E8=AF=8D=E7=BB=93=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/AlphaFineConstants.java | 16 +++++++++++--- .../cell/render/BottomCellRender.java | 2 +- .../alphafine/component/AlphaFineDialog.java | 11 ++++++---- .../manager/impl/SegmentationManager.java | 20 +++++++++++++++++- .../mainframe/alphafine/images/back@1x.png | Bin 0 -> 221 bytes .../mainframe/alphafine/images/back@2x.png | Bin 0 -> 336 bytes 6 files changed, 40 insertions(+), 9 deletions(-) create mode 100644 designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/back@1x.png create mode 100644 designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/back@2x.png diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java index fe72f9c1d..ea0d6331d 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java @@ -2,9 +2,11 @@ package com.fr.design.mainframe.alphafine; import com.fr.base.extension.FileExtension; import com.fr.general.CloudCenter; + import java.awt.Color; import java.awt.Dimension; import java.awt.Font; +import java.util.ArrayList; /** @@ -49,7 +51,7 @@ public class AlphaFineConstants { public static final Dimension HOT_ICON_LABEL_SIZE = new Dimension(36, 36); - public static final Dimension HOT_ISSUES_JAPNEL_SIZE = new Dimension(213,182); + public static final Dimension HOT_ISSUES_JAPNEL_SIZE = new Dimension(213, 182); public static final Dimension CLOSE_BUTTON_SIZE = new Dimension(40, 40); @@ -83,7 +85,7 @@ public class AlphaFineConstants { public static final String IMAGE_URL = "/com/fr/design/mainframe/alphafine/images/"; - public static final String ALPHA_HOT_IMAGE_NAME = "alphafine_hot"; + public static final String ALPHA_HOT_IMAGE_NAME = "alphafine_hot"; public static final String PLUGIN_SEARCH_URL = CloudCenter.getInstance().acquireUrlByKind("plugin.searchAPI"); @@ -134,8 +136,16 @@ public class AlphaFineConstants { public static final String FIRST_PAGE = "-1"; - public static final FileExtension[] FILE_EXTENSIONS= new FileExtension[]{FileExtension.CPT, FileExtension.FRM}; + public static final FileExtension[] FILE_EXTENSIONS = new FileExtension[]{FileExtension.CPT, FileExtension.FRM}; public static final int RECOMMEND_MAX_ITEM_NUM = 3; + public static final String BACK_ICON_NAME = "back@1x.png"; + + public static final ArrayList CONJUNCTION = new ArrayList() {{ + add("和"); + add("与"); + add("的"); + }}; + } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/render/BottomCellRender.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/render/BottomCellRender.java index 824fc3bfc..43aca2cae 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/render/BottomCellRender.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/render/BottomCellRender.java @@ -24,7 +24,7 @@ public class BottomCellRender implements ListCellRenderer { JPanel line = new JPanel(); line.setPreferredSize(new Dimension(200, 1)); - line.setBackground(AlphaFineConstants.GRAY); + line.setBackground(AlphaFineConstants.WHITE); panel.add(line, BorderLayout.NORTH); goToWebLabel.setFont(AlphaFineConstants.MEDIUM_FONT); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java index 6b21b0b6a..5d0b2aff0 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -239,20 +239,21 @@ public class AlphaFineDialog extends UIDialog { hotPane.setLayout(new BorderLayout()); UILabel uiLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Hot")); + uiLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); uiLabel.setFont(AlphaFineConstants.SMALL_FONT); uiLabel.setForeground(AlphaFineConstants.DARK_GRAY); GridLayout gridLayout = new GridLayout(2, 3, 3, 3); JPanel panel = new JPanel(); panel.setLayout(gridLayout); - if(AlphaFineHelper.isNetworkOk()) { + if (AlphaFineHelper.isNetworkOk()) { if (hotData == null) { hotData = HotIssuesManager.getInstance().getHotIssues(); } for (int i = 0; i < hotData.length; i++) { panel.add(new HotIssueJpanel(hotData[i], i + 1)); } - }else { + } else { hotData = null; for (int i = 0; i < AlphaFineConstants.HOT_ITEMS; i++) { panel.add(new HotIssueJpanel(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Connection_Failed")}, i + 1)); @@ -947,7 +948,7 @@ public class AlphaFineDialog extends UIDialog { Thread sendThread = new Thread(new Runnable() { @Override public void run() { - if(StringUtils.isNotEmpty(storeText)){ + if (StringUtils.isNotEmpty(storeText)) { RecentSearchManager searchManager = RecentSearchManager.getInstance(); searchManager.addModel(storeText, cellModel); sendDataToServer(storeText, cellModel); @@ -1377,7 +1378,9 @@ public class AlphaFineDialog extends UIDialog { */ private void initBackPane() { backPane = new JPanel(new BorderLayout()); - JLabel jLabel = new JLabel(" < " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Back")); + JLabel jLabel = new JLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Back")); + jLabel.setIcon(IconLoader.getIcon(AlphaFineConstants.IMAGE_URL + AlphaFineConstants.BACK_ICON_NAME)); + jLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); jLabel.setPreferredSize(new Dimension(80, 20)); jLabel.setFont(AlphaFineConstants.SMALL_FONT); jLabel.setForeground(AlphaFineConstants.DARK_GRAY); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SegmentationManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SegmentationManager.java index 6f1e3850a..d52ff529c 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SegmentationManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SegmentationManager.java @@ -2,10 +2,10 @@ package com.fr.design.mainframe.alphafine.search.manager.impl; import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.stable.StringUtils; - import com.fr.third.ibm.icu.text.BreakIterator; import java.util.ArrayList; +import java.util.Iterator; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -76,8 +76,26 @@ public class SegmentationManager { result.add(temp); } } + result = removeConjunction(result); String[] strings = new String[result.size()]; result.toArray(strings); return strings; } + + /** + * 去除连词 + * + * @param result + * @return + */ + public static List removeConjunction(List result) { + Iterator it = result.iterator(); + while (it.hasNext()) { + String s = it.next(); + if (AlphaFineConstants.CONJUNCTION.contains(s)) { + it.remove(); + } + } + return result; + } } diff --git a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/back@1x.png b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/back@1x.png new file mode 100644 index 0000000000000000000000000000000000000000..3cc82966536005104870347a6260ffbd0055445a GIT binary patch literal 221 zcmeAS@N?(olHy`uVBq!ia0vp^AT}2V8<6ZZI=>f4F%}28J29*~C-V}>neOT07$PB= zoN$1#r?SPn$UL=D#m5FY_xDuF110es)H4!SYA{{{B|y3SwbmsNi-x Uc>1{o(1i>Pp00i_>zopr0PZqZkN^Mx literal 0 HcmV?d00001 diff --git a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/back@2x.png b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/back@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..7a0e30162f762e2edc9597e25356b45a7497b5cb GIT binary patch literal 336 zcmV-W0k8gvP)Px$3Q0skR5%f1U?3BOhK90X)5?NP5TBTXg9Fc(FJCs_yLV3vs7@PQEfcx`K0e5> z&!0bU`~UyH15n*YY-$;?31Sn283vTIWn^URJ9FktF*bEX8Az;QAPWc@NQz+u4J6et zyatkE7)}GpH4J1R)?@=r8Y_Tucw-Z!85_WAAd*6Yk%pue%*1M-u&{7AQ1&n|0T-H> znDn7*!pCRECVBVn-QT*px~sl_|85JE50{pf=709=*-mU~(Z#SD2vS6@p*RgB*HF9$ zl4B@A14%WMC<9@Js;jH7{`Kn@IHIJaq}ZQ7f4&zahYYYL8)OB@>;nf5eBtHg^#Y3R i2V#F@If~i1ssI4qxto(zpcf Date: Tue, 9 Oct 2018 09:20:38 +0800 Subject: [PATCH 02/35] =?UTF-8?q?REPORT-10617=2010.0=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E4=B8=AD=E6=9C=89=E9=83=A8=E4=BB=BD9.0=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E7=AB=AF=E7=9A=84=E5=8A=9F=E8=83=BD=E7=BC=BA=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-form/src/main/java/com/fr/design/mainframe/JForm.java | 2 +- .../src/main/java/com/fr/design/mainframe/JWorkBook.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index 95d4e16ce..2fb5febd3 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -936,7 +936,7 @@ public class JForm extends JTemplate implements BaseJForm { */ @Override public PreviewProvider[] supportPreview() { - return new PreviewProvider[]{new FormPreview()}; + return new PreviewProvider[]{new FormPreview(), new MobilePreview()}; } /** diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java index b546d618b..bfc01d0bf 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java @@ -52,6 +52,7 @@ import com.fr.design.menu.ToolBarDef; import com.fr.design.module.DesignModuleFactory; import com.fr.design.parameter.ParameterDefinitePane; import com.fr.design.parameter.ParameterInputPane; +import com.fr.design.preview.MobilePreview; import com.fr.design.preview.PagePreview; import com.fr.design.preview.ViewPreview; import com.fr.design.preview.WriteEnhancePreview; @@ -889,7 +890,7 @@ public class JWorkBook extends JTemplate { public PreviewProvider[] supportPreview() { Set set = ExtraDesignClassManager.getInstance().getArray(PreviewProvider.MARK_STRING); return ArrayUtils.addAll(new PreviewProvider[]{ - new PagePreview(), new WritePreview(), new ViewPreview(), new WriteEnhancePreview() + new PagePreview(), new WritePreview(), new ViewPreview(), new WriteEnhancePreview(), new MobilePreview() }, set.toArray(new PreviewProvider[set.size()])); } From dc4894321f606da0c9bdb29181b5bf72df3f2a05 Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Tue, 9 Oct 2018 09:40:06 +0800 Subject: [PATCH 03/35] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/AlphaFineConstants.java | 6 ++--- .../manager/impl/SegmentationManager.java | 22 ++----------------- 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java index ea0d6331d..4cebe741c 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java @@ -143,9 +143,9 @@ public class AlphaFineConstants { public static final String BACK_ICON_NAME = "back@1x.png"; public static final ArrayList CONJUNCTION = new ArrayList() {{ - add("和"); - add("与"); - add("的"); + add(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Conjunction_HE")); + add(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Conjunction_YU")); + add(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Conjunction_DE")); }}; } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SegmentationManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SegmentationManager.java index d52ff529c..79506cd9f 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SegmentationManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SegmentationManager.java @@ -5,7 +5,6 @@ import com.fr.stable.StringUtils; import com.fr.third.ibm.icu.text.BreakIterator; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -72,30 +71,13 @@ public class SegmentationManager { int start = itor.first(); for (int end = itor.next(); end != BreakIterator.DONE; start = end, end = itor.next()) { String temp = searchText.substring(start, end); - if (!StringUtils.isEmpty(temp)) { + //去掉空和连词 + if (!StringUtils.isEmpty(temp) & !AlphaFineConstants.CONJUNCTION.contains(temp)) { result.add(temp); } } - result = removeConjunction(result); String[] strings = new String[result.size()]; result.toArray(strings); return strings; } - - /** - * 去除连词 - * - * @param result - * @return - */ - public static List removeConjunction(List result) { - Iterator it = result.iterator(); - while (it.hasNext()) { - String s = it.next(); - if (AlphaFineConstants.CONJUNCTION.contains(s)) { - it.remove(); - } - } - return result; - } } From 78c2f5222c2e998a0f7b49f0b7022c8bdef2c3ab Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Tue, 9 Oct 2018 10:17:44 +0800 Subject: [PATCH 04/35] =?UTF-8?q?=E5=82=BB=E9=80=BC=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/search/manager/impl/SegmentationManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SegmentationManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SegmentationManager.java index 79506cd9f..40c37341c 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SegmentationManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SegmentationManager.java @@ -72,7 +72,7 @@ public class SegmentationManager { for (int end = itor.next(); end != BreakIterator.DONE; start = end, end = itor.next()) { String temp = searchText.substring(start, end); //去掉空和连词 - if (!StringUtils.isEmpty(temp) & !AlphaFineConstants.CONJUNCTION.contains(temp)) { + if (StringUtils.isNotEmpty(temp) && !AlphaFineConstants.CONJUNCTION.contains(temp)) { result.add(temp); } } From 203702a85cee613d57b93eb4bb9df882d5a0d2cc Mon Sep 17 00:00:00 2001 From: ju Date: Tue, 9 Oct 2018 12:09:21 +0800 Subject: [PATCH 05/35] =?UTF-8?q?BI-33768=20=E6=8F=90=E4=BE=9B=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E6=89=80=E6=9C=89=E5=90=AF=E5=8A=A8=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/start/module/DesignerStartup.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java b/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java index 237a19fa9..71f197ea6 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java @@ -7,6 +7,7 @@ import com.fr.event.Listener; import com.fr.module.Activator; import com.fr.record.analyzer.EnableMetrics; import com.fr.record.analyzer.Metrics; +import com.fr.runtime.FineRuntime; import com.fr.start.Designer; import com.fr.start.ServerStarter; import com.fr.start.SplashContext; @@ -63,7 +64,7 @@ public class DesignerStartup extends Activator { DesignerContext.getDesignerFrame().getProgressDialog().setVisible(true); startSub(StartFinishActivator.class); - + FineRuntime.startFinish(); } private void browserDemo() { From 19a1f65822a018b0b7a826df87d08daf72fcbb57 Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 10 Oct 2018 19:33:36 +0800 Subject: [PATCH 06/35] =?UTF-8?q?REPORT-11794=2010.0=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=AE=89=E8=A3=85=E8=B7=AF=E5=BE=84=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E7=89=B9=E6=AE=8A=E7=AC=A6=E5=8F=B7=E4=BC=9A=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E7=AE=A1=E7=90=86=E7=95=8C=E9=9D=A2=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E5=8A=A0=E8=BD=BD=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/extra/PluginWebPane.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/extra/PluginWebPane.java b/designer-base/src/main/java/com/fr/design/extra/PluginWebPane.java index 3e2cafdfe..4257cb234 100644 --- a/designer-base/src/main/java/com/fr/design/extra/PluginWebPane.java +++ b/designer-base/src/main/java/com/fr/design/extra/PluginWebPane.java @@ -4,6 +4,7 @@ import com.fr.base.TemplateUtils; import com.fr.general.GeneralContext; import com.fr.general.IOUtils; import com.fr.log.FineLoggerFactory; +import com.fr.stable.EncodeConstants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import javafx.application.Platform; @@ -32,6 +33,8 @@ import java.util.Map; public class PluginWebPane extends JFXPanel { private static final String RESOURCE_URL = "resourceURL"; private static final String LANGUAGE = "language"; + private static final String URL_PLUS = "+"; + private static final String URL_SPACING = "%20"; private WebEngine webEngine; public PluginWebPane(final String installHome, final String mainJs) { @@ -75,8 +78,9 @@ public class PluginWebPane extends JFXPanel { StringBuffer sb = new StringBuffer(); String line; Map map4Tpl = new HashMap(); - - map4Tpl.put(RESOURCE_URL, "file:///" + URLEncoder.encode(installHome, "UTF-8")); + //URL中关于空格的编码与空格所在位置相关:空格被编码成+的情况只能在查询字符串部分出现,而被编码成%20则可以出现在路径和查询字符串中 + //URLEncoder会将空格转成+,这边需要+转成%20 + map4Tpl.put(RESOURCE_URL, "file:///" + URLEncoder.encode(installHome, EncodeConstants.ENCODING_UTF_8).replace(URL_PLUS, URL_SPACING)); map4Tpl.put(LANGUAGE, GeneralContext.getLocale().toString()); while ((line = read.readLine()) != null) { if (sb.length() > 0) { From c030289603513e447a9b0d8f025cc6206b92fd97 Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 10 Oct 2018 19:35:12 +0800 Subject: [PATCH 07/35] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/extra/PluginWebPane.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/extra/PluginWebPane.java b/designer-base/src/main/java/com/fr/design/extra/PluginWebPane.java index 4257cb234..627d16855 100644 --- a/designer-base/src/main/java/com/fr/design/extra/PluginWebPane.java +++ b/designer-base/src/main/java/com/fr/design/extra/PluginWebPane.java @@ -35,6 +35,7 @@ public class PluginWebPane extends JFXPanel { private static final String LANGUAGE = "language"; private static final String URL_PLUS = "+"; private static final String URL_SPACING = "%20"; + private static final String URL_PREFIX = "file:///"; private WebEngine webEngine; public PluginWebPane(final String installHome, final String mainJs) { @@ -80,7 +81,7 @@ public class PluginWebPane extends JFXPanel { Map map4Tpl = new HashMap(); //URL中关于空格的编码与空格所在位置相关:空格被编码成+的情况只能在查询字符串部分出现,而被编码成%20则可以出现在路径和查询字符串中 //URLEncoder会将空格转成+,这边需要+转成%20 - map4Tpl.put(RESOURCE_URL, "file:///" + URLEncoder.encode(installHome, EncodeConstants.ENCODING_UTF_8).replace(URL_PLUS, URL_SPACING)); + map4Tpl.put(RESOURCE_URL, URL_PREFIX + URLEncoder.encode(installHome, EncodeConstants.ENCODING_UTF_8).replace(URL_PLUS, URL_SPACING)); map4Tpl.put(LANGUAGE, GeneralContext.getLocale().toString()); while ((line = read.readLine()) != null) { if (sb.length() > 0) { From 90bd695b0d14afe31dfb79e4d25a50e6dd7e63c6 Mon Sep 17 00:00:00 2001 From: zheng Date: Thu, 11 Oct 2018 14:54:52 +0800 Subject: [PATCH 08/35] =?UTF-8?q?CHART-2982=20gis=E8=BD=AE=E6=92=AD?= =?UTF-8?q?=E5=9B=BE=20=E4=BF=AE=E6=94=B9typepane=20update=E6=97=B6?= =?UTF-8?q?=E5=80=99=E4=BC=9A=E6=9B=BF=E6=8D=A2=E9=BB=98=E8=AE=A4chart?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/chart/gui/ChartTypePane.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java index e847f190c..5f9dd9a15 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java @@ -152,8 +152,9 @@ public class ChartTypePane extends AbstractChartAttrPane{ try{ Chart newDefaultChart = (Chart)((AbstractChartTypePane)getSelectedPane()).getDefaultChart().clone(); - if(!chart.accept(newDefaultChart.getClass())){ - //vanChart 和 chart 之间切换 + if (!ComparatorUtils.equals(chart.getClass(), newDefaultChart.getClass())) { + //vanChart 和 chart 之间切换 + //不同chart之间切换 editingCollection.removeNameObject(editingCollection.getSelectedIndex()); editingCollection.addChart(newDefaultChart); chart = newDefaultChart; From 3c9a20bd9e22fb5da318675540a13ad20eb7e6d5 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Fri, 12 Oct 2018 14:34:42 +0800 Subject: [PATCH 09/35] REPORT-11193 --- .../gui/icombocheckbox/UICheckListPopup.java | 234 +++++++++++++ .../gui/icombocheckbox/UIComboCheckBox.java | 330 ++++++++++++++++++ .../com/fr/design/icon/IconPathConstants.java | 4 + .../buttonicon/control_checkbox_normal.png | Bin 0 -> 164 bytes .../buttonicon/control_checkbox_part.png | Bin 0 -> 200 bytes .../buttonicon/control_checkbox_selected.png | Bin 0 -> 337 bytes 6 files changed, 568 insertions(+) create mode 100644 designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java create mode 100644 designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/control_checkbox_normal.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/control_checkbox_part.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/control_checkbox_selected.png diff --git a/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java b/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java new file mode 100644 index 000000000..2884e2279 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java @@ -0,0 +1,234 @@ +package com.fr.design.gui.icombocheckbox; + +import com.fr.base.BaseUtils; +import com.fr.design.constants.UIConstants; +import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.imenu.UIPopupMenu; +import com.fr.design.icon.IconPathConstants; +import com.fr.design.layout.FRGUIPaneFactory; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.*; +import java.util.ArrayList; +import java.util.List; + +public class UICheckListPopup extends UIPopupMenu { + private List listeners = new ArrayList(); + private List checkBoxList = new ArrayList(); + + private Object[] values; + private JPanel checkboxPane; + private UIScrollPane jScrollPane; + private Color mouseEnteredColor = UIConstants.CHECKBOX_HOVER_SELECTED; + private int maxDisplayNumber = 8; + + public static final String COMMIT_EVENT = "commit"; + public static final String SELECT_ALL = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Choose_All"); + private static final int CHECKBOX_HEIGHT = 25; + + public UICheckListPopup(Object[] value) { + super(); + values = value; + initComponent(); + } + + public void setMouseEnteredColor(Color color) { + this.mouseEnteredColor = color; + } + + public void setMaxDisplayNumber(int maxDisplayNumber) { + this.maxDisplayNumber = maxDisplayNumber; + //全选加在第一个位置 + addCheckboxValues(values); + } + + private void initComponent() { + checkboxPane = new JPanel(); + checkboxPane.setLayout(new GridLayout(checkBoxList.size(), 1, 0, 0)); + checkboxPane.setBackground(Color.WHITE); + jScrollPane = new UIScrollPane(checkboxPane); + + this.setLayout(new BorderLayout()); + this.add(jScrollPane, BorderLayout.CENTER); + + addCheckboxValues(values); + } + + public void addCheckboxValues(Object[] value) { + checkboxPane.removeAll(); + checkBoxList.clear(); + + //全选加在第一个位置 + addOneCheckValue(SELECT_ALL); + for (Object checkValue : value) { + addOneCheckValue(checkValue); + } + addSelectListener(); + + jScrollPane.setPreferredSize(new Dimension(200, checkBoxList.size() * CHECKBOX_HEIGHT + 10)); + //超过1页的数量时显示滚动条 + if (checkBoxList.size() > maxDisplayNumber) { + jScrollPane.setPreferredSize(new Dimension(200, maxDisplayNumber * CHECKBOX_HEIGHT)); + } + checkboxPane.repaint(); + jScrollPane.repaint(); + } + + private void addOneCheckValue(Object checkValue) { + JPanel checkPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + checkPane.setPreferredSize(new Dimension(185, CHECKBOX_HEIGHT)); + final JCheckBox temp = createCheckbox(); + final UILabel label = new UILabel(checkValue.toString()); + label.setBackground(Color.WHITE); + label.setPreferredSize(new Dimension(156, 20)); + checkPane.setBackground(Color.WHITE); + checkPane.add(temp); + checkPane.add(label); + addMouseListener(temp, label); + + checkBoxList.add(temp); + checkboxPane.add(checkPane); + } + + private JCheckBox createCheckbox() { + JCheckBox checkBox = new JCheckBox(); + checkBox.setPreferredSize(new Dimension(20, 20)); + checkBox.setBackground(Color.WHITE); + checkBox.setIcon(BaseUtils.readIcon(IconPathConstants.CHECKBOX_NORMAL)); + checkBox.setSelectedIcon(BaseUtils.readIcon(IconPathConstants.CHECKBOX_SELECTED)); + + return checkBox; + } + + /** + * 设置鼠标事件,鼠标进入时背景色变换 + * + * @param checkBox + * @param label + */ + private void addMouseListener(final JCheckBox checkBox, final UILabel label) { + label.addMouseListener(new MouseAdapter() { + public void mouseExited(MouseEvent e) { + label.setBackground(Color.WHITE); + } + + public void mouseEntered(MouseEvent e) { + label.setOpaque(true); + label.setBackground(mouseEnteredColor); + } + + @Override + public void mouseClicked(MouseEvent e) { + checkBox.doClick(); + } + }); + } + + /** + * 单选框选中事件 + */ + private void addSelectListener() { + for (int i = 0; i < checkBoxList.size(); i++) { + JCheckBox checkBox = checkBoxList.get(i); + if (i == 0) { + checkBox.addItemListener(new ItemListener() { + public void itemStateChanged(ItemEvent e) { + //全选checkbox事件 + doSelectAll(checkBoxList.get(0).isSelected()); + } + }); + } else { + checkBox.addItemListener(new ItemListener() { + public void itemStateChanged(ItemEvent e) { + //do半选判断放在commit事件里 + commit(); + } + }); + } + } + } + + /** + * 全选 + * + * @param isSelected 选中是true,未选是false + */ + private void doSelectAll(boolean isSelected) { + for (int i = 1; i < checkBoxList.size(); i++) { + //全选和反全选都不考虑全选按钮本身 + if (!SELECT_ALL.equals(checkBoxList.get(i).getText())) + checkBoxList.get(i).setSelected(isSelected); + } + } + + /** + * 获取所有选中的值 + * + * @return + */ + public Object[] getSelectedValues() { + List selectedValues = new ArrayList(); + int selectCount = 0; + + for (int i = 1; i < checkBoxList.size(); i++) { + if (checkBoxList.get(i).isSelected()) { + selectedValues.add(values[i - 1]); + selectCount++; + } + } + //全选半选切换 + switchSelectIcon(selectCount); + + return selectedValues.toArray(new Object[selectedValues.size()]); + } + + + /** + * 切换全选半选图片 + */ + private void switchSelectIcon(int selectCount) { + JCheckBox checkBox = checkBoxList.get(0); + if (selectCount == 0) { + checkBox.setIcon(BaseUtils.readIcon(IconPathConstants.CHECKBOX_NORMAL)); + } else if (selectCount < checkBoxList.size() - 1) { + //虽然有选中,但是要判断此时全选状态去换图标 + if (checkBoxList.get(0).isSelected()) { + checkBox.setSelectedIcon(BaseUtils.readIcon(IconPathConstants.CHECKBOX_HATFSELECT)); + } else { + checkBox.setIcon(BaseUtils.readIcon(IconPathConstants.CHECKBOX_HATFSELECT)); + } + } else { + //全选了,图标要换回来 + checkBox.setSelectedIcon(BaseUtils.readIcon(IconPathConstants.CHECKBOX_SELECTED)); + } + } + + public void commit() { + fireActionPerformed(new ActionEvent(this, 0, COMMIT_EVENT)); + } + + @Override + public Insets getInsets() { + return new Insets(0, 0, 0, 0); + } + + public void addActionListener(ActionListener listener) { + if (!listeners.contains(listener)) + listeners.add(listener); + } + + public void removeActionListener(ActionListener listener) { + if (listeners.contains(listener)) { + listeners.remove(listener); + } + } + + protected void fireActionPerformed(ActionEvent e) { + for (ActionListener l : listeners) { + l.actionPerformed(e); + } + } + +} diff --git a/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java b/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java new file mode 100644 index 000000000..11cfeb6fe --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java @@ -0,0 +1,330 @@ +package com.fr.design.gui.icombocheckbox; + +import com.fr.base.BaseUtils; +import com.fr.design.event.GlobalNameListener; +import com.fr.design.event.GlobalNameObserver; +import com.fr.design.event.UIObserver; +import com.fr.design.event.UIObserverListener; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.icon.IconPathConstants; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.stable.StringUtils; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.util.ArrayList; +import java.util.List; + +/** + * 设计器下拉复选框组件 + * 支持全选、半选 + * 可以设置悬停颜色、一页最多显示单选框个数 + * 可以省略显示 + */ +public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNameObserver { + //下拉框的值 + private Object[] values; + //已经选中的值 + private Object[] selectedValues; + + private List listeners = new ArrayList(); + private UICheckListPopup popup; + private UITextField editor; + private UIButton arrowButton; + //选中的值之间显示的分隔符 + private String valueSperator; + private static final String DEFAULT_VALUE_SPERATOR = ","; + private static final String OMIT_TEXT = "..."; + + private UIObserverListener uiObserverListener; + private GlobalNameListener globalNameListener = null; + private String multiComboName = StringUtils.EMPTY; + private boolean showOmitText = true; + + public UIComboCheckBox(Object[] value) { + this(value, DEFAULT_VALUE_SPERATOR); + } + + /** + * 自定义分隔符的复选框 + * + * @param value + * @param valueSperator + */ + public UIComboCheckBox(Object[] value, String valueSperator) { + values = value; + this.valueSperator = valueSperator; + initComponent(); + } + + /** + * 设置鼠标悬停的背景色 + * + * @param color + */ + public void setCheckboxEnteredColor(Color color) { + this.popup.setMouseEnteredColor(color); + } + + /** + * 设置弹出框最多显示单选的个数,超过显示滚动条 + */ + public void setPopupMaxDisplayNumber(int maxDisplayNumber) { + this.popup.setMaxDisplayNumber(maxDisplayNumber); + } + + /** + * 是否要超过文本框长度后显示省略号 + * + * @param isShowOmitText + */ + public void isShowOmitText(boolean isShowOmitText) { + this.showOmitText = isShowOmitText; + } + + private void initComponent() { + this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); + this.popup = new UICheckListPopup(values); + this.popup.addActionListener(new PopupAction()); + this.editor = createEditor(); + this.arrowButton = createArrowButton(); + this.add(editor); + this.add(arrowButton); + setText(); + } + + private UIButton createArrowButton() { + final UIButton arrowBtn = new UIButton(); + arrowBtn.setNormalPainted(false); + arrowBtn.setPreferredSize(new Dimension(20, 5)); + arrowBtn.setBackground(new Color(218, 218, 218)); + arrowBtn.setOpaque(true); + arrowBtn.setIcon(getIcon()); + arrowBtn.setExtraPainted(false); + addPopupListener(arrowBtn); + arrowBtn.addMouseListener(new MouseAdapter() { + @Override + public void mouseEntered(MouseEvent e) { + arrowBtn.setBackground(new Color(200, 200, 200)); + } + + @Override + public void mouseExited(MouseEvent e) { + arrowBtn.setBackground(new Color(218, 218, 218)); + } + }); + + return arrowBtn; + } + + private UITextField createEditor() { + UITextField editor = new UITextField(); + editor.setEditable(false); + editor.setPreferredSize(new Dimension(180, 20)); + addPopupListener(editor); + + return editor; + } + + /** + * 弹出框事件 + * + * @param component + */ + private void addPopupListener(Component component) { + component.addMouseListener(new MouseAdapter() { + public void mouseClicked(MouseEvent e) { + togglePopup(); + } + }); + + } + + /** + * 刷新复选框的列表值 + * + * @param value + */ + public void refreshCombo(Object[] value) { + this.values = value; + this.popup.addCheckboxValues(value); + } + + /** + * 获取复选框选中的值 + * + * @return 复选框选中的值 + */ + public Object[] getSelectedValues() { + return popup.getSelectedValues(); + } + + private class PopupAction implements ActionListener { + + public void actionPerformed(ActionEvent e) { + if (e.getActionCommand().equals(UICheckListPopup.COMMIT_EVENT)) { + selectedValues = popup.getSelectedValues(); + setText(); + //把事件继续传递出去 + fireActionPerformed(e); + } + } + } + + private void togglePopup() { + if (this.arrowButton.isEnabled()) { + popup.show(this, 0, getHeight()); + } + } + + /** + * 清除文本框 + */ + public void clearText() { + editor.setText(StringUtils.EMPTY); + } + + /** + * 获取文本框内容 + */ + public String getText() { + return editor.getText(); + } + + /** + * 文本框设置显示值 + */ + private void setText() { + StringBuilder builder = new StringBuilder(); + if (selectedValues != null) { + for (Object value : selectedValues) { + builder.append(value); + builder.append(valueSperator); + } + } + //去掉末尾多余的逗号 + String text = builder.length() > 0 ? builder.substring(0, builder.length() - 1) : StringUtils.EMPTY; + //计算加省略号后的文本 + editor.setText(this.showOmitText ? omitEditorText(editor, text) : text); + } + + /** + * 根据字体大小计算得到省略后的文字 + * + * @param textEditor + * @param text + * @return 省略后的文字 + */ + private static String omitEditorText(UITextField textEditor, String text) { + char[] omitChars = OMIT_TEXT.toCharArray(); + //获取字体的大小 + FontMetrics fontMetrics = textEditor.getFontMetrics(textEditor.getFont()); + //计算省略号的长度 + int omitLength = fontMetrics.charsWidth(omitChars, 0, omitChars.length); + String omitText = StringUtils.EMPTY; + char[] chars = text.toCharArray(); + + for (int i = 1; i <= chars.length; i++) { + //如果原文本+省略号长度超过文本框 + if (fontMetrics.charsWidth(chars, 0, i) + omitLength > textEditor.getPreferredSize().getWidth()) { + //从第i-1的位置截断再拼上省略号 + omitText = text.substring(0, i - 2) + OMIT_TEXT; + break; + } + } + + return omitText == StringUtils.EMPTY ? text : omitText; + } + + /** + * 给组件登记一个观察者监听事件 + * + * @param listener 观察者监听事件 + */ + @Override + public void registerChangeListener(UIObserverListener listener) { + this.uiObserverListener = listener; + } + + + @Override + public void setGlobalName(String name) { + multiComboName = name; + } + + /** + * 组件是否需要响应添加的观察者事件 + * + * @return 如果需要响应观察者事件则返回true,否则返回false + */ + @Override + public boolean shouldResponseChangeListener() { + return true; + } + + /** + * 注册观察者监听事件 + * + * @param listener 观察者监听事件 + */ + @Override + public void registerNameListener(GlobalNameListener listener) { + globalNameListener = listener; + } + + private Icon getIcon() { + return BaseUtils.readIcon(IconPathConstants.ARROW_ICON_PATH); + } + + /** + * 组件是否需要响应观察者事件 + * + * @return 如果需要响应观察者事件则返回true,否则返回false + */ + @Override + public boolean shouldResponseNameListener() { + return true; + } + + public void addActionListener(ActionListener listener) { + if (!listeners.contains(listener)) + listeners.add(listener); + } + + public void removeActionListener(ActionListener listener) { + if (listeners.contains(listener)) + listeners.remove(listener); + } + + protected void fireActionPerformed(ActionEvent e) { + for (ActionListener l : listeners) { + l.actionPerformed(e); + } + } + + /** + * 简单的测试demo + * @param args + */ + public static void main(String args[]) { + UIComboCheckBox comboBox = new UIComboCheckBox(new Object[] + {"MATA", "HANA", "KAKA", "KUKA", "INFI", "LILY", "RIBO", "CUBE", "MATA", "HANA", "KAKA", "KUKA"}); + + comboBox.isShowOmitText(false); + comboBox.setPopupMaxDisplayNumber(6); + + JPanel jPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + jPanel.add(comboBox); + + JFrame jFrame = new JFrame(); + jFrame.setVisible(true); + jFrame.setSize(600, 400); + jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + jFrame.add(jPanel, BorderLayout.CENTER); + } +} diff --git a/designer-base/src/main/java/com/fr/design/icon/IconPathConstants.java b/designer-base/src/main/java/com/fr/design/icon/IconPathConstants.java index 9a670fa4c..e01aa5251 100644 --- a/designer-base/src/main/java/com/fr/design/icon/IconPathConstants.java +++ b/designer-base/src/main/java/com/fr/design/icon/IconPathConstants.java @@ -33,4 +33,8 @@ public class IconPathConstants { public static final String XMLA_ICON_PATH = "/com/fr/design/images/data/cube.png"; public static final String FORBID_ICON_PATH = "/com/fr/web/images/form/forbid.png"; public static final String EDIT_ICON_PATH = "/com/fr/design/images/control/newEdit.png"; + public static final String ARROW_ICON_PATH = "com/fr/design/images/buttonicon/arrow.png"; + public static final String CHECKBOX_NORMAL = "com/fr/design/images/buttonicon/control_checkbox_normal.png"; + public static final String CHECKBOX_SELECTED = "com/fr/design/images/buttonicon/control_checkbox_selected.png"; + public static final String CHECKBOX_HATFSELECT = "com/fr/design/images/buttonicon/control_checkbox_part.png"; } diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/control_checkbox_normal.png b/designer-base/src/main/resources/com/fr/design/images/buttonicon/control_checkbox_normal.png new file mode 100644 index 0000000000000000000000000000000000000000..9aeac2db177320ba7cacae76f6a36852137c3fbe GIT binary patch literal 164 zcmeAS@N?(olHy`uVBq!ia0vp@Ak4uAB#T}@sR2@q#X;^)4C~IxyaaOMJY5_^G(?kQ zHYT+m{r~^}bHl6CrK78B`t<2j&Wyx_iXR^qKKuCi_;bU?90fP# z6D||1CRC|49ZL>0Sj8!&QNqI!aEalV$+Q~>M3`1GtE(1Wl4Ee_(q+>t-17`*6N9I# KpUXO@geCyEjX47V literal 0 HcmV?d00001 diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/control_checkbox_part.png b/designer-base/src/main/resources/com/fr/design/images/buttonicon/control_checkbox_part.png new file mode 100644 index 0000000000000000000000000000000000000000..10fff7cc1450e1c6cc2fd069610ad8e8c851d49c GIT binary patch literal 200 zcmeAS@N?(olHy`uVBq!ia0vp@Ak4uAB#T}@sR2@q#X;^)4C~IxyaaNZJY5_^G(?k2 zX8k_?`Tzd?nPx$3rR#lR45f=bej9e^Z&oUvlti{WPq3uc*4lUoW|%l`{!ezN@6s?41B^wj0R># z28I{|kWw&^fwN#D=rmA0Lzx{j!|_M|;Zg)O727g1JpatVaQ7XNnsO|d88k#085W=a z3%3QtfZJ4L!^|KjfRIZvW@hl$Vq)k#_?O`?!V<6o7MQYaH~%qA_h)68eflp0Co9n7 zhRh60FZ^Y={T59JPy<}kjo1GfcHjBOkY@!Ey8r$k!@_f@&VpG0cOFOpWXrp6{~7-N z`_Iq?bk?7LFlDGT+$NCl*Ix__(@y+lP!MEfxcLUtSum|2O;3Oro+9?$!(lv32T(l| jC@n!XB7||Xz-bQv)`(Bkjygt300000NkvXXu0mjfdP9u? literal 0 HcmV?d00001 From 85d7fb705c910b49916da3db89bf2d57d6ad2d70 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Fri, 12 Oct 2018 14:36:30 +0800 Subject: [PATCH 10/35] REPORT-11193 --- .../java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java b/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java index 2884e2279..a0f442074 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java @@ -40,7 +40,6 @@ public class UICheckListPopup extends UIPopupMenu { public void setMaxDisplayNumber(int maxDisplayNumber) { this.maxDisplayNumber = maxDisplayNumber; - //全选加在第一个位置 addCheckboxValues(values); } From e668acc1e88f84f1abd6f1f39aceef0fe81aafe0 Mon Sep 17 00:00:00 2001 From: "Wim.Zhai" Date: Sun, 14 Oct 2018 22:56:20 +0800 Subject: [PATCH 11/35] =?UTF-8?q?CHART-2808=20=E6=96=B0=E5=A2=9E=E4=B8=80?= =?UTF-8?q?=E6=96=B9=E6=B3=95=EF=BC=8C=E4=BF=AE=E6=94=B9=E5=8C=BA=E9=97=B4?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=A4=84=E9=BB=98=E8=AE=A4=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/SectionIntervalConfigPaneWithOutNum.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/range/component/SectionIntervalConfigPaneWithOutNum.java b/designer-chart/src/main/java/com/fr/van/chart/range/component/SectionIntervalConfigPaneWithOutNum.java index e8342aad5..cad289f10 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/range/component/SectionIntervalConfigPaneWithOutNum.java +++ b/designer-chart/src/main/java/com/fr/van/chart/range/component/SectionIntervalConfigPaneWithOutNum.java @@ -3,6 +3,7 @@ package com.fr.van.chart.range.component; import com.fr.chart.chartglyph.MapHotAreaColor; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.ilable.BoldFontTextLabel; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.gui.style.series.MapColorPickerPaneWithFormula; import com.fr.van.chart.designer.TableLayout4VanChartHelper; @@ -19,6 +20,10 @@ import java.awt.Dimension; public class SectionIntervalConfigPaneWithOutNum extends MapColorPickerPaneWithFormula { private BoldFontTextLabel numLabel; + public String getNameOfSubRange() { + return Toolkit.i18nText("Fine-Design_Chart_Range_Num"); + } + public SectionIntervalConfigPaneWithOutNum(AbstractAttrNoScrollPane container) { super(container); getDesignTypeButtonGroup().addChangeListener(new ChangeListener() { @@ -49,12 +54,12 @@ public class SectionIntervalConfigPaneWithOutNum extends MapColorPickerPaneWithF @Override protected Component[][] createComponents() { - numLabel = new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Value_Divided_Stage")); + numLabel = new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Value_Divided_Stage")); setRegionVisible(false); return new Component[][]{ - new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Range_Num")), getDesignTypeButtonGroup()}, + new Component[]{new BoldFontTextLabel(getNameOfSubRange()), getDesignTypeButtonGroup()}, new Component[]{numLabel, getRegionNumPane()}, }; } From 80279fe9539c4dc8012a9a13062aec1abe22a45b Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Tue, 16 Oct 2018 10:53:58 +0800 Subject: [PATCH 12/35] =?UTF-8?q?REPORT-11690=20=E3=80=90=E9=9B=86?= =?UTF-8?q?=E7=BE=A4=E3=80=91=E3=80=90=E8=BF=9C=E7=A8=8B=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E3=80=91=E6=B7=BB=E5=8A=A0=E6=9C=8D=E5=8A=A1=E5=99=A8=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tabledatapane/DBTableDataPane.java | 682 +++++++++--------- 1 file changed, 349 insertions(+), 333 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java index 37ba91466..d441d5116 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java @@ -1,7 +1,6 @@ package com.fr.design.data.tabledata.tabledatapane; import com.fr.base.BaseUtils; -import com.fr.base.FRContext; import com.fr.base.Parameter; import com.fr.base.ParameterHelper; import com.fr.data.core.db.TableProcedure; @@ -35,17 +34,25 @@ import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.ToolBarDef; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; - import com.fr.general.sql.SqlUtils; +import com.fr.log.FineLoggerFactory; import com.fr.script.Calculator; import com.fr.stable.ArrayUtils; import com.fr.stable.ParameterProvider; import com.fr.stable.StringUtils; -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.Box; +import javax.swing.BoxLayout; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JSplitPane; +import javax.swing.JToolBar; import javax.swing.text.BadLocationException; import javax.swing.text.Document; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; @@ -53,334 +60,343 @@ import java.util.ArrayList; import java.util.List; public class DBTableDataPane extends AbstractTableDataPane { - private static final int BOTTOM = 6; - private static final String PREVIEW_BUTTON = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"); + private static final int BOTTOM = 6; + private static final String PREVIEW_BUTTON = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"); private static final String REFRESH_BUTTON = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh"); - private ConnectionTableProcedurePane connectionTableProcedurePane; - private UITableEditorPane editorPane; - - private DBTableDataMenuHandler dbTableDataMenuHandler; - private SQLEditPane sqlTextPane; - private UICheckBox isShareCheckBox; - private MaxMemRowCountPanel maxPanel; - private String pageQuery = null; - private DBTableData dbTableData; - - private void init() { - this.setLayout(new BorderLayout(4, 4)); - - sqlTextPane = new SQLEditPane(); - sqlTextPane.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_SQL); - - ParameterTableModel model = new ParameterTableModel() { - @Override - public UITableEditAction[] createAction() { - return (UITableEditAction[]) ArrayUtils.add(super.createDBTableAction(), new RefreshAction()); - } - }; - editorPane = new UITableEditorPane(model); - - // 左边的Panel,上面是选择DatabaseConnection的ComboBox,下面DatabaseConnection对应的Table - connectionTableProcedurePane = new ConnectionTableProcedurePane() { - @Override - protected void filter(Connection connection, String conName, List nameList) { - connection.addConnection(nameList, conName, new Class[]{JDBCDatabaseConnection.class, JNDIDatabaseConnection.class}); - } - }; - connectionTableProcedurePane.addDoubleClickListener(new DoubleClickSelectedNodeOnTreeListener() { - - @Override - public void actionPerformed(TableProcedure target) { - Document document = sqlTextPane.getDocument(); - try { - document.insertString(sqlTextPane.getCaretPosition(), target.toString(), null); - } catch (BadLocationException e) { - FRContext.getLogger().error(e.getMessage(), e); - } - // 这里开始作色,本来可以给sqlTextPane添加DocumentListener来实现的, - // 后来发现insertString的时候,锁定了JTextPane,不能调用setXXX来作色,先这样了. -// sqlTextPane.syntaxTexts(); - sqlTextPane.requestFocus(); - } - }); - sqlTextPane.addFocusListener(new FocusListener() { - public void focusGained(FocusEvent e) { - // unsupport - } - - public void focusLost(FocusEvent e) { - if (isPreviewOrRefreshButton(e)) { - checkParameter(); - } - } - }); - } - - - private void initMainSplitPane() { - Box box = new Box(BoxLayout.Y_AXIS); - - - JPanel northPane = new JPanel(new BorderLayout(4, 4)); - JToolBar editToolBar = createToolBar(); - northPane.add(editToolBar, BorderLayout.CENTER); - northPane.setBorder(BorderFactory.createEmptyBorder(0, 0, BOTTOM, 0)); - - RTextScrollPane sqlTextScrollPane = new RTextScrollPane(sqlTextPane); - sqlTextScrollPane.setLineNumbersEnabled(true); - sqlTextScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC)); - sqlTextScrollPane.setPreferredSize(new Dimension(680, 600)); - - JPanel paraMeanPane = new JPanel(new BorderLayout()); - paraMeanPane.setPreferredSize(new Dimension(680, 90)); - UILabel paraMean = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Datasource_Param_DES")); - paraMeanPane.add(paraMean, BorderLayout.CENTER); - - - box.add(northPane); - box.add(sqlTextScrollPane); - box.add(paraMeanPane); - box.add(editorPane); - - JPanel sqlSplitPane = new JPanel(new BorderLayout(4, 4)); - sqlSplitPane.add(box, BorderLayout.CENTER); - - - box.setMinimumSize(new Dimension(310, 400)); - // 使用SplitPane - JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, connectionTableProcedurePane, sqlSplitPane); - mainSplitPane.setBorder(BorderFactory.createLineBorder(GUICoreUtils.getTitleLineBorderColor())); - mainSplitPane.setOneTouchExpandable(true); - this.add(mainSplitPane, BorderLayout.CENTER); - } - - public DBTableDataPane() { - init(); - initMainSplitPane(); - } - - - - private boolean isPreviewOrRefreshButton (FocusEvent e) { - if (e.getOppositeComponent() != null) { - String name = e.getOppositeComponent().getName(); - return ComparatorUtils.equals(name, PREVIEW_BUTTON) || ComparatorUtils.equals(name, REFRESH_BUTTON); - } - return false; - } - - @Override - protected String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS-Database_Query"); - } - - private void refresh() { - String[] paramTexts = new String[2]; - paramTexts[0] = SqlUtils.tryPureSqlText(sqlTextPane.getText()); - paramTexts[1] = SqlUtils.tryPureSqlText(pageQuery); - List existParameterList = editorPane.update(); - Parameter[] ps = existParameterList == null ? new Parameter[0] : existParameterList.toArray(new Parameter[existParameterList.size()]); - - editorPane.populate(ParameterHelper.analyzeAndUnionSameParameters(paramTexts, ps)); - } - - private JToolBar createToolBar() { - // p:工具栏. - ToolBarDef toolBarDef = new ToolBarDef(); - toolBarDef.addShortCut(new PreviewAction()); - toolBarDef.addShortCut(SeparatorDef.DEFAULT); - toolBarDef.addShortCut(new EditPageQueryAction()); - dbTableDataMenuHandler = ExtraDesignClassManager.getInstance().getSingle(DBTableDataMenuHandler.MARK_STRING); - if (dbTableDataMenuHandler != null) { - toolBarDef.addShortCut(SeparatorDef.DEFAULT); - toolBarDef.addShortCut(dbTableDataMenuHandler.createQueryAction()); - } - isShareCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Is_Share_DBTableData")); - isShareCheckBox.setBackground(Color.WHITE); - maxPanel = new MaxMemRowCountPanel(); - maxPanel.setBorder(null); - UIToolbar editToolBar = ToolBarDef.createJToolBar(); - toolBarDef.updateToolBar(editToolBar); - editToolBar.add(isShareCheckBox); - editToolBar.add(maxPanel); - return editToolBar; - } - - private void checkParameter() { - String[] paramTexts = new String[2]; - paramTexts[0] = sqlTextPane.getText(); - paramTexts[1] = pageQuery; - Parameter[] parameters = ParameterHelper.analyze4Parameters(paramTexts, false); - - if (parameters.length < 1 && editorPane.update().size() < 1) { - return; - } - boolean isIn = true; - List list = editorPane.update(); - List name = new ArrayList(); - for (int i = 0; i < list.size(); i++) { - name.add(list.get(i).getName()); - } - for (int i = 0; i < parameters.length; i++) { - if (!name.contains(parameters[i].getName())) { - isIn = false; - break; - } - } - if (list.size() == parameters.length && isIn) { - return; - } - // bug:34175 删了是否刷新对话框, 均直接刷新 - refresh(); - } - - @Override - public void populateBean(DBTableData dbtabledata) { - this.dbTableData = dbtabledata; - if (dbTableDataMenuHandler != null) { - dbTableDataMenuHandler.populate(dbtabledata); - } - ParameterProvider[] parameters = null; - - Calculator c = Calculator.createCalculator(); - - parameters = dbtabledata.getParameters(c); - editorPane.populate(parameters); - - com.fr.data.impl.Connection db = null; - String query = null; - boolean isShare = false; - int maxMemeryRow = -1; - - db = dbtabledata.getDatabase(); - query = dbtabledata.getQuery(); - isShare = dbtabledata.isShare(); - maxMemeryRow = dbtabledata.getMaxMemRowCount(); - this.pageQuery = dbtabledata.getPageQuerySql(); - this.connectionTableProcedurePane.setSelectedDatabaseConnection(db); - this.sqlTextPane.setText(query); - this.sqlTextPane.requestFocus(); - this.sqlTextPane.moveCaretPosition(this.sqlTextPane.getCaretPosition()); - - isShareCheckBox.setSelected(isShare); - maxPanel.setValue(maxMemeryRow); - } - - @Override - public DBTableData updateBean() { - String dbName = this.connectionTableProcedurePane.getSelectedDatabaseConnnectonName(); - if (StringUtils.isBlank(dbName) || StringUtils.isBlank(this.sqlTextPane.getText())) { - try { - throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connect_SQL_Cannot_Null") + "."); - } catch (Exception e) { - // JOptionPane.showMessageDialog(DBTableDataPane.this, - // com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connect_SQL_Cannot_Null") + "."); - } - } - - List parameterList = editorPane.update(); - Parameter[] parameters = parameterList.toArray(new Parameter[parameterList.size()]); - - dbTableData.setDatabase(new NameDatabaseConnection(dbName)); - - // p:必须先设置Parameters数组,因为setQuery里面会自动设置的 - - dbTableData.setParameters(parameters); - dbTableData.setQuery(this.sqlTextPane.getText()); - - dbTableData.setShare(isShareCheckBox.isSelected()); - dbTableData.setMaxMemRowCount(maxPanel.getValue()); - dbTableData.setPageQuerySql(this.pageQuery); - if (dbTableDataMenuHandler != null) { - dbTableDataMenuHandler.update(); - } - return dbTableData; - } - - protected class RefreshAction extends UITableEditAction { - public RefreshAction() { - this.setName(REFRESH_BUTTON); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/refresh.png")); - } - - public void actionPerformed(ActionEvent e) { - refresh(); - } - - @Override - public void checkEnabled() { - // unsupport - } - } - - private class PreviewAction extends UpdateAction { - public PreviewAction() { - this.setName(PREVIEW_BUTTON); - this.setMnemonic('P'); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/preview.png")); - } - - public void actionPerformed(ActionEvent evt) { - checkParameter(); - PreviewTablePane.previewTableData(DBTableDataPane.this.updateBean()); - } - } - - private class EditPageQueryAction extends UpdateAction { - public EditPageQueryAction() { - this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Layer_Page_Report_Page_Query")); - this.setMnemonic('L'); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/text.png")); - } - - public void actionPerformed(ActionEvent e) { - final QueryPane pane = new QueryPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Layer_Page_Report_Define_Page_Query_SQL")); - pane.populate(pageQuery); - BasicDialog dialog = pane.showWindow(DesignerContext.getDesignerFrame()); - dialog.addDialogActionListener(new DialogActionAdapter() { - public void doOk() { - pageQuery = pane.update(); - checkParameter(); - } - }); - dialog.setVisible(true); - } - } - - private class QueryPane extends BasicPane { - private SQLEditPane pageQueryPane; - private String title; - - public QueryPane(String title) { - this.title = title; - this.initComponents(); - } - - public void initComponents() { - this.setLayout(new BorderLayout()); - pageQueryPane = new SQLEditPane(); - this.add(new JScrollPane(pageQueryPane)); - } - - public void populate(String text) { - if (StringUtils.isBlank(text)) { - return; - } - pageQueryPane.setText(text); - } - - public String update() { - String text = pageQueryPane.getText(); - if (StringUtils.isBlank(text)) { - return null; - } else { - return text; - } - } - - @Override - protected String title4PopupWindow() { - return title; - } - } + private ConnectionTableProcedurePane connectionTableProcedurePane; + private UITableEditorPane editorPane; + + private DBTableDataMenuHandler dbTableDataMenuHandler; + private SQLEditPane sqlTextPane; + private UICheckBox isShareCheckBox; + private MaxMemRowCountPanel maxPanel; + private String pageQuery = null; + private DBTableData dbTableData; + + private void init() { + this.setLayout(new BorderLayout(4, 4)); + + sqlTextPane = new SQLEditPane(); + sqlTextPane.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_SQL); + + ParameterTableModel model = new ParameterTableModel() { + @Override + public UITableEditAction[] createAction() { + return ArrayUtils.add(super.createDBTableAction(), new RefreshAction()); + } + }; + editorPane = new UITableEditorPane(model); + + // 左边的Panel,上面是选择DatabaseConnection的ComboBox,下面DatabaseConnection对应的Table + connectionTableProcedurePane = new ConnectionTableProcedurePane() { + @Override + protected void filter(Connection connection, String conName, List nameList) { + + connection.addConnection(nameList, conName, new Class[]{JDBCDatabaseConnection.class, JNDIDatabaseConnection.class}); + } + }; + connectionTableProcedurePane.addDoubleClickListener(new DoubleClickSelectedNodeOnTreeListener() { + + @Override + public void actionPerformed(TableProcedure target) { + Document document = sqlTextPane.getDocument(); + try { + document.insertString(sqlTextPane.getCaretPosition(), target.toString(), null); + } catch (BadLocationException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + // 这里开始作色,本来可以给sqlTextPane添加DocumentListener来实现的, + // 后来发现insertString的时候,锁定了JTextPane,不能调用setXXX来作色,先这样了. + // sqlTextPane.syntaxTexts(); + sqlTextPane.requestFocus(); + } + }); + sqlTextPane.addFocusListener(new FocusListener() { + @Override + public void focusGained(FocusEvent e) { + // do nothing + } + + @Override + public void focusLost(FocusEvent e) { + if (isPreviewOrRefreshButton(e)) { + checkParameter(); + } + } + }); + } + + + private void initMainSplitPane() { + Box box = new Box(BoxLayout.Y_AXIS); + + + JPanel northPane = new JPanel(new BorderLayout(4, 4)); + JToolBar editToolBar = createToolBar(); + northPane.add(editToolBar, BorderLayout.CENTER); + northPane.setBorder(BorderFactory.createEmptyBorder(0, 0, BOTTOM, 0)); + + RTextScrollPane sqlTextScrollPane = new RTextScrollPane(sqlTextPane); + sqlTextScrollPane.setLineNumbersEnabled(true); + sqlTextScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC)); + sqlTextScrollPane.setPreferredSize(new Dimension(680, 600)); + + JPanel paraMeanPane = new JPanel(new BorderLayout()); + paraMeanPane.setPreferredSize(new Dimension(680, 90)); + UILabel paraMean = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Datasource_Param_DES")); + paraMeanPane.add(paraMean, BorderLayout.CENTER); + + + box.add(northPane); + box.add(sqlTextScrollPane); + box.add(paraMeanPane); + box.add(editorPane); + + JPanel sqlSplitPane = new JPanel(new BorderLayout(4, 4)); + sqlSplitPane.add(box, BorderLayout.CENTER); + + + box.setMinimumSize(new Dimension(300, 400)); + // 防止数据连接名过长时影响 split pane 分割效果 + connectionTableProcedurePane.setMinimumSize(new Dimension(250, 400)); + connectionTableProcedurePane.setMaximumSize(new Dimension(500, 400)); + // 使用SplitPane + JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, connectionTableProcedurePane, sqlSplitPane); + mainSplitPane.setBorder(BorderFactory.createLineBorder(GUICoreUtils.getTitleLineBorderColor())); + mainSplitPane.setOneTouchExpandable(true); + this.add(mainSplitPane, BorderLayout.CENTER); + } + + public DBTableDataPane() { + init(); + initMainSplitPane(); + } + + + private boolean isPreviewOrRefreshButton(FocusEvent e) { + if (e.getOppositeComponent() != null) { + String name = e.getOppositeComponent().getName(); + return ComparatorUtils.equals(name, PREVIEW_BUTTON) || ComparatorUtils.equals(name, REFRESH_BUTTON); + } + return false; + } + + @Override + protected String title4PopupWindow() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS-Database_Query"); + } + + private void refresh() { + String[] paramTexts = new String[2]; + paramTexts[0] = SqlUtils.tryPureSqlText(sqlTextPane.getText()); + paramTexts[1] = SqlUtils.tryPureSqlText(pageQuery); + List existParameterList = editorPane.update(); + Parameter[] ps = existParameterList == null ? new Parameter[0] : existParameterList.toArray(new Parameter[existParameterList.size()]); + + editorPane.populate(ParameterHelper.analyzeAndUnionSameParameters(paramTexts, ps)); + } + + private JToolBar createToolBar() { + // p:工具栏. + ToolBarDef toolBarDef = new ToolBarDef(); + toolBarDef.addShortCut(new PreviewAction()); + toolBarDef.addShortCut(SeparatorDef.DEFAULT); + toolBarDef.addShortCut(new EditPageQueryAction()); + dbTableDataMenuHandler = ExtraDesignClassManager.getInstance().getSingle(DBTableDataMenuHandler.MARK_STRING); + if (dbTableDataMenuHandler != null) { + toolBarDef.addShortCut(SeparatorDef.DEFAULT); + toolBarDef.addShortCut(dbTableDataMenuHandler.createQueryAction()); + } + isShareCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Is_Share_DBTableData")); + isShareCheckBox.setBackground(Color.WHITE); + maxPanel = new MaxMemRowCountPanel(); + maxPanel.setBorder(null); + UIToolbar editToolBar = ToolBarDef.createJToolBar(); + toolBarDef.updateToolBar(editToolBar); + editToolBar.add(isShareCheckBox); + editToolBar.add(maxPanel); + return editToolBar; + } + + private void checkParameter() { + String[] paramTexts = new String[2]; + paramTexts[0] = sqlTextPane.getText(); + paramTexts[1] = pageQuery; + Parameter[] parameters = ParameterHelper.analyze4Parameters(paramTexts, false); + + if (parameters.length < 1 && editorPane.update().size() < 1) { + return; + } + boolean isIn = true; + List list = editorPane.update(); + List name = new ArrayList(); + for (int i = 0; i < list.size(); i++) { + name.add(list.get(i).getName()); + } + for (int i = 0; i < parameters.length; i++) { + if (!name.contains(parameters[i].getName())) { + isIn = false; + break; + } + } + if (list.size() == parameters.length && isIn) { + return; + } + // bug:34175 删了是否刷新对话框, 均直接刷新 + refresh(); + } + + @Override + public void populateBean(DBTableData dbtabledata) { + this.dbTableData = dbtabledata; + if (dbTableDataMenuHandler != null) { + dbTableDataMenuHandler.populate(dbtabledata); + } + ParameterProvider[] parameters = null; + + Calculator c = Calculator.createCalculator(); + + parameters = dbtabledata.getParameters(c); + editorPane.populate(parameters); + + com.fr.data.impl.Connection db = null; + String query = null; + boolean isShare = false; + int maxMemeryRow = -1; + + db = dbtabledata.getDatabase(); + query = dbtabledata.getQuery(); + isShare = dbtabledata.isShare(); + maxMemeryRow = dbtabledata.getMaxMemRowCount(); + this.pageQuery = dbtabledata.getPageQuerySql(); + this.connectionTableProcedurePane.setSelectedDatabaseConnection(db); + this.sqlTextPane.setText(query); + this.sqlTextPane.requestFocus(); + this.sqlTextPane.moveCaretPosition(this.sqlTextPane.getCaretPosition()); + + isShareCheckBox.setSelected(isShare); + maxPanel.setValue(maxMemeryRow); + } + + @Override + public DBTableData updateBean() { + String dbName = this.connectionTableProcedurePane.getSelectedDatabaseConnnectonName(); + if (StringUtils.isBlank(dbName) || StringUtils.isBlank(this.sqlTextPane.getText())) { + try { + throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connect_SQL_Cannot_Null") + "."); + } catch (Exception ignore) { + // JOptionPane.showMessageDialog(DBTableDataPane.this, + // com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connect_SQL_Cannot_Null") + "."); + } + } + + List parameterList = editorPane.update(); + Parameter[] parameters = parameterList.toArray(new Parameter[parameterList.size()]); + + dbTableData.setDatabase(new NameDatabaseConnection(dbName)); + + // p:必须先设置Parameters数组,因为setQuery里面会自动设置的 + + dbTableData.setParameters(parameters); + dbTableData.setQuery(this.sqlTextPane.getText()); + + dbTableData.setShare(isShareCheckBox.isSelected()); + dbTableData.setMaxMemRowCount(maxPanel.getValue()); + dbTableData.setPageQuerySql(this.pageQuery); + if (dbTableDataMenuHandler != null) { + dbTableDataMenuHandler.update(); + } + return dbTableData; + } + + protected class RefreshAction extends UITableEditAction { + public RefreshAction() { + this.setName(REFRESH_BUTTON); + this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/refresh.png")); + } + + @Override + public void actionPerformed(ActionEvent e) { + refresh(); + } + + @Override + public void checkEnabled() { + // do nothing + } + } + + private class PreviewAction extends UpdateAction { + public PreviewAction() { + this.setName(PREVIEW_BUTTON); + this.setMnemonic('P'); + this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/preview.png")); + } + + @Override + public void actionPerformed(ActionEvent evt) { + checkParameter(); + PreviewTablePane.previewTableData(DBTableDataPane.this.updateBean()); + } + } + + private class EditPageQueryAction extends UpdateAction { + public EditPageQueryAction() { + this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Layer_Page_Report_Page_Query")); + this.setMnemonic('L'); + this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/text.png")); + } + + @Override + public void actionPerformed(ActionEvent e) { + final QueryPane pane = new QueryPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Layer_Page_Report_Define_Page_Query_SQL")); + pane.populate(pageQuery); + BasicDialog dialog = pane.showWindow(DesignerContext.getDesignerFrame()); + dialog.addDialogActionListener(new DialogActionAdapter() { + @Override + public void doOk() { + pageQuery = pane.update(); + checkParameter(); + } + }); + dialog.setVisible(true); + } + } + + private class QueryPane extends BasicPane { + private SQLEditPane pageQueryPane; + private String title; + + public QueryPane(String title) { + this.title = title; + this.initComponents(); + } + + public void initComponents() { + this.setLayout(new BorderLayout()); + pageQueryPane = new SQLEditPane(); + this.add(new JScrollPane(pageQueryPane)); + } + + public void populate(String text) { + if (StringUtils.isBlank(text)) { + return; + } + pageQueryPane.setText(text); + } + + public String update() { + String text = pageQueryPane.getText(); + if (StringUtils.isBlank(text)) { + return null; + } else { + return text; + } + } + + @Override + protected String title4PopupWindow() { + return title; + } + } } From 4d9e1fb8bc669f01c6b6e1dc448f5820f7f7cc50 Mon Sep 17 00:00:00 2001 From: zheng Date: Tue, 16 Oct 2018 11:57:48 +0800 Subject: [PATCH 13/35] =?UTF-8?q?CHART-3211=20=E7=AC=AC=E4=B8=89=E6=96=B9?= =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E6=8F=92=E4=BB=B6=E6=9C=89=E4=BA=9B=E6=B2=A1?= =?UTF-8?q?=E6=9C=89type=20pane?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/ChartTypeInterfaceManager.java | 6 ++++++ .../chart/fun/impl/AbstractIndependentChartsUI.java | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java index 5d54adff7..a01fc0ce5 100644 --- a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java @@ -61,6 +61,7 @@ import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.injectable.PluginSingleInjection; import com.fr.plugin.solution.closeable.CloseableContainedMap; import com.fr.stable.ArrayUtils; +import com.fr.stable.AssistUtils; import com.fr.stable.StringUtils; import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; import com.fr.van.chart.area.AreaIndependentVanChartInterface; @@ -107,6 +108,8 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr private static Map idAndPriorityMap = new HashMap(); + public static final String TYPE_PANE_DEFAULT_TITLE = "DEFAULT_NAME"; + public synchronized static ChartTypeInterfaceManager getInstance() { return classManager; @@ -260,6 +263,9 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr String plotID = entry.getKey(); AbstractChartTypePane pane = entry.getValue().getPlotTypePane(); + if (AssistUtils.equals(pane.title4PopupWindow(), TYPE_PANE_DEFAULT_TITLE)) { + continue; + } pane.setPlotID(plotID); paneList.add(pane); diff --git a/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractIndependentChartsUI.java b/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractIndependentChartsUI.java index 6e9ef2f03..19244a3fd 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractIndependentChartsUI.java +++ b/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractIndependentChartsUI.java @@ -1,6 +1,7 @@ package com.fr.design.chart.fun.impl; import com.fr.chart.chartattr.Plot; +import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.beans.BasicBeanPane; import com.fr.design.chart.fun.IndependentChartUIProvider; import com.fr.design.condition.ConditionAttributesPane; @@ -40,7 +41,12 @@ public abstract class AbstractIndependentChartsUI extends AbstractProvider imple @Override public AbstractChartTypePane getPlotTypePane() { - return new PiePlotPane(); + return new PiePlotPane() { + @Override + public String title4PopupWindow() { + return ChartTypeInterfaceManager.TYPE_PANE_DEFAULT_TITLE; + } + }; } @Override From 06a9cf646bbcccb0543d4294b8c492e78a22ffa3 Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 18 Oct 2018 14:11:18 +0800 Subject: [PATCH 14/35] =?UTF-8?q?REPORT-11950=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=86=85=E6=8F=92=E4=BB=B6=E7=AE=A1=E7=90=86=E4=B8=8E?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E5=86=85=E6=8F=92=E4=BB=B6=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E7=9A=84=E6=8E=88=E6=9D=83=E5=AD=97=E6=A0=B7=E4=B8=8D=E4=B8=80?= =?UTF-8?q?=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/extra/PluginUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/extra/PluginUtils.java b/designer-base/src/main/java/com/fr/design/extra/PluginUtils.java index ff4b44c21..92a838864 100644 --- a/designer-base/src/main/java/com/fr/design/extra/PluginUtils.java +++ b/designer-base/src/main/java/com/fr/design/extra/PluginUtils.java @@ -230,7 +230,7 @@ public class PluginUtils { jo.put("licDamaged", pluginContext.isLicDamaged()); jo.put("available", pluginContext.isAvailable()); jo.put("leftDays", pluginContext.getLeftDays()); - jo.put("trial", pluginContext.isOnTrial()); + jo.put("onTrial", pluginContext.isOnTrial()); jo.put("deadline", getDeadline(pluginContext)); jo.put("registerFailed", pluginContext.isRegisterFailed()); ja.put(jo); From 7883dc1a6bccf4b83d16bc68a9692636d82694cd Mon Sep 17 00:00:00 2001 From: "Wim.Zhai" Date: Thu, 18 Oct 2018 15:13:34 +0800 Subject: [PATCH 15/35] =?UTF-8?q?CHART-3208=20=E7=BB=A7=E6=89=BF&=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E5=90=AB=E9=BB=98=E8=AE=A4=E5=80=BC=E2=80=9C=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E2=80=9D=E7=9A=84=E4=B8=8B=E6=8B=89=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/extended/chart/UIComboBoxWithNone.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/extended/chart/UIComboBoxWithNone.java b/designer-chart/src/main/java/com/fr/extended/chart/UIComboBoxWithNone.java index 57960a47b..7be740f4d 100644 --- a/designer-chart/src/main/java/com/fr/extended/chart/UIComboBoxWithNone.java +++ b/designer-chart/src/main/java/com/fr/extended/chart/UIComboBoxWithNone.java @@ -10,7 +10,7 @@ import java.util.List; */ public class UIComboBoxWithNone extends UIComboBox { - private static String getNoneLocaleString() { + public String getNoneLocaleString() { return Toolkit.i18nText("Fine-Design_Chart_Use_None"); } From bfa56e2ba8f52c68480c92541b8da7a91f129c1e Mon Sep 17 00:00:00 2001 From: "Wim.Zhai" Date: Thu, 18 Oct 2018 15:26:17 +0800 Subject: [PATCH 16/35] change to protected method --- .../com/fr/extended/chart/UIComboBoxWithNone.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/extended/chart/UIComboBoxWithNone.java b/designer-chart/src/main/java/com/fr/extended/chart/UIComboBoxWithNone.java index 7be740f4d..77347e0fd 100644 --- a/designer-chart/src/main/java/com/fr/extended/chart/UIComboBoxWithNone.java +++ b/designer-chart/src/main/java/com/fr/extended/chart/UIComboBoxWithNone.java @@ -10,25 +10,25 @@ import java.util.List; */ public class UIComboBoxWithNone extends UIComboBox { - public String getNoneLocaleString() { + protected String getDefaultLocaleString() { return Toolkit.i18nText("Fine-Design_Chart_Use_None"); } @Override public void refreshBoxItems(List list) { super.refreshBoxItems(list); - addNoneItem(); + addDefaultItem(); } @Override public void clearBoxItems() { super.clearBoxItems(); - addNoneItem(); + addDefaultItem(); } - private void addNoneItem() { - addItem(getNoneLocaleString()); + private void addDefaultItem() { + addItem(getDefaultLocaleString()); } @@ -37,7 +37,7 @@ public class UIComboBoxWithNone extends UIComboBox { super.setSelectedItem(anObject); if (getSelectedIndex() == -1) {//找不到的都选中无。中文的无 英文下是none。 - super.setSelectedItem(getNoneLocaleString()); + super.setSelectedItem(getDefaultLocaleString()); } } From 46283dc93c6423225ab4637f99942a72041a59b1 Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Mon, 22 Oct 2018 11:11:06 +0800 Subject: [PATCH 17/35] =?UTF-8?q?REPORT-11880=20SimilarSearchManeger?= =?UTF-8?q?=E6=8B=BC=E9=94=99=E4=BA=86....?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/alphafine/AlphaFineHelper.java | 4 ++-- .../mainframe/alphafine/cell/CellModelHelper.java | 4 ++-- .../mainframe/alphafine/component/AlphaFineDialog.java | 6 +++--- ...larSearchManeger.java => SimilarSearchManager.java} | 10 +++++----- .../search/manager/impl/SearchManegerTest.java | 10 +++++----- 5 files changed, 17 insertions(+), 17 deletions(-) rename designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/{SimilarSearchManeger.java => SimilarSearchManager.java} (92%) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java index 93e60182c..376d63f17 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java @@ -14,7 +14,7 @@ import com.fr.design.mainframe.alphafine.search.manager.impl.HotIssuesManager; import com.fr.design.mainframe.alphafine.search.manager.impl.PluginSearchManager; import com.fr.design.mainframe.alphafine.search.manager.impl.RecentSearchManager; import com.fr.design.mainframe.alphafine.search.manager.impl.RecommendSearchManager; -import com.fr.design.mainframe.alphafine.search.manager.impl.SimilarSearchManeger; +import com.fr.design.mainframe.alphafine.search.manager.impl.SimilarSearchManager; import com.fr.general.ProcessCanceledException; import com.fr.general.http.HttpToolbox; import com.fr.json.JSONArray; @@ -142,7 +142,7 @@ public class AlphaFineHelper { result.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Community_Help"))); } else if (object instanceof PluginSearchManager) { result.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Plugin_Addon"))); - } else if (object instanceof SimilarSearchManeger) { + } else if (object instanceof SimilarSearchManager) { result.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Relation_Item"))); } else if (object instanceof HotIssuesManager) { return new SearchResult(); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java index 83ab319a6..c545cefaa 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java @@ -6,7 +6,7 @@ import com.fr.design.mainframe.alphafine.search.manager.impl.ActionSearchManager import com.fr.design.mainframe.alphafine.search.manager.impl.DocumentSearchManager; import com.fr.design.mainframe.alphafine.search.manager.impl.FileSearchManager; import com.fr.design.mainframe.alphafine.search.manager.impl.PluginSearchManager; -import com.fr.design.mainframe.alphafine.search.manager.impl.SimilarSearchManeger; +import com.fr.design.mainframe.alphafine.search.manager.impl.SimilarSearchManager; import com.fr.json.JSONObject; /** @@ -34,7 +34,7 @@ public class CellModelHelper { break; case ROBOT: case RECOMMEND_ROBOT: - cellModel = SimilarSearchManeger.getModelFromCloud(object.optJSONObject(RESULT)); + cellModel = SimilarSearchManager.getModelFromCloud(object.optJSONObject(RESULT)); break; } return cellModel; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java index 5d0b2aff0..6310a2233 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -32,7 +32,7 @@ import com.fr.design.mainframe.alphafine.search.manager.impl.PluginSearchManager import com.fr.design.mainframe.alphafine.search.manager.impl.RecentSearchManager; import com.fr.design.mainframe.alphafine.search.manager.impl.RecommendSearchManager; import com.fr.design.mainframe.alphafine.search.manager.impl.SegmentationManager; -import com.fr.design.mainframe.alphafine.search.manager.impl.SimilarSearchManeger; +import com.fr.design.mainframe.alphafine.search.manager.impl.SimilarSearchManager; import com.fr.design.mainframe.errorinfo.ErrorInfoUploader; import com.fr.design.mainframe.templateinfo.TemplateInfoCollector; import com.fr.form.main.Form; @@ -573,7 +573,7 @@ public class AlphaFineDialog extends UIDialog { } private void buildSimilarList(final String[] searchText) { - addSearchResult(SimilarSearchManeger.getInstance().getLessSearchResult(searchText)); + addSearchResult(SimilarSearchManager.getInstance().getLessSearchResult(searchText)); } private synchronized void addSearchResult(SearchResult searchResult) { @@ -1052,7 +1052,7 @@ public class AlphaFineDialog extends UIDialog { break; case ROBOT: case RECOMMEND_ROBOT: - moreResult = SimilarSearchManeger.getInstance().getMoreSearchResult(searchTextField.getText()); + moreResult = SimilarSearchManager.getInstance().getMoreSearchResult(searchTextField.getText()); break; case RECOMMEND: moreResult = RecommendSearchManager.getInstance().getMoreSearchResult(searchTextField.getText()); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManeger.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManager.java similarity index 92% rename from designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManeger.java rename to designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManager.java index b1da3d72b..1754b1284 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManeger.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManager.java @@ -17,16 +17,16 @@ import com.fr.third.org.apache.commons.codec.digest.DigestUtils; /** * Created by alex.sung on 2018/8/3. */ -public class SimilarSearchManeger implements AlphaFineSearchProvider { - private static volatile SimilarSearchManeger instance; +public class SimilarSearchManager implements AlphaFineSearchProvider { + private static volatile SimilarSearchManager instance; private SearchResult lessModelList; private SearchResult moreModelList = new SearchResult(); - public static SimilarSearchManeger getInstance() { + public static SimilarSearchManager getInstance() { if (instance == null) { - synchronized (SimilarSearchManeger.class) { + synchronized (SimilarSearchManager.class) { if (instance == null) { - instance = new SimilarSearchManeger(); + instance = new SimilarSearchManager(); } } } diff --git a/designer-realize/src/test/java/com.fr/design/mainframe/alphafine/search/manager/impl/SearchManegerTest.java b/designer-realize/src/test/java/com.fr/design/mainframe/alphafine/search/manager/impl/SearchManegerTest.java index e09be0cfb..1b6236f98 100644 --- a/designer-realize/src/test/java/com.fr/design/mainframe/alphafine/search/manager/impl/SearchManegerTest.java +++ b/designer-realize/src/test/java/com.fr/design/mainframe/alphafine/search/manager/impl/SearchManegerTest.java @@ -9,7 +9,7 @@ import org.junit.Before; import org.junit.Test; public class SearchManegerTest { - SimilarSearchManeger similarSearchManeger; + SimilarSearchManager similarSearchManager; ComplementAdviceManager complementAdviceManager; DocumentSearchManager documentSearchManager; PluginSearchManager pluginSearchManager; @@ -23,7 +23,7 @@ public class SearchManegerTest { public void setUp() { recentSearchManager = RecentSearchManager.getInstance(); recommendSearchManager = RecommendSearchManager.getInstance(); - similarSearchManeger = SimilarSearchManeger.getInstance(); + similarSearchManager = SimilarSearchManager.getInstance(); complementAdviceManager = ComplementAdviceManager.getInstance(); documentSearchManager = DocumentSearchManager.getInstance(); pluginSearchManager = PluginSearchManager.getInstance(); @@ -43,7 +43,7 @@ public class SearchManegerTest { lessModelList = recentSearchManager.getLessSearchResult(new String[]{"数据集"}); Assert.assertNotNull(lessModelList); - lessModelList = similarSearchManeger.getLessSearchResult(new String[]{"数据集"}); + lessModelList = similarSearchManager.getLessSearchResult(new String[]{"数据集"}); Assert.assertEquals(lessModelList.get(1).getType(), CellType.ROBOT); lessModelList = complementAdviceManager.getAllSearchResult(new String[]{"数据集"}); @@ -51,7 +51,7 @@ public class SearchManegerTest { //返回MoreSearchResult SearchResult moreModelList; - moreModelList = similarSearchManeger.getMoreSearchResult("数据集"); + moreModelList = similarSearchManager.getMoreSearchResult("数据集"); Assert.assertNotNull(moreModelList); moreModelList = recommendSearchManager.getMoreSearchResult("数据集"); @@ -60,7 +60,7 @@ public class SearchManegerTest { @Test public void getModelFromCloudTest() { - Assert.assertNotNull(SimilarSearchManeger.getModelFromCloud(new JSONObject())); + Assert.assertNotNull(SimilarSearchManager.getModelFromCloud(new JSONObject())); Assert.assertNotNull(DocumentSearchManager.getModelFromCloud(new JSONObject())); Assert.assertNotNull(PluginSearchManager.getModelFromCloud(new JSONObject())); } From 45bfd042154f2cbae33462a18a7ff61cd52febf1 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Mon, 22 Oct 2018 16:49:31 +0800 Subject: [PATCH 18/35] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20findbug?= =?UTF-8?q?s=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../onlineupdate/domain/UpdateConstants.java | 16 +++++---- .../ui/dialog/RestoreResultDialog.java | 5 +-- .../ui/dialog/UpdateMainDialog.java | 36 +++++++++---------- 3 files changed, 30 insertions(+), 27 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/onlineupdate/domain/UpdateConstants.java b/designer-base/src/main/java/com/fr/design/onlineupdate/domain/UpdateConstants.java index c132dcc03..853b8576e 100644 --- a/designer-base/src/main/java/com/fr/design/onlineupdate/domain/UpdateConstants.java +++ b/designer-base/src/main/java/com/fr/design/onlineupdate/domain/UpdateConstants.java @@ -4,7 +4,11 @@ package com.fr.design.onlineupdate.domain; * Created by XINZAI on 2018/8/21. */ +import com.fr.third.org.apache.commons.collections4.collection.UnmodifiableCollection; +import com.fr.third.org.apache.commons.collections4.list.UnmodifiableList; + import java.awt.Color; +import java.util.Arrays; /** * 更新升级的常量 @@ -28,7 +32,7 @@ public interface UpdateConstants { int BYTE = 153600; - String[] JARS_FOR_SERVER_X = new String[]{ + UnmodifiableList JARS_FOR_SERVER_X = new UnmodifiableList(Arrays.asList(new String[]{ "fine-activator-10.0.jar", "fine-core-10.0.jar", "fine-report-engine-10.0.jar", @@ -41,16 +45,16 @@ public interface UpdateConstants { "fine-datasource-10.0.jar", "fine-third-10.0.jar", "fine-accumulator-10.0.jar" - }; + })); - String[] JARS_FOR_DESIGNER_X = new String[]{ + UnmodifiableList JARS_FOR_DESIGNER_X = new UnmodifiableList(Arrays.asList(new String[]{ "fine-report-designer-10.0.jar", "aspectjrt.jar" - }; + })); - String[] LOG_TYPE = new String[]{ + UnmodifiableList LOG_TYPE = new UnmodifiableList(Arrays.asList(new String[]{ "REPORT", "MOBILE", "CHART", "PFC", "BI" - }; + })); } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/RestoreResultDialog.java b/designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/RestoreResultDialog.java index 787a88ea8..680d3190d 100644 --- a/designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/RestoreResultDialog.java +++ b/designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/RestoreResultDialog.java @@ -27,6 +27,7 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; /** @@ -161,7 +162,7 @@ public class RestoreResultDialog extends JDialog { } private void putJarBackupFilesToInstallLib(String installHome, Map map, java.util.List list) { - String[] files = UpdateConstants.JARS_FOR_DESIGNER_X; + List files = UpdateConstants.JARS_FOR_DESIGNER_X; String backupDir = UpdateConstants.DESIGNER_BACKUP_DIR; for (String file : files) { map.put(StableUtils.pathJoin(installHome, backupDir, jarRestoreDir, file), @@ -171,7 +172,7 @@ public class RestoreResultDialog extends JDialog { } private void putJarBackupFilesToInstallEnv(String installHome, Map map, java.util.List list) { - String[] files = UpdateConstants.JARS_FOR_SERVER_X; + List files = UpdateConstants.JARS_FOR_SERVER_X; String backupDir = UpdateConstants.DESIGNER_BACKUP_DIR; for (String file : files) { map.put(StableUtils.pathJoin(installHome, backupDir, jarRestoreDir, file), diff --git a/designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/UpdateMainDialog.java b/designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/UpdateMainDialog.java index 3f99543a3..e4f44086a 100644 --- a/designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/UpdateMainDialog.java +++ b/designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/UpdateMainDialog.java @@ -58,12 +58,7 @@ import java.awt.Dimension; import java.awt.Frame; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; +import java.io.*; import java.text.ParsePosition; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -443,8 +438,8 @@ public class UpdateMainDialog extends UIDialog { return; } if (cacheFile.exists()) { - FileReader reader = new FileReader(cacheFile); - BufferedReader br = new BufferedReader(reader); + InputStreamReader streamReader = new InputStreamReader(new FileInputStream(cacheFile), "UTF-8"); + BufferedReader br = new BufferedReader(streamReader); String readStr, updateTimeStr; while ((readStr = br.readLine()) != null) { @@ -466,7 +461,7 @@ public class UpdateMainDialog extends UIDialog { } } br.close(); - reader.close(); + streamReader.close(); } } @@ -490,8 +485,8 @@ public class UpdateMainDialog extends UIDialog { if (endTime.equals(lastUpdateCacheTime) || jsonArray.length() == 0 || ComparatorUtils.compare(endTime, lastUpdateCacheTime) <= 0) { return; } - FileWriter fileWriter = new FileWriter(cacheFile, true); - BufferedWriter bufferWriter = new BufferedWriter(fileWriter); + OutputStreamWriter writerStream = new OutputStreamWriter(new FileOutputStream(cacheFile), "UTF-8"); + BufferedWriter bufferWriter = new BufferedWriter(writerStream); for (int i = 0; i < jsonArray.length(); i++) { JSONObject jo = (JSONObject) jsonArray.get(i); bufferWriter.write((String) jo.get("update") + '\t' + jo.get("title")); @@ -499,7 +494,7 @@ public class UpdateMainDialog extends UIDialog { bufferWriter.flush(); } bufferWriter.close(); - fileWriter.close(); + writerStream.close(); lastUpdateCacheState = UPDATE_CACHE_STATE_SUCCESS; lastUpdateCacheTime = endTime; cacheProperty.updateProperty("updateTime", lastUpdateCacheTime); @@ -678,7 +673,7 @@ public class UpdateMainDialog extends UIDialog { jarCurrentLabel.setText(downloadFileConfig.optString("buildNO")); } - private void backupFilesFromInstallEnv(String installHome, String todayBackupDir, String[] files) { + private void backupFilesFromInstallEnv(String installHome, String todayBackupDir, List files) { for (String file : files) { try { IOUtils.copy( @@ -690,7 +685,7 @@ public class UpdateMainDialog extends UIDialog { } } - private void backupFilesFromInstallLib(String installHome, String todayBackupDir, String[] files) { + private void backupFilesFromInstallLib(String installHome, String todayBackupDir, List files) { for (String file : files) { try { IOUtils.copy( @@ -734,21 +729,22 @@ public class UpdateMainDialog extends UIDialog { } //获取服务器jar包列表 - private String[] getJARList4Server() { + private List getJARList4Server() { return UpdateConstants.JARS_FOR_SERVER_X; } //获取设计器jar包列表 - private String[] getJARList4Designer() { + private List getJARList4Designer() { return UpdateConstants.JARS_FOR_DESIGNER_X; } //获取服务器jar包下载列表 private String[] getDownLoadJAR4Server() { ArrayList jarList = new ArrayList(); + List serverItems = getJARList4Server(); for (DownloadItem downloadItem : downloadItems) { String downloadItemName = downloadItem.getName(); - if (ArrayUtils.contains(getJARList4Server(), downloadItemName)) { + if (serverItems.contains(downloadItemName)) { jarList.add(downloadItemName); } } @@ -758,9 +754,10 @@ public class UpdateMainDialog extends UIDialog { //获取设计器jar包下载列表 private String[] getDownLoadJAR4Designer() { ArrayList jarList = new ArrayList(); + List designerJarItems = getJARList4Designer(); for (DownloadItem downloadItem : downloadItems) { String downloadItemName = downloadItem.getName(); - if (ArrayUtils.contains(getJARList4Designer(), downloadItemName)) { + if (designerJarItems.contains(downloadItemName)) { jarList.add(downloadItemName); } } @@ -791,7 +788,8 @@ public class UpdateMainDialog extends UIDialog { //判断是否是有效的日志内容 private boolean isValidLogInfo(String logContent) { String log = logContent.toUpperCase(); - for (String s : UpdateConstants.LOG_TYPE) { + List logType = UpdateConstants.LOG_TYPE; + for (String s : logType) { if (log.startsWith(s)) { return true; } From a2523a0af25598135a3e7b616c58c89e69a50fe6 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Mon, 22 Oct 2018 17:10:27 +0800 Subject: [PATCH 19/35] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20findbug?= =?UTF-8?q?s=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/onlineupdate/domain/UpdateConstants.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/onlineupdate/domain/UpdateConstants.java b/designer-base/src/main/java/com/fr/design/onlineupdate/domain/UpdateConstants.java index 853b8576e..293c5d1f0 100644 --- a/designer-base/src/main/java/com/fr/design/onlineupdate/domain/UpdateConstants.java +++ b/designer-base/src/main/java/com/fr/design/onlineupdate/domain/UpdateConstants.java @@ -4,11 +4,11 @@ package com.fr.design.onlineupdate.domain; * Created by XINZAI on 2018/8/21. */ -import com.fr.third.org.apache.commons.collections4.collection.UnmodifiableCollection; -import com.fr.third.org.apache.commons.collections4.list.UnmodifiableList; import java.awt.Color; import java.util.Arrays; +import java.util.Collections; +import java.util.List; /** * 更新升级的常量 @@ -32,7 +32,7 @@ public interface UpdateConstants { int BYTE = 153600; - UnmodifiableList JARS_FOR_SERVER_X = new UnmodifiableList(Arrays.asList(new String[]{ + List JARS_FOR_SERVER_X = Collections.unmodifiableList(Arrays.asList(new String[]{ "fine-activator-10.0.jar", "fine-core-10.0.jar", "fine-report-engine-10.0.jar", @@ -47,13 +47,13 @@ public interface UpdateConstants { "fine-accumulator-10.0.jar" })); - UnmodifiableList JARS_FOR_DESIGNER_X = new UnmodifiableList(Arrays.asList(new String[]{ + List JARS_FOR_DESIGNER_X = Collections.unmodifiableList(Arrays.asList(new String[]{ "fine-report-designer-10.0.jar", "aspectjrt.jar" })); - UnmodifiableList LOG_TYPE = new UnmodifiableList(Arrays.asList(new String[]{ + List LOG_TYPE = Collections.unmodifiableList(Arrays.asList(new String[]{ "REPORT", "MOBILE", "CHART", "PFC", "BI" })); From 268f71145e869d85075efff5d639e3125e6bb6bc Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Tue, 23 Oct 2018 15:42:40 +0800 Subject: [PATCH 20/35] =?UTF-8?q?REPORT-11993=20=E6=99=AE=E9=80=9A?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E8=BF=9C=E7=A8=8B=E8=AE=BE=E8=AE=A1=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=BF=9E=E6=8E=A5=E6=9D=83=E9=99=90=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E6=97=A0=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/datapane/connect/ConnectionComboBoxPanel.java | 10 ++++++++++ designer-base/src/main/java/com/fr/design/mingche.java | 6 ------ 2 files changed, 10 insertions(+), 6 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/design/mingche.java diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java index 68db344fb..f4a7910b1 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java @@ -15,11 +15,13 @@ import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.Configurations; import com.fr.transaction.WorkerFacade; import com.fr.workspace.WorkContext; +import com.fr.workspace.server.connection.DBConnectAuth; import javax.swing.SwingUtilities; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.util.ArrayList; +import java.util.Collection; import java.util.Iterator; import java.util.List; @@ -62,8 +64,16 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel { ConnectionConfig mgr = ConnectionConfig.getInstance(); Iterator nameIt = mgr.getConnections().keySet().iterator(); + + Collection noAuthConnections = WorkContext.getCurrent().get(DBConnectAuth.class).getNoAuthConnections(); + if (noAuthConnections == null) { + return nameList.iterator(); + } while (nameIt.hasNext()) { String conName = nameIt.next(); + if (noAuthConnections.contains(conName)) { + continue; + } Connection connection = mgr.getConnection(conName); filterConnection(connection, conName, nameList); } diff --git a/designer-base/src/main/java/com/fr/design/mingche.java b/designer-base/src/main/java/com/fr/design/mingche.java deleted file mode 100644 index da6ffa948..000000000 --- a/designer-base/src/main/java/com/fr/design/mingche.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.fr.design; - -public class mingche -{ - -} From 0a81bbe1dbccb3d5dfb03a0162243122a86cb711 Mon Sep 17 00:00:00 2001 From: vito Date: Wed, 24 Oct 2018 17:48:21 +0800 Subject: [PATCH 21/35] =?UTF-8?q?REPORT-11016=2010.0=E7=89=88=E6=9C=ACmac?= =?UTF-8?q?=E4=B8=8A=E7=82=B9=E5=87=BB=E6=9C=80=E5=A4=A7=E5=8C=96=E4=BC=9A?= =?UTF-8?q?=E5=8D=A1=E6=AD=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/com/fr/start/jni/splash.dylib | Bin 32320 -> 41248 bytes 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 designer-realize/src/main/resources/com/fr/start/jni/splash.dylib diff --git a/designer-realize/src/main/resources/com/fr/start/jni/splash.dylib b/designer-realize/src/main/resources/com/fr/start/jni/splash.dylib old mode 100644 new mode 100755 index 3e19cd20e55488220c6ea4559390f4cc112921b9..5d096b2b37d34197e377f7b1ed115c3768bd0d08 GIT binary patch literal 41248 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 aE&{m-{+W!Kk_o_(% From eb1ebc95c833bb8aa30ccee02582a22f4ab62365 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Thu, 25 Oct 2018 10:27:05 +0800 Subject: [PATCH 22/35] =?UTF-8?q?REPORT-11886=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E7=9B=AE=E5=BD=95=E6=A0=91=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E5=8D=A1=E9=A1=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/itree/filetree/EnvFileTree.java | 14 +- .../itree/filetree/FileNodeComparator.java | 109 ++++++---- .../design/gui/itree/filetree/JFileTree.java | 201 +++++++++--------- .../gui/itree/filetree/TemplateFileTree.java | 2 +- .../main/java/com/fr/file/FileNodeFILE.java | 8 +- 5 files changed, 177 insertions(+), 157 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java index 0c894ff92..550ba715e 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java @@ -146,14 +146,14 @@ public class EnvFileTree extends RefreshableJTree { * * 返回currentTreeNode下是否找到了filePath */ - private boolean selectFilePath(ExpandMutableTreeNode currentTreeNode, String prefix, String filePath, DefaultTreeModel m_model) { + private boolean selectFilePath(ExpandMutableTreeNode currentTreeNode, String prefix, String filePath, DefaultTreeModel model) { FileNode fileNode = (FileNode) currentTreeNode.getUserObject(); String nodePath = fileNode.getName(); String currentTreePath = prefix + nodePath; // 如果equals,说明找到了,不必再找下去了 if (ComparatorUtils.equals(new File(currentTreePath), new File(filePath))) { - this.setSelectionPath(new TreePath(m_model.getPathToRoot(currentTreeNode))); + this.setSelectionPath(new TreePath(model.getPathToRoot(currentTreeNode))); return true; } // 如果当前路径是currentFilePath的ParentFile,则expandTreeNode,并继续往下找 @@ -164,7 +164,7 @@ public class EnvFileTree extends RefreshableJTree { for (int i = 0, len = currentTreeNode.getChildCount(); i < len; i++) { ExpandMutableTreeNode childTreeNode = (ExpandMutableTreeNode) currentTreeNode.getChildAt(i); - if (selectFilePath(childTreeNode, prefix, filePath, m_model)) { + if (selectFilePath(childTreeNode, prefix, filePath, model)) { return true; } } @@ -219,7 +219,7 @@ public class EnvFileTree extends RefreshableJTree { resFns = tList.toArray(new FileNode[tList.size()]); } - Arrays.sort(resFns, new FileNodeComparator()); + Arrays.sort(resFns, new FileNodeComparator(FRContext.getFileNodes().getSupportedTypes())); return resFns; } @@ -248,8 +248,8 @@ public class EnvFileTree extends RefreshableJTree { */ public void refreshEnv() { - DefaultTreeModel m_model = (DefaultTreeModel) this.getModel(); - ExpandMutableTreeNode rootTreeNode = (ExpandMutableTreeNode) m_model.getRoot(); + DefaultTreeModel model = (DefaultTreeModel) this.getModel(); + ExpandMutableTreeNode rootTreeNode = (ExpandMutableTreeNode) model.getRoot(); rootTreeNode.removeAllChildren(); FileNode[] fns; @@ -273,7 +273,7 @@ public class EnvFileTree extends RefreshableJTree { rootTreeNode.add(node); } - m_model.reload(rootTreeNode); + model.reload(rootTreeNode); } /* diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeComparator.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeComparator.java index bf4a5155c..f963d80d1 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeComparator.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeComparator.java @@ -10,17 +10,45 @@ import java.util.Comparator; * Directory is in the first. and normal file the in the last. */ public class FileNodeComparator implements Comparator { - // 正序还是倒序 - private boolean isReverse = false; - - public FileNodeComparator() { - this(false); - } - - public FileNodeComparator(boolean reverse) { - this.isReverse = reverse; - } - + /** + * 正序还是倒序 + */ + private boolean isReverse; + + /** + * 文件扩展名类型 + */ + private String[] supportTypes; + + /** + * @see FileNodeComparator#FileNodeComparator(boolean, String[]) + * @deprecated + */ + @Deprecated + public FileNodeComparator() { + this(false); + } + + public FileNodeComparator(String[] types) { + this(false, types); + } + + /** + * @param reverse 是否是倒序,{@code true} 倒序,{@code false} 正序 + * @see FileNodeComparator#FileNodeComparator(boolean, String[]) + * @deprecated + */ + @Deprecated + public FileNodeComparator(boolean reverse) { + this.isReverse = reverse; + this.supportTypes = FRContext.getFileNodes().getSupportedTypes(); + } + + public FileNodeComparator(boolean reverse, String[] types) { + this.isReverse = reverse; + this.supportTypes = types; + } + /** * This method should return > 0 if v1 is greater than v2, 0 if * v1 is equal to v2, or < 0 if v1 is less than v2. @@ -29,49 +57,48 @@ public class FileNodeComparator implements Comparator { * @return < 0, 0, or > 0 for v1v2. */ public int compare(FileNode nameNode1, FileNode nameNode2) { - int returnVal; + int returnVal; if (nameNode1.isDirectory()) { if (nameNode2.isDirectory()) { - returnVal = nameNode1.getName().toLowerCase().compareTo(nameNode2.getName().toLowerCase()); + returnVal = nameNode1.getName().toLowerCase().compareTo(nameNode2.getName().toLowerCase()); } else { - returnVal = -1; + returnVal = -1; } } else { if (nameNode2.isDirectory()) { - returnVal = 1; + returnVal = 1; } else { - returnVal=groupByFileType(nameNode1, nameNode2, 0); + returnVal = groupByFileType(nameNode1, nameNode2, 0); } } if (isReverse) { - returnVal = 0 - returnVal; + returnVal = 0 - returnVal; } return returnVal; } /** - * 一个简单的递归判断算法 - * @param nameNode1 - * @param nameNode2 - * @param i - * @return + * 一个简单的递归判断算法,依据文件类型排序 + * + * @param nameNode1 节点1 + * @param nameNode2 节点2 + * @param i i + * @return value */ - private int groupByFileType(FileNode nameNode1, FileNode nameNode2, - int i) { - - String[] supportTypes = FRContext.getFileNodes().getSupportedTypes(); - if (i < supportTypes.length) { - if (nameNode1.isFileType(supportTypes[i])) - if (nameNode2.isFileType(supportTypes[i])) - return nameNode1.getName().toLowerCase().compareTo(nameNode2.getName().toLowerCase()); - else - return-1; - else if (nameNode2.isFileType(supportTypes[i])) - return 1; - else{ - return groupByFileType(nameNode1, nameNode2, i+1); - } - }else - return -1; - } - } \ No newline at end of file + private int groupByFileType(FileNode nameNode1, FileNode nameNode2, + int i) { + if (i < supportTypes.length) { + if (nameNode1.isFileType(supportTypes[i])) + if (nameNode2.isFileType(supportTypes[i])) + return nameNode1.getName().toLowerCase().compareTo(nameNode2.getName().toLowerCase()); + else + return -1; + else if (nameNode2.isFileType(supportTypes[i])) + return 1; + else { + return groupByFileType(nameNode1, nameNode2, i + 1); + } + } else + return -1; + } +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/JFileTree.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/JFileTree.java index 1ade707d4..a1a1567c5 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/JFileTree.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/JFileTree.java @@ -1,5 +1,18 @@ package com.fr.design.gui.itree.filetree; +import com.fr.base.BaseUtils; +import com.fr.design.i18n.Toolkit; +import com.fr.general.ComparatorUtils; +import com.fr.stable.ArrayUtils; +import com.fr.stable.project.ProjectConstants; + +import javax.swing.Icon; +import javax.swing.JTree; +import javax.swing.filechooser.FileSystemView; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeCellRenderer; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreePath; import java.awt.Color; import java.awt.Component; import java.awt.Font; @@ -11,26 +24,12 @@ import java.util.Comparator; import java.util.List; import java.util.Stack; -import javax.swing.Icon; -import javax.swing.JTree; -import javax.swing.filechooser.FileSystemView; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.DefaultTreeCellRenderer; -import javax.swing.tree.DefaultTreeModel; -import javax.swing.tree.TreePath; - -import com.fr.base.BaseUtils; -import com.fr.general.ComparatorUtils; - -import com.fr.stable.ArrayUtils; -import com.fr.stable.project.ProjectConstants; - /** * File Tree. */ public class JFileTree extends AbstractFileTree { - protected FileFilter fileFilter ; + protected FileFilter fileFilter; public JFileTree() { this(null); @@ -43,9 +42,9 @@ public class JFileTree extends AbstractFileTree { private void init(FileFilter filter) { this.fileFilter = filter; - DefaultTreeModel m_model = new DefaultTreeModel(new DefaultMutableTreeNode(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_My_Computer"))); + DefaultTreeModel m_model = new DefaultTreeModel(new DefaultMutableTreeNode(Toolkit.i18nText("Fine-Design_Basic_My_Computer"))); this.setModel(m_model); - + this.putClientProperty("JTree.lineStyle", "Angled"); this.addTreeExpansionListener(this); @@ -57,7 +56,7 @@ public class JFileTree extends AbstractFileTree { } public void setRootFile(File rootFile) { - setRootFiles(new File[] { rootFile }); + setRootFiles(new File[]{rootFile}); } public void setRootFiles(File[] rootFiles) { @@ -65,8 +64,8 @@ public class JFileTree extends AbstractFileTree { return; } - DefaultTreeModel m_model = (DefaultTreeModel) this.getModel(); - DefaultMutableTreeNode rootTreeNode = (DefaultMutableTreeNode) m_model.getRoot(); + DefaultTreeModel defaultTreeModel = (DefaultTreeModel) this.getModel(); + DefaultMutableTreeNode rootTreeNode = (DefaultMutableTreeNode) defaultTreeModel.getRoot(); rootTreeNode.removeAllChildren(); for (int k = 0; k < rootFiles.length; k++) { @@ -78,7 +77,7 @@ public class JFileTree extends AbstractFileTree { } } // richer:不是LocalEnv根本就不会运行到这儿 - m_model.reload(rootTreeNode); + defaultTreeModel.reload(rootTreeNode); if (rootFiles.length == 1) { File expandFile = rootFiles[0]; @@ -96,22 +95,19 @@ public class JFileTree extends AbstractFileTree { public File getSelectedFile() { TreePath selectedTreePath = this.getSelectionPath(); - if(selectedTreePath == null) { + if (selectedTreePath == null) { return null; } DefaultMutableTreeNode currentTreeNode = this.getMutableTreeNode(selectedTreePath); - StringBuffer fBuf = new StringBuffer(); - while (true) { - // 如果已经到了根节点,直接退出. - if (currentTreeNode == null) { - break; - } + StringBuilder fBuf = new StringBuilder(); + while (currentTreeNode != null) { + // 如果已经到了根节点,直接退出. Object object = currentTreeNode.getUserObject(); if (object instanceof RootFile) { - // 当前文件. - RootFile rootFileNode = (RootFile) object; + // 当前文件. + RootFile rootFileNode = (RootFile) object; return new File(rootFileNode.getFile() + fBuf.toString()); } @@ -128,6 +124,7 @@ public class JFileTree extends AbstractFileTree { /** * 通过文件夹寻找展开路径 + * * @param currentFile 当前文件 */ public void selectFile(File currentFile) { @@ -181,26 +178,25 @@ public class JFileTree extends AbstractFileTree { /** * 列出当前所有的File + * * @param currentTreeNode 当前文件节点 * @return 当前节点下的所有File */ + @Override public FileDirectoryNode[] listFileNodes(DefaultMutableTreeNode currentTreeNode) { - StringBuffer fBuf = new StringBuffer(); - while (true) { - // 如果已经到了根节点,直接退出. - if (currentTreeNode == null) { - break; - } + StringBuilder fBuf = new StringBuilder(); + while (currentTreeNode != null) { + // 如果已经到了根节点,直接退出. Object object = currentTreeNode.getUserObject(); if (object instanceof RootFile) { - RootFile rootFileNode = (RootFile) object; + RootFile rootFileNode = (RootFile) object; // 当前文件. (rootFileNode + fBuf.toString = Path  local地址) File currentFile = new File(rootFileNode.getFile() + fBuf.toString()); // 列出当前文件的所有子文件,要判断下是否是系统保护的文件 能否打开. 打不开的话显示为null File[] files = currentFile.listFiles(); // 如果文件列表为null 或者为File[0] = []返回null - if (files == null ) { - return new FileDirectoryNode[0]; + if (files == null) { + return new FileDirectoryNode[0]; } List fileNodeList = new ArrayList(); for (int k = 0; k < files.length; k++) { @@ -211,8 +207,8 @@ public class JFileTree extends AbstractFileTree { } // 过滤只显示文件夹 并进行 名字简化 if (fileFilter.accept(tmpFile)) { - // newNode 传递 isDirectory属性 并且只显示文件夹名字 - FileDirectoryNode newNode = FileDirectoryNode.createFileDirectoryNode(tmpFile); + // newNode 传递 isDirectory属性 并且只显示文件夹名字 + FileDirectoryNode newNode = FileDirectoryNode.createFileDirectoryNode(tmpFile); fileNodeList.add(newNode); } } @@ -220,78 +216,77 @@ public class JFileTree extends AbstractFileTree { FileDirectoryNode[] fileNodes = new FileDirectoryNode[fileNodeList.size()]; fileNodeList.toArray(fileNodes); // 对文件夹进行排序 - Arrays.sort(fileNodes, new FileNodeComparator()); + Arrays.sort(fileNodes, new FileDirectoryNodeComparator()); return fileNodes; } // 名字进行逐层反序的回加. 例: Doload ==> C:\java\Doload ,返回到文件夹的path,因为有可能是String. 所以加上instanceof if (object instanceof FileDirectoryNode) { - FileDirectoryNode nameNode = (FileDirectoryNode)object; - fBuf.insert(0, nameNode.getName()); - fBuf.insert(0, "/"); + FileDirectoryNode nameNode = (FileDirectoryNode) object; + fBuf.insert(0, nameNode.getName()); + fBuf.insert(0, "/"); } // 逐层返回 currentTreeNode = (DefaultMutableTreeNode) currentTreeNode.getParent(); } return new FileDirectoryNode[0]; } - + /** - * cellRenderer: tree中显示文件的类型图标 + * cellRenderer: tree中显示文件的类型图标 */ - private DefaultTreeCellRenderer fileTreeCellRenderer = new DefaultTreeCellRenderer() { - - public Component getTreeCellRendererComponent(JTree tree, Object value, - boolean selected, boolean expanded, boolean leaf, int row, - boolean hasFocus) { - super.getTreeCellRendererComponent(tree, value, selected, expanded, - leaf, row, hasFocus); - - DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) value; - StringBuffer fBuf = new StringBuffer(); - while(true) { - if (treeNode == null) { - break; - } - Object userObj = treeNode.getUserObject(); - if (userObj instanceof RootFile) { - RootFile rootFileNode = (RootFile) userObj; - // 当前文件的全部路径. (rootFileNode + fBuf.toString = Path  local地址) - File currentFile = new File(rootFileNode.getFile() + fBuf.toString()); - FileSystemView view = FileSystemView.getFileSystemView(); - // File的全部路径. - // 得到本地tree图标 - Icon tmpIcon = view.getSystemIcon(currentFile); + private DefaultTreeCellRenderer fileTreeCellRenderer = new DefaultTreeCellRenderer() { + + @Override + public Component getTreeCellRendererComponent(JTree tree, Object value, + boolean selected, boolean expanded, boolean leaf, int row, + boolean hasFocus) { + super.getTreeCellRendererComponent(tree, value, selected, expanded, + leaf, row, hasFocus); + + DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) value; + StringBuilder fBuf = new StringBuilder(); + while (treeNode != null) { + Object userObj = treeNode.getUserObject(); + if (userObj instanceof RootFile) { + RootFile rootFileNode = (RootFile) userObj; + // 当前文件的全部路径. (rootFileNode + fBuf.toString = Path  local地址) + File currentFile = new File(rootFileNode.getFile() + fBuf.toString()); + FileSystemView view = FileSystemView.getFileSystemView(); + // File的全部路径. + // 得到本地tree图标 + Icon tmpIcon = view.getSystemIcon(currentFile); if (currentFile.isDirectory() && fBuf.length() > 0) { - tmpIcon=BaseUtils.readIcon("/com/fr/design/images/gui/folder.png"); + tmpIcon = BaseUtils.readIcon("/com/fr/design/images/gui/folder.png"); } this.setIcon(tmpIcon); - this.setName(null); - Font oldFont = this.getFont(); - if(ComparatorUtils.equals(currentFile.getName(), ProjectConstants.WEBINF_NAME)){ - this.setForeground(Color.blue); - this.setFont(new Font(oldFont.getName(),1,oldFont.getSize())); - }else{ - this.setFont(new Font(oldFont.getName(),0,oldFont.getSize())); - } - } - // 名字进行逐层反序的回加. 例: Doload ==> C:\java\Doload - if (userObj instanceof FileDirectoryNode ) { - FileDirectoryNode nameNode = (FileDirectoryNode)userObj; - fBuf.insert(0, nameNode.getName()); - fBuf.insert(0, "/"); - } - // 逐层往上 倒退返回 - treeNode = (DefaultMutableTreeNode) treeNode.getParent(); - } - return this; - } - }; - + this.setName(null); + Font oldFont = this.getFont(); + if (ComparatorUtils.equals(currentFile.getName(), ProjectConstants.WEBINF_NAME)) { + this.setForeground(Color.blue); + this.setFont(new Font(oldFont.getName(), Font.BOLD, oldFont.getSize())); + } else { + this.setFont(new Font(oldFont.getName(), Font.PLAIN, oldFont.getSize())); + } + } + // 名字进行逐层反序的回加. 例: Doload ==> C:\java\Doload + if (userObj instanceof FileDirectoryNode) { + FileDirectoryNode nameNode = (FileDirectoryNode) userObj; + fBuf.insert(0, nameNode.getName()); + fBuf.insert(0, "/"); + } + // 逐层往上 倒退返回 + treeNode = (DefaultMutableTreeNode) treeNode.getParent(); + } + return this; + } + }; + /** - * 对文件夹进行排序 先文件夹 然后各种类型文件 + * 对文件夹进行排序 先文件夹 然后各种类型文件 + * * @author kunsnat */ - public class FileNodeComparator implements Comparator { + public class FileDirectoryNodeComparator implements Comparator { /** * This method should return > 0 if v1 is greater than v2, 0 if * v1 is equal to v2, or < 0 if v1 is less than v2. @@ -302,21 +297,19 @@ public class JFileTree extends AbstractFileTree { * @param v2 comparison value.值2 * @return < 0, 0, or > 0 for v1v2 .值1大于值2返回大于0,相等返回0,小于和大于相反 */ - public int compare(Object v1, Object v2) { - FileDirectoryNode nameNode1 = (FileDirectoryNode) v1; - FileDirectoryNode nameNode2 = (FileDirectoryNode) v2; - - if (nameNode1.isDirectory()) { - if (nameNode2.isDirectory()) { - return nameNode1.getName().toLowerCase().compareTo(nameNode2.getName().toLowerCase()); + @Override + public int compare(FileDirectoryNode v1, FileDirectoryNode v2) { + if (v1.isDirectory()) { + if (v2.isDirectory()) { + return v1.getName().toLowerCase().compareTo(v2.getName().toLowerCase()); } else { return -1; } } else { - if (nameNode2.isDirectory()) { + if (v2.isDirectory()) { return 1; } else { - return nameNode1.getName().toLowerCase().compareTo(nameNode2.getName().toLowerCase()); + return v1.getName().toLowerCase().compareTo(v2.getName().toLowerCase()); } } } diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java index 0a13dd1bd..f9b18b7f8 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java @@ -217,7 +217,7 @@ public class TemplateFileTree extends EnvFileTree { fileNodes = list.toArray(new FileNode[list.size()]); } - Arrays.sort(fileNodes, new FileNodeComparator()); + Arrays.sort(fileNodes, new FileNodeComparator(FRContext.getFileNodes().getSupportedTypes())); return fileNodes; } diff --git a/designer-base/src/main/java/com/fr/file/FileNodeFILE.java b/designer-base/src/main/java/com/fr/file/FileNodeFILE.java index 84724df35..207c51d24 100644 --- a/designer-base/src/main/java/com/fr/file/FileNodeFILE.java +++ b/designer-base/src/main/java/com/fr/file/FileNodeFILE.java @@ -211,7 +211,7 @@ public class FileNodeFILE implements FILE { try { FileNode[] nodeArray; nodeArray = listFile(node.getEnvPath()); - Arrays.sort(nodeArray, new FileNodeComparator()); + Arrays.sort(nodeArray, new FileNodeComparator(FRContext.getFileNodes().getSupportedTypes())); return fileNodeArray2FILEArray(nodeArray, envPath); } catch (Exception e) { @@ -240,7 +240,7 @@ public class FileNodeFILE implements FILE { return FRContext.getFileNodes().list(rootFilePath); } } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } return new FileNode[0]; } @@ -280,7 +280,7 @@ public class FileNodeFILE implements FILE { try { return FRContext.getCommonOperator().fileLocked(node.getEnvPath()); } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); return false; } } @@ -304,7 +304,7 @@ public class FileNodeFILE implements FILE { try { return WorkContext.getWorkResource().exist(node.getEnvPath()); } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); return false; } } From db2334e1965acb05a8e5641d14fef5406fb02e24 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Thu, 25 Oct 2018 10:29:01 +0800 Subject: [PATCH 23/35] =?UTF-8?q?=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/gui/itree/filetree/JFileTree.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/JFileTree.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/JFileTree.java index a1a1567c5..69875a97f 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/JFileTree.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/JFileTree.java @@ -42,8 +42,8 @@ public class JFileTree extends AbstractFileTree { private void init(FileFilter filter) { this.fileFilter = filter; - DefaultTreeModel m_model = new DefaultTreeModel(new DefaultMutableTreeNode(Toolkit.i18nText("Fine-Design_Basic_My_Computer"))); - this.setModel(m_model); + DefaultTreeModel treeModel = new DefaultTreeModel(new DefaultMutableTreeNode(Toolkit.i18nText("Fine-Design_Basic_My_Computer"))); + this.setModel(treeModel); this.putClientProperty("JTree.lineStyle", "Angled"); From c27ba8498f985d63c1cf43d001b90b105d076360 Mon Sep 17 00:00:00 2001 From: qinghuiliu Date: Sun, 28 Oct 2018 19:36:27 +0800 Subject: [PATCH 24/35] =?UTF-8?q?CHART-2665=20&=20CHART-2886=20=E5=A0=86?= =?UTF-8?q?=E7=A7=AF=E5=92=8C=E5=9D=90=E6=A0=87=E8=BD=B4update=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E4=B8=80=E4=B8=AA=E6=96=B0=E5=88=9B=E5=BB=BA=E7=9A=84?= =?UTF-8?q?conditionattr=20CHART-1882=E7=9B=B4=E6=8E=A5=E6=94=B9=E6=8A=A5?= =?UTF-8?q?=E9=94=99=E5=8D=B3=E5=8F=AF=20=E4=B8=8D=E7=94=A8=E8=AE=B0?= =?UTF-8?q?=E4=BD=8Fconditionattr?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...nChartCustomStackAndAxisConditionPane.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/column/VanChartCustomStackAndAxisConditionPane.java b/designer-chart/src/main/java/com/fr/van/chart/column/VanChartCustomStackAndAxisConditionPane.java index efa071305..712d5bdd2 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/column/VanChartCustomStackAndAxisConditionPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/column/VanChartCustomStackAndAxisConditionPane.java @@ -99,10 +99,12 @@ public class VanChartCustomStackAndAxisConditionPane extends BasicBeanPane(seriesStackAndAxis.getXAxisNamesArray()); - YAxis = new UIButtonGroup(seriesStackAndAxis.getYAxisNameArray()); + AttrSeriesStackAndAxis seriesStackAndAxis = conditionAttr.getExisted(AttrSeriesStackAndAxis.class); + + if (XAxis == null || YAxis == null) { + XAxis = new UIButtonGroup(seriesStackAndAxis.getXAxisNamesArray()); + YAxis = new UIButtonGroup(seriesStackAndAxis.getYAxisNameArray()); + } doLayoutPane(); XAxis.setSelectedIndex(seriesStackAndAxis.getXAxisIndex()); @@ -129,11 +131,16 @@ public class VanChartCustomStackAndAxisConditionPane extends BasicBeanPane Date: Sun, 28 Oct 2018 19:48:06 +0800 Subject: [PATCH 25/35] =?UTF-8?q?CHART-2665=20&=20CHART-2886=20=E5=A0=86?= =?UTF-8?q?=E7=A7=AF=E5=92=8C=E5=9D=90=E6=A0=87=E8=BD=B4update=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E4=B8=80=E4=B8=AA=E6=96=B0=E5=88=9B=E5=BB=BA=E7=9A=84?= =?UTF-8?q?conditionattr=20CHART-1882=E7=9B=B4=E6=8E=A5=E6=94=B9=E6=8A=A5?= =?UTF-8?q?=E9=94=99=E5=8D=B3=E5=8F=AF=20=E4=B8=8D=E7=94=A8=E8=AE=B0?= =?UTF-8?q?=E4=BD=8Fconditionattr?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/column/VanChartCustomStackAndAxisConditionPane.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/column/VanChartCustomStackAndAxisConditionPane.java b/designer-chart/src/main/java/com/fr/van/chart/column/VanChartCustomStackAndAxisConditionPane.java index 712d5bdd2..ceb9bf480 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/column/VanChartCustomStackAndAxisConditionPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/column/VanChartCustomStackAndAxisConditionPane.java @@ -34,8 +34,6 @@ public class VanChartCustomStackAndAxisConditionPane extends BasicBeanPane isStacked; protected UIButtonGroup isPercentStacked; - private ConditionAttr conditionAttr; - private LiteConditionPane liteConditionPane; public VanChartCustomStackAndAxisConditionPane() { From 59b4b4073e7eeb397a02a43a6730fcc398eef54c Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Mon, 29 Oct 2018 17:58:23 +0800 Subject: [PATCH 26/35] =?UTF-8?q?=E5=AF=B9=E8=AF=9D=E6=A1=86=E6=89=93?= =?UTF-8?q?=E5=BC=80=E8=B6=85=E9=93=BE=E6=94=AF=E6=8C=81=E6=A0=87=E9=A2=98?= =?UTF-8?q?=E5=92=8C=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hyperlink/AbstractHyperNorthPane.java | 28 +- .../hyperlink/ReporletHyperNorthPane.java | 184 ------- .../hyperlink/ReportletHyperNorthPane.java | 510 ++++++++++++++++++ .../hyperlink/ReportletHyperlinkPane.java | 47 +- 4 files changed, 563 insertions(+), 206 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/design/hyperlink/ReporletHyperNorthPane.java create mode 100644 designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java diff --git a/designer-base/src/main/java/com/fr/design/hyperlink/AbstractHyperNorthPane.java b/designer-base/src/main/java/com/fr/design/hyperlink/AbstractHyperNorthPane.java index cd78c1755..22c12e296 100644 --- a/designer-base/src/main/java/com/fr/design/hyperlink/AbstractHyperNorthPane.java +++ b/designer-base/src/main/java/com/fr/design/hyperlink/AbstractHyperNorthPane.java @@ -6,11 +6,14 @@ import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UINumberField; import com.fr.design.layout.FRGUIPaneFactory; - import com.fr.js.Hyperlink; -import javax.swing.*; -import java.awt.*; +import javax.swing.DefaultListCellRenderer; +import javax.swing.JList; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -21,11 +24,18 @@ public abstract class AbstractHyperNorthPane extends BasicB public static final int DEFAULT_H_VALUE = 400; public static final int DEFAULT_V_VALUE = 600; - private JPanel headerPane; - private UIComboBox targetFrameComboBox; - - private UINumberField heightTextFiled; - private UINumberField widthTextFiled; + /** + * 链接打开方式对话框 + */ + UIComboBox targetFrameComboBox; + /** + * 对话框高度输入框 + */ + UINumberField heightTextFiled; + /** + * 对话框宽度输入框 + */ + UINumberField widthTextFiled; public AbstractHyperNorthPane() { @@ -35,7 +45,7 @@ public abstract class AbstractHyperNorthPane extends BasicB protected void initComponents() { this.setLayout(FRGUIPaneFactory.createM_BorderLayout()); JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); - headerPane = this.setHeaderPanel(); + JPanel headerPane = this.setHeaderPanel(); this.add(headerPane, BorderLayout.NORTH); this.add(centerPane, BorderLayout.CENTER); targetFrameComboBox = new UIComboBox(getTargetFrames()); diff --git a/designer-base/src/main/java/com/fr/design/hyperlink/ReporletHyperNorthPane.java b/designer-base/src/main/java/com/fr/design/hyperlink/ReporletHyperNorthPane.java deleted file mode 100644 index d35c70a82..000000000 --- a/designer-base/src/main/java/com/fr/design/hyperlink/ReporletHyperNorthPane.java +++ /dev/null @@ -1,184 +0,0 @@ -package com.fr.design.hyperlink; - -import com.fr.design.actions.UpdateAction; -import com.fr.design.dialog.BasicDialog; -import com.fr.design.dialog.DialogActionAdapter; -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.ilable.UILabel; -import com.fr.design.gui.itextfield.UITextField; -import com.fr.design.gui.itree.filetree.ReportletPane; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.utils.gui.GUICoreUtils; - -import com.fr.js.ReportletHyperlink; -import com.fr.stable.StringUtils; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -/** - * 热点链接部分 上方 定义特征 样式 报表 等属性的界面. - * - * @author kunsnat - */ -public class ReporletHyperNorthPane extends AbstractHyperNorthPane { - private UITextField itemNameTextField; - private boolean needRenamePane = false; - private UITextField reportPathTextField; - private UICheckBox showParameterInterface; - private UIButton browserButton; - - // richer:参数传递方式 - private UIComboBox postComboBox; - - public ReporletHyperNorthPane(boolean needRenamePane) { - this.needRenamePane = needRenamePane; - this.inits(); - } - - public ReporletHyperNorthPane() { - this.inits(); - } - - /** - * 初始化组件 - */ - public void inits() { - super.initComponents(); - } - - @Override - protected JPanel setHeaderPanel() { - JPanel headerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); - double p = TableLayout.PREFERRED; - double[] rowSize = {p, p, p}; - double[] columnSize = {p, TableLayout.FILL}; - // Reportlet. - JPanel reportletNamePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - - reportPathTextField = new UITextField(20); - reportletNamePane.add(reportPathTextField, BorderLayout.CENTER); - - browserButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Select")); - browserButton.setPreferredSize(new Dimension(browserButton.getPreferredSize().width, 20)); - reportletNamePane.add(browserButton, BorderLayout.EAST); - browserButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent evt) { - final ReportletPane reportletPane = new ReportletPane(); - reportletPane.setSelectedReportletPath(reportPathTextField.getText()); - BasicDialog reportletDialog = reportletPane.showWindow(SwingUtilities.getWindowAncestor(ReporletHyperNorthPane.this)); - - reportletDialog.addDialogActionListener(new DialogActionAdapter() { - public void doOk() { - reportPathTextField.setText(reportletPane.getSelectedReportletPath()); - } - }); - reportletDialog.setVisible(true); - } - }); - - Component[][] components; - if (!this.needRenamePane) { - components = new Component[][]{ - {new UILabel(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Reportlet") + ":"), reportletNamePane}, - }; - } else { - itemNameTextField = new UITextField(); - components = new Component[][]{ - {new UILabel(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Name") + ":"), itemNameTextField}, - {new UILabel(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Reportlet") + ":"), reportletNamePane}, - }; - } - JPanel northPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - headerPane.add(northPane, BorderLayout.NORTH); - return headerPane; - } - - @Override - protected String title4PopupWindow() { - return "reportlet"; - } - - @Override - protected void populateSubHyperlinkBean(ReportletHyperlink link) { - if (itemNameTextField != null) { - this.itemNameTextField.setText(link.getItemName()); - } - this.reportPathTextField.setText(link.getReportletPath()); - this.showParameterInterface.setSelected(link.isShowParameterInterface()); - this.postComboBox.setSelectedIndex(link.isByPost() ? 1 : 0); - } - - @Override - protected ReportletHyperlink updateSubHyperlinkBean() { - ReportletHyperlink reportletHyperlink = new ReportletHyperlink(); - updateSubHyperlinkBean(reportletHyperlink); - - return reportletHyperlink; - } - - @Override - protected void updateSubHyperlinkBean(ReportletHyperlink reportletHyperlink) { - if (itemNameTextField != null) { - reportletHyperlink.setItemName(this.itemNameTextField.getText()); - } - reportletHyperlink.setReportletPath(this.reportPathTextField.getText()); - reportletHyperlink.setShowParameterInterface(this.showParameterInterface.isSelected()); - reportletHyperlink.setByPost(postComboBox.getSelectedIndex() == 1 ? true : false); - } - - public String getReportletName() { - return StringUtils.isBlank(this.reportPathTextField.getText()) ? StringUtils.EMPTY : this.reportPathTextField.getText().substring(1); - } - - /** - * 获取按钮焦点 - */ - public void requestButtonFocus() { - this.browserButton.requestFocus(); - JPopupMenu popup = new JPopupMenu(); - FakeTipAction tip = new FakeTipAction(); - tip.setEnabled(false); - popup.add(tip); - GUICoreUtils.showPopupCloseMenu(popup, this.browserButton); - } - - private class FakeTipAction extends UpdateAction { - public FakeTipAction() { - this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Template_Select")); - } - - public void actionPerformed(ActionEvent e) { - //do nothing - } - } - - @Override - protected JPanel setFootPanel() { - double p = TableLayout.PREFERRED; - double[] rowSize = {p, p, p}; - double[] columnSize = {p, TableLayout.FILL}; - showParameterInterface = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameter_UI_Display")); - JPanel showParameterPanel = new JPanel(); - showParameterPanel.add(new UILabel()); - showParameterPanel.add(showParameterInterface); - - postComboBox = new UIComboBox(new String[]{"GET", "POST"}); - JPanel postPanel = new JPanel(); - postPanel.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Reportlet_Parameter_Type"))); - postPanel.add(postComboBox); - Component[][] components = {{postPanel}, - {showParameterPanel}, - {new UILabel(" ")} - }; - - return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - } - -} diff --git a/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java b/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java new file mode 100644 index 000000000..bd1b3a4d7 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java @@ -0,0 +1,510 @@ +package com.fr.design.hyperlink; + +import com.fr.base.BaseFormula; +import com.fr.design.actions.UpdateAction; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.event.UIObserverListener; +import com.fr.design.formula.FormulaFactory; +import com.fr.design.formula.UIFormula; +import com.fr.design.formula.VariableResolver; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ibutton.UIRadioButton; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itextfield.UINumberField; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.gui.itree.filetree.ReportletPane; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.IOUtils; +import com.fr.js.ReportletHyperlink; +import com.fr.js.ReportletHyperlinkDialogAttr; +import com.fr.stable.FormulaProvider; +import com.fr.stable.StringUtils; + +import javax.swing.BorderFactory; +import javax.swing.ButtonGroup; +import javax.swing.JPanel; +import javax.swing.JPopupMenu; +import javax.swing.SwingUtilities; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.List; + +/** + * 热点链接部分 上方 定义特征 样式 报表 等属性的界面. + * + * @author kunsnat + */ +public class ReportletHyperNorthPane extends AbstractHyperNorthPane { + /** + * item name text filed + */ + private UITextField itemNameTextField; + /** + * 是否展示item name + */ + private boolean needRenamePane = false; + /** + * 参数路径输入框 + */ + private UITextField reportPathTextField; + /** + * 是否展示参数面板勾选框 + */ + private UICheckBox showParameterInterface; + /** + * 选择文件按钮 + */ + private UIButton browserButton; + + /** + * 参数传递方式下拉选择框 + */ + private UIComboBox postComboBox; + /** + * 对话框标题输入框 + */ + private JFormulaField titleFiled; + + + /** + * 对话框居中按钮 + */ + private UIRadioButton center; + /** + * 对话框位置自定义按钮 + */ + private UIRadioButton custom; + /** + * 距左 + */ + private UINumberField leftLocation; + /** + * 距上 + */ + private UINumberField topLocation; + + + public ReportletHyperNorthPane(boolean needRenamePane) { + this.needRenamePane = needRenamePane; + } + + public ReportletHyperNorthPane() { + } + + /** + * 初始化面板 + */ + @Override + protected void initComponents() { + this.setLayout(FRGUIPaneFactory.createM_BorderLayout()); + this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + + final List dialogComponents = new ArrayList<>(); + final List othersComponents = new ArrayList<>(); + + initRenamePanel(dialogComponents, othersComponents); + initHeaderPanel(dialogComponents, othersComponents); + initTargetComboBoxPanel(dialogComponents, othersComponents); + + initTitlePanel(dialogComponents); + initDialogSizePanel(dialogComponents); + initDialogLocationPanel(dialogComponents); + + initFooterPanel(dialogComponents, othersComponents); + + initPlaceHolder(othersComponents); + + bindListener(dialogComponents, othersComponents); + + // 创建内容面板 + JPanel content = TableLayoutHelper.createTableLayoutPane(dialogComponents.toArray(new Component[dialogComponents.size()][]), TableLayoutHelper.FILL_LASTCOL_AND_ROW); + this.add(content, BorderLayout.CENTER); + } + + + /** + * 生成最上方的配置面板 + * + * @return JPanel + */ + @Override + protected JPanel setHeaderPanel() { + + JPanel reportletNamePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + // 路径输入框 + reportPathTextField = new UITextField(20); + reportletNamePane.add(reportPathTextField, BorderLayout.CENTER); + + // 选择路径按钮 + browserButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Select")); + browserButton.setPreferredSize(new Dimension(browserButton.getPreferredSize().width, 20)); + reportletNamePane.add(browserButton, BorderLayout.EAST); + browserButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent evt) { + final ReportletPane reportletPane = new ReportletPane(); + reportletPane.setSelectedReportletPath(reportPathTextField.getText()); + BasicDialog reportletDialog = reportletPane.showWindow(SwingUtilities.getWindowAncestor(ReportletHyperNorthPane.this)); + + reportletDialog.addDialogActionListener(new DialogActionAdapter() { + @Override + public void doOk() { + reportPathTextField.setText(reportletPane.getSelectedReportletPath()); + } + }); + reportletDialog.setVisible(true); + } + }); + return reportletNamePane; + } + + @Override + protected String title4PopupWindow() { + return "reportlet"; + } + + @Override + protected void populateSubHyperlinkBean(ReportletHyperlink link) { + if (itemNameTextField != null) { + this.itemNameTextField.setText(link.getItemName()); + } + this.reportPathTextField.setText(link.getReportletPath()); + this.showParameterInterface.setSelected(link.isShowParameterInterface()); + this.postComboBox.setSelectedIndex(link.isByPost() ? 1 : 0); + + ReportletHyperlinkDialogAttr attr = link.getAttr(); + titleFiled.setFormulaText(StringUtils.EMPTY); + leftLocation.setText(StringUtils.EMPTY); + topLocation.setText(StringUtils.EMPTY); + center.setSelected(true); + if (attr != null) { + FormulaProvider title = attr.getTitleFormula(); + String titleContent = title == null ? StringUtils.EMPTY : title.getPureContent(); + titleFiled.setFormulaText(titleContent); + boolean isCenter = attr.isCenter(); + if (!isCenter) { + int left = attr.getLeft(), top = attr.getTop(); + leftLocation.setText(Integer.toString(left)); + topLocation.setText(Integer.toString(top)); + } + center.setSelected(isCenter); + custom.setSelected(!isCenter); + } + } + + @Override + protected ReportletHyperlink updateSubHyperlinkBean() { + ReportletHyperlink reportletHyperlink = new ReportletHyperlink(); + updateSubHyperlinkBean(reportletHyperlink); + return reportletHyperlink; + } + + @Override + protected void updateSubHyperlinkBean(ReportletHyperlink reportletHyperlink) { + if (itemNameTextField != null) { + reportletHyperlink.setItemName(this.itemNameTextField.getText()); + } + reportletHyperlink.setReportletPath(this.reportPathTextField.getText()); + reportletHyperlink.setShowParameterInterface(this.showParameterInterface.isSelected()); + reportletHyperlink.setByPost(postComboBox.getSelectedIndex() == 1); + + ReportletHyperlinkDialogAttr attr = new ReportletHyperlinkDialogAttr(); + attr.setTitleFormula(BaseFormula.createFormulaBuilder().build(titleFiled.getFormulaText())); + attr.setCenter(center.isSelected()); + if (!attr.isCenter()) { + attr.setLeft((int) leftLocation.getValue()); + attr.setTop((int) topLocation.getValue()); + } + reportletHyperlink.setAttr(attr); + + } + + public String getReportletName() { + String text = this.reportPathTextField.getText(); + return StringUtils.isBlank(text) ? StringUtils.EMPTY : text.substring(1); + } + + /** + * 获取按钮焦点 + */ + public void requestButtonFocus() { + this.browserButton.requestFocus(); + JPopupMenu popup = new JPopupMenu(); + FakeTipAction tip = new FakeTipAction(); + tip.setEnabled(false); + popup.add(tip); + GUICoreUtils.showPopupCloseMenu(popup, this.browserButton); + } + + private class FakeTipAction extends UpdateAction { + public FakeTipAction() { + this.setName(Toolkit.i18nText("Fine-Design_Basic_Template_Select")); + } + + @Override + public void actionPerformed(ActionEvent e) { + // do nothing + } + } + + /** + * 底部面板,参数传递方式 + * + * @return JPanel + */ + @Override + protected JPanel setFootPanel() { + JPanel content = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); + + // 参数传递方式下拉框 + postComboBox = new UIComboBox(new String[]{"GET", "POST"}); + postComboBox.setPreferredSize(new Dimension(60, 20)); + postComboBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + content.add(postComboBox); + + + showParameterInterface = new UICheckBox(Toolkit.i18nText("Fine-Design_Basic_Parameter_UI_Display")); + + showParameterInterface.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); + content.add(showParameterInterface); + return content; + } + + private void bindListener(final List dialogComponents, final List othersComponents) { + targetFrameComboBox.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + boolean show = DIALOG == targetFrameComboBox.getSelectedIndex(); + JPanel content; + List cs; + if (show) { + cs = dialogComponents; + } else { + cs = othersComponents; + } + ReportletHyperNorthPane.this.removeAll(); + content = TableLayoutHelper.createTableLayoutPane(cs.toArray(new Component[cs.size()][]), TableLayoutHelper.FILL_LASTCOL_AND_ROW); + ReportletHyperNorthPane.this.add(content, BorderLayout.CENTER); + ReportletHyperNorthPane.this.revalidate(); + ReportletHyperNorthPane.this.repaint(); + } + }); + } + + private void initPlaceHolder(List othersComponents) { + JPanel empty1 = new JPanel(); + empty1.setPreferredSize(new Dimension(20, 20)); + JPanel empty2 = new JPanel(); + empty2.setPreferredSize(new Dimension(20, 20)); + JPanel empty3 = new JPanel(); + empty3.setPreferredSize(new Dimension(20, 23)); + + othersComponents.add(new Component[]{empty1, new JPanel()}); + othersComponents.add(new Component[]{empty2, new JPanel()}); + othersComponents.add(new Component[]{empty3, new JPanel()}); + } + + private void initRenamePanel(List dialogComponents, List othersComponents) { + // 是否有重命名属性 + if (this.needRenamePane) { + itemNameTextField = new UITextField(); + Component[] renameComponents = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Name") + ":"), itemNameTextField}; + dialogComponents.add(renameComponents); + othersComponents.add(renameComponents); + } + } + + private void initHeaderPanel(List dialogComponents, List othersComponents) { + //最上方位置的面板 + JPanel headerPane = this.setHeaderPanel(); + Component[] headerComponents = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Reportlet") + ":"), headerPane}; + dialogComponents.add(headerComponents); + othersComponents.add(headerComponents); + } + + private void initTargetComboBoxPanel(List dialogComponents, List othersComponents) { + // 链接打开于 + targetFrameComboBox = new UIComboBox(getTargetFrames()); + targetFrameComboBox.setEditable(true); + targetFrameComboBox.setPreferredSize(new Dimension(100, 20)); + JPanel targetFramePanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); + targetFramePanel.add(targetFrameComboBox); + Component[] targetComponents = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Link_Opened_In") + ":"), targetFramePanel}; + dialogComponents.add(targetComponents); + othersComponents.add(targetComponents); + } + + private void initTitlePanel(List dialogComponents) { + // 对话框标题 + titleFiled = new JFormulaField(15); + final JPanel titlePanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); + titlePanel.add(titleFiled); + Component[] titleComponents = new Component[]{new UILabel(Toolkit.i18nText("对话框标题") + ":"), titlePanel}; + dialogComponents.add(titleComponents); + } + + private void initDialogSizePanel(List dialogComponents) {// 对话框大小 + final JPanel sizeJPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); + UILabel heightLabel = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Height") + ":"); + heightLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); + sizeJPanel.add(heightLabel); + heightTextFiled = new UINumberField(); + heightTextFiled.setText(String.valueOf(DEFAULT_H_VALUE)); + heightTextFiled.setPreferredSize(new Dimension(40, 20)); + sizeJPanel.add(heightTextFiled); + UILabel widthLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Designer_Width") + ":"); + widthLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10)); + sizeJPanel.add(widthLabel); + widthTextFiled = new UINumberField(); + widthTextFiled.setText(String.valueOf(DEFAULT_V_VALUE)); + widthTextFiled.setPreferredSize(new Dimension(40, 20)); + sizeJPanel.add(widthTextFiled); + sizeJPanel.setVisible(true); + dialogComponents.add(new Component[]{new UILabel(Toolkit.i18nText("对话框大小") + ":"), sizeJPanel}); + } + + private void initDialogLocationPanel(List dialogComponents) { + // 显示位置 + final JPanel locationPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); + // 居中 + center = new UIRadioButton(Toolkit.i18nText("居中")); + // 自定义 + custom = new UIRadioButton(Toolkit.i18nText("自定义")); + + custom.setBorder(BorderFactory.createEmptyBorder(4, 20, 4, 5)); + ButtonGroup group = new ButtonGroup(); + group.setSelected(center.getModel(), true); + group.add(center); + group.add(custom); + locationPanel.add(center); + locationPanel.add(custom); + + // 位置 距左 + final UILabel leftLabel = new UILabel(Toolkit.i18nText("距左")); + leftLabel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 10)); + leftLocation = new UINumberField(); + leftLocation.setPreferredSize(new Dimension(40, 20)); + // 位置 距上 + final UILabel topLabel = new UILabel(Toolkit.i18nText("距上")); + topLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10)); + topLocation = new UINumberField(); + topLocation.setPreferredSize(new Dimension(40, 20)); + + locationPanel.add(leftLabel); + locationPanel.add(leftLocation); + locationPanel.add(topLabel); + locationPanel.add(topLocation); + leftLabel.setVisible(false); + leftLocation.setVisible(false); + topLabel.setVisible(false); + topLocation.setVisible(false); + ChangeListener actionListener = new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + boolean visible = custom.isSelected(); + leftLabel.setVisible(visible); + leftLocation.setVisible(visible); + topLabel.setVisible(visible); + topLocation.setVisible(visible); + } + }; + // 默认居中 + center.setSelected(true); + center.addChangeListener(actionListener); + custom.addChangeListener(actionListener); + + dialogComponents.add(new Component[]{new UILabel(Toolkit.i18nText("显示位置") + ":"), locationPanel}); + } + + private void initFooterPanel(List dialogComponents, List othersComponents) { + // 最下方的配置面板 + // 参数传递方式 + Component[] footerComponents = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Reportlet_Parameter_Type") + ":"), this.setFootPanel()}; + dialogComponents.add(footerComponents); + othersComponents.add(footerComponents); + } + + /** + * 公式输入框 + */ + public class JFormulaField extends JPanel { + private UITextField formulaTextField; + + public JFormulaField(int columns) { + + formulaTextField = new UITextField(columns); + JPanel textFieldPane = new JPanel(new BorderLayout()); + textFieldPane.add(formulaTextField, BorderLayout.CENTER); + textFieldPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); + UIButton formulaButton = new UIButton(IOUtils.readIcon("/com/fr/design/images/m_insert/formula.png")); + formulaButton.setToolTipText(Toolkit.i18nText("Fine-Design_Report_Formula") + "..."); + formulaButton.setPreferredSize(new Dimension(24, formulaTextField.getPreferredSize().height)); + formulaButton.addActionListener(formulaButtonActionListener); + + JPanel pane = new JPanel(new BorderLayout()); + pane.add(textFieldPane, BorderLayout.CENTER); + pane.add(formulaButton, BorderLayout.EAST); + this.setLayout(new BorderLayout()); + this.add(pane, BorderLayout.NORTH); + } + + public void setFormulaText(String formulaContent) { + this.formulaTextField.setText(formulaContent); + } + + public String getFormulaText() { + + String text = formulaTextField.getText(); + if (text == null) { + text = StringUtils.EMPTY; + } + return text; + } + + /** + * 添加事件监听器 + * + * @param listener 公式文本输入框改动事件监听器 + */ + public void addListener(UIObserverListener listener) { + this.formulaTextField.registerChangeListener(listener); + } + + /** + * 取消事件监听器 + */ + public void removeListener() { + this.formulaTextField.registerChangeListener(null); + } + + private ActionListener formulaButtonActionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent evt) { + BaseFormula valueFormula = BaseFormula.createFormulaBuilder().build(); + valueFormula.setContent(getFormulaText()); + final UIFormula formulaPane = FormulaFactory.createFormulaPaneWhenReserveFormula(); + formulaPane.populate(valueFormula, VariableResolver.DEFAULT); + formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(ReportletHyperNorthPane.this), new DialogActionAdapter() { + @Override + public void doOk() { + BaseFormula valueFormula = formulaPane.update(); + setFormulaText(valueFormula.getContent()); + } + }).setVisible(true); + } + }; + } +} diff --git a/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperlinkPane.java b/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperlinkPane.java index e50360c19..532fe467c 100644 --- a/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperlinkPane.java +++ b/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperlinkPane.java @@ -6,23 +6,30 @@ import com.fr.design.gui.frpane.ReportletParameterViewPane; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.itableeditorpane.ParameterTableModel; import com.fr.design.gui.itableeditorpane.UITableEditAction; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.module.DesignModuleFactory; import com.fr.design.parameter.ParameterReader; import com.fr.design.utils.gui.GUICoreUtils; - import com.fr.js.ReportletHyperlink; import com.fr.stable.ParameterProvider; import com.fr.stable.StringUtils; -import javax.swing.*; -import java.awt.*; +import javax.swing.JOptionPane; +import java.awt.BorderLayout; +import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.util.HashMap; import java.util.List; public class ReportletHyperlinkPane extends AbstractHyperLinkPane { - private ReporletHyperNorthPane northPane; + /** + * 超链配置面板 + */ + private ReportletHyperNorthPane northPane; + /** + * 是否继承参数勾选框 + */ private UICheckBox extendParametersCheckBox; public ReportletHyperlinkPane(HashMap hyperLinkEditorMap, boolean needRenamePane) { @@ -38,22 +45,29 @@ public class ReportletHyperlinkPane extends AbstractHyperLinkPane Date: Tue, 30 Oct 2018 00:35:37 +0800 Subject: [PATCH 27/35] =?UTF-8?q?REPORT-11520=20=E8=B6=85=E7=BA=A7?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=E5=AF=B9=E8=AF=9D=E6=A1=86=E6=89=93=E5=BC=80?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/hyperlink/ReportletHyperNorthPane.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java b/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java index bd1b3a4d7..7f36d5a2c 100644 --- a/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java +++ b/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java @@ -352,7 +352,7 @@ public class ReportletHyperNorthPane extends AbstractHyperNorthPane dialogComponents) { // 显示位置 final JPanel locationPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); // 居中 - center = new UIRadioButton(Toolkit.i18nText("居中")); + center = new UIRadioButton(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Dialog_Position_Center")); // 自定义 - custom = new UIRadioButton(Toolkit.i18nText("自定义")); + custom = new UIRadioButton(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Dialog_Position_Custom")); custom.setBorder(BorderFactory.createEmptyBorder(4, 20, 4, 5)); ButtonGroup group = new ButtonGroup(); @@ -393,12 +393,12 @@ public class ReportletHyperNorthPane extends AbstractHyperNorthPane dialogComponents, List othersComponents) { From 5918d7186aaeb1f5c3786646ae921116c08a2a7b Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Tue, 30 Oct 2018 09:33:46 +0800 Subject: [PATCH 28/35] ff --- .../fr/design/hyperlink/AbstractHyperNorthPane.java | 6 +++--- .../fr/design/hyperlink/ReportletHyperNorthPane.java | 10 +++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/hyperlink/AbstractHyperNorthPane.java b/designer-base/src/main/java/com/fr/design/hyperlink/AbstractHyperNorthPane.java index 22c12e296..42f13ceed 100644 --- a/designer-base/src/main/java/com/fr/design/hyperlink/AbstractHyperNorthPane.java +++ b/designer-base/src/main/java/com/fr/design/hyperlink/AbstractHyperNorthPane.java @@ -27,15 +27,15 @@ public abstract class AbstractHyperNorthPane extends BasicB /** * 链接打开方式对话框 */ - UIComboBox targetFrameComboBox; + private UIComboBox targetFrameComboBox; /** * 对话框高度输入框 */ - UINumberField heightTextFiled; + private UINumberField heightTextFiled; /** * 对话框宽度输入框 */ - UINumberField widthTextFiled; + private UINumberField widthTextFiled; public AbstractHyperNorthPane() { diff --git a/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java b/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java index 7f36d5a2c..57fcfe25d 100644 --- a/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java +++ b/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java @@ -284,6 +284,7 @@ public class ReportletHyperNorthPane extends AbstractHyperNorthPane dialogComponents, final List othersComponents) { + final UIComboBox targetFrameComboBox = this.getTargetFrameComboBox(); targetFrameComboBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -337,7 +338,8 @@ public class ReportletHyperNorthPane extends AbstractHyperNorthPane dialogComponents, List othersComponents) { // 链接打开于 - targetFrameComboBox = new UIComboBox(getTargetFrames()); + UIComboBox targetFrameComboBox = new UIComboBox(getTargetFrames()); + this.setTargetFrameComboBox(targetFrameComboBox); targetFrameComboBox.setEditable(true); targetFrameComboBox.setPreferredSize(new Dimension(100, 20)); JPanel targetFramePanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); @@ -361,17 +363,19 @@ public class ReportletHyperNorthPane extends AbstractHyperNorthPane Date: Tue, 30 Oct 2018 16:16:46 +0800 Subject: [PATCH 29/35] REPORT-11831 --- .../onlineupdate/ui/dialog/UpdateMainDialog.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/UpdateMainDialog.java b/designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/UpdateMainDialog.java index e4f44086a..fb5db0cd4 100644 --- a/designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/UpdateMainDialog.java +++ b/designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/UpdateMainDialog.java @@ -23,11 +23,7 @@ import com.fr.design.onlineupdate.ui.widget.UpdateInfoTableCellRender; import com.fr.design.onlineupdate.ui.widget.UpdateInfoTableModel; import com.fr.design.onlineupdate.ui.widget.UpdateInfoTextAreaCellRender; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.general.ComparatorUtils; -import com.fr.general.DateUtils; -import com.fr.general.GeneralUtils; -import com.fr.general.IOUtils; -import com.fr.general.SiteCenter; +import com.fr.general.*; import com.fr.general.http.HttpClient; import com.fr.json.JSONArray; import com.fr.json.JSONObject; @@ -341,8 +337,14 @@ public class UpdateMainDialog extends UIDialog { initUpdateActionPane(); add(jarVersionInfoPane, BorderLayout.NORTH); - add(jarUpdateInfoPane, BorderLayout.CENTER); - add(updateActionPane, BorderLayout.SOUTH); + + //海外版本不显示更新信息 + if (GeneralContext.getLocale().equals(Locale.CHINA) || GeneralContext.getLocale().equals(Locale.TAIWAN)){ + add(jarUpdateInfoPane, BorderLayout.CENTER); + add(updateActionPane, BorderLayout.SOUTH); + }else { + add(updateActionPane, BorderLayout.CENTER); + } addActionListenerForUpdateBtn(); From 8a00f5f32100d313722e257add29cbd686104811 Mon Sep 17 00:00:00 2001 From: zheng Date: Tue, 30 Oct 2018 16:38:13 +0800 Subject: [PATCH 30/35] =?UTF-8?q?CHART-3275=20=E5=AE=89=E8=A3=85=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=20=E5=9B=BE=E8=A1=A8=E7=B1=BB=E5=9E=8B=E4=B8=8D?= =?UTF-8?q?=E9=87=8D=E5=90=AF=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/ChartTypeInterfaceManager.java | 26 +++++++++++++++++++ .../design/mainframe/FormParaWidgetPane.java | 7 +++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java index a01fc0ce5..154f4c097 100644 --- a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java @@ -37,7 +37,9 @@ import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.module.DesignModuleFactory; import com.fr.form.ui.ChartEditor; +import com.fr.general.GeneralContext; import com.fr.general.IOUtils; import com.fr.plugin.chart.PiePlot4VanChart; import com.fr.plugin.chart.area.VanChartAreaPlot; @@ -57,8 +59,13 @@ import com.fr.plugin.chart.scatter.VanChartScatterPlot; import com.fr.plugin.chart.structure.VanChartStructurePlot; import com.fr.plugin.chart.treemap.VanChartTreeMapPlot; import com.fr.plugin.chart.wordcloud.VanChartWordCloudPlot; +import com.fr.plugin.context.PluginContext; import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.injectable.PluginSingleInjection; +import com.fr.plugin.injectable.SpecialLevel; +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.AssistUtils; @@ -119,6 +126,25 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr readDefault(); readVanChart(); PluginModule.registerAgent(PluginModule.ExtraChartDesign, classManager); + + GeneralContext.listenPluginRunningChanged(new PluginEventListener() { + + @Override + public void on(PluginEvent event) { + + synchronized (ChartTypeInterfaceManager.class) { + //因为是CloseableContainedMap,所以不能在mount那边处理。 + DesignModuleFactory.registerExtraWidgetOptions(ChartTypeInterfaceManager.initWidgetOption()); + } + } + }, new PluginFilter() { + + @Override + public boolean accept(PluginContext context) { + + return context.contain(PluginModule.ExtraChartDesign, SpecialLevel.IndependentChartUIProvider.getTagName()); + } + }); } public static WidgetOption[] initWidgetOption() { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java index b78ecbf74..2fb695012 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java @@ -22,9 +22,9 @@ import com.fr.form.ui.WidgetConfig; import com.fr.form.ui.WidgetInfoConfig; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; - import com.fr.plugin.context.PluginContext; import com.fr.plugin.injectable.PluginModule; +import com.fr.plugin.injectable.SpecialLevel; import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; @@ -47,6 +47,8 @@ import java.util.Arrays; import java.util.Iterator; import java.util.List; +import static com.fr.plugin.injectable.SpecialLevel.IndependentChartUIProvider; + /** * @author null */ @@ -98,7 +100,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.ExtraChartDesign, SpecialLevel.IndependentChartUIProvider.getTagName()); } }); } From ef1340db0e992817d33c35afe812089e561a41ce Mon Sep 17 00:00:00 2001 From: zheng Date: Tue, 30 Oct 2018 16:40:10 +0800 Subject: [PATCH 31/35] update --- .../main/java/com/fr/design/mainframe/FormParaWidgetPane.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java index 2fb695012..1958056b3 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java @@ -47,8 +47,6 @@ import java.util.Arrays; import java.util.Iterator; import java.util.List; -import static com.fr.plugin.injectable.SpecialLevel.IndependentChartUIProvider; - /** * @author null */ From 5b6d88e90c215d09e4e7d68125e2ef5424056af2 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Wed, 31 Oct 2018 20:10:36 +0800 Subject: [PATCH 32/35] REPORT-11831 --- .../onlineupdate/ui/dialog/UpdateMainDialog.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/UpdateMainDialog.java b/designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/UpdateMainDialog.java index fb5db0cd4..551d5d3db 100644 --- a/designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/UpdateMainDialog.java +++ b/designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/UpdateMainDialog.java @@ -337,14 +337,8 @@ public class UpdateMainDialog extends UIDialog { initUpdateActionPane(); add(jarVersionInfoPane, BorderLayout.NORTH); - - //海外版本不显示更新信息 - if (GeneralContext.getLocale().equals(Locale.CHINA) || GeneralContext.getLocale().equals(Locale.TAIWAN)){ - add(jarUpdateInfoPane, BorderLayout.CENTER); - add(updateActionPane, BorderLayout.SOUTH); - }else { - add(updateActionPane, BorderLayout.CENTER); - } + add(jarUpdateInfoPane, BorderLayout.CENTER); + add(updateActionPane, BorderLayout.SOUTH); addActionListenerForUpdateBtn(); From 2c4cc795e392c5c9adb2ea41443df6be441edf6c Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Wed, 31 Oct 2018 20:45:55 +0800 Subject: [PATCH 33/35] =?UTF-8?q?=E8=B6=85=E7=BA=A7=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=E5=AF=B9=E8=AF=9D=E6=A1=86=E6=89=93=E5=BC=80=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E5=9B=9E=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hyperlink/AbstractHyperNorthPane.java | 22 +- .../hyperlink/ReporletHyperNorthPane.java | 184 +++++++ .../hyperlink/ReportletHyperNorthPane.java | 514 ------------------ .../hyperlink/ReportletHyperlinkPane.java | 47 +- 4 files changed, 203 insertions(+), 564 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/hyperlink/ReporletHyperNorthPane.java delete mode 100644 designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java diff --git a/designer-base/src/main/java/com/fr/design/hyperlink/AbstractHyperNorthPane.java b/designer-base/src/main/java/com/fr/design/hyperlink/AbstractHyperNorthPane.java index 42f13ceed..cd78c1755 100644 --- a/designer-base/src/main/java/com/fr/design/hyperlink/AbstractHyperNorthPane.java +++ b/designer-base/src/main/java/com/fr/design/hyperlink/AbstractHyperNorthPane.java @@ -6,14 +6,11 @@ import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UINumberField; import com.fr.design.layout.FRGUIPaneFactory; + import com.fr.js.Hyperlink; -import javax.swing.DefaultListCellRenderer; -import javax.swing.JList; -import javax.swing.JPanel; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -24,17 +21,10 @@ public abstract class AbstractHyperNorthPane extends BasicB public static final int DEFAULT_H_VALUE = 400; public static final int DEFAULT_V_VALUE = 600; - /** - * 链接打开方式对话框 - */ + private JPanel headerPane; private UIComboBox targetFrameComboBox; - /** - * 对话框高度输入框 - */ + private UINumberField heightTextFiled; - /** - * 对话框宽度输入框 - */ private UINumberField widthTextFiled; @@ -45,7 +35,7 @@ public abstract class AbstractHyperNorthPane extends BasicB protected void initComponents() { this.setLayout(FRGUIPaneFactory.createM_BorderLayout()); JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); - JPanel headerPane = this.setHeaderPanel(); + headerPane = this.setHeaderPanel(); this.add(headerPane, BorderLayout.NORTH); this.add(centerPane, BorderLayout.CENTER); targetFrameComboBox = new UIComboBox(getTargetFrames()); diff --git a/designer-base/src/main/java/com/fr/design/hyperlink/ReporletHyperNorthPane.java b/designer-base/src/main/java/com/fr/design/hyperlink/ReporletHyperNorthPane.java new file mode 100644 index 000000000..d35c70a82 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/hyperlink/ReporletHyperNorthPane.java @@ -0,0 +1,184 @@ +package com.fr.design.hyperlink; + +import com.fr.design.actions.UpdateAction; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.DialogActionAdapter; +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.ilable.UILabel; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.gui.itree.filetree.ReportletPane; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.utils.gui.GUICoreUtils; + +import com.fr.js.ReportletHyperlink; +import com.fr.stable.StringUtils; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * 热点链接部分 上方 定义特征 样式 报表 等属性的界面. + * + * @author kunsnat + */ +public class ReporletHyperNorthPane extends AbstractHyperNorthPane { + private UITextField itemNameTextField; + private boolean needRenamePane = false; + private UITextField reportPathTextField; + private UICheckBox showParameterInterface; + private UIButton browserButton; + + // richer:参数传递方式 + private UIComboBox postComboBox; + + public ReporletHyperNorthPane(boolean needRenamePane) { + this.needRenamePane = needRenamePane; + this.inits(); + } + + public ReporletHyperNorthPane() { + this.inits(); + } + + /** + * 初始化组件 + */ + public void inits() { + super.initComponents(); + } + + @Override + protected JPanel setHeaderPanel() { + JPanel headerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); + double p = TableLayout.PREFERRED; + double[] rowSize = {p, p, p}; + double[] columnSize = {p, TableLayout.FILL}; + // Reportlet. + JPanel reportletNamePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + + reportPathTextField = new UITextField(20); + reportletNamePane.add(reportPathTextField, BorderLayout.CENTER); + + browserButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Select")); + browserButton.setPreferredSize(new Dimension(browserButton.getPreferredSize().width, 20)); + reportletNamePane.add(browserButton, BorderLayout.EAST); + browserButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent evt) { + final ReportletPane reportletPane = new ReportletPane(); + reportletPane.setSelectedReportletPath(reportPathTextField.getText()); + BasicDialog reportletDialog = reportletPane.showWindow(SwingUtilities.getWindowAncestor(ReporletHyperNorthPane.this)); + + reportletDialog.addDialogActionListener(new DialogActionAdapter() { + public void doOk() { + reportPathTextField.setText(reportletPane.getSelectedReportletPath()); + } + }); + reportletDialog.setVisible(true); + } + }); + + Component[][] components; + if (!this.needRenamePane) { + components = new Component[][]{ + {new UILabel(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Reportlet") + ":"), reportletNamePane}, + }; + } else { + itemNameTextField = new UITextField(); + components = new Component[][]{ + {new UILabel(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Name") + ":"), itemNameTextField}, + {new UILabel(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Reportlet") + ":"), reportletNamePane}, + }; + } + JPanel northPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + headerPane.add(northPane, BorderLayout.NORTH); + return headerPane; + } + + @Override + protected String title4PopupWindow() { + return "reportlet"; + } + + @Override + protected void populateSubHyperlinkBean(ReportletHyperlink link) { + if (itemNameTextField != null) { + this.itemNameTextField.setText(link.getItemName()); + } + this.reportPathTextField.setText(link.getReportletPath()); + this.showParameterInterface.setSelected(link.isShowParameterInterface()); + this.postComboBox.setSelectedIndex(link.isByPost() ? 1 : 0); + } + + @Override + protected ReportletHyperlink updateSubHyperlinkBean() { + ReportletHyperlink reportletHyperlink = new ReportletHyperlink(); + updateSubHyperlinkBean(reportletHyperlink); + + return reportletHyperlink; + } + + @Override + protected void updateSubHyperlinkBean(ReportletHyperlink reportletHyperlink) { + if (itemNameTextField != null) { + reportletHyperlink.setItemName(this.itemNameTextField.getText()); + } + reportletHyperlink.setReportletPath(this.reportPathTextField.getText()); + reportletHyperlink.setShowParameterInterface(this.showParameterInterface.isSelected()); + reportletHyperlink.setByPost(postComboBox.getSelectedIndex() == 1 ? true : false); + } + + public String getReportletName() { + return StringUtils.isBlank(this.reportPathTextField.getText()) ? StringUtils.EMPTY : this.reportPathTextField.getText().substring(1); + } + + /** + * 获取按钮焦点 + */ + public void requestButtonFocus() { + this.browserButton.requestFocus(); + JPopupMenu popup = new JPopupMenu(); + FakeTipAction tip = new FakeTipAction(); + tip.setEnabled(false); + popup.add(tip); + GUICoreUtils.showPopupCloseMenu(popup, this.browserButton); + } + + private class FakeTipAction extends UpdateAction { + public FakeTipAction() { + this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Template_Select")); + } + + public void actionPerformed(ActionEvent e) { + //do nothing + } + } + + @Override + protected JPanel setFootPanel() { + double p = TableLayout.PREFERRED; + double[] rowSize = {p, p, p}; + double[] columnSize = {p, TableLayout.FILL}; + showParameterInterface = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameter_UI_Display")); + JPanel showParameterPanel = new JPanel(); + showParameterPanel.add(new UILabel()); + showParameterPanel.add(showParameterInterface); + + postComboBox = new UIComboBox(new String[]{"GET", "POST"}); + JPanel postPanel = new JPanel(); + postPanel.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Reportlet_Parameter_Type"))); + postPanel.add(postComboBox); + Component[][] components = {{postPanel}, + {showParameterPanel}, + {new UILabel(" ")} + }; + + return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + } + +} diff --git a/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java b/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java deleted file mode 100644 index 57fcfe25d..000000000 --- a/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java +++ /dev/null @@ -1,514 +0,0 @@ -package com.fr.design.hyperlink; - -import com.fr.base.BaseFormula; -import com.fr.design.actions.UpdateAction; -import com.fr.design.dialog.BasicDialog; -import com.fr.design.dialog.DialogActionAdapter; -import com.fr.design.event.UIObserverListener; -import com.fr.design.formula.FormulaFactory; -import com.fr.design.formula.UIFormula; -import com.fr.design.formula.VariableResolver; -import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.gui.ibutton.UIRadioButton; -import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.gui.icombobox.UIComboBox; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.itextfield.UINumberField; -import com.fr.design.gui.itextfield.UITextField; -import com.fr.design.gui.itree.filetree.ReportletPane; -import com.fr.design.i18n.Toolkit; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.general.IOUtils; -import com.fr.js.ReportletHyperlink; -import com.fr.js.ReportletHyperlinkDialogAttr; -import com.fr.stable.FormulaProvider; -import com.fr.stable.StringUtils; - -import javax.swing.BorderFactory; -import javax.swing.ButtonGroup; -import javax.swing.JPanel; -import javax.swing.JPopupMenu; -import javax.swing.SwingUtilities; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.ArrayList; -import java.util.List; - -/** - * 热点链接部分 上方 定义特征 样式 报表 等属性的界面. - * - * @author kunsnat - */ -public class ReportletHyperNorthPane extends AbstractHyperNorthPane { - /** - * item name text filed - */ - private UITextField itemNameTextField; - /** - * 是否展示item name - */ - private boolean needRenamePane = false; - /** - * 参数路径输入框 - */ - private UITextField reportPathTextField; - /** - * 是否展示参数面板勾选框 - */ - private UICheckBox showParameterInterface; - /** - * 选择文件按钮 - */ - private UIButton browserButton; - - /** - * 参数传递方式下拉选择框 - */ - private UIComboBox postComboBox; - /** - * 对话框标题输入框 - */ - private JFormulaField titleFiled; - - - /** - * 对话框居中按钮 - */ - private UIRadioButton center; - /** - * 对话框位置自定义按钮 - */ - private UIRadioButton custom; - /** - * 距左 - */ - private UINumberField leftLocation; - /** - * 距上 - */ - private UINumberField topLocation; - - - public ReportletHyperNorthPane(boolean needRenamePane) { - this.needRenamePane = needRenamePane; - } - - public ReportletHyperNorthPane() { - } - - /** - * 初始化面板 - */ - @Override - protected void initComponents() { - this.setLayout(FRGUIPaneFactory.createM_BorderLayout()); - this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); - - final List dialogComponents = new ArrayList<>(); - final List othersComponents = new ArrayList<>(); - - initRenamePanel(dialogComponents, othersComponents); - initHeaderPanel(dialogComponents, othersComponents); - initTargetComboBoxPanel(dialogComponents, othersComponents); - - initTitlePanel(dialogComponents); - initDialogSizePanel(dialogComponents); - initDialogLocationPanel(dialogComponents); - - initFooterPanel(dialogComponents, othersComponents); - - initPlaceHolder(othersComponents); - - bindListener(dialogComponents, othersComponents); - - // 创建内容面板 - JPanel content = TableLayoutHelper.createTableLayoutPane(dialogComponents.toArray(new Component[dialogComponents.size()][]), TableLayoutHelper.FILL_LASTCOL_AND_ROW); - this.add(content, BorderLayout.CENTER); - } - - - /** - * 生成最上方的配置面板 - * - * @return JPanel - */ - @Override - protected JPanel setHeaderPanel() { - - JPanel reportletNamePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - // 路径输入框 - reportPathTextField = new UITextField(20); - reportletNamePane.add(reportPathTextField, BorderLayout.CENTER); - - // 选择路径按钮 - browserButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Select")); - browserButton.setPreferredSize(new Dimension(browserButton.getPreferredSize().width, 20)); - reportletNamePane.add(browserButton, BorderLayout.EAST); - browserButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent evt) { - final ReportletPane reportletPane = new ReportletPane(); - reportletPane.setSelectedReportletPath(reportPathTextField.getText()); - BasicDialog reportletDialog = reportletPane.showWindow(SwingUtilities.getWindowAncestor(ReportletHyperNorthPane.this)); - - reportletDialog.addDialogActionListener(new DialogActionAdapter() { - @Override - public void doOk() { - reportPathTextField.setText(reportletPane.getSelectedReportletPath()); - } - }); - reportletDialog.setVisible(true); - } - }); - return reportletNamePane; - } - - @Override - protected String title4PopupWindow() { - return "reportlet"; - } - - @Override - protected void populateSubHyperlinkBean(ReportletHyperlink link) { - if (itemNameTextField != null) { - this.itemNameTextField.setText(link.getItemName()); - } - this.reportPathTextField.setText(link.getReportletPath()); - this.showParameterInterface.setSelected(link.isShowParameterInterface()); - this.postComboBox.setSelectedIndex(link.isByPost() ? 1 : 0); - - ReportletHyperlinkDialogAttr attr = link.getAttr(); - titleFiled.setFormulaText(StringUtils.EMPTY); - leftLocation.setText(StringUtils.EMPTY); - topLocation.setText(StringUtils.EMPTY); - center.setSelected(true); - if (attr != null) { - FormulaProvider title = attr.getTitleFormula(); - String titleContent = title == null ? StringUtils.EMPTY : title.getPureContent(); - titleFiled.setFormulaText(titleContent); - boolean isCenter = attr.isCenter(); - if (!isCenter) { - int left = attr.getLeft(), top = attr.getTop(); - leftLocation.setText(Integer.toString(left)); - topLocation.setText(Integer.toString(top)); - } - center.setSelected(isCenter); - custom.setSelected(!isCenter); - } - } - - @Override - protected ReportletHyperlink updateSubHyperlinkBean() { - ReportletHyperlink reportletHyperlink = new ReportletHyperlink(); - updateSubHyperlinkBean(reportletHyperlink); - return reportletHyperlink; - } - - @Override - protected void updateSubHyperlinkBean(ReportletHyperlink reportletHyperlink) { - if (itemNameTextField != null) { - reportletHyperlink.setItemName(this.itemNameTextField.getText()); - } - reportletHyperlink.setReportletPath(this.reportPathTextField.getText()); - reportletHyperlink.setShowParameterInterface(this.showParameterInterface.isSelected()); - reportletHyperlink.setByPost(postComboBox.getSelectedIndex() == 1); - - ReportletHyperlinkDialogAttr attr = new ReportletHyperlinkDialogAttr(); - attr.setTitleFormula(BaseFormula.createFormulaBuilder().build(titleFiled.getFormulaText())); - attr.setCenter(center.isSelected()); - if (!attr.isCenter()) { - attr.setLeft((int) leftLocation.getValue()); - attr.setTop((int) topLocation.getValue()); - } - reportletHyperlink.setAttr(attr); - - } - - public String getReportletName() { - String text = this.reportPathTextField.getText(); - return StringUtils.isBlank(text) ? StringUtils.EMPTY : text.substring(1); - } - - /** - * 获取按钮焦点 - */ - public void requestButtonFocus() { - this.browserButton.requestFocus(); - JPopupMenu popup = new JPopupMenu(); - FakeTipAction tip = new FakeTipAction(); - tip.setEnabled(false); - popup.add(tip); - GUICoreUtils.showPopupCloseMenu(popup, this.browserButton); - } - - private class FakeTipAction extends UpdateAction { - public FakeTipAction() { - this.setName(Toolkit.i18nText("Fine-Design_Basic_Template_Select")); - } - - @Override - public void actionPerformed(ActionEvent e) { - // do nothing - } - } - - /** - * 底部面板,参数传递方式 - * - * @return JPanel - */ - @Override - protected JPanel setFootPanel() { - JPanel content = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); - - // 参数传递方式下拉框 - postComboBox = new UIComboBox(new String[]{"GET", "POST"}); - postComboBox.setPreferredSize(new Dimension(60, 20)); - postComboBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - content.add(postComboBox); - - - showParameterInterface = new UICheckBox(Toolkit.i18nText("Fine-Design_Basic_Parameter_UI_Display")); - - showParameterInterface.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); - content.add(showParameterInterface); - return content; - } - - private void bindListener(final List dialogComponents, final List othersComponents) { - final UIComboBox targetFrameComboBox = this.getTargetFrameComboBox(); - targetFrameComboBox.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - boolean show = DIALOG == targetFrameComboBox.getSelectedIndex(); - JPanel content; - List cs; - if (show) { - cs = dialogComponents; - } else { - cs = othersComponents; - } - ReportletHyperNorthPane.this.removeAll(); - content = TableLayoutHelper.createTableLayoutPane(cs.toArray(new Component[cs.size()][]), TableLayoutHelper.FILL_LASTCOL_AND_ROW); - ReportletHyperNorthPane.this.add(content, BorderLayout.CENTER); - ReportletHyperNorthPane.this.revalidate(); - ReportletHyperNorthPane.this.repaint(); - } - }); - } - - private void initPlaceHolder(List othersComponents) { - JPanel empty1 = new JPanel(); - empty1.setPreferredSize(new Dimension(20, 20)); - JPanel empty2 = new JPanel(); - empty2.setPreferredSize(new Dimension(20, 20)); - JPanel empty3 = new JPanel(); - empty3.setPreferredSize(new Dimension(20, 23)); - - othersComponents.add(new Component[]{empty1, new JPanel()}); - othersComponents.add(new Component[]{empty2, new JPanel()}); - othersComponents.add(new Component[]{empty3, new JPanel()}); - } - - private void initRenamePanel(List dialogComponents, List othersComponents) { - // 是否有重命名属性 - if (this.needRenamePane) { - itemNameTextField = new UITextField(); - Component[] renameComponents = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Name") + ":"), itemNameTextField}; - dialogComponents.add(renameComponents); - othersComponents.add(renameComponents); - } - } - - private void initHeaderPanel(List dialogComponents, List othersComponents) { - //最上方位置的面板 - JPanel headerPane = this.setHeaderPanel(); - Component[] headerComponents = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Reportlet") + ":"), headerPane}; - dialogComponents.add(headerComponents); - othersComponents.add(headerComponents); - } - - private void initTargetComboBoxPanel(List dialogComponents, List othersComponents) { - // 链接打开于 - UIComboBox targetFrameComboBox = new UIComboBox(getTargetFrames()); - this.setTargetFrameComboBox(targetFrameComboBox); - targetFrameComboBox.setEditable(true); - targetFrameComboBox.setPreferredSize(new Dimension(100, 20)); - JPanel targetFramePanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); - targetFramePanel.add(targetFrameComboBox); - Component[] targetComponents = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Link_Opened_In") + ":"), targetFramePanel}; - dialogComponents.add(targetComponents); - othersComponents.add(targetComponents); - } - - private void initTitlePanel(List dialogComponents) { - // 对话框标题 - titleFiled = new JFormulaField(15); - final JPanel titlePanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); - titlePanel.add(titleFiled); - Component[] titleComponents = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Dialog_Title") + ":"), titlePanel}; - dialogComponents.add(titleComponents); - } - - private void initDialogSizePanel(List dialogComponents) {// 对话框大小 - final JPanel sizeJPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); - UILabel heightLabel = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Height") + ":"); - heightLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); - sizeJPanel.add(heightLabel); - UINumberField heightTextFiled = new UINumberField(); - heightTextFiled.setText(String.valueOf(DEFAULT_H_VALUE)); - heightTextFiled.setPreferredSize(new Dimension(40, 20)); - sizeJPanel.add(heightTextFiled); - this.setHeightTextFiled(heightTextFiled); - UILabel widthLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Designer_Width") + ":"); - widthLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10)); - sizeJPanel.add(widthLabel); - UINumberField widthTextFiled = new UINumberField(); - widthTextFiled.setText(String.valueOf(DEFAULT_V_VALUE)); - widthTextFiled.setPreferredSize(new Dimension(40, 20)); - sizeJPanel.add(widthTextFiled); - this.setWidthTextFiled(widthTextFiled); - sizeJPanel.setVisible(true); - dialogComponents.add(new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Dialog_Size") + ":"), sizeJPanel}); - } - - private void initDialogLocationPanel(List dialogComponents) { - // 显示位置 - final JPanel locationPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); - // 居中 - center = new UIRadioButton(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Dialog_Position_Center")); - // 自定义 - custom = new UIRadioButton(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Dialog_Position_Custom")); - - custom.setBorder(BorderFactory.createEmptyBorder(4, 20, 4, 5)); - ButtonGroup group = new ButtonGroup(); - group.setSelected(center.getModel(), true); - group.add(center); - group.add(custom); - locationPanel.add(center); - locationPanel.add(custom); - - // 位置 距左 - final UILabel leftLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Dialog_Position_Left")); - leftLabel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 10)); - leftLocation = new UINumberField(); - leftLocation.setPreferredSize(new Dimension(40, 20)); - // 位置 距上 - final UILabel topLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Dialog_Position_Top")); - topLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10)); - topLocation = new UINumberField(); - topLocation.setPreferredSize(new Dimension(40, 20)); - - locationPanel.add(leftLabel); - locationPanel.add(leftLocation); - locationPanel.add(topLabel); - locationPanel.add(topLocation); - leftLabel.setVisible(false); - leftLocation.setVisible(false); - topLabel.setVisible(false); - topLocation.setVisible(false); - ChangeListener actionListener = new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - boolean visible = custom.isSelected(); - leftLabel.setVisible(visible); - leftLocation.setVisible(visible); - topLabel.setVisible(visible); - topLocation.setVisible(visible); - } - }; - // 默认居中 - center.setSelected(true); - center.addChangeListener(actionListener); - custom.addChangeListener(actionListener); - - dialogComponents.add(new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Dialog_Show_Position") + ":"), locationPanel}); - } - - private void initFooterPanel(List dialogComponents, List othersComponents) { - // 最下方的配置面板 - // 参数传递方式 - Component[] footerComponents = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Reportlet_Parameter_Type") + ":"), this.setFootPanel()}; - dialogComponents.add(footerComponents); - othersComponents.add(footerComponents); - } - - /** - * 公式输入框 - */ - public class JFormulaField extends JPanel { - private UITextField formulaTextField; - - public JFormulaField(int columns) { - - formulaTextField = new UITextField(columns); - JPanel textFieldPane = new JPanel(new BorderLayout()); - textFieldPane.add(formulaTextField, BorderLayout.CENTER); - textFieldPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); - UIButton formulaButton = new UIButton(IOUtils.readIcon("/com/fr/design/images/m_insert/formula.png")); - formulaButton.setToolTipText(Toolkit.i18nText("Fine-Design_Report_Formula") + "..."); - formulaButton.setPreferredSize(new Dimension(24, formulaTextField.getPreferredSize().height)); - formulaButton.addActionListener(formulaButtonActionListener); - - JPanel pane = new JPanel(new BorderLayout()); - pane.add(textFieldPane, BorderLayout.CENTER); - pane.add(formulaButton, BorderLayout.EAST); - this.setLayout(new BorderLayout()); - this.add(pane, BorderLayout.NORTH); - } - - public void setFormulaText(String formulaContent) { - this.formulaTextField.setText(formulaContent); - } - - public String getFormulaText() { - - String text = formulaTextField.getText(); - if (text == null) { - text = StringUtils.EMPTY; - } - return text; - } - - /** - * 添加事件监听器 - * - * @param listener 公式文本输入框改动事件监听器 - */ - public void addListener(UIObserverListener listener) { - this.formulaTextField.registerChangeListener(listener); - } - - /** - * 取消事件监听器 - */ - public void removeListener() { - this.formulaTextField.registerChangeListener(null); - } - - private ActionListener formulaButtonActionListener = new ActionListener() { - @Override - public void actionPerformed(ActionEvent evt) { - BaseFormula valueFormula = BaseFormula.createFormulaBuilder().build(); - valueFormula.setContent(getFormulaText()); - final UIFormula formulaPane = FormulaFactory.createFormulaPaneWhenReserveFormula(); - formulaPane.populate(valueFormula, VariableResolver.DEFAULT); - formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(ReportletHyperNorthPane.this), new DialogActionAdapter() { - @Override - public void doOk() { - BaseFormula valueFormula = formulaPane.update(); - setFormulaText(valueFormula.getContent()); - } - }).setVisible(true); - } - }; - } -} diff --git a/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperlinkPane.java b/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperlinkPane.java index 532fe467c..e50360c19 100644 --- a/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperlinkPane.java +++ b/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperlinkPane.java @@ -6,30 +6,23 @@ import com.fr.design.gui.frpane.ReportletParameterViewPane; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.itableeditorpane.ParameterTableModel; import com.fr.design.gui.itableeditorpane.UITableEditAction; -import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.module.DesignModuleFactory; import com.fr.design.parameter.ParameterReader; import com.fr.design.utils.gui.GUICoreUtils; + import com.fr.js.ReportletHyperlink; import com.fr.stable.ParameterProvider; import com.fr.stable.StringUtils; -import javax.swing.JOptionPane; -import java.awt.BorderLayout; -import java.awt.FlowLayout; +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.util.HashMap; import java.util.List; public class ReportletHyperlinkPane extends AbstractHyperLinkPane { - /** - * 超链配置面板 - */ - private ReportletHyperNorthPane northPane; - /** - * 是否继承参数勾选框 - */ + private ReporletHyperNorthPane northPane; private UICheckBox extendParametersCheckBox; public ReportletHyperlinkPane(HashMap hyperLinkEditorMap, boolean needRenamePane) { @@ -45,29 +38,22 @@ public class ReportletHyperlinkPane extends AbstractHyperLinkPane Date: Mon, 5 Nov 2018 14:01:31 +0800 Subject: [PATCH 34/35] =?UTF-8?q?REPORT-12324=20=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=99=A8=E3=80=8B=E6=9C=8D=E5=8A=A1=E5=99=A8=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=E4=B8=AD=E6=96=B0=E5=A2=9E=E6=95=B0=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=E9=A2=84=E8=A7=88=E5=90=8E=E6=97=A5=E5=BF=97=E4=B8=AD?= =?UTF-8?q?=E5=87=BA=E7=8E=B0=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/data/datapane/TreeTableDataDictPane.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TreeTableDataDictPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/TreeTableDataDictPane.java index 81c791282..f1f1c6c75 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TreeTableDataDictPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TreeTableDataDictPane.java @@ -16,12 +16,15 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; - -import com.fr.script.Calculator; import com.fr.stable.StringUtils; -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.ButtonGroup; +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; @@ -155,7 +158,6 @@ public class TreeTableDataDictPane extends BasicPane implements Previewable { } } rtd.setTableDataSource(DesignTableDataManager.getEditingTableDataSource()); - rtd.createDataModel(Calculator.createCalculator()); PreviewTablePane.previewTableData(rtd); } }); From f086badbf6a0d839f5cf141d80c724b044265ffb Mon Sep 17 00:00:00 2001 From: richie Date: Tue, 13 Nov 2018 12:04:05 +0800 Subject: [PATCH 35/35] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20=20webs?= =?UTF-8?q?ocket=E7=AB=AF=E5=8F=A3=E5=8F=AF=E4=BB=A5=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E5=A4=9A=E4=B8=AA=E5=8F=AF=E9=80=89=E7=AB=AF?= =?UTF-8?q?=E5=8F=A3=EF=BC=8C=E8=AE=A9=E5=8D=95=E6=9C=BA=E5=A4=9A=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E9=9B=86=E7=BE=A4=E5=8F=AF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/socketio/DesignerSocketIO.java | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java index 132d72d17..bcf7450e1 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java @@ -68,8 +68,8 @@ public class DesignerSocketIO { return; } try { - String uri = getSocketUri(current); - socketIO = Optional.of(IO.socket(new URI(uri))); + String[] uri = getSocketUri(current); + socketIO = Optional.of(IO.socket(new URI(uri[0]))); socketIO.get().on(WorkspaceConstants.WS_LOGRECORD, printLog); socketIO.get().on(WorkspaceConstants.CONFIG_MODIFY, new Emitter.Listener() { @Override @@ -109,19 +109,23 @@ public class DesignerSocketIO { } } - private static String getSocketUri(Workspace current) throws IOException { + private static String[] getSocketUri(Workspace current) throws IOException { URL url = new URL(current.getPath()); - int port = WorkContext.getCurrent().get(SocketInfoOperator.class).getPort(); + Integer[] ports = WorkContext.getCurrent().get(SocketInfoOperator.class).getPort(); WorkspaceConnection connection = WorkContext.getCurrent().getConnection(); - return String.format("%s://%s:%s%s?%s=%s&%s=%s", - url.getProtocol(), - url.getHost(), - port, - WorkspaceConstants.WS_NAMESPACE, - DecisionServiceConstants.WEB_SOCKET_TOKEN_NAME, - connection.getToken(), - RemoteDesignConstants.USER_LOCK_ID, - connection.getId() - ); + String[] result = new String[ports.length]; + for (int i = 0; i < ports.length; i++ ) { + result[i] = String.format("%s://%s:%s%s?%s=%s&%s=%s", + url.getProtocol(), + url.getHost(), + ports[i], + WorkspaceConstants.WS_NAMESPACE, + DecisionServiceConstants.WEB_SOCKET_TOKEN_NAME, + connection.getToken(), + RemoteDesignConstants.USER_LOCK_ID, + connection.getId()); + } + return result; + } }