Browse Source

Merge pull request #6253 in DESIGN/design from release/11.0 to feature/x

* commit 'dc4558f2c70cae1fc8dc473b21abc31cd9e450ee':
  REPORT-60995 导出-导出事件-参数设置-取消勾选继承报表后弹窗关不掉
  REPORT-60919 && REPORT-60899 引导页优化解决弹窗类的引导快速点击发生异常的问题
  REPORT-60992 导出-导出事件-其他模板-点击模板文件后效果错乱
  REPORT-60900 视觉切图提供的有点问题,找视觉更新了切图
  REPORT-59545 设计器很多报错提示弹窗的交互有问题
  REPORT-60535 表单新自适应单元格设置“用下载链接显示二进制内容”设计器和PC打开颜色不一致
feature/x
superman 3 years ago
parent
commit
7e0fd02523
  1. 17
      designer-base/src/main/java/com/fr/design/formula/FormulaChecker.java
  2. 11
      designer-base/src/main/java/com/fr/design/formula/FormulaCheckerException.java
  3. 60
      designer-base/src/main/java/com/fr/design/formula/FormulaPane.java
  4. 23
      designer-base/src/main/java/com/fr/design/javascript/ExportJavaScriptPane.java
  5. 17
      designer-base/src/main/java/com/fr/design/mainframe/guide/scene/AbstractGuideScene.java
  6. 73
      designer-base/src/main/java/com/fr/design/mainframe/guide/scene/ClickScene.java
  7. BIN
      designer-form/src/main/resources/com/fr/design/form/layouts/images/simple_style_18.png
  8. 10
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java
  9. 2
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideSceneHelper.java
  10. 23
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/ChangeLayoutComponentGuide.java
  11. 24
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java
  12. 2
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java
  13. 5
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java

17
designer-base/src/main/java/com/fr/design/formula/FormulaChecker.java

@ -25,7 +25,7 @@ public class FormulaChecker {
private static final String INVALID_FORMULA = Toolkit.i18nText("Fine-Design_Basic_FormulaD_Invalid_Formula");
public static final String COLON = ":";
public static String check(String formulaText) {
public static String check(String formulaText) throws FormulaCheckerException {
StringReader in = new StringReader(formulaText);
FRLexer lexer = new FRLexer(in);
@ -34,12 +34,15 @@ public class FormulaChecker {
try {
Expression expression = parser.parse();
Node node = expression.getConditionalExpression();
return FunctionCheckerDispatcher.getInstance()
.getFunctionChecker(node)
.checkFunction(node) ? VALID_FORMULA : INVALID_FORMULA;
boolean valid = FunctionCheckerDispatcher.getInstance().getFunctionChecker(node).checkFunction(node);
if (valid) {
return VALID_FORMULA;
} else {
throw new FormulaCheckerException(INVALID_FORMULA);
}
} catch (ConditionCheckWrongException cce) {
String functionName = cce.getFunctionName();
return functionName + Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Condition_Tips") + COLON;
throw new FormulaCheckerException(functionName + Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Condition_Tips") + COLON);
} catch (FunctionCheckWrongException ce) {
List<FunctionRule> rules = ce.getRules();
String functionName = ce.getFunctionName();
@ -60,10 +63,10 @@ public class FormulaChecker {
errorMsg.append(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Or"));
}
}
return errorMsg.toString();
throw new FormulaCheckerException(errorMsg.toString());
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
return INVALID_FORMULA;
throw new FormulaCheckerException(INVALID_FORMULA);
// alex:继续往下面走,expression为null时告知不合法公式
}
}

11
designer-base/src/main/java/com/fr/design/formula/FormulaCheckerException.java

@ -0,0 +1,11 @@
package com.fr.design.formula;
public class FormulaCheckerException extends Exception {
public FormulaCheckerException() {
}
public FormulaCheckerException(String message) {
super(message);
}
}

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

@ -650,12 +650,14 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
public void actionPerformed(ActionEvent evt) {
// Execute Formula default cell element.
String formulaText = formulaTextArea.getText().trim();
String formulaValidMessage = FormulaChecker.check(formulaText);
FineJOptionPane.showMessageDialog(
FormulaPane.this,
formulaValidMessage + ".",
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
JOptionPane.WARNING_MESSAGE);
String formulaValidMessage;
try {
formulaValidMessage = FormulaChecker.check(formulaText);
showMessageDialog(formulaValidMessage + ".");
} catch (FormulaCheckerException e) {
formulaValidMessage = e.getMessage();
showMessageDialog(formulaValidMessage + ".", false);
}
}
};
@ -663,22 +665,26 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
@Override
public void actionPerformed(ActionEvent e) {
String formulaText = formulaTextArea.getText().trim();
String formulaValidMessage = FormulaChecker.check(formulaText);
;
String unSupportFormula = containsUnsupportedSimulationFormulas(formulaText);
if (unSupportFormula != null) {
FineJOptionPane.showMessageDialog(
FormulaPane.this,
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);
showMessageDialog(Toolkit.i18nText("Fine-Design_Basic_Formula_Unsupported_Formulas") + ":" + unSupportFormula, false);
return;
}
String formulaValidMessage;
boolean formulaValid;
try {
formulaValidMessage = FormulaChecker.check(formulaText);
formulaValid = true;
} catch (FormulaCheckerException formulaCheckerException) {
formulaValidMessage = formulaCheckerException.getMessage();
formulaValid = false;
}
String messageTips;
if (formulaValidMessage.equals(INVALID_FORMULA)) {
if (ComparatorUtils.equals(formulaValidMessage, INVALID_FORMULA)) {
messageTips = INVALID_FORMULA;
} else {
messageTips = formulaValidMessage.equals(VALID_FORMULA) ? "" : formulaValidMessage + "\n";
messageTips = ComparatorUtils.equals(formulaValidMessage, VALID_FORMULA) ? "" : formulaValidMessage + "\n";
Map<String, Object> paramsMap = setParamsIfExist(formulaText);
Calculator calculator = Calculator.createCalculator();
ParameterMapNameSpace parameterMapNameSpace = ParameterMapNameSpace.create(paramsMap);
@ -699,19 +705,33 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
String result = objectToString.length() > DEFUAL_FOMULA_LENGTH ?
objectToString.substring(0, DEFUAL_FOMULA_LENGTH - ELLIPSIS.length()) + ELLIPSIS : objectToString;
messageTips = messageTips +
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Formula_Cal_Result") + ":" + result;
Toolkit.i18nText("Fine-Design_Basic_Formula_Cal_Result") + ":" + result;
FineLoggerFactory.getLogger().info("value:{}", value);
} catch (UtilEvalError utilEvalError) {
FineLoggerFactory.getLogger().error("", utilEvalError);
}
}
showMessageDialog(messageTips, formulaValid);
}
};
private void showMessageDialog(String message) {
showMessageDialog(message, true);
}
private void showMessageDialog(String message, boolean formulaValid) {
if (formulaValid) {
FineJOptionPane.showMessageDialog(
FormulaPane.this,
message);
} else {
FineJOptionPane.showMessageDialog(
FormulaPane.this,
messageTips,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
JOptionPane.INFORMATION_MESSAGE);
message,
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
JOptionPane.WARNING_MESSAGE);
}
};
}
private String containsUnsupportedSimulationFormulas(String formulaText) {
try {

23
designer-base/src/main/java/com/fr/design/javascript/ExportJavaScriptPane.java

@ -326,16 +326,19 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
private UIButton browserButton;
public ExportTemplateChooser() {
reportletNamePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
// 路径输入框
reportPathTextField = new UITextField(7);
reportPathTextField = new UITextField(8);
reportPathTextField.setEnabled(false);
reportletNamePane.add(reportPathTextField, BorderLayout.WEST);
// 选择路径按钮
browserButton = new UIButton("...");
browserButton.setVisible(true);
reportletNamePane.add(browserButton, BorderLayout.EAST);
Component[][] templateChooserComponent = {{reportPathTextField, browserButton}};
double[] rowSize = {TableLayout.PREFERRED};
double[] columnSize = {TableLayout.FILL, 22};
reportletNamePane = TableLayoutHelper.createCommonTableLayoutPane(templateChooserComponent, rowSize, columnSize, 0);
browserButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
@ -777,11 +780,13 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
if (currentTemplatePane.extendParametersCheckBox.isSelected()) {
exportJavaScript.setParameters(null);
} else {
List<ParameterProvider> parameterList = parameterViewPane.update();
if (!parameterList.isEmpty()) {
Parameter[] parameters = new Parameter[parameterList.size()];
parameterList.toArray(parameters);
js.setParameters(parameters);
if (parameterViewPane != null) {
List<ParameterProvider> parameterList = parameterViewPane.update();
if (!parameterList.isEmpty()) {
Parameter[] parameters = new Parameter[parameterList.size()];
parameterList.toArray(parameters);
js.setParameters(parameters);
}
}
}
exportJavaScript.addJS(js);

17
designer-base/src/main/java/com/fr/design/mainframe/guide/scene/AbstractGuideScene.java

@ -307,9 +307,6 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
nextButton.setBounds((getSceneWidth() - 60) / 2, getSceneHeight() - 100, 60, 30);
add(nextButton);
}
container.revalidate();
container.repaint();
}
showContainer();
if (lifecycle != null) {
@ -319,9 +316,7 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
@Override
public void complete() {
container.getLayeredPane().remove(this);
container.repaint();
clear();
if (lifecycle != null && !lifecycle.onComplete()) {
return;
}
@ -386,13 +381,15 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
return container.getLayeredPane().getHeight();
}
private void clear() {
public void clear() {
targetList = new ArrayList<>();
highlightList = new ArrayList<>();
this.nextButton = null;
this.removeAll();
invalidate();
repaint();
if (this.getComponentCount() > 0) {
this.removeAll();
invalidate();
repaint();
}
}
@Override

73
designer-base/src/main/java/com/fr/design/mainframe/guide/scene/ClickScene.java

@ -1,13 +1,15 @@
package com.fr.design.mainframe.guide.scene;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.mainframe.guide.base.GuideManager;
import javax.swing.AbstractButton;
import javax.swing.ButtonModel;
import javax.swing.SwingUtilities;
import java.awt.Component;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
@ -58,49 +60,60 @@ public class ClickScene extends AbstractGuideScene{
public void mouseClicked(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON1) {
if ((e.getClickCount() == 1 && clickType == ClickType.LEFT) || (e.getClickCount() == 2 && clickType == ClickType.LEFT_DOUBLE)) {
if (isDispatch) {
redispatchMouseEvent(e, target);
}
complete();
dealWithDispatchLeftClick(target, e, isDispatch);
}
} else if (e.getButton() == MouseEvent.BUTTON3 && clickType == ClickType.RIGHT) {
if (isDispatch) {
redispatchMouseEvent(e, target);
}
complete();
clear();
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (isDispatch) {
redispatchMouseEvent(e, target);
}
complete();
}
});
}
}
@Override
public void mousePressed(MouseEvent e) {
if (isDispatch) {
if (target instanceof AbstractButton) {
AbstractButton b = (AbstractButton) target;
b.setFocusable(false);
if ((target instanceof AbstractButton) && (target.getParent() instanceof UIButtonGroup)) {
if (isDispatch) {
redispatchMouseEvent(e, target);
}
redispatchMouseEvent(e, target);
}
}
@Override
public void mouseReleased(MouseEvent e) {
if (isDispatch) {
redispatchMouseEvent(e, target);
}
}
@Override
public void mouseEntered(MouseEvent e) {
if (isDispatch) {
redispatchMouseEvent(e, target);
}
}
});
}
private void dealWithDispatchLeftClick(Component target, MouseEvent e, boolean isDispatch) {
clear();
SwingUtilities.invokeLater(new Runnable() {
@Override
public void mouseExited(MouseEvent e) {
public void run() {
if (isDispatch) {
redispatchMouseEvent(e, target);
if (target instanceof AbstractButton) {
AbstractButton button = (AbstractButton) target;
ActionListener[] actionListeners= button.getActionListeners();
for(int i = 0; i < actionListeners.length; i++) {
ActionListener actionListener = actionListeners[i];
actionListener.actionPerformed(new ActionEvent(
button,
ActionEvent.ACTION_PERFORMED,
button.getActionCommand(),
e.getWhen(),
e.getModifiers()
));
}
} else {
redispatchMouseEvent(e, target);
}
}
complete();
}
});
}
@ -114,7 +127,7 @@ public class ClickScene extends AbstractGuideScene{
@Override
public void showScene() {
// 交互类的 scene 如果没有高亮内容块载,需要及时终止Guide,否则就没法去掉模态框影响到设计器主功能的使用了
if (this.getComponentCount() == 0) {
if (this.getComponentCount() == 0 && getHighlightList().isEmpty()) {
GuideManager.getInstance().getCurrentGuide().terminate();
} else {
super.showScene();

BIN
designer-form/src/main/resources/com/fr/design/form/layouts/images/simple_style_18.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

10
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.cell.settingpane;
import com.fr.base.Style;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.constants.UIConstants;
import com.fr.design.editor.ValueEditorPane;
@ -21,11 +22,13 @@ import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont;
import com.fr.report.cell.TemplateCellElement;
import com.fr.report.cell.cellattr.CellGUIAttr;
import com.fr.report.cell.cellattr.CellInsertPolicyAttr;
import com.fr.report.cell.cellattr.CellPageAttr;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.Constants;
import com.fr.stable.StringUtils;
import com.fr.design.i18n.Toolkit;
import java.awt.Color;
@ -327,13 +330,20 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
@Override
public void itemStateChanged(ItemEvent e) {
Style elementStyle = cellElement.getStyle();
FRFont frFont = elementStyle.getFRFont();
if (showContent.getSelectedIndex() == 3) {
fileNamePane.setPreferredSize(new Dimension(100, 20));
fileNameLayout.show(fileNamePane, "content");
frFont = frFont.applyForeground(Color.blue);
frFont = frFont.applyUnderline(Constants.LINE_THIN);
} else {
fileNameLayout.show(fileNamePane, "none");
fileNamePane.setPreferredSize(new Dimension(0, 0));
frFont = frFont.applyForeground(Color.black);
frFont = frFont.applyUnderline(Constants.LINE_NONE);
}
cellElement.setStyle(elementStyle.deriveFRFont(frFont));
}
});
return fileNamePane;

2
designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideSceneHelper.java

@ -19,8 +19,6 @@ import com.fr.design.utils.ComponentUtils;
import com.fr.design.worker.save.CallbackSaveWorker;
import com.fr.design.worker.save.EmptyCallBackSaveWorker;
import java.awt.Window;
public class GuideSceneHelper {
public static GuideScene createFormDesignerBodyDisplayScene() {
DisplayScene scene = new DisplayScene();

23
designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/ChangeLayoutComponentGuide.java

@ -98,20 +98,15 @@ public class ChangeLayoutComponentGuide {
@Override
public boolean prepared() {
switchButton.getComponentPopupMenu().setVisible(true);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
scene.addCustomTarget(
GuideCreateUtils.createModalTarget(switchButton.getComponentPopupMenu()),
GuideCreateUtils.getRelativeBounds(switchButton.getComponentPopupMenu(), switchButton,0, -switchButton.getComponentPopupMenu().getHeight())
);
scene.addClickTarget(switchButton.getComponentPopupMenu().getComponent(1), ClickScene.ClickType.LEFT, true);
scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_F001002_Tip_Select_Fix_layout"), null, GuideTip.Direction.RIGHT, 0.5f, 0.8f);
switchButton.getComponentPopupMenu().setVisible(false);
scene.showScene();
}
});
return false;
scene.addCustomTarget(
GuideCreateUtils.createModalTarget(switchButton.getComponentPopupMenu()),
GuideCreateUtils.getRelativeBounds(switchButton.getComponentPopupMenu(), switchButton,0, -switchButton.getComponentPopupMenu().getHeight())
);
scene.addClickTarget(switchButton.getComponentPopupMenu().getComponent(1), ClickScene.ClickType.LEFT, true);
scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_F001002_Tip_Select_Fix_layout"), null, GuideTip.Direction.RIGHT, 0.5f, 0.8f);
switchButton.getComponentPopupMenu().setVisible(false);
scene.showScene();
return true;
}
});
return scene;

24
designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java

@ -32,6 +32,7 @@ import com.fr.form.share.group.DefaultShareGroup;
import com.fr.form.share.group.DefaultShareGroupManager;
import com.fr.stable.StringUtils;
import javax.swing.JComponent;
import java.awt.Component;
import java.util.ArrayList;
import java.util.List;
@ -72,15 +73,11 @@ public class UseLayoutAndComponentGuide {
preloadShareComponent();
Component component = ComponentUtils.findComponentByName(NorthRegionContainerPane.getInstance(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_File"));
fileHeadMenu = ((UIHeadMenu) component);
fileHeadMenu.setSelected(true);
fileHeadMenu.getPopupMenu().show(fileHeadMenu, 0, fileHeadMenu.getHeight());
return true;
}
@Override
public void onEnd() {
fileHeadMenu.setSelected(false);
fileHeadMenu.getPopupMenu().setVisible(false);
if (newFormPane != null) {
newFormPane.getWindow().dispose();
}
@ -101,18 +98,18 @@ public class UseLayoutAndComponentGuide {
GuideCreateUtils.createModalTarget(fileHeadMenu.getPopupMenu()),
GuideCreateUtils.getRelativeBounds(fileHeadMenu.getPopupMenu(), fileHeadMenu, 0 , fileHeadMenu.getHeight())
);
scene.addClickTarget(fileHeadMenu.getMenuComponent(2), ClickScene.ClickType.LEFT);
scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_F001001_Tip_New_Form"), GuideTip.Direction.BOTTOM);
scene.addCustomClickTarget(
GuideCreateUtils.createTarget((JComponent) fileHeadMenu.getMenuComponent(2)),
GuideCreateUtils.getRelativeBounds(fileHeadMenu.getMenuComponent(2), fileHeadMenu, 0,fileHeadMenu.getHeight() + fileHeadMenu.getMenuComponent(2).getY()),
ClickScene.ClickType.LEFT
);
scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_F001001_Tip_New_Form") + "测试文本测试文本测试文本测试文本测试文本", GuideTip.Direction.BOTTOM);
scene.showScene();
return true;
}
@Override
public void onShow() {
fileHeadMenu.setSelected(false);
fileHeadMenu.getPopupMenu().setVisible(false);
}
@Override
public boolean onComplete() {
@ -124,6 +121,7 @@ public class UseLayoutAndComponentGuide {
return scene;
}
public static GuideScene createScene2() {
DisplayScene scene = new DisplayScene();
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@ -136,7 +134,7 @@ public class UseLayoutAndComponentGuide {
scene.showScene();
GuideCreateUtils.TIMER.purge();
}
}, 300);
}, 100);
return false;
}
});

2
designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java

@ -267,7 +267,7 @@ public class DownloadComponentPackageGuide {
scene.showScene();
GuideCreateUtils.TIMER.purge();
}
}, 300);
}, 100);
return false;
}
});

5
designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java

@ -136,7 +136,7 @@ public class ThemeToggleGuide {
scene.showScene();
GuideCreateUtils.TIMER.purge();
}
},300);
},100);
return false;
}
});
@ -194,7 +194,7 @@ public class ThemeToggleGuide {
if (target2 != null) {
uiButtonGroup[0] = (UIButtonGroup) target2;
target2 = ((UIButtonGroup) target2).getButton(0);
scene.addClickTarget(target2, ClickScene.ClickType.LEFT, true);
scene.addClickTarget(target2, ClickScene.ClickType.LEFT,true);
scene.addBubbleTip(
Toolkit.i18nText("Fine-Design_Guide_Scene_F002001_Tip_Toggle_Follow_Theme"),
Toolkit.i18nText("Fine-Design_Guide_Scene_F002001_Tip_Toggle_Follow_Theme_Description"),
@ -214,6 +214,7 @@ public class ThemeToggleGuide {
if (uiButtonGroup[0] != null) {
uiButtonGroup[0].setSelectedIndex(0);
}
GuideCreateUtils.getFormDesigner().repaint();
return true;
}
});

Loading…
Cancel
Save