From 5c7c4bd888fdaf105ef70af64b056430e7d12bf7 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Fri, 27 Aug 2021 11:00:23 +0800 Subject: [PATCH 1/4] =?UTF-8?q?REPORT-58136=20=E8=BF=9C=E7=A8=8B=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E6=97=A0=E6=B3=95=E6=96=B0=E5=BB=BA=E5=86=B3=E7=AD=96?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/mainframe/JTemplateNameHelper.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java index 4e201a5efa..607c91aef1 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java @@ -53,6 +53,9 @@ public class JTemplateNameHelper { * @Date 2021/4/9 11:13 **/ private static Integer getFileNameIndex(String prefix, String fileName) { + if (fileName.length() <= prefix.length()) { + return null; + } char[] chars = new char[fileName.length()]; int i = 0; for (; i < fileName.length(); i++) { From 1b7f5cf7761e9ad8c0c37926fe3a23e5fa3b4aa8 Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 8 Sep 2021 17:31:07 +0800 Subject: [PATCH 2/4] =?UTF-8?q?REPORT-58227=20=E8=BF=9C=E7=A8=8B=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=20=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E5=B7=B2=E7=BB=8F=E6=89=93=E5=BC=80=E7=9A=84=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E5=8D=A1=E9=A1=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/data/datapane/ChoosePane.java | 48 ++++++++++++++-- .../connect/ItemEditableComboBoxPanel.java | 55 ++++++++++++++----- 2 files changed, 84 insertions(+), 19 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java index b5bc39e4eb..f656105265 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java @@ -25,6 +25,7 @@ import com.fr.design.gui.icombobox.UIComboBoxEditor; import com.fr.design.gui.icombobox.UIComboBoxRenderer; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; @@ -39,7 +40,16 @@ import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; import com.fr.workspace.server.connection.DBConnectAuth; -import javax.swing.*; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.util.Collections; +import java.util.concurrent.CancellationException; +import javax.swing.JList; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JTree; +import javax.swing.SwingWorker; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.PopupMenuEvent; @@ -50,7 +60,6 @@ import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreeCellRenderer; import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; -import java.awt.*; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; import java.awt.event.ItemEvent; @@ -70,6 +79,9 @@ import java.util.concurrent.FutureTask; * @since 2012-7-11下午4:49:39 */ public class ChoosePane extends BasicBeanPane implements Refreshable, Previewable, Prepare4DataSourceChange { + + private static final List PENDING_CONTENT = new ArrayList<>(Collections.singletonList(Toolkit.i18nText("Fine-Design_Basic_Loading") + "...")); + private static final double COLUMN_SIZE = 24; /** @@ -91,6 +103,8 @@ public class ChoosePane extends BasicBeanPane implements Refresha private SwingWorker populateWorker; + private SwingWorker, Void> initWorker; + private PopupMenuListener popupMenuListener = new PopupMenuListener() { @Override @@ -213,10 +227,34 @@ public class ChoosePane extends BasicBeanPane implements Refresha @SuppressWarnings("unchecked") protected void initDsNameComboBox() { + if (initWorker != null && !initWorker.isDone()) { + initWorker.cancel(true); + } dsNameComboBox.setRefreshingModel(true); - FilterableComboBoxModel dsNameComboBoxModel = new FilterableComboBoxModel(getHasAuthConnections()); - dsNameComboBox.setModel(dsNameComboBoxModel); - dsNameComboBox.setRefreshingModel(false); + dsNameComboBox.setModel(new FilterableComboBoxModel(PENDING_CONTENT)); + initWorker = new SwingWorker, Void>() { + + @Override + protected List doInBackground() throws Exception { + return getHasAuthConnections(); + } + + @Override + protected void done() { + try { + FilterableComboBoxModel dsNameComboBoxModel = new FilterableComboBoxModel(get()); + String selected = dsNameComboBox.getSelectedItem(); + dsNameComboBox.setModel(dsNameComboBoxModel); + dsNameComboBox.setSelectedItem(selected); + dsNameComboBox.setRefreshingModel(false); + } catch (Exception e) { + if (!(e instanceof CancellationException)) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + } + }; + initWorker.execute(); } protected void initComponentsLayout(PreviewLabel previewLabel, int labelSize) { diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java index f06d1405b8..248d3318c9 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java @@ -3,12 +3,19 @@ package com.fr.design.data.datapane.connect; import com.fr.base.BaseUtils; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; -import javax.swing.*; -import java.awt.*; +import com.fr.log.FineLoggerFactory; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.util.Iterator; +import java.util.concurrent.CancellationException; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JPanel; +import javax.swing.SwingWorker; public abstract class ItemEditableComboBoxPanel extends JPanel { /** @@ -16,6 +23,8 @@ public abstract class ItemEditableComboBoxPanel extends JPanel { */ private static final long serialVersionUID = 1L; + private static final String PENDING = Toolkit.i18nText("Fine-Design_Basic_Loading") + "..."; + protected static final Object EMPTY = new Object() { public String toString() { return ""; @@ -26,6 +35,8 @@ public abstract class ItemEditableComboBoxPanel extends JPanel { protected UIButton editButton; protected UIButton refreshButton; + private SwingWorker, Void> refreshWorker; + public ItemEditableComboBoxPanel() { super(); @@ -75,26 +86,42 @@ public abstract class ItemEditableComboBoxPanel extends JPanel { * 刷新itemComboBox的内容 */ protected void refreshItems() { - // 记录原来选中的Item,重新加载后需要再次选中 - Object lastSelectedItem = itemComboBox.getSelectedItem(); + + if (refreshWorker != null && !refreshWorker.isDone()) { + refreshWorker.cancel(true); + } DefaultComboBoxModel model = ((DefaultComboBoxModel) itemComboBox.getModel()); model.removeAllElements(); // 先加EMPTY,再加items model.addElement(EMPTY); + model.addElement(PENDING); - java.util.Iterator itemIt = items(); - while(itemIt.hasNext()) { - model.addElement(itemIt.next()); - } + refreshWorker = new SwingWorker, Void>() { + @Override + protected Iterator doInBackground() throws Exception { + return items(); + } - // 再次选中之前选中的Item - int idx = model.getIndexOf(lastSelectedItem); - if(idx < 0) { - idx = 0; - } - itemComboBox.setSelectedIndex(idx); + @Override + protected void done() { + try { + Iterator itemIt = get(); + model.removeElement(PENDING); + while(itemIt.hasNext()) { + model.addElement(itemIt.next()); + } + itemComboBox.setMaximumRowCount(itemComboBox.getMaximumRowCount() + 1); + } catch (Exception e) { + if (!(e instanceof CancellationException)) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + + } + }; + refreshWorker.execute(); } /* From 48d4c2ab9f0116574e24db8be39f7cf625075879 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Thu, 9 Sep 2021 09:39:35 +0800 Subject: [PATCH 3/4] =?UTF-8?q?REPORT-58592=20=E6=97=A5=E8=AF=AD=E7=89=88?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=20=E5=BC=95=E7=94=A8css=E5=92=8CJav?= =?UTF-8?q?aScript=E7=9A=84=E9=80=89=E6=8B=A9=E6=96=87=E4=BB=B6=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E6=98=BE=E7=A4=BA=E4=B8=8D=E5=87=BA=E6=9D=A5=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/com/fr/design/i18n/dimension_en.properties | 3 ++- .../resources/com/fr/design/i18n/dimension_ja_JP.properties | 3 ++- .../resources/com/fr/design/i18n/dimension_ko_KR.properties | 3 ++- .../resources/com/fr/design/i18n/dimension_zh.properties | 3 ++- .../resources/com/fr/design/i18n/dimension_zh_TW.properties | 3 ++- .../src/main/java/com/fr/design/webattr/WebCssPane.java | 3 ++- .../src/main/java/com/fr/design/webattr/WebJsPane.java | 5 +++-- 7 files changed, 15 insertions(+), 8 deletions(-) diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties index dd33c6a6a4..ef851ffe3f 100644 --- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties +++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties @@ -6,4 +6,5 @@ com.fr.design.report.ReportColumnsPane=800*600 com.fr.env.RemoteEnvPane.dialog=458*132 com.fr.design.version.check.dialog=490*95 com.fr.design.version.detail.label=750*30 -com.fr.design.version.detail.dialog=900*500 \ No newline at end of file +com.fr.design.version.detail.dialog=900*500 +com.fr.design.web.pane.text.field=450*20 \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties index b67a913e7a..379c257449 100644 --- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties +++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties @@ -5,4 +5,5 @@ com.fr.design.mainframe.check.CheckFontInfoDialog.unfold=610*280 com.fr.env.RemoteEnvPane.dialog=458*132 com.fr.design.version.check.dialog=430*95 com.fr.design.version.detail.label=650*30 -com.fr.design.version.detail.dialog=800*500 \ No newline at end of file +com.fr.design.version.detail.dialog=800*500 +com.fr.design.web.pane.text.field=400*20 \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties index 862580eedc..62ee87a7c4 100644 --- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties +++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties @@ -5,4 +5,5 @@ com.fr.design.mainframe.check.CheckFontInfoDialog.unfold=490*280 com.fr.env.RemoteEnvPane.dialog=458*132 com.fr.design.version.check.dialog=450*95 com.fr.design.version.detail.label=700*30 -com.fr.design.version.detail.dialog=850*500 \ No newline at end of file +com.fr.design.version.detail.dialog=850*500 +com.fr.design.web.pane.text.field=450*20 \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties index 5a325b16bb..fff64947d9 100644 --- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties +++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties @@ -6,4 +6,5 @@ com.fr.design.mainframe.check.CheckFontInfoDialog.unfold=385*280 com.fr.env.RemoteEnvPane.dialog=308*132 com.fr.design.version.check.dialog=230*95 com.fr.design.version.detail.label=450*30 -com.fr.design.version.detail.dialog=600*500 \ No newline at end of file +com.fr.design.version.detail.dialog=600*500 +com.fr.design.web.pane.text.field=450*20 \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties index 1be37f9c7a..4b2de3f02c 100644 --- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties +++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties @@ -5,4 +5,5 @@ com.fr.design.mainframe.check.CheckFontInfoDialog.unfold=385*280 com.fr.env.RemoteEnvPane.dialog=308*132 com.fr.design.version.check.dialog=230*95 com.fr.design.version.detail.label=450*30 -com.fr.design.version.detail.dialog=600*500 \ No newline at end of file +com.fr.design.version.detail.dialog=600*500 +com.fr.design.web.pane.text.field=450*20 \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/webattr/WebCssPane.java b/designer-realize/src/main/java/com/fr/design/webattr/WebCssPane.java index 9ebbf875fe..7dcd3e21b2 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/WebCssPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/WebCssPane.java @@ -5,6 +5,7 @@ import com.fr.design.gui.frpane.EditingStringListPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.i18n.DesignSizeI18nManager; import com.fr.design.mainframe.DesignerContext; import com.fr.design.widget.FRWidgetFactory; import com.fr.file.FILE; @@ -38,7 +39,7 @@ public class WebCssPane extends BasicPane { JPanel outnorth = new JPanel(new BorderLayout(0, 5)); JPanel northPane = new JPanel(new FlowLayout(FlowLayout.LEFT,8,0)); localText = new UITextField(); - localText.setPreferredSize(new Dimension(450, 20)); + localText.setPreferredSize(DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.web.pane.text.field")); localText.setEditable(false); chooseFile = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Selection")); chooseFile.setPreferredSize(new Dimension(75, 23)); diff --git a/designer-realize/src/main/java/com/fr/design/webattr/WebJsPane.java b/designer-realize/src/main/java/com/fr/design/webattr/WebJsPane.java index b2934b10e3..7b371802b6 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/WebJsPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/WebJsPane.java @@ -7,6 +7,7 @@ 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.gui.itextfield.UITextField; +import com.fr.design.i18n.DesignSizeI18nManager; import com.fr.design.mainframe.DesignerContext; import com.fr.design.widget.FRWidgetFactory; import com.fr.file.FILE; @@ -66,8 +67,8 @@ public class WebJsPane extends BasicPane { localText = new UITextField(); localText.setEditable(false); urlText = new UITextField(); - localText.setPreferredSize(new Dimension(450, 20)); - urlText.setPreferredSize(new Dimension(450, 20)); + localText.setPreferredSize(DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.web.pane.text.field")); + urlText.setPreferredSize(DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.web.pane.text.field")); urlText.addKeyListener(urlTextListener); urlText.setEnabled(false); chooseFile = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Selection")); From 2bfab3ce67865f948c180fc83367d42d2ca0a80d Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Thu, 9 Sep 2021 09:46:24 +0800 Subject: [PATCH 4/4] =?UTF-8?q?REPORT-58592=20=E6=97=A5=E8=AF=AD=E7=89=88?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=20=E5=BC=95=E7=94=A8css=E5=92=8CJav?= =?UTF-8?q?aScript=E7=9A=84=E9=80=89=E6=8B=A9=E6=96=87=E4=BB=B6=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E6=98=BE=E7=A4=BA=E4=B8=8D=E5=87=BA=E6=9D=A5=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/mainframe/JTemplateNameHelper.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java index 607c91aef1..4e201a5efa 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java @@ -53,9 +53,6 @@ public class JTemplateNameHelper { * @Date 2021/4/9 11:13 **/ private static Integer getFileNameIndex(String prefix, String fileName) { - if (fileName.length() <= prefix.length()) { - return null; - } char[] chars = new char[fileName.length()]; int i = 0; for (; i < fileName.length(); i++) {