|
|
@ -6,24 +6,39 @@ package com.fr.design.actions.insert.flot; |
|
|
|
import com.fr.base.BaseUtils; |
|
|
|
import com.fr.base.BaseUtils; |
|
|
|
import com.fr.base.DynamicUnitList; |
|
|
|
import com.fr.base.DynamicUnitList; |
|
|
|
import com.fr.base.Formula; |
|
|
|
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.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.mainframe.ElementCasePane; |
|
|
|
import com.fr.design.menu.MenuKeySet; |
|
|
|
import com.fr.design.menu.MenuKeySet; |
|
|
|
|
|
|
|
import com.fr.design.report.SelectImagePane; |
|
|
|
import com.fr.general.Inter; |
|
|
|
import com.fr.general.Inter; |
|
|
|
import com.fr.grid.Grid; |
|
|
|
import com.fr.grid.Grid; |
|
|
|
import com.fr.grid.selection.FloatSelection; |
|
|
|
import com.fr.grid.selection.FloatSelection; |
|
|
|
import com.fr.report.ReportHelper; |
|
|
|
import com.fr.report.ReportHelper; |
|
|
|
import com.fr.report.cell.FloatElement; |
|
|
|
import com.fr.report.cell.FloatElement; |
|
|
|
|
|
|
|
import com.fr.report.cell.cellattr.CellImage; |
|
|
|
import com.fr.report.elementcase.TemplateElementCase; |
|
|
|
import com.fr.report.elementcase.TemplateElementCase; |
|
|
|
|
|
|
|
import com.fr.stable.CoreGraphHelper; |
|
|
|
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.unit.FU; |
|
|
|
import com.fr.stable.unit.FU; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
import javax.swing.*; |
|
|
|
|
|
|
|
import java.awt.*; |
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Insert formula. |
|
|
|
* Insert formula. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class FormulaFloatAction extends AbstractShapeAction { |
|
|
|
public class FormulaFloatAction extends ElementCaseAction { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean returnValue = false; |
|
|
|
|
|
|
|
|
|
|
|
public FormulaFloatAction(ElementCasePane t) { |
|
|
|
public FormulaFloatAction(ElementCasePane t) { |
|
|
|
super(t); |
|
|
|
super(t); |
|
|
|
this.setMenuKeySet(FLOAT_INSERT_FORMULA); |
|
|
|
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() { |
|
|
|
private void doWithDrawingFloatElement() { |
|
|
|
ElementCasePane jws = (ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane(); |
|
|
|
ElementCasePane jws = (ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane(); |
|
|
|
Grid grid = jws.getGrid(); |
|
|
|
Grid grid = jws.getGrid(); |
|
|
@ -95,4 +93,43 @@ public class FormulaFloatAction extends AbstractShapeAction { |
|
|
|
reportPane.setSelection(new FloatSelection(grid.getDrawingFloatElement().getName())); |
|
|
|
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; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |