Browse Source

Merge pull request #1267 in DESIGN/design from ~HADES/design:release/10.0 to release/10.0

* commit 'b828a9a8a143c27341227b062b6fccd0e016f274':
  REPORT-22964 系统参数说明无对应国际化键值
  REPORT-22964 系统参数说明无对应国际化键值
feature/big-screen
Hades 5 years ago
parent
commit
d1daf10359
  1. 57
      designer-base/src/main/java/com/fr/design/formula/FormulaConstants.java
  2. 29
      designer-base/src/main/java/com/fr/design/formula/FormulaPane.java

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

@ -0,0 +1,57 @@
package com.fr.design.formula;
import com.fr.stable.StringUtils;
/**
* @author Joe
* @version 10.0
* Created by Joe on 10/30/2019
*/
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 static final String KEY_PREFIX = "Fine-Design_CurReport_Variable_";
private FormulaConstants(String key, String value) {
this.key = key;
this.value = KEY_PREFIX + 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;
}
}

29
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,31 @@ 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(com.fr.design.i18n.Toolkit.i18nText(FormulaConstants.getValueByKey(((TextUserObject) selectedValue).getText())));
} else {
path = "/com/fr/design/insert/formula/variable/en/";
descriptionTextArea.setText(StringUtils.EMPTY);
}
if (selectedValue instanceof TextUserObject) {
desBuf = getText((TextUserObject) selectedValue, path);
}
} catch (IOException exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} else if (selectedValue instanceof TextFolderUserObject) {
descriptionTextArea.setText(StringUtils.EMPTY);
}
descriptionTextArea.setText(desBuf.toString());
descriptionTextArea.moveCaretPosition(0);
}
});
}
private void initVariablesTree() {
// vairable.
variablesTree = new JTree();

Loading…
Cancel
Save