Browse Source

REPORT-22964 系统参数说明无对应国际化键值

feature/big-screen
Joe.Jiang 5 years ago
parent
commit
0f5518c1b1
  1. 50
      designer-base/src/main/java/com/fr/design/formula/FormulaConstants.java
  2. 33
      designer-base/src/main/java/com/fr/design/formula/FormulaPane.java

50
designer-base/src/main/java/com/fr/design/formula/FormulaConstants.java

@ -0,0 +1,50 @@
package com.fr.design.formula;
import com.fr.stable.StringUtils;
public enum FormulaConstants {
PAGE_NUMBER("$$page_number", "Page_Number"),
TOTAL_PAGE_NUMBER("$$totalPage_number", "Total_Page_Number"),
FINE_USERNAME("$fine_username", "Fine_Username"),
FINE_ROLE("$fine_role", "Fine_Role"),
FINE_POSITION("$fine_position", "Fine_Position"),
NULL("NULL", "Null"),
NOFILTER("NOFILTER", "No_Filter"),
REPORT_NAME("reportName", "Report_Name"),
FORMLET_NAME("formletName", "Formlet_Name"),
SERVLET_URL("servletURL", "Servlet_URL"),
SERVER_SCHEMA("serverSchema", "Server_Schema"),
SERVER_NAME("serverName", "Server_Name"),
SERVER_PORT("serverPort", "Server_Port"),
SERVER_URL("serverURL", "Server_URL"),
CONTEXT_PATH("contextPath", "Context_Path"),
SESSION_ID("sessionID", "SessionID");
private String key;
private String value;
private FormulaConstants(String key, String value) {
this.key = key;
this.value = value;
}
public String getKey() {
return key;
}
public String getValue() {
return value;
}
public static String getValueByKey(String key) {
for (FormulaConstants formulaConstant : values()) {
if (formulaConstant.getKey().equals(key)) {
return formulaConstant.getValue();
}
}
return StringUtils.EMPTY;
}
}

33
designer-base/src/main/java/com/fr/design/formula/FormulaPane.java

@ -19,6 +19,7 @@ import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.parser.FRLexer;
import com.fr.parser.FRParser;
@ -779,31 +780,35 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
private void initVariablesTreeSelectionListener() {
variablesTree.addTreeSelectionListener(new TreeSelectionListener() {
public void valueChanged(TreeSelectionEvent e) {
Object selectedValue = ((DefaultMutableTreeNode) variablesTree.getLastSelectedPathComponent()).getUserObject();
DefaultMutableTreeNode selectedTreeNode = (DefaultMutableTreeNode) variablesTree.getLastSelectedPathComponent();
Object selectedValue = selectedTreeNode.getUserObject();
Object selectedParentValue = ((DefaultMutableTreeNode)selectedTreeNode.getParent()).getUserObject();
if (selectedValue == null) {
return;
}
StringBuilder desBuf = new StringBuilder();
try {
String path;
Locale locale = FRContext.getLocale();
if (locale.equals(Locale.CHINA)) {
path = "/com/fr/design/insert/formula/variable/cn/";
if (selectedValue instanceof TextUserObject) {
//有公式说明的条件:1.属于TextUserObject 2.parent是系统参数
if (ComparatorUtils.equals(((TextFolderUserObject) selectedParentValue).getText(),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaPane_Variables"))) {
descriptionTextArea.setText(getVariableDescription((TextUserObject) selectedValue));
} else {
path = "/com/fr/design/insert/formula/variable/en/";
}
if (selectedValue instanceof TextUserObject) {
desBuf = getText((TextUserObject) selectedValue, path);
descriptionTextArea.setText("");
}
} catch (IOException exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} else if (selectedValue instanceof TextFolderUserObject) {
descriptionTextArea.setText("");
}
descriptionTextArea.setText(desBuf.toString());
descriptionTextArea.moveCaretPosition(0);
}
});
}
private String getVariableDescription(TextUserObject selectedValue) {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_CurReport_Variable_" + FormulaConstants.getValueByKey(selectedValue.getText()));
}
private void initVariablesTree() {
// vairable.
variablesTree = new JTree();

Loading…
Cancel
Save