From 434f4a0f5622140dab6dd1c2d5d50335ecf0011c Mon Sep 17 00:00:00 2001 From: kuangshuai Date: Mon, 15 Mar 2021 16:37:32 +0800 Subject: [PATCH 1/4] =?UTF-8?q?CHART-18080=20=E4=BF=AE=E5=A4=8D=E6=95=B0?= =?UTF-8?q?=E5=AD=97=E8=BE=93=E5=85=A5=E6=A1=86=E8=BE=93=E5=85=A5=E4=B8=AD?= =?UTF-8?q?=E6=96=87=E6=97=B6=E8=87=AA=E5=8A=A8=E5=88=A0=E9=99=A4=E6=95=B0?= =?UTF-8?q?=E5=AD=97=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/gui/itextfield/UINumberField.java | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java b/designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java index f4437a9c4..8176905fe 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java +++ b/designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java @@ -5,11 +5,15 @@ import com.fr.general.ComparatorUtils; import com.fr.stable.CoreConstants; import com.fr.stable.StringUtils; +import javax.swing.event.CaretEvent; +import javax.swing.event.CaretListener; import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; import javax.swing.text.PlainDocument; import java.awt.Dimension; import java.awt.Toolkit; +import java.awt.event.InputMethodEvent; +import java.awt.event.InputMethodListener; /** * Number Field. @@ -35,6 +39,8 @@ public class UINumberField extends UITextField { private boolean isContentChanged = false; private boolean fillNegativeNumber = true; + private boolean isInputMethodChange = false; + private int insertOffset = 0; public UINumberField() { this(MAX_INTEGERLENGTH_32, MAX_DECIMALLENGTH); @@ -55,6 +61,7 @@ public class UINumberField extends UITextField { this.minValue = minValue; this.maxValue = maxValue; setFieldDocument(); + initFieldListener(); } public void setFieldDocument() { @@ -62,6 +69,31 @@ public class UINumberField extends UITextField { initListener(); } + private void initFieldListener() { + addInputMethodListener(new InputMethodListener() { + @Override + public void inputMethodTextChanged(InputMethodEvent event) { + isInputMethodChange = true; + } + + @Override + public void caretPositionChanged(InputMethodEvent event) { + } + }); + + addCaretListener(new CaretListener() { + @Override + public void caretUpdate(CaretEvent e) { + if (isInputMethodChange) { + isInputMethodChange = false; + setCaretPosition(insertOffset); + } else { + insertOffset = e.getDot(); + } + } + }); + } + public void canFillNegativeNumber(boolean fillNegativeNumber) { this.fillNegativeNumber = fillNegativeNumber; } @@ -186,6 +218,13 @@ public class UINumberField extends UITextField { super.insertString(offset, s, a); } + public void remove(int offs, int len) throws BadLocationException { + if (isInputMethodChange) { + return; + } + super.remove(offs, len); + } + // kunsnat: 这种限制输入 有个不好的地方, 比如删除时: 10.1 最大值限定100, 那么就删除中间的小数点之后变为101, 超出了100. // 但是直接限制不能删除中间类似小数点, 那么也可能遇到: 最小值10 , 从100变化到其中的19, 就很难.. private boolean notChange(String strNew) { From e329e432ff304be65ff69f0cf06f487462b20eaf Mon Sep 17 00:00:00 2001 From: kuangshuai Date: Wed, 24 Mar 2021 17:37:41 +0800 Subject: [PATCH 2/4] =?UTF-8?q?CHART-18080=20=E5=8F=98=E9=87=8F=E5=90=8D?= =?UTF-8?q?=E6=9B=B4=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/itextfield/UINumberField.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java b/designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java index 8176905fe..62d24c56a 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java +++ b/designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java @@ -39,7 +39,10 @@ public class UINumberField extends UITextField { private boolean isContentChanged = false; private boolean fillNegativeNumber = true; - private boolean isInputMethodChange = false; + /** + * 输入法输入完成一个字符输入过程的标记。开始输入的时候是true,输入完矫正光标后为false + */ + private boolean isInputMethodOnceInserting = false; private int insertOffset = 0; public UINumberField() { @@ -73,7 +76,7 @@ public class UINumberField extends UITextField { addInputMethodListener(new InputMethodListener() { @Override public void inputMethodTextChanged(InputMethodEvent event) { - isInputMethodChange = true; + isInputMethodOnceInserting = true; } @Override @@ -84,8 +87,8 @@ public class UINumberField extends UITextField { addCaretListener(new CaretListener() { @Override public void caretUpdate(CaretEvent e) { - if (isInputMethodChange) { - isInputMethodChange = false; + if (isInputMethodOnceInserting) { + isInputMethodOnceInserting = false; setCaretPosition(insertOffset); } else { insertOffset = e.getDot(); @@ -219,7 +222,7 @@ public class UINumberField extends UITextField { } public void remove(int offs, int len) throws BadLocationException { - if (isInputMethodChange) { + if (isInputMethodOnceInserting) { return; } super.remove(offs, len); From 018f559fbd8b1022b55d7eb6e0b5f345af4614a8 Mon Sep 17 00:00:00 2001 From: Yvan Date: Thu, 25 Mar 2021 16:48:26 +0800 Subject: [PATCH 3/4] =?UTF-8?q?REPORT-50191=20=E8=AE=BE=E8=AE=A1=E5=99=A8-?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=99=A8=E6=95=B0=E6=8D=AE=E9=9B=86-?= =?UTF-8?q?=E5=B7=A6=E4=B8=8B=E8=A7=92=E5=9B=BE=E6=A0=87=E5=8F=98=E5=8C=96?= =?UTF-8?q?=E5=A4=B1=E6=95=88=20=E3=80=90=E9=97=AE=E9=A2=98=E5=8E=9F?= =?UTF-8?q?=E5=9B=A0=E3=80=91REPORT-49782=E4=BB=BB=E5=8A=A1=E4=B8=AD?= =?UTF-8?q?=E8=A1=A5=E5=85=85=E5=9B=BE=E6=A0=87=E7=9A=84=E6=97=B6=E5=80=99?= =?UTF-8?q?=EF=BC=8C=E5=9B=BE=E6=A0=87=E5=90=8D=E7=A7=B0=E5=86=99=E9=94=99?= =?UTF-8?q?=E4=BA=86=EF=BC=8C=E5=AF=BC=E8=87=B4=E6=B2=A1=E8=AF=86=E5=88=AB?= =?UTF-8?q?=E5=87=BA=E6=9D=A5=20=E3=80=90=E6=94=B9=E5=8A=A8=E6=80=9D?= =?UTF-8?q?=E8=B7=AF=E3=80=91=E4=BF=AE=E6=94=B9=E5=9B=BE=E6=A0=87=E5=90=8D?= =?UTF-8?q?=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/images/control/{edit_disable.svg => edit_disabled.svg} | 0 .../images/control/{remove_disable.svg => remove_disabled.svg} | 0 .../images/m_file/{preview_disable.svg => preview_disabled.svg} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename designer-base/src/main/resources/com/fr/design/images/control/{edit_disable.svg => edit_disabled.svg} (100%) rename designer-base/src/main/resources/com/fr/design/images/control/{remove_disable.svg => remove_disabled.svg} (100%) rename designer-base/src/main/resources/com/fr/design/images/m_file/{preview_disable.svg => preview_disabled.svg} (100%) diff --git a/designer-base/src/main/resources/com/fr/design/images/control/edit_disable.svg b/designer-base/src/main/resources/com/fr/design/images/control/edit_disabled.svg similarity index 100% rename from designer-base/src/main/resources/com/fr/design/images/control/edit_disable.svg rename to designer-base/src/main/resources/com/fr/design/images/control/edit_disabled.svg diff --git a/designer-base/src/main/resources/com/fr/design/images/control/remove_disable.svg b/designer-base/src/main/resources/com/fr/design/images/control/remove_disabled.svg similarity index 100% rename from designer-base/src/main/resources/com/fr/design/images/control/remove_disable.svg rename to designer-base/src/main/resources/com/fr/design/images/control/remove_disabled.svg diff --git a/designer-base/src/main/resources/com/fr/design/images/m_file/preview_disable.svg b/designer-base/src/main/resources/com/fr/design/images/m_file/preview_disabled.svg similarity index 100% rename from designer-base/src/main/resources/com/fr/design/images/m_file/preview_disable.svg rename to designer-base/src/main/resources/com/fr/design/images/m_file/preview_disabled.svg From bc700703fc98f626511dc746f2e060a2eed2942b Mon Sep 17 00:00:00 2001 From: Yvan Date: Fri, 26 Mar 2021 17:13:42 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=EF=BC=8C?= =?UTF-8?q?=E5=A4=84=E7=90=86=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/images/m_file/preview_disable.svg | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 designer-base/src/main/resources/com/fr/design/images/m_file/preview_disable.svg diff --git a/designer-base/src/main/resources/com/fr/design/images/m_file/preview_disable.svg b/designer-base/src/main/resources/com/fr/design/images/m_file/preview_disable.svg deleted file mode 100644 index 2d64f68f7..000000000 --- a/designer-base/src/main/resources/com/fr/design/images/m_file/preview_disable.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - icon_报表web属性_打印预览_normal - - - - - - - -