Browse Source

REPORT-55696 国际化-远程版本不一致的提示弹窗在非中文下显示不全 && REPORT-55415 富文本框,鼠标选择不同的字体,会导致所选字体都变成一样的

feature/10.0
Henry.Wang 3 years ago
parent
commit
9cca8d7671
  1. 12
      designer-base/src/main/java/com/fr/design/dialog/NotificationDialog.java
  2. 3
      designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java
  3. 1
      designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties
  4. 1
      designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties
  5. 1
      designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties
  6. 1
      designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties
  7. 1
      designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties
  8. 68
      designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java

12
designer-base/src/main/java/com/fr/design/dialog/NotificationDialog.java

@ -3,6 +3,7 @@ package com.fr.design.dialog;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.DesignSizeI18nManager;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
@ -10,6 +11,7 @@ import com.fr.design.notification.Notification;
import com.fr.design.notification.NotificationCenter;
import com.fr.module.ModuleContext;
import com.fr.stable.StringUtils;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
@ -40,9 +42,17 @@ public class NotificationDialog extends JDialog {
private UILabel messageText;
private NotificationDialogAction notificationDialogAction;
private ScheduledExecutorService TIMER;
private Dimension dialogSize = new Dimension(230, 95);
public NotificationDialog(Frame owner, String title, boolean isModal, int messageType, String message, NotificationDialogAction action) {
this(owner, title, isModal, messageType, message, action, null);
}
public NotificationDialog(Frame owner, String title, boolean isModal, int messageType, String message, NotificationDialogAction action, Dimension dimension) {
super(owner);
if (dimension != null) {
this.dialogSize = dimension;
}
setTitle(title);
initComponents(StringUtils.EMPTY, messageType, message, isModal, action);
}
@ -77,7 +87,7 @@ public class NotificationDialog extends JDialog {
JScrollPane jScrollPane = new JScrollPane(messageText, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
jScrollPane.setBorder(BorderFactory.createEmptyBorder());
centerPanel.add(jScrollPane, BorderLayout.CENTER);
centerPanel.setPreferredSize(new Dimension(230, 95));
centerPanel.setPreferredSize(dialogSize);
body.add(centerPanel, BorderLayout.CENTER);
//查看详情

3
designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java

@ -7,6 +7,7 @@ import com.fr.design.dialog.NotificationDialogAction;
import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.DesignerWorkspaceType;
import com.fr.design.env.RemoteWorkspace;
import com.fr.design.i18n.DesignSizeI18nManager;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.env.CheckServiceDialog;
@ -107,7 +108,7 @@ public class VersionCheckUtils {
CheckServiceDialog checkServiceDialog = new CheckServiceDialog(DesignerContext.getDesignerFrame(), GeneralUtils.readFullBuildNO(), getRemoteBranch(envName), getNoExistServiceDescription(envName));
checkServiceDialog.setVisible(true);
}
});
},DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.version.check.dialog"));
notificationDialog.setVisible(true);
}

1
designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties

@ -4,3 +4,4 @@ com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink=630*31
com.fr.design.mainframe.check.CheckFontInfoDialog.unfold=630*280
com.fr.design.report.ReportColumnsPane=800*600
com.fr.env.RemoteEnvPane.dialog=458*132
com.fr.design.version.check.dialog=490*95

1
designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties

@ -3,3 +3,4 @@ com.fr.design.mainframe.check.CheckFontInfoDialog.collapse=610*185
com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink=610*31
com.fr.design.mainframe.check.CheckFontInfoDialog.unfold=610*280
com.fr.env.RemoteEnvPane.dialog=458*132
com.fr.design.version.check.dialog=430*95

1
designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties

@ -3,3 +3,4 @@ com.fr.design.mainframe.check.CheckFontInfoDialog.collapse=490*185
com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink=490*35
com.fr.design.mainframe.check.CheckFontInfoDialog.unfold=490*280
com.fr.env.RemoteEnvPane.dialog=458*132
com.fr.design.version.check.dialog=450*95

1
designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties

@ -4,3 +4,4 @@ com.fr.design.mainframe.check.CheckFontInfoDialog.collapse=385*185
com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink=385*31
com.fr.design.mainframe.check.CheckFontInfoDialog.unfold=385*280
com.fr.env.RemoteEnvPane.dialog=308*132
com.fr.design.version.check.dialog=230*95

1
designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties

@ -3,3 +3,4 @@ com.fr.design.mainframe.check.CheckFontInfoDialog.collapse=385*185
com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink=385*31
com.fr.design.mainframe.check.CheckFontInfoDialog.unfold=385*280
com.fr.env.RemoteEnvPane.dialog=308*132
com.fr.design.version.check.dialog=230*95

68
designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java

@ -58,7 +58,7 @@ import java.math.BigDecimal;
*
* @date: 2014-12-5-下午1:10:31
*/
public class RichTextToolBar extends BasicPane{
public class RichTextToolBar extends BasicPane {
private static final Dimension BUTTON_SIZE = new Dimension(24, 20);
@ -103,7 +103,7 @@ public class RichTextToolBar extends BasicPane{
addToToolBar();
}
private void initAllButton(){
private void initAllButton() {
fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report());
fontNameComboBox.setPreferredSize(new Dimension(144, 20));
fontSizeComboBox = new UIComboBox(FRFontPane.getFontSizes());
@ -127,7 +127,7 @@ public class RichTextToolBar extends BasicPane{
bindListener();
}
private void setAllButtonStyle(){
private void setAllButtonStyle() {
setButtonStyle(bold);
setButtonStyle(italic);
setButtonStyle(underline);
@ -136,7 +136,7 @@ public class RichTextToolBar extends BasicPane{
setButtonStyle(formulaPane);
}
private void setButtonStyle(UIButton button){
private void setButtonStyle(UIButton button) {
button.setNormalPainted(false);
button.setBackground(null);
button.setOpaque(false);
@ -144,7 +144,7 @@ public class RichTextToolBar extends BasicPane{
button.setBorderPaintedOnlyWhenPressed(true);
}
private void addToToolBar(){
private void addToToolBar() {
this.setLayout(new FlowLayout(FlowLayout.LEFT));
this.add(fontNameComboBox);
@ -158,7 +158,7 @@ public class RichTextToolBar extends BasicPane{
this.add(formulaPane);
}
private void bindListener(){
private void bindListener() {
// 这里下拉框默认选中字体 不由UI界面字体决定 两套不同体系
fontNameComboBox.addItemListener(fontNameItemListener);
fontNameComboBox.setSelectedItem(DEFAULT_FONT.getFamily());
@ -207,7 +207,7 @@ public class RichTextToolBar extends BasicPane{
* @date 2015-1-5-下午5:13:04
*
*/
public void removeInputListener(){
public void removeInputListener() {
this.textPane.getDocument().removeDocumentListener(inputListener);
}
@ -218,7 +218,7 @@ public class RichTextToolBar extends BasicPane{
* @date 2015-1-5-下午5:13:26
*
*/
public void addInputListener(){
public void addInputListener() {
this.textPane.getDocument().addDocumentListener(inputListener);
}
@ -322,7 +322,7 @@ public class RichTextToolBar extends BasicPane{
@Override
public void itemStateChanged(ItemEvent e) {
int fontSize = (Integer) RichTextToolBar.this.fontSizeComboBox.getSelectedItem();
fontSize= scaleUp(fontSize);
fontSize = scaleUp(fontSize);
// 调用setCharacterAttributes函数设置文本区选择文本的字体
MutableAttributeSet attr = new SimpleAttributeSet();
StyleConstants.setFontSize(attr, fontSize);
@ -334,11 +334,13 @@ public class RichTextToolBar extends BasicPane{
@Override
public void itemStateChanged(ItemEvent e) {
String fontName = (String) RichTextToolBar.this.fontNameComboBox.getSelectedItem();
if (fontName != null) {
// 调用setCharacterAttributes函数设置文本区选择文本的字体
MutableAttributeSet attr = new SimpleAttributeSet();
StyleConstants.setFontFamily(attr, fontName);
setCharacterAttributes(RichTextToolBar.this.textPane, attr, false);
}
}
};
private ActionListener formulaActionListener = new ActionListener() {
@ -363,7 +365,7 @@ public class RichTextToolBar extends BasicPane{
}
};
private int roundUp(double num){
private int roundUp(double num) {
String numStr = Double.toString(num);
numStr = new BigDecimal(numStr).setScale(0, BigDecimal.ROUND_HALF_UP).toString();
return Integer.valueOf(numStr);
@ -372,7 +374,7 @@ public class RichTextToolBar extends BasicPane{
private CaretListener textCareListener = new CaretListener() {
//根据选中部分的文字样式, 来动态显示工具栏上按钮的状态
private void setSelectedCharStyle(int start, int end, StyledDocument doc){
private void setSelectedCharStyle(int start, int end, StyledDocument doc) {
boolean isBold = true;
boolean isItalic = true;
boolean isUnderline = true;
@ -397,11 +399,15 @@ public class RichTextToolBar extends BasicPane{
//上标
isSuperscript = isSuperscript && StyleConstants.isSuperscript(attrs);
if(i == start){
if (i == start) {
fontName_1st = (String) attrs.getAttribute(StyleConstants.FontFamily);
fontSize_1st = (Integer) attrs.getAttribute(StyleConstants.FontSize);
fontColor_1st = (Color) attrs.getAttribute(StyleConstants.Foreground);
fontColor_1st = fontColor_1st == null ? Color.BLACK : fontColor_1st;
} else {
if (!(attrs.getAttribute(StyleConstants.FontFamily)).equals(fontName_1st)) {
fontName_1st = null;
}
}
}
@ -412,7 +418,7 @@ public class RichTextToolBar extends BasicPane{
//动态显示工具栏上按钮的状态
private void setButtonSelected(boolean isBold, boolean isItalic, boolean isUnderline,
boolean isSubscript, boolean isSuperscript, String fontName_1st,
int fontSize_1st, Color fontColor_1st){
int fontSize_1st, Color fontColor_1st) {
bold.setSelected(isBold);
italic.setSelected(isItalic);
underline.setSelected(isUnderline);
@ -427,7 +433,7 @@ public class RichTextToolBar extends BasicPane{
selectColorPane(fontColor_1st);
}
private void selectColorPane(Color color){
private void selectColorPane(Color color) {
colorSelectPane.removeColorChangeListener(colorChangeAction);
colorSelectPane.setColor(color);
colorSelectPane.addColorChangeListener(colorChangeAction);
@ -442,7 +448,7 @@ public class RichTextToolBar extends BasicPane{
int end = textPane.getSelectionEnd();
//如果没有选定字符
if(end == start){
if (end == start) {
return;
}
@ -461,7 +467,7 @@ public class RichTextToolBar extends BasicPane{
int start = textPane.getSelectionStart();
int end = textPane.getSelectionEnd();
if(start != end){
if (start != end) {
return;
}
@ -469,8 +475,8 @@ public class RichTextToolBar extends BasicPane{
}
//如果默认不选字符, 那么设置为最后一个字符的样式
private void setToLastCharStyle(int end, StyledDocument doc){
if(textPane.isUpdating()){
private void setToLastCharStyle(int end, StyledDocument doc) {
if (textPane.isUpdating()) {
return;
}
@ -490,7 +496,7 @@ public class RichTextToolBar extends BasicPane{
* @date 2015-1-5-下午5:12:33
*
*/
public void populateToolBar(AttributeSet attrs){
public void populateToolBar(AttributeSet attrs) {
int size = scaleDown(StyleConstants.getFontSize(attrs));
fontNameComboBox.setSelectedItem(StyleConstants.getFontFamily(attrs));
fontSizeComboBox.setSelectedItem(size);
@ -547,11 +553,11 @@ public class RichTextToolBar extends BasicPane{
}
//根据Style来显示populate按钮
private void changeContentStyle(int start, MutableAttributeSet attr){
private void changeContentStyle(int start, MutableAttributeSet attr) {
changeContentStyle(start, attr, 1);
}
private void changeContentStyle(int start, MutableAttributeSet attr, int contentLength){
private void changeContentStyle(int start, MutableAttributeSet attr, int contentLength) {
// 将所选文本设置为新的样式,replace为false表示不覆盖原有的样式
StyledDocument doc = (StyledDocument) textPane.getDocument();
doc.setCharacterAttributes(start, contentLength, attr, false);
@ -559,7 +565,7 @@ public class RichTextToolBar extends BasicPane{
}
//将界面上的设置赋值给输入的字符
private MutableAttributeSet updateStyleFromToolBar(){
private MutableAttributeSet updateStyleFromToolBar() {
final boolean isBold = bold.isSelected();
final boolean isItalic = italic.isSelected();
final boolean isSub = subPane.isSelected();
@ -595,8 +601,8 @@ public class RichTextToolBar extends BasicPane{
//他会一个个insert进去直接触发inserupdate事件, 而jdk7会直接把所有的塞进来.
//inserupdate那边绑定的是一个个插入的事件, 多个一起插入的放这
//bug84777 8.0不走if逻辑,改成只有jdk7走if逻辑
if(StableUtils.getMajorJavaVersion() == JDK_7){
if(isUpdating()){
if (StableUtils.getMajorJavaVersion() == JDK_7) {
if (isUpdating()) {
return;
}
StyledDocument doc = (StyledDocument) textPane.getDocument();
@ -613,7 +619,7 @@ public class RichTextToolBar extends BasicPane{
}
//中文输入法, 默认输入字符会被输入法的框截取住, jtextpane得到是一个空格, 此时不做处理
if(StringUtils.isBlank(content) || inputLen <= 0){
if (StringUtils.isBlank(content) || inputLen <= 0) {
return;
}
//设置一次性输入多个文字的样式
@ -621,7 +627,7 @@ public class RichTextToolBar extends BasicPane{
}
}
private void setContentStyle(final int inputLen){
private void setContentStyle(final int inputLen) {
//缓存下Start, 下面要用来设置样式
final int _start = inputStart;
final MutableAttributeSet attr = updateStyleFromToolBar();
@ -640,24 +646,24 @@ public class RichTextToolBar extends BasicPane{
});
}
private boolean isUpdating(){
private boolean isUpdating() {
return inputStart == UPDATING;
}
private void startUpdating(){
private void startUpdating() {
inputStart = UPDATING;
}
//初始标记状态, 用于记录中文输入法多个字符同时输入的问题
private void initFlag(StyledDocument doc){
if(inputStart != NOT_INITED){
private void initFlag(StyledDocument doc) {
if (inputStart != NOT_INITED) {
return;
}
inputStart = textPane.getSelectionStart() - 1;
}
//重置标记状态
private void resetFlag(){
private void resetFlag() {
inputStart = NOT_INITED;
}
};

Loading…
Cancel
Save