Browse Source

Merge pull request #2080 in DESIGN/design from release/10.0 to bugfix/10.0

* commit 'ec083560ed5cda9d1f395618178f076c3724dae1':
  问题修复
  REPORT-37353【frm设计界面支持缩放】缩放过程中,如果进行图表编辑,拖动滚动条,就会重叠
  REPORT-36778 【配合平台】版本号规范FR适配任务 去除多处的空格
  REPORT-36778 【配合平台】版本号规范FR适配任务 去除多处的空格
  REPORT-27497 编辑单元格输入韩文时字会缺失 使用java自带方式判断 + 漏传代码
  REPORT-27497 编辑单元格输入韩文时字会缺失
bugfix/10.0
superman 4 years ago
parent
commit
d81e86642e
  1. 7
      designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java
  2. 7
      designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java
  3. 4
      designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java
  4. 16
      designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java
  5. 10
      designer-realize/src/main/java/com/fr/grid/Grid.java
  6. 5
      designer-realize/src/main/java/com/fr/grid/GridKeyListener.java
  7. 31
      designer-realize/src/main/java/com/fr/grid/action/GridInputAction.java
  8. 53
      designer-realize/src/main/java/com/fr/grid/help/GridHelper.java
  9. 47
      designer-realize/src/test/java/com/fr/grid/help/GridHelperTest.java

7
designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java

@ -303,12 +303,13 @@ public class AboutPane extends JPanel {
public BoxCenterAlignmentCopyablePane(String title, String copyText, final String[] descriptions) { public BoxCenterAlignmentCopyablePane(String title, String copyText, final String[] descriptions) {
setLayout(FRGUIPaneFactory.createBorderLayout()); setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel centerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel centerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
this.label = new UILabel(title); if (StringUtils.isNotEmpty(title)) {
this.label = new UILabel(title);
centerPane.add(label);
}
this.textField = new UILabel(copyText); this.textField = new UILabel(copyText);
textField.setBackground(null); textField.setBackground(null);
textField.setBorder(null); textField.setBorder(null);
centerPane.add(label);
centerPane.add(textField); centerPane.add(textField);
textField.addMouseListener(new MouseAdapter() { textField.addMouseListener(new MouseAdapter() {
@Override @Override

7
designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java

@ -117,6 +117,13 @@ public enum SupportOSImpl implements SupportOS {
public boolean support() { public boolean support() {
return OperatingSystem.isWindows(); return OperatingSystem.isWindows();
} }
},
KOREAN_INPUT {
@Override
public boolean support() {
return OperatingSystem.isWindows();
}
} }
} }

4
designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java

@ -685,8 +685,8 @@ public class EditingMouseListener extends MouseInputAdapter {
Rectangle rect = ComponentUtils.getRelativeBounds(currentXCreator); Rectangle rect = ComponentUtils.getRelativeBounds(currentXCreator);
Rectangle bounds = new Rectangle(1, 1, currentXCreator.getWidth() - 2, currentXCreator.getHeight() - 2); Rectangle bounds = new Rectangle(1, 1, currentXCreator.getWidth() - 2, currentXCreator.getHeight() - 2);
bounds.x += (rect.x - designer.getArea().getHorizontalValue()); bounds.x += (rect.x - designer.getHorizontalScaleValue());
bounds.y += (rect.y - designer.getArea().getVerticalValue()); bounds.y += (rect.y - designer.getVerticalScaleValue());
if (currentXCreator instanceof XEditorHolder) { if (currentXCreator instanceof XEditorHolder) {
ToolTipEditor.getInstance().resetBounds((XEditorHolder) currentXCreator, bounds, currentEditor.getEditorTarget().getBounds()); ToolTipEditor.getInstance().resetBounds((XEditorHolder) currentXCreator, bounds, currentEditor.getEditorTarget().getBounds());
} }

16
designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java

@ -177,13 +177,13 @@ public class FormDesignerUI extends ComponentUI {
if (k == 1 || k == 2) { if (k == 1 || k == 2) {
x1 = 0; x1 = 0;
x2 = 6; x2 = 6;
y2 = y1 = bounds.y - designer.getArea().getVerticalValue() + (k == 1 ? 0 : bounds.height); y2 = y1 = bounds.y - designer.getVerticalScaleValue() + (k == 1 ? 0 : bounds.height);
text = Utils.objectToString(y1 + designer.getArea().getVerticalValue()); text = Utils.objectToString(bounds.y);
} else { } else {
y1 = 0; y1 = 0;
y2 = 6; y2 = 6;
x1 = x2 = bounds.x - designer.getArea().getHorizontalValue() + (k == 3 ? 0 : bounds.width); x1 = x2 = bounds.x - designer.getHorizontalScaleValue()+ (k == 3 ? 0 : bounds.width);
text = Utils.objectToString(x1 + designer.getArea().getHorizontalValue()); text = Utils.objectToString(bounds.x);
} }
text += com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Indent_Pixel"); text += com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Indent_Pixel");
g2d.setColor(XCreatorConstants.RESIZE_BOX_BORDER_COLOR); g2d.setColor(XCreatorConstants.RESIZE_BOX_BORDER_COLOR);
@ -409,8 +409,8 @@ public class FormDesignerUI extends ComponentUI {
clipg = g.create( clipg = g.create(
-designer.getHorizontalScaleValue(), -designer.getHorizontalScaleValue(),
-designer.getVerticalScaleValue() + designer.getParaHeight(), -designer.getVerticalScaleValue() + designer.getParaHeight(),
parent.getSize().width + designer.getArea().getHorizontalValue(), (int) ((parent.getSize().width + designer.getArea().getHorizontalValue()) / designer.getScale()),
parent.getSize().height + designer.getArea().getVerticalValue()); (int) ((parent.getSize().height + designer.getArea().getVerticalValue()) / designer.getScale()));
designer.paintContent(clipg); designer.paintContent(clipg);
paintWatermark((Graphics2D) clipg); paintWatermark((Graphics2D) clipg);
@ -435,8 +435,8 @@ public class FormDesignerUI extends ComponentUI {
Graphics clipg1; Graphics clipg1;
clipg1 = g.create(-designer.getHorizontalScaleValue(), clipg1 = g.create(-designer.getHorizontalScaleValue(),
-designer.getVerticalScaleValue(), -designer.getVerticalScaleValue(),
parent.getSize().width + designer.getArea().getHorizontalValue(), (int) ((parent.getSize().width + designer.getArea().getHorizontalValue()) / designer.getScale()),
designer.getParaHeight() + designer.getArea().getVerticalValue()); (int) ((designer.getParaHeight() + designer.getArea().getVerticalValue()) / designer.getScale()));
designer.paintPara(clipg1); designer.paintPara(clipg1);
clipg1.dispose(); clipg1.dispose();

10
designer-realize/src/main/java/com/fr/grid/Grid.java

@ -130,6 +130,8 @@ public class Grid extends BaseGridComponent {
private boolean notShowingTableSelectPane = true; private boolean notShowingTableSelectPane = true;
private GridMouseAdapter gridMouseAdapter; private GridMouseAdapter gridMouseAdapter;
private boolean needRequestFocus = true;
public Grid(int resolution) { public Grid(int resolution) {
this.resolution = resolution; this.resolution = resolution;
// 能触发processEvent,不管是否给component增加listener // 能触发processEvent,不管是否给component增加listener
@ -259,6 +261,10 @@ public class Grid extends BaseGridComponent {
this.getElementCasePane().repaint(); this.getElementCasePane().repaint();
} }
public void setNeedRequestFocus(boolean needRequestFocus) {
this.needRequestFocus = needRequestFocus;
}
/** /**
* Gets vertical frozen line color. * Gets vertical frozen line color.
*/ */
@ -908,7 +914,9 @@ public class Grid extends BaseGridComponent {
this.validate(); this.validate();
// 需要重新绘制界面 // 需要重新绘制界面
this.repaint(10); this.repaint(10);
this.editorComponent.requestFocus(); if (this.needRequestFocus) {
this.editorComponent.requestFocus();
}
} }
/** /**

5
designer-realize/src/main/java/com/fr/grid/GridKeyListener.java

@ -2,10 +2,12 @@ package com.fr.grid;
import com.fr.common.inputevent.InputEventBaseOnOS; import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.grid.action.GridInputAction;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.FloatSelection;
import com.fr.grid.selection.Selection; import com.fr.grid.selection.Selection;
import com.fr.report.elementcase.ElementCase; import com.fr.report.elementcase.ElementCase;
import com.fr.stable.os.support.OSSupportCenter;
import java.awt.*; import java.awt.*;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
@ -177,6 +179,9 @@ public class GridKeyListener implements KeyListener {
return; return;
} }
if (!grid.isCellEditing()) { if (!grid.isCellEditing()) {
GridInputAction action = OSSupportCenter.getAction(GridInputAction.class);
action.register(grid, ch);
action.execute();
grid.startEditing(true); grid.startEditing(true);
} }

31
designer-realize/src/main/java/com/fr/grid/action/GridInputAction.java

@ -0,0 +1,31 @@
package com.fr.grid.action;
import com.fr.design.os.impl.SupportOSImpl;
import com.fr.grid.Grid;
import com.fr.grid.help.GridHelper;
import com.fr.stable.os.support.OSBasedAction;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/8/12
*/
public class GridInputAction implements OSBasedAction {
private Grid grid;
private char ch;
@Override
public void execute(Object... objects) {
// win下韩语输入法与其他输入法不一样 在输入第二个字符时 就开始触发keyType 而其中grid的焦点转移会导致输入失效
boolean accept = SupportOSImpl.KOREAN_INPUT.support() && grid != null;
if (accept) {
grid.setNeedRequestFocus(!GridHelper.isKoreanCharacter(ch));
}
}
public void register(Grid grid, char ch) {
this.grid = grid;
this.ch = ch;
}
}

53
designer-realize/src/main/java/com/fr/grid/help/GridHelper.java

@ -0,0 +1,53 @@
package com.fr.grid.help;
/**
* 韩文unicode编码范围
* http://www.ch2ko.com/hanguoyu/hanwen-unicode/
*
* 韩文音节AC00-D7AF
* Character.UnicodeBlock.HANGUL_SYLLABLES
* https://www.unicode.org/charts/PDF/UAC00.pdf
*
*
* 韩文兼容字母3130-318F
* Character.UnicodeBlock.HANGUL_COMPATIBILITY_JAMO
* https://www.unicode.org/charts/PDF/U3130.pdf
*
*
* 韩文字母1100-11FF
* Character.UnicodeBlock.HANGUL_JAMO
* https://www.unicode.org/charts/PDF/U1100.pdf
*
*
* 韩文字母扩展A
* Character.UnicodeBlock.HANGUL_JAMO_EXTENDED_A
* https://www.unicode.org/charts/PDF/UA960.pdf
*
*
* 韩文字母扩展B
* haracter.UnicodeBlock.HANGUL_JAMO_EXTENDED_B
* https://www.unicode.org/charts/PDF/UD7B0.pdf
*
*
* 使用java内部的韩文unicode集判断
*
* @author hades
* @version 10.0
* Created by hades on 2020/8/7
*/
public class GridHelper {
/**
* 韩国货币符号
*/
private static final char HEX_20A9 = 0x20A9;
public static boolean isKoreanCharacter(char value) {
Character.UnicodeBlock unicodeBlock = Character.UnicodeBlock.of(value);
return unicodeBlock == Character.UnicodeBlock.HANGUL_JAMO
|| unicodeBlock == Character.UnicodeBlock.HANGUL_COMPATIBILITY_JAMO
|| unicodeBlock == Character.UnicodeBlock.HANGUL_SYLLABLES
|| unicodeBlock == Character.UnicodeBlock.HANGUL_JAMO_EXTENDED_A
|| unicodeBlock == Character.UnicodeBlock.HANGUL_JAMO_EXTENDED_B
|| value == HEX_20A9;
}
}

47
designer-realize/src/test/java/com/fr/grid/help/GridHelperTest.java

@ -0,0 +1,47 @@
package com.fr.grid.help;
import junit.framework.TestCase;
import org.junit.Assert;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/8/7
*/
public class GridHelperTest extends TestCase {
/**
* 为空
*/
private char ch;
public void testIsKoreanCharacter() {
Assert.assertFalse(GridHelper.isKoreanCharacter('1'));
Assert.assertFalse(GridHelper.isKoreanCharacter('A'));
Assert.assertFalse(GridHelper.isKoreanCharacter('z'));
Assert.assertFalse(GridHelper.isKoreanCharacter('测'));
Assert.assertFalse(GridHelper.isKoreanCharacter('測'));
Assert.assertFalse(GridHelper.isKoreanCharacter('鐪'));
Assert.assertFalse(GridHelper.isKoreanCharacter('&'));
Assert.assertFalse(GridHelper.isKoreanCharacter(' '));
Assert.assertFalse(GridHelper.isKoreanCharacter(ch));
Assert.assertFalse(GridHelper.isKoreanCharacter('は'));
Assert.assertTrue(GridHelper.isKoreanCharacter('먀'));
Assert.assertTrue(GridHelper.isKoreanCharacter('이'));
Assert.assertTrue(GridHelper.isKoreanCharacter('한'));
// 韩文音节
Assert.assertTrue(GridHelper.isKoreanCharacter('휖'));
// 韩文兼容字母
Assert.assertTrue(GridHelper.isKoreanCharacter('ㆋ'));
// 韩文字母
Assert.assertTrue(GridHelper.isKoreanCharacter('ᇪ'));
// 韩文字母扩展A
Assert.assertTrue(GridHelper.isKoreanCharacter('ꥵ'));
// 韩文字母扩展B
Assert.assertTrue(GridHelper.isKoreanCharacter('ퟂ'));
// 韩文货币符号
Assert.assertTrue(GridHelper.isKoreanCharacter('₩'));
}
}
Loading…
Cancel
Save