Browse Source

REPORT-2897 9.0设计器修改

插入悬浮元素公式,点击确定后才插入
插入悬浮元素文本,支持撤销
master
MoMeak 7 years ago
parent
commit
6b585ad7a7
  1. 73
      designer/src/com/fr/design/actions/insert/flot/FormulaFloatAction.java
  2. 4
      designer/src/com/fr/design/actions/insert/flot/TextBoxFloatAction.java

73
designer/src/com/fr/design/actions/insert/flot/FormulaFloatAction.java

@ -6,24 +6,39 @@ package com.fr.design.actions.insert.flot;
import com.fr.base.BaseUtils;
import com.fr.base.DynamicUnitList;
import com.fr.base.Formula;
import com.fr.design.actions.ElementCaseAction;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.formula.FormulaFactory;
import com.fr.design.formula.UIFormula;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.report.SelectImagePane;
import com.fr.general.Inter;
import com.fr.grid.Grid;
import com.fr.grid.selection.FloatSelection;
import com.fr.report.ReportHelper;
import com.fr.report.cell.FloatElement;
import com.fr.report.cell.cellattr.CellImage;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.CoreGraphHelper;
import com.fr.stable.StringUtils;
import com.fr.stable.unit.FU;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.io.File;
/**
* Insert formula.
*/
public class FormulaFloatAction extends AbstractShapeAction {
public class FormulaFloatAction extends ElementCaseAction {
private boolean returnValue = false;
public FormulaFloatAction(ElementCasePane t) {
super(t);
this.setMenuKeySet(FLOAT_INSERT_FORMULA);
@ -49,23 +64,6 @@ public class FormulaFloatAction extends AbstractShapeAction {
}
};
/**
* 动作
*
* @param e 事件
*/
public void actionPerformed(ActionEvent e) {
ElementCasePane jws = getEditingComponent();
if (jws == null) {
return;
}
//
FloatElement floatElement = new FloatElement(new Formula(""));
this.startDraw(floatElement);
doWithDrawingFloatElement();
jws.getGrid().startEditing();
}
private void doWithDrawingFloatElement() {
ElementCasePane jws = (ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane();
Grid grid = jws.getGrid();
@ -95,4 +93,43 @@ public class FormulaFloatAction extends AbstractShapeAction {
reportPane.setSelection(new FloatSelection(grid.getDrawingFloatElement().getName()));
}
/**
* 执行动作
*
* @return 成功返回true
*/
@Override
public boolean executeActionReturnUndoRecordNeeded() {
final ElementCasePane reportPane = (ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane();
if (reportPane == null) {
return false;
}
reportPane.stopEditing();
final FloatElement floatElement = new FloatElement();
final UIFormula formulaPane = FormulaFactory.createFormulaPane();
formulaPane.populate(new Formula(StringUtils.EMPTY));
BasicDialog dialog = formulaPane.showLargeWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
floatElement.setValue(formulaPane.update());
if (reportPane == null) {
return;
}
reportPane.getGrid().setDrawingFloatElement(floatElement);
doWithDrawingFloatElement();
returnValue = true;
}
@Override
public void doCancel() {
returnValue = false;
}
});
dialog.setVisible(true);
return returnValue;
}
}

4
designer/src/com/fr/design/actions/insert/flot/TextBoxFloatAction.java

@ -54,6 +54,7 @@ public class TextBoxFloatAction extends AbstractShapeAction {
*
* @param e 动作
*/
@Override
public void actionPerformed(ActionEvent e) {
ElementCasePane jws = getEditingComponent();
if (jws == null) {
@ -67,7 +68,7 @@ public class TextBoxFloatAction extends AbstractShapeAction {
private void doWithDrawingFloatElement() {
ElementCasePane jws = (ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane();
;
Grid grid = jws.getGrid();
ElementCasePane reportPane = grid.getElementCasePane();
@ -93,5 +94,6 @@ public class TextBoxFloatAction extends AbstractShapeAction {
report.addFloatElement(grid.getDrawingFloatElement());
reportPane.setSelection(new FloatSelection(grid.getDrawingFloatElement().getName()));
reportPane.fireTargetModified();
}
}
Loading…
Cancel
Save