Browse Source

Merge branch 'release/11.0' of https://code.fineres.com/scm/~henry.wang/design into release/11.0

fix-lag
Henry.Wang 3 years ago
parent
commit
01a7889402
  1. 13
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java
  2. 43
      designer-base/src/main/java/com/fr/design/formula/FormulaPane.java
  3. 49
      designer-base/src/main/java/com/fr/design/formula/UnsupportedFormulaScanner.java
  4. 8
      designer-base/src/main/java/com/fr/design/gui/itextfield/EditTextField.java
  5. 10
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java
  6. 11
      designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java

13
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java

@ -710,7 +710,7 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
strategyConfig = StrategyConfigAttrUtils.getStrategyConfig(dsName);
if (useGlobal(getTableData(), strategyConfig, tplPath)) {
if (useGlobal(getTableData(), strategyConfig)) {
//使用全局配置
strategyConfig = StrategyConfigHelper.createStrategyConfig(true);
} else if (getTableData().isShare()) {
@ -722,14 +722,13 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
return strategyConfig;
}
private boolean useGlobal(DBTableData dbTableData, StrategyConfig strategyConfig, String tplPath) {
private boolean useGlobal(DBTableData dbTableData, StrategyConfig strategyConfig) {
//非共享且配置为空或者指定使用全局配置时,检查是否全局开启
if (!dbTableData.isShare() && (strategyConfig == null || strategyConfig.isUseGlobal())) {
//模版里面没有配置,检查模版是否被开启
return StrategyConfigService.isTemplateEnabled(tplPath);
if (strategyConfig == null) {
return !dbTableData.isShare();
} else {
return strategyConfig.isUseGlobal();
}
return false;
}
@Override

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

@ -39,7 +39,6 @@ import com.fr.parser.BlockIntervalLiteral;
import com.fr.parser.ColumnRowRangeInPage;
import com.fr.parser.FRLexer;
import com.fr.parser.FRParser;
import com.fr.parser.FunctionCall;
import com.fr.parser.SheetIntervalLiteral;
import com.fr.report.core.namespace.SimpleCellValueNameSpace;
import com.fr.script.Calculator;
@ -100,7 +99,6 @@ import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
@ -729,15 +727,16 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
@Override
public void actionPerformed(ActionEvent e) {
String formulaText = formulaTextArea.getText().trim();
if (containsUnsupportedSimulationFormulas(formulaText)) {
String formulaValidMessage = getFormulaValidMessage(formulaText);
String unSupportFormula = containsUnsupportedSimulationFormulas(formulaText);
if (unSupportFormula != null) {
FineJOptionPane.showMessageDialog(
FormulaPane.this,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Formula_Unsupported_Formulas"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Formula_Unsupported_Formulas") + ":" + unSupportFormula,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
JOptionPane.INFORMATION_MESSAGE);
return;
}
String formulaValidMessage = getFormulaValidMessage(formulaText);
String messageTips;
if (formulaValidMessage.equals(INVALID_FORMULA)) {
messageTips = INVALID_FORMULA;
@ -777,20 +776,21 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
}
};
private boolean containsUnsupportedSimulationFormulas(String formulaText) {
private String containsUnsupportedSimulationFormulas(String formulaText) {
try {
Expression expression = Calculator.createCalculator().parse(formulaText);
String name = ((FunctionCall) expression.getConditionalExpression()).getName();
if (UnsupportedSimulationFormulaHunter.isUnsupportedFomula(name)) {
return true;
UnsupportedFormulaScanner scanner = new UnsupportedFormulaScanner();
if (!scanner.travelFormula(expression.getConditionalExpression())) {
return scanner.getUnSupportFormula();
}
UnsupportedSimulationFormulaHunter unsupportedSimulationFormulaHunter = new UnsupportedSimulationFormulaHunter();
expression.traversal4Tiny(unsupportedSimulationFormulaHunter);
return !unsupportedSimulationFormulaHunter.isSupported();
return unsupportedSimulationFormulaHunter.isSupported() ? null : unsupportedSimulationFormulaHunter.getUnSupportFormula();
} catch (Exception e) {
FineLoggerFactory.getLogger().error("", e);
}
return true;
return null;
}
private Map<String, Object> setParamsIfExist(String formulaText) {
@ -814,7 +814,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
}).setVisible(true);
//过滤出数组参数,如:[1,2]
for (Map.Entry<String, Object> entry : parameterMap.entrySet()) {
if (entry.getValue().toString().startsWith("[") && entry.getValue().toString().startsWith("]")) {
if (entry.getValue().toString().startsWith("[") && entry.getValue().toString().endsWith("]")) {
Expression parse = calculator.parse(entry.getValue());
ArrayExpression arrayExpression = (ArrayExpression) parse.getConditionalExpression();
FArray<Node> fArray = new FArray<>(arrayExpression.getArrays());
@ -839,7 +839,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
String statement = tiny.getStatement();
if (StringUtils.isNotBlank(statement) && statement.startsWith(ScriptConstants.DETAIL_TAG)) {
parameterList.add(new Parameter(statement.substring(1)));
} else if (tiny.getClass() == ColumnRowRange.class || tiny.getClass() == ColumnRowRangeInPage.class ||
} else if (tiny.getClass() == ColumnRowRange.class ||
tiny.getClass() == SheetIntervalLiteral.class || tiny.getClass() == BlockIntervalLiteral.class) {
parameterList.add(new Parameter(tiny.toString()));
}
@ -847,25 +847,26 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
}
private static class UnsupportedSimulationFormulaHunter extends TinyHunter {
public final static String[] UNSUPPORTED_FORMULAS = new String[]{"PROPORTION", "TOIMAGE",
"WEBIMAGE", "SORT", "CROSSLAYERTOTAL", "CIRCULAR", "LAYERTOTAL", "MOM", "HIERARCHY"};
private boolean supported = true;
private String unSupportFormula;
public boolean isSupported() {
return supported;
}
public String getUnSupportFormula() {
return unSupportFormula;
}
public void hunter4Tiny(Tiny tiny) {
String statement = tiny.getStatement().toUpperCase();
if (Arrays.asList(UNSUPPORTED_FORMULAS).contains(statement)) {
if (tiny.getClass() == ColumnRowRangeInPage.class) {
supported = false;
unSupportFormula = tiny.toString();
}
}
public static boolean isUnsupportedFomula(String formula) {
return Arrays.asList(UNSUPPORTED_FORMULAS).contains(formula);
}
}
public class VariableTreeAndDescriptionArea extends JPanel {

49
designer-base/src/main/java/com/fr/design/formula/UnsupportedFormulaScanner.java

@ -0,0 +1,49 @@
package com.fr.design.formula;
import com.fr.parser.BinaryExpression;
import com.fr.parser.FunctionCall;
import com.fr.stable.script.Node;
import java.util.Arrays;
/**
* @author Hoky
* @date 2021/8/30
*/
public class UnsupportedFormulaScanner {
public final static String[] UNSUPPORTED_FORMULAS = new String[]{"PROPORTION", "TOIMAGE",
"WEBIMAGE", "SORT", "CROSSLAYERTOTAL", "CIRCULAR", "LAYERTOTAL", "MOM", "HIERARCHY",
"FILENAME", "FILESIZE", "FILETYPE", "TREELAYER", "GETUSERDEPARTMENTS", "GETUSERJOBTITLES"};
private String unSupportFormula = "";
public boolean travelFormula(Node node) {
if (node instanceof FunctionCall) {
if (isUnsupportedFomula(((FunctionCall) node).getName())) {
unSupportFormula = ((FunctionCall) node).getName();
return false;
} else {
for (Node argument : ((FunctionCall) node).getArguments()) {
if (!travelFormula(argument)) {
return false;
}
}
}
} else if (node instanceof BinaryExpression) {
for (Node array : ((BinaryExpression) node).getNodes()) {
if (!travelFormula(array)) {
return false;
}
}
}
return true;
}
public String getUnSupportFormula() {
return unSupportFormula;
}
private static boolean isUnsupportedFomula(String formula) {
return Arrays.asList(UNSUPPORTED_FORMULAS).contains(formula.toUpperCase());
}
}

8
designer-base/src/main/java/com/fr/design/gui/itextfield/EditTextField.java

@ -13,6 +13,9 @@ import javax.swing.text.PlainDocument;
* Number Field.
*/
public class EditTextField extends UIGridTextField {
private static final String I18NProperty = "i18n";
private int maxLength = 24;
public EditTextField() {
@ -39,7 +42,11 @@ public class EditTextField extends UIGridTextField {
}
class TextDocument extends PlainDocument {
private Object defaultI18NProperty;
public TextDocument() {
defaultI18NProperty = getProperty(I18NProperty);
}
@Override
@ -49,6 +56,7 @@ public class EditTextField extends UIGridTextField {
Toolkit.getDefaultToolkit().beep();
return;
}
putProperty(I18NProperty, defaultI18NProperty);
super.insertString(offset, s, a);
}
}

10
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java

@ -173,8 +173,7 @@ public class ChartTypePane extends AbstractChartAttrPane {
Map<Integer, Map<String, FurtherBasicBeanPane<? extends ChartProvider>>> allChartTypePane,
ActionListener autoButtonListener) {
String[] chartIDs = ChartTypeManager.getInstance().getAllChartIDs();
String[] chartIDs = ChartTypeManager.getInstance().getAllChartIDsIncludeDisabled();
for (String id : chartIDs) {
@ -222,6 +221,7 @@ public class ChartTypePane extends AbstractChartAttrPane {
String lastPlotID = chart.getID();
boolean chartTypeChange = false;
try {
AbstractChartTypePane selectedPane = (AbstractChartTypePane) getSelectedPane();
ChartProvider newDefaultChart = (ChartProvider) ChartTypeManager.getInstanceWithCheck().getCharts(selectedPane.getPlotID())[0].clone();
@ -231,13 +231,16 @@ public class ChartTypePane extends AbstractChartAttrPane {
editingCollection.removeNameObject(editingCollection.getSelectedIndex());
editingCollection.addChart(newDefaultChart);
chart = newDefaultChart;
chartTypeChange = true;
}
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
//这一步会替换plot
String id = chart.getID();
((AbstractChartTypePane) getSelectedPane()).updateBean(chart);
if (inForm) {
chartTypeChange = chartTypeChange || !ComparatorUtils.equals(id, chart.getID());
if (inForm && chartTypeChange) {
chart.resetAttrInForm();
}
reLayoutEditPane(chart, lastPlotID);
@ -465,5 +468,6 @@ public class ChartTypePane extends AbstractChartAttrPane {
public void registerChartEditPane(ChartEditPane currentEditPane) {
this.editPane = currentEditPane;
this.inForm = editPane.isInForm();
buttonPane.refreshChartInForm(inForm);
}
}

11
designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java

@ -799,10 +799,13 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
popup.setLocation(designer.getLocationOnScreen().x + designer.getPaintX() + extraX, designer.getLocationOnScreen().y + designer.getPaintY() + extraY);
popup.updatePane(designer);
popup.setVisible(selected && accept && popup.hasVisibleButtons() && popup.isCanVisible() && !isShowPluginDialog());
popup.setRelativeBounds(bounds);
try {
popup.setLocation(designer.getLocationOnScreen().x + designer.getPaintX() + extraX, designer.getLocationOnScreen().y + designer.getPaintY() + extraY);
popup.updatePane(designer);
popup.setVisible(selected && accept && popup.hasVisibleButtons() && popup.isCanVisible() && !isShowPluginDialog());
popup.setRelativeBounds(bounds);
} catch (Exception ignored) {
}
}
});
}

Loading…
Cancel
Save