Browse Source

REPORT-10965 [10.0冒烟]添加控件js事件,右键操作国际化问题

final/10.0
Harrison 6 years ago
parent
commit
21acd863e9
  1. 11
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RecordableTextAction.java
  2. 60
      designer-base/src/main/java/com/fr/design/gui/syntax/util/RTextAreaActionI18nMappingUtil.java

11
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RecordableTextAction.java

@ -11,13 +11,14 @@ package com.fr.design.gui.syntax.ui.rtextarea;
import java.awt.event.ActionEvent;
import java.util.ResourceBundle;
import com.fr.design.gui.syntax.util.RTextAreaActionI18nMappingUtil;
import javax.swing.Icon;
import javax.swing.KeyStroke;
import javax.swing.text.DefaultEditorKit;
import javax.swing.text.JTextComponent;
import javax.swing.text.TextAction;
import java.awt.event.ActionEvent;
/**
@ -258,9 +259,9 @@ public abstract class RecordableTextAction extends TextAction {
* property.
*/
public void setProperties(String keyRoot) {
setName(com.fr.design.i18n.Toolkit.i18nText(keyRoot + ".Name"));
setMnemonic(com.fr.design.i18n.Toolkit.i18nText(keyRoot + ".Mnemonic").charAt(0));
setShortDescription(com.fr.design.i18n.Toolkit.i18nText(keyRoot + ".Desc"));
setName(com.fr.design.i18n.Toolkit.i18nText(RTextAreaActionI18nMappingUtil.getActionName(keyRoot)));
setMnemonic(com.fr.design.i18n.Toolkit.i18nText(RTextAreaActionI18nMappingUtil.getActionMnemonic(keyRoot)).charAt(0));
setShortDescription(com.fr.design.i18n.Toolkit.i18nText(RTextAreaActionI18nMappingUtil.getActionDesc(keyRoot)));
}

60
designer-base/src/main/java/com/fr/design/gui/syntax/util/RTextAreaActionI18nMappingUtil.java

@ -0,0 +1,60 @@
package com.fr.design.gui.syntax.util;
import com.fr.stable.StringUtils;
/**
* @author Harrison
* @date 2018/08/29
* @description: RTextArea 类中的 Action.xxx 准备的国际化匹配文件
**/
public enum RTextAreaActionI18nMappingUtil {
Action_CollapseAllFolds("Action.CollapseAllFolds","Fine-Design_Basic_Action_CollapseAllFolds_Name","Fine-Design_Basic_Action_CollapseAllFolds_Mnemonic","Fine-Design_Basic_Action_CollapseAllFolds_Desc"),
Action_CollapseCommentFolds("Action.CollapseCommentFolds","Fine-Design_Basic_Action_CollapseCommentFolds_Name","Fine-Design_Basic_Action_CollapseCommentFolds_Mnemonic","Fine-Design_Basic_Action_CollapseCommentFolds_Desc"),
Action_Copy("Action.Copy","Fine-Design_Basic_Action_Copy_Name","Fine-Design_Basic_Action_Copy_Mnemonic","Fine-Design_Basic_Action_Copy_Desc"),
Action_Cut("Action.Cut","Fine-Design_Basic_Action_Cut_Name","Fine-Design_Basic_Action_Cut_Mnemonic","Fine-Design_Basic_Action_Cut_Desc"),
Action_Delete("Action.Delete","Fine-Design_Basic_Action_Delete_Name","Fine-Design_Basic_Action_Delete_Mnemonic","Fine-Design_Basic_Action_Delete_Desc"),
Action_ExpandAllFolds("Action.ExpandAllFolds","Fine-Design_Basic_Action_ExpandAllFolds_Name","Fine-Design_Basic_Action_ExpandAllFolds_Mnemonic","Fine-Design_Basic_Action_ExpandAllFolds_Desc"),
Action_Paste("Action.Paste","Fine-Design_Basic_Action_Paste_Name","Fine-Design_Basic_Action_Paste_Mnemonic","Fine-Design_Basic_Action_Paste_Desc"),
Action_Redo("Action.Redo","Fine-Design_Basic_Action_Redo_Name","Fine-Design_Basic_Action_Redo_Mnemonic","Fine-Design_Basic_Action_Redo_Desc"),
Action_SelectAll("Action.SelectAll","Fine-Design_Basic_Action_SelectAll_Name","Fine-Design_Basic_Action_SelectAll_Mnemonic","Fine-Design_Basic_Action_SelectAll_Desc"),
Action_ToggleCurrentFold("Action.ToggleCurrentFold","Fine-Design_Basic_Action_ToggleCurrentFold_Name","Fine-Design_Basic_Action_ToggleCurrentFold_Mnemonic","Fine-Design_Basic_Action_ToggleCurrentFold_Desc"),
Action_Undo("Action.Undo","Fine-Design_Basic_Action_Undo_Name","Fine-Design_Basic_Action_Undo_Mnemonic","Fine-Design_Basic_Action_Undo_Desc");
private String actionRawKey;
private String actionName;
private String actionMnemonic;
private String actionDesc;
RTextAreaActionI18nMappingUtil(String actionRawKey, String actionName, String actionMnemonic, String actionDesc) {
this.actionRawKey = actionRawKey;
this.actionName = actionName;
this.actionMnemonic = actionMnemonic;
this.actionDesc = actionDesc;
}
public static String getActionName(String actionKey) {
for (RTextAreaActionI18nMappingUtil mapping: RTextAreaActionI18nMappingUtil.values()) {
if (StringUtils.equals(mapping.actionRawKey, actionKey)) {
return mapping.actionName;
}
}
return actionKey;
}
public static String getActionMnemonic(String actionKey) {
for (RTextAreaActionI18nMappingUtil mapping: RTextAreaActionI18nMappingUtil.values()) {
if (StringUtils.equals(mapping.actionRawKey, actionKey)) {
return mapping.actionMnemonic;
}
}
return actionKey;
}
public static String getActionDesc(String actionKey) {
for (RTextAreaActionI18nMappingUtil mapping: RTextAreaActionI18nMappingUtil.values()) {
if (StringUtils.equals(mapping.actionRawKey, actionKey)) {
return mapping.actionDesc;
}
}
return actionKey;
}
}
Loading…
Cancel
Save