Browse Source

代码质量,公式部分可扩展

master
finereport 7 years ago
parent
commit
6a9170a93c
  1. 3
      designer/src/com/fr/design/actions/insert/flot/FormulaFloatAction.java
  2. 10
      designer/src/com/fr/design/cell/editor/FormulaCellEditor.java
  3. 10
      designer/src/com/fr/design/cell/editor/FormulaFloatEditor.java
  4. 5
      designer/src/com/fr/design/cell/editor/RichTextToolBar.java
  5. 10
      designer/src/com/fr/design/dscolumn/DSColumnAdvancedPane.java
  6. 6
      designer/src/com/fr/design/dscolumn/SpecifiedGroupAttrPane.java
  7. 5
      designer/src/com/fr/design/headerfooter/HFAttributesEditDialog.java
  8. 2
      designer/src/com/fr/design/mainframe/ElementCasePane.java
  9. 2
      designer/src/com/fr/design/module/DesignerModule.java
  10. 5
      designer/src/com/fr/design/report/RichTextEditingPane.java
  11. 6
      designer/src/com/fr/design/report/ValueVerifierEditPane.java
  12. 47
      designer/src/com/fr/design/widget/ui/DateEditorDefinePane.java
  13. 22
      designer/src/com/fr/grid/IntelliElements.java
  14. 18
      designer/src/com/fr/grid/selection/CellSelection.java
  15. 13
      designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java
  16. 12
      designer/src/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java
  17. 8
      designer/src/com/fr/quickeditor/cellquick/CellStringQuickEditor.java
  18. 8
      designer/src/com/fr/quickeditor/floatquick/FloatStringQuickEditor.java
  19. 25
      designer_base/src/com/fr/design/actions/core/ActionFactory.java
  20. 10
      designer_base/src/com/fr/design/condition/LiteConditionPane.java
  21. 239
      designer_base/src/com/fr/design/data/datapane/ChoosePaneSupportFormula.java
  22. 4
      designer_base/src/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java
  23. 17
      designer_base/src/com/fr/design/editor/DoubleDeckValueEditorPane.java
  24. 17
      designer_base/src/com/fr/design/editor/ValueEditorPane.java
  25. 5
      designer_base/src/com/fr/design/editor/editor/ConstantsEditor.java
  26. 28
      designer_base/src/com/fr/design/editor/editor/FormulaEditor.java
  27. 41
      designer_base/src/com/fr/design/formula/FormulaPane.java
  28. 7
      designer_base/src/com/fr/design/formula/FormulaPaneWhenReserveFormula.java
  29. 7
      designer_base/src/com/fr/design/formula/SortFormulaPane.java
  30. 7
      designer_base/src/com/fr/design/formula/TinyFormulaPane.java
  31. 7
      designer_base/src/com/fr/design/formula/UIFormula.java
  32. 10
      designer_base/src/com/fr/design/present/dict/FormulaDictPane.java
  33. 11
      designer_base/src/com/fr/design/widget/component/DateValuePane.java
  34. 64
      designer_base/src/com/fr/design/write/submit/DBManipulationPane.java
  35. 5
      designer_chart/src/com/fr/design/chart/ChartSwingUtils.java
  36. 7
      designer_chart/src/com/fr/design/chart/axis/ChartAlertValuePane.java
  37. 14
      designer_chart/src/com/fr/design/chart/axis/MinMaxValuePane.java
  38. 30
      designer_chart/src/com/fr/design/chart/report/GisMapReportDataContentPane.java
  39. 26
      designer_chart/src/com/fr/design/chart/report/MapMoreReportIndexPane.java
  40. 33
      designer_chart/src/com/fr/design/chart/report/MapReportDataSinglePane.java
  41. 6
      designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/AbstractReportDataContentPane.java
  42. 3
      designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotReportDataContentPane.java
  43. 4
      designer_chart/src/com/fr/design/mainframe/chart/gui/other/ChartDesignerInteractivePane.java
  44. 4
      designer_chart/src/com/fr/design/mainframe/chart/gui/other/ChartInteractivePane.java
  45. 25
      designer_chart/src/com/fr/design/mainframe/chart/gui/other/TimeSwitchPane.java
  46. 38
      designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartAxisLabelPane.java
  47. 6
      designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartAxisTitlePane.java
  48. 23
      designer_chart/src/com/fr/design/mainframe/chart/gui/style/DateAxisValuePane.java
  49. 5
      designer_chart/src/com/fr/design/mainframe/chart/gui/style/axis/ChartValuePane.java
  50. 24
      designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java
  51. 24
      designer_chart/src/com/fr/design/mainframe/chart/gui/style/title/ChartTitlePane.java
  52. 14
      designer_chart/src/com/fr/plugin/chart/designer/other/VanChartInteractivePane.java
  53. 8
      designer_chart/src/com/fr/plugin/chart/designer/style/VanChartTitlePane.java
  54. 12
      designer_chart/src/com/fr/plugin/chart/designer/style/axis/VanChartBaseAxisPane.java
  55. 16
      designer_chart/src/com/fr/plugin/chart/designer/style/axis/VanChartTimeAxisPane.java
  56. 5
      designer_chart/src/com/fr/plugin/chart/designer/style/axis/VanChartValueAxisPane.java
  57. 6
      designer_chart/src/com/fr/plugin/chart/designer/style/axis/component/MinMaxValuePaneWithOutTick.java
  58. 5
      designer_chart/src/com/fr/plugin/chart/designer/style/background/VanChartAlertValuePane.java
  59. 6
      designer_chart/src/com/fr/plugin/chart/designer/style/background/VanChartCustomIntervalBackgroundPane.java
  60. 12
      designer_form/src/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java
  61. 3
      designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleFormulaEditor.java
  62. 3
      designer_form/src/com/fr/design/mainframe/widget/wrappers/FormulaWrapper.java
  63. 49
      designer_form/src/com/fr/design/widget/ui/designer/DateEditorDefinePane.java

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

@ -3,6 +3,7 @@
*/ */
package com.fr.design.actions.insert.flot; package com.fr.design.actions.insert.flot;
import com.fr.base.BaseFormula;
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;
@ -108,7 +109,7 @@ public class FormulaFloatAction extends ElementCaseAction {
reportPane.stopEditing(); reportPane.stopEditing();
final FloatElement floatElement = new FloatElement(); final FloatElement floatElement = new FloatElement();
final UIFormula formulaPane = FormulaFactory.createFormulaPane(); final UIFormula formulaPane = FormulaFactory.createFormulaPane();
formulaPane.populate(new Formula(StringUtils.EMPTY)); formulaPane.populate(BaseFormula.createFormulaBuilder().build());
BasicDialog dialog = formulaPane.showLargeWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { BasicDialog dialog = formulaPane.showLargeWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {

10
designer/src/com/fr/design/cell/editor/FormulaCellEditor.java

@ -3,7 +3,7 @@
*/ */
package com.fr.design.cell.editor; package com.fr.design.cell.editor;
import com.fr.base.Formula; import com.fr.base.BaseFormula;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.formula.FormulaFactory; import com.fr.design.formula.FormulaFactory;
import com.fr.design.formula.UIFormula; import com.fr.design.formula.UIFormula;
@ -34,7 +34,7 @@ public class FormulaCellEditor extends com.fr.design.cell.editor.AbstractCellEdi
*/ */
@Override @Override
public Object getCellEditorValue() throws Exception { public Object getCellEditorValue() throws Exception {
Formula newFormula = this.formulaEditorPane.update(); BaseFormula newFormula = this.formulaEditorPane.update();
if (newFormula.getContent() != null && newFormula.getContent().trim().length() > 1) { if (newFormula.getContent() != null && newFormula.getContent().trim().length() > 1) {
return newFormula; return newFormula;
} else { } else {
@ -64,13 +64,13 @@ public class FormulaCellEditor extends com.fr.design.cell.editor.AbstractCellEdi
if (cellElement != null) { if (cellElement != null) {
value = cellElement.getValue(); value = cellElement.getValue();
} }
if (value == null || !(value instanceof Formula)) { if (value == null || !(value instanceof BaseFormula)) {
value = new Formula(""); value = BaseFormula.createFormulaBuilder().build();
} }
this.formulaEditorPane = FormulaFactory.createFormulaPaneWhenReserveFormula(); this.formulaEditorPane = FormulaFactory.createFormulaPaneWhenReserveFormula();
this.formulaEditorPane.populate((Formula) value); this.formulaEditorPane.populate((BaseFormula) value);
return this.formulaEditorPane.showLargeWindow(SwingUtilities.getWindowAncestor(grid), new DialogActionAdapter() { return this.formulaEditorPane.showLargeWindow(SwingUtilities.getWindowAncestor(grid), new DialogActionAdapter() {
@Override @Override

10
designer/src/com/fr/design/cell/editor/FormulaFloatEditor.java

@ -3,7 +3,7 @@
*/ */
package com.fr.design.cell.editor; package com.fr.design.cell.editor;
import com.fr.base.Formula; import com.fr.base.BaseFormula;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.formula.FormulaFactory; import com.fr.design.formula.FormulaFactory;
import com.fr.design.formula.UIFormula; import com.fr.design.formula.UIFormula;
@ -31,7 +31,7 @@ public class FormulaFloatEditor extends AbstractFloatEditor {
*/ */
@Override @Override
public Object getFloatEditorValue() throws Exception { public Object getFloatEditorValue() throws Exception {
Formula newFormula = this.formulaEditorPane.update(); BaseFormula newFormula = this.formulaEditorPane.update();
if (newFormula.getContent() != null && newFormula.getContent().trim().length() > 1) { if (newFormula.getContent() != null && newFormula.getContent().trim().length() > 1) {
return newFormula; return newFormula;
} else { } else {
@ -59,12 +59,12 @@ public class FormulaFloatEditor extends AbstractFloatEditor {
public Component getFloatEditorComponent(Grid grid, FloatElement floatElement, int resolution) { public Component getFloatEditorComponent(Grid grid, FloatElement floatElement, int resolution) {
//populate data to UI //populate data to UI
Object value = floatElement.getValue(); Object value = floatElement.getValue();
if (value == null || !(value instanceof com.fr.base.Formula)) { if (value == null || !(value instanceof BaseFormula)) {
value = new Formula(""); value = BaseFormula.createFormulaBuilder().build();
} }
this.formulaEditorPane = FormulaFactory.createFormulaPane(); this.formulaEditorPane = FormulaFactory.createFormulaPane();
this.formulaEditorPane.populate((Formula) value); this.formulaEditorPane.populate((BaseFormula) value);
return this.formulaEditorPane.showLargeWindow(SwingUtilities.getWindowAncestor(grid), new DialogActionAdapter() { return this.formulaEditorPane.showLargeWindow(SwingUtilities.getWindowAncestor(grid), new DialogActionAdapter() {

5
designer/src/com/fr/design/cell/editor/RichTextToolBar.java

@ -3,6 +3,7 @@
*/ */
package com.fr.design.cell.editor; package com.fr.design.cell.editor;
import com.fr.base.BaseFormula;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.Formula; import com.fr.base.Formula;
@ -311,12 +312,12 @@ public class RichTextToolBar extends BasicPane{
private ActionListener formulaActionListener = new ActionListener() { private ActionListener formulaActionListener = new ActionListener() {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
final UIFormula formulaPane = FormulaFactory.createFormulaPane(); final UIFormula formulaPane = FormulaFactory.createFormulaPane();
formulaPane.populate(new Formula()); formulaPane.populate(BaseFormula.createFormulaBuilder().build());
formulaPane.showLargeWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { formulaPane.showLargeWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
StyledDocument doc = (StyledDocument) textPane.getDocument(); StyledDocument doc = (StyledDocument) textPane.getDocument();
Formula fm = formulaPane.update(); BaseFormula fm = formulaPane.update();
String content = RichTextConverter.asFormula(fm.getContent()); String content = RichTextConverter.asFormula(fm.getContent());
int start = textPane.getSelectionStart(); int start = textPane.getSelectionStart();
AttributeSet attrs = start > 0 ? doc.getCharacterElement(start - 1).getAttributes() : new SimpleAttributeSet(); AttributeSet attrs = start > 0 ? doc.getCharacterElement(start - 1).getAttributes() : new SimpleAttributeSet();

10
designer/src/com/fr/design/dscolumn/DSColumnAdvancedPane.java

@ -1,6 +1,6 @@
package com.fr.design.dscolumn; package com.fr.design.dscolumn;
import com.fr.base.Formula; import com.fr.base.BaseFormula;
import com.fr.data.util.SortOrder; import com.fr.data.util.SortOrder;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
@ -31,7 +31,9 @@ import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.*; import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.BOTTOM;
import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.SPECIFY;
import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.TOP;
public class DSColumnAdvancedPane extends BasicPane { public class DSColumnAdvancedPane extends BasicPane {
@ -460,7 +462,7 @@ public class DSColumnAdvancedPane extends BasicPane {
private ActionListener formulaButtonActionListener = new ActionListener() { private ActionListener formulaButtonActionListener = new ActionListener() {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
Formula valueFormula = new Formula(); BaseFormula valueFormula = BaseFormula.createFormulaBuilder().build();
String text = formulaTextField.getText(); String text = formulaTextField.getText();
if (text == null || text.length() <= 0) { if (text == null || text.length() <= 0) {
valueFormula.setContent(defaultValue); valueFormula.setContent(defaultValue);
@ -485,7 +487,7 @@ public class DSColumnAdvancedPane extends BasicPane {
formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(JFormulaField.this), new DialogActionAdapter() { formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(JFormulaField.this), new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
Formula valueFormula = formulaPane.update(); BaseFormula valueFormula = formulaPane.update();
if (valueFormula.getContent().length() <= 1) { if (valueFormula.getContent().length() <= 1) {
formulaTextField.setText(defaultValue); formulaTextField.setText(defaultValue);
} else { } else {

6
designer/src/com/fr/design/dscolumn/SpecifiedGroupAttrPane.java

@ -1,6 +1,6 @@
package com.fr.design.dscolumn; package com.fr.design.dscolumn;
import com.fr.base.Formula; import com.fr.base.BaseFormula;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.condition.DSColumnLiteConditionPane; import com.fr.design.condition.DSColumnLiteConditionPane;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
@ -333,7 +333,7 @@ public class SpecifiedGroupAttrPane extends BasicPane {
formulaButton.setPreferredSize(new Dimension(25, valueField.getPreferredSize().height)); formulaButton.setPreferredSize(new Dimension(25, valueField.getPreferredSize().height));
formulaButton.addActionListener(new ActionListener() { formulaButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
Formula valueFormula = new Formula(); BaseFormula valueFormula = BaseFormula.createFormulaBuilder().build();
String text = valueField.getText(); String text = valueField.getText();
if (text == null || text.length() <= 0) { if (text == null || text.length() <= 0) {
valueFormula.setContent("$$$"); valueFormula.setContent("$$$");
@ -347,7 +347,7 @@ public class SpecifiedGroupAttrPane extends BasicPane {
formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(FormulaGroupPane.this), new DialogActionAdapter(){ formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(FormulaGroupPane.this), new DialogActionAdapter(){
@Override @Override
public void doOk() { public void doOk() {
Formula valueFormula = formulaPane.update(); BaseFormula valueFormula = formulaPane.update();
if (valueFormula.getContent().length() <= 1) { if (valueFormula.getContent().length() <= 1) {
valueField.setText("$$$"); valueField.setText("$$$");
} else { } else {

5
designer/src/com/fr/design/headerfooter/HFAttributesEditDialog.java

@ -3,6 +3,7 @@
*/ */
package com.fr.design.headerfooter; package com.fr.design.headerfooter;
import com.fr.base.BaseFormula;
import com.fr.base.Formula; import com.fr.base.Formula;
import com.fr.base.headerfooter.*; import com.fr.base.headerfooter.*;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
@ -121,7 +122,7 @@ public class HFAttributesEditDialog extends BasicPane {
formulaButton.addActionListener(new ActionListener() { formulaButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
Formula valueFormula = new Formula(); BaseFormula valueFormula = BaseFormula.createFormulaBuilder().build();
String text = formulaContentField.getText(); String text = formulaContentField.getText();
if (text == null || text.length() <= 0) { if (text == null || text.length() <= 0) {
valueFormula.setContent(""); valueFormula.setContent("");
@ -135,7 +136,7 @@ public class HFAttributesEditDialog extends BasicPane {
@Override @Override
public void doOk() { public void doOk() {
Formula valueFormula = formulaPane.update(); BaseFormula valueFormula = formulaPane.update();
if (valueFormula.getContent().length() <= 1) { if (valueFormula.getContent().length() <= 1) {
formulaContentField.setText(""); formulaContentField.setText("");
} else { } else {

2
designer/src/com/fr/design/mainframe/ElementCasePane.java

@ -322,7 +322,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
private void initDefaultEditors() { private void initDefaultEditors() {
Grid grid = this.getGrid(); Grid grid = this.getGrid();
grid.setDefaultCellEditor(DSColumn.class, new DSColumnCellEditor(this)); grid.setDefaultCellEditor(DSColumn.class, new DSColumnCellEditor(this));
grid.setDefaultCellEditor(Formula.class, new FormulaCellEditor(this)); grid.setDefaultCellEditor(BaseFormula.class, new FormulaCellEditor(this));
grid.setDefaultCellEditor(RichText.class, new RichTextCellEditor(this)); grid.setDefaultCellEditor(RichText.class, new RichTextCellEditor(this));
grid.setDefaultCellEditor(BiasTextPainter.class, new BiasTextPainterCellEditor(this)); grid.setDefaultCellEditor(BiasTextPainter.class, new BiasTextPainterCellEditor(this));

2
designer/src/com/fr/design/module/DesignerModule.java

@ -112,7 +112,7 @@ public class DesignerModule extends DesignModule {
private void registerCellEditor() { private void registerCellEditor() {
ActionFactory.registerCellEditor(String.class, CellStringQuickEditor.class); ActionFactory.registerCellEditor(String.class, CellStringQuickEditor.class);
ActionFactory.registerCellEditor(Number.class, CellStringQuickEditor.class); ActionFactory.registerCellEditor(Number.class, CellStringQuickEditor.class);
ActionFactory.registerCellEditor(Formula.class, CellFormulaQuickEditor.class); ActionFactory.registerCellEditor(BaseFormula.class, CellFormulaQuickEditor.class);
ActionFactory.registerCellEditor(SubReport.class, CellSubReportEditor.class); ActionFactory.registerCellEditor(SubReport.class, CellSubReportEditor.class);
ActionFactory.registerCellEditor(RichText.class, CellRichTextEditor.class); ActionFactory.registerCellEditor(RichText.class, CellRichTextEditor.class);
ActionFactory.registerCellEditor(DSColumn.class, CellDSColumnEditor.class); ActionFactory.registerCellEditor(DSColumn.class, CellDSColumnEditor.class);

5
designer/src/com/fr/design/report/RichTextEditingPane.java

@ -3,6 +3,7 @@
*/ */
package com.fr.design.report; package com.fr.design.report;
import com.fr.base.BaseFormula;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.Formula; import com.fr.base.Formula;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
@ -139,12 +140,12 @@ public class RichTextEditingPane extends UITextPane{
private void popUpFormulaEditPane(final String formulaContent, final int formulaStart, private void popUpFormulaEditPane(final String formulaContent, final int formulaStart,
final AttributeSet attrs){ final AttributeSet attrs){
final UIFormula formulaPane = FormulaFactory.createFormulaPane(); final UIFormula formulaPane = FormulaFactory.createFormulaPane();
formulaPane.populate(new Formula(formulaContent)); formulaPane.populate(BaseFormula.createFormulaBuilder().build(formulaContent));
formulaPane.showLargeWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { formulaPane.showLargeWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
StyledDocument doc = (StyledDocument) RichTextEditingPane.this.getDocument(); StyledDocument doc = (StyledDocument) RichTextEditingPane.this.getDocument();
Formula fm = formulaPane.update(); BaseFormula fm = formulaPane.update();
String content = RichTextConverter.asFormula(fm.getContent()); String content = RichTextConverter.asFormula(fm.getContent());
try { try {
doc.remove(formulaStart, formulaContent.length() + WRAPPER_LEN); doc.remove(formulaStart, formulaContent.length() + WRAPPER_LEN);

6
designer/src/com/fr/design/report/ValueVerifierEditPane.java

@ -1,6 +1,6 @@
package com.fr.design.report; package com.fr.design.report;
import com.fr.base.Formula; import com.fr.base.BaseFormula;
import com.fr.data.VerifyItem; import com.fr.data.VerifyItem;
import com.fr.design.gui.itableeditorpane.ActionStyle; import com.fr.design.gui.itableeditorpane.ActionStyle;
import com.fr.design.gui.itableeditorpane.UIArrayFormulaTableModel; import com.fr.design.gui.itableeditorpane.UIArrayFormulaTableModel;
@ -50,7 +50,7 @@ public class ValueVerifierEditPane extends JPanel {
if (!StableUtils.canBeFormula(msg)) { if (!StableUtils.canBeFormula(msg)) {
msg = "\"" + msg + "\"";//如果报错信息是以前的写法(字符串)就拼上"" msg = "\"" + msg + "\"";//如果报错信息是以前的写法(字符串)就拼上""
} }
os[tableDataCount++] = new Object[]{formula, new Formula(msg)}; os[tableDataCount++] = new Object[]{formula, BaseFormula.createFormulaBuilder().build(msg)};
} }
this.tableEditorPane.populate(os); this.tableEditorPane.populate(os);
} }
@ -63,7 +63,7 @@ public class ValueVerifierEditPane extends JPanel {
if (o == null || o[0] == null) { if (o == null || o[0] == null) {
continue; continue;
} }
VerifyItem item = new VerifyItem(new Formula(GeneralUtils.objectToString(o[0])), GeneralUtils.objectToString(o[1])); VerifyItem item = new VerifyItem(BaseFormula.createFormulaBuilder().build(o[0]), GeneralUtils.objectToString(o[1]));
valueVerifier.addVerifyItem(item); valueVerifier.addVerifyItem(item);
} }
return valueVerifier; return valueVerifier;

47
designer/src/com/fr/design/widget/ui/DateEditorDefinePane.java

@ -17,6 +17,7 @@ import com.fr.general.DateUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.script.Calculator; import com.fr.script.Calculator;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.FormulaProvider;
import com.fr.stable.UtilEvalError; import com.fr.stable.UtilEvalError;
import javax.swing.*; import javax.swing.*;
@ -214,52 +215,6 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
return ob; return ob;
} }
/**
* 更新日期控件的起止日期
* @param dateWidgetEditor 日期控件
*/
public void updateStartEnd(DateEditor dateWidgetEditor) {
Object startObject = "";
Object endObject = endDv.update();
// wei : 对公式的处理
Calculator cal = null;
if (startObject instanceof Formula) {
cal = Calculator.createCalculator();
Formula startFormula = (Formula) startObject;
try {
startFormula.setResult(cal.evalValue(startFormula.getContent()));
} catch (UtilEvalError e) {
FRContext.getLogger().error(e.getMessage(), e);
}
startObject = startFormula.getResult();
dateWidgetEditor.setStartDateFM(startFormula);
dateWidgetEditor.setStartText(null);
} else {
try {
dateWidgetEditor.setStartText(startObject == null ? "" : DateUtils.getDate2Str("MM/dd/yyyy", (Date)startObject));
} catch(ClassCastException e) {
//wei : TODO 说明应用的公式不能转化成日期格式,应该做些处理。
}
}
if (endObject instanceof Formula) {
cal = Calculator.createCalculator();
Formula endFormula = (Formula) endObject;
try {
endFormula.setResult(cal.evalValue(endFormula.getContent()));
} catch (UtilEvalError e) {
FRContext.getLogger().error(e.getMessage(), e);
}
endObject = endFormula.getResult();
dateWidgetEditor.setEndDateFM(endFormula);
dateWidgetEditor.setEndText(null);
} else {
try {
dateWidgetEditor.setEndText(endObject == null ? "" : DateUtils.getDate2Str("MM/dd/yyyy", (Date)endObject));
} catch(ClassCastException e) {
}
}
}
private SimpleDateFormat getSimpleDateFormat() { private SimpleDateFormat getSimpleDateFormat() {
String text = (String) currentFormatComboBox.getSelectedItem(); String text = (String) currentFormatComboBox.getSelectedItem();

22
designer/src/com/fr/grid/IntelliElements.java

@ -1,12 +1,8 @@
package com.fr.grid; package com.fr.grid;
import java.awt.Rectangle; import com.fr.base.BaseFormula;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.Formula;
import com.fr.design.cell.clipboard.CellElementsClip; import com.fr.design.cell.clipboard.CellElementsClip;
import com.fr.design.cell.clipboard.ElementsTransferable; import com.fr.design.cell.clipboard.ElementsTransferable;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
@ -19,6 +15,10 @@ import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.ColumnRow; import com.fr.stable.ColumnRow;
import java.awt.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/** /**
* Kevin Wang: inner class used by method intelliElements iterating in GridUtils.java. * Kevin Wang: inner class used by method intelliElements iterating in GridUtils.java.
*/ */
@ -199,8 +199,8 @@ public class IntelliElements {
newCellElement.setCellExpandAttr(sourceCellElement.getCellExpandAttr()); newCellElement.setCellExpandAttr(sourceCellElement.getCellExpandAttr());
} else if (sourceCellElement.getValue() instanceof Number) { } else if (sourceCellElement.getValue() instanceof Number) {
newCellElement.setValue(processNumber((Number) sourceCellElement.getValue())); newCellElement.setValue(processNumber((Number) sourceCellElement.getValue()));
} else if (sourceCellElement.getValue() instanceof Formula) { } else if (sourceCellElement.getValue() instanceof BaseFormula) {
Formula formula = (Formula) sourceCellElement.getValue(); BaseFormula formula = (BaseFormula) sourceCellElement.getValue();
formula = this.generateSimpleFormula(formula, 1); formula = this.generateSimpleFormula(formula, 1);
newCellElement.setValue(formula); newCellElement.setValue(formula);
} else { } else {
@ -231,12 +231,12 @@ public class IntelliElements {
protected abstract ColumnRow processColumnRow(ColumnRow org, int diff); protected abstract ColumnRow processColumnRow(ColumnRow org, int diff);
private Formula generateSimpleFormula(Formula formula, int diff) { private BaseFormula generateSimpleFormula(BaseFormula formula, int diff) {
Formula newFormula; BaseFormula newFormula;
try { try {
newFormula = (Formula) (formula.clone()); newFormula = formula.clone();
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
newFormula = new Formula(); newFormula = BaseFormula.createFormulaBuilder().build();
FRContext.getLogger().error(e.getMessage(), e); FRContext.getLogger().error(e.getMessage(), e);
} }
String formulaContent = formula.getContent(); String formulaContent = formula.getContent();

18
designer/src/com/fr/grid/selection/CellSelection.java

@ -1,10 +1,21 @@
package com.fr.grid.selection; package com.fr.grid.selection;
import com.fr.base.*; import com.fr.base.BaseFormula;
import com.fr.base.BaseUtils;
import com.fr.base.ConfigManager;
import com.fr.base.NameStyle;
import com.fr.base.Utils;
import com.fr.cache.list.IntList; import com.fr.cache.list.IntList;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.cell.*; import com.fr.design.actions.cell.CellAttributeAction;
import com.fr.design.actions.cell.CellExpandAttrAction;
import com.fr.design.actions.cell.CellWidgetAttrAction;
import com.fr.design.actions.cell.CleanAuthorityAction;
import com.fr.design.actions.cell.ConditionAttributesAction;
import com.fr.design.actions.cell.EditCellAction;
import com.fr.design.actions.cell.GlobalStyleMenuDef;
import com.fr.design.actions.cell.GlobalStyleMenuDef.GlobalStyleSelection; import com.fr.design.actions.cell.GlobalStyleMenuDef.GlobalStyleSelection;
import com.fr.design.actions.cell.StyleAction;
import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.edit.CopyAction; import com.fr.design.actions.edit.CopyAction;
import com.fr.design.actions.edit.CutAction; import com.fr.design.actions.edit.CutAction;
@ -26,7 +37,6 @@ import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
import com.fr.design.report.RowColumnPane; import com.fr.design.report.RowColumnPane;
import com.fr.design.selection.QuickEditor; import com.fr.design.selection.QuickEditor;
import com.fr.form.ui.CellWidget;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.grid.GridUtils; import com.fr.grid.GridUtils;
import com.fr.report.cell.CellElement; import com.fr.report.cell.CellElement;
@ -293,7 +303,7 @@ public class CellSelection extends Selection {
for (int c = 0; c < lineTextArray.length; c++) { for (int c = 0; c < lineTextArray.length; c++) {
String textValue = lineTextArray[c]; String textValue = lineTextArray[c];
if (textValue.length() > 0 && textValue.charAt(0) == '=') { if (textValue.length() > 0 && textValue.charAt(0) == '=') {
ec.setCellValue(column + c, row + r, new Formula(textValue)); ec.setCellValue(column + c, row + r, BaseFormula.createFormulaBuilder().build(textValue));
} else { } else {
Number number = Utils.string2Number(lineTextArray[c]); Number number = Utils.string2Number(lineTextArray[c]);
if (number != null) { if (number != null) {

13
designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java

@ -1,6 +1,6 @@
package com.fr.quickeditor.cellquick; package com.fr.quickeditor.cellquick;
import com.fr.base.Formula; import com.fr.base.BaseFormula;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.columnrow.DSColumnConditionAction; import com.fr.design.actions.columnrow.DSColumnConditionAction;
import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.core.ActionFactory;
@ -47,7 +47,12 @@ import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.ArrayList; import java.util.ArrayList;
import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.*; import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.BOTTOM;
import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.EVEN;
import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.ODD;
import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.SPECIFY;
import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.TOP;
import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.UNDEFINE;
/** /**
@ -974,7 +979,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
private ActionListener formulaButtonActionListener = new ActionListener() { private ActionListener formulaButtonActionListener = new ActionListener() {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
Formula valueFormula = new Formula(); BaseFormula valueFormula = BaseFormula.createFormulaBuilder().build();
String text = formulaTextField.getText(); String text = formulaTextField.getText();
if (text == null || text.length() <= 0) { if (text == null || text.length() <= 0) {
valueFormula.setContent(defaultValue); valueFormula.setContent(defaultValue);
@ -991,7 +996,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(DSColumnAdvancedEditorPane.JFormulaField.this), new DialogActionAdapter() { formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(DSColumnAdvancedEditorPane.JFormulaField.this), new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
Formula valueFormula = formulaPane.update(); BaseFormula valueFormula = formulaPane.update();
if (valueFormula.getContent().length() <= 1) { if (valueFormula.getContent().length() <= 1) {
formulaTextField.setText(defaultValue); formulaTextField.setText(defaultValue);
} else { } else {

12
designer/src/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java

@ -1,6 +1,6 @@
package com.fr.quickeditor.cellquick; package com.fr.quickeditor.cellquick;
import com.fr.base.Formula; import com.fr.base.BaseFormula;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.TextFormat; import com.fr.base.TextFormat;
import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.core.ActionFactory;
@ -99,11 +99,11 @@ public class CellFormulaQuickEditor extends CellQuickEditor {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
String text = formulaTextField.getText(); String text = formulaTextField.getText();
final UIFormula formulaPane = FormulaFactory.createFormulaPane(); final UIFormula formulaPane = FormulaFactory.createFormulaPane();
formulaPane.populate(new Formula(text)); formulaPane.populate(BaseFormula.createFormulaBuilder().build(text));
formulaPane.showLargeWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { formulaPane.showLargeWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
Formula fm = formulaPane.update(); BaseFormula fm = formulaPane.update();
if (fm.getContent().length() <= 1) { if (fm.getContent().length() <= 1) {
formulaTextField.setText(DEFAULT_FORMULA); formulaTextField.setText(DEFAULT_FORMULA);
} else { } else {
@ -146,7 +146,7 @@ public class CellFormulaQuickEditor extends CellQuickEditor {
tc.getEditingElementCase().addCellElement(cellElement, false); tc.getEditingElementCase().addCellElement(cellElement, false);
} }
if (tmpText != null && (tmpText.length() > 0 && tmpText.charAt(0) == '=')) { if (tmpText != null && (tmpText.length() > 0 && tmpText.charAt(0) == '=')) {
Formula textFormula = new Formula(tmpText); BaseFormula textFormula = BaseFormula.createFormulaBuilder().build(tmpText);
textFormula.setReserveInResult(reserveInResult); textFormula.setReserveInResult(reserveInResult);
textFormula.setReserveOnWriteOrAnaly(reserveOnWriteOrAnaly); textFormula.setReserveOnWriteOrAnaly(reserveOnWriteOrAnaly);
cellElement.setValue(textFormula); cellElement.setValue(textFormula);
@ -175,8 +175,8 @@ public class CellFormulaQuickEditor extends CellQuickEditor {
Object value = cellElement.getValue(); Object value = cellElement.getValue();
if (value == null) { if (value == null) {
str = StringUtils.EMPTY; str = StringUtils.EMPTY;
} else if (value instanceof Formula) { } else if (value instanceof BaseFormula) {
Formula formula = (Formula) value; BaseFormula formula = (BaseFormula) value;
str = formula.getContent(); str = formula.getContent();
reserveInResult = formula.isReserveInResult(); reserveInResult = formula.isReserveInResult();
reserveOnWriteOrAnaly = formula.isReserveOnWriteOrAnaly(); reserveOnWriteOrAnaly = formula.isReserveOnWriteOrAnaly();

8
designer/src/com/fr/quickeditor/cellquick/CellStringQuickEditor.java

@ -1,6 +1,6 @@
package com.fr.quickeditor.cellquick; package com.fr.quickeditor.cellquick;
import com.fr.base.Formula; import com.fr.base.BaseFormula;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.TextFormat; import com.fr.base.TextFormat;
import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.gui.itextarea.UITextArea;
@ -110,7 +110,7 @@ public class CellStringQuickEditor extends CellQuickEditor {
tc.getEditingElementCase().addCellElement(cellElement, false); tc.getEditingElementCase().addCellElement(cellElement, false);
} }
if (tmpText != null && (tmpText.length() > 0 && tmpText.charAt(0) == '=')) { if (tmpText != null && (tmpText.length() > 0 && tmpText.charAt(0) == '=')) {
Formula textFormula = new Formula(tmpText); BaseFormula textFormula = BaseFormula.createFormulaBuilder().build(tmpText);
textFormula.setReserveInResult(reserveInResult); textFormula.setReserveInResult(reserveInResult);
textFormula.setReserveOnWriteOrAnaly(reserveOnWriteOrAnaly); textFormula.setReserveOnWriteOrAnaly(reserveOnWriteOrAnaly);
cellElement.setValue(textFormula); cellElement.setValue(textFormula);
@ -139,8 +139,8 @@ public class CellStringQuickEditor extends CellQuickEditor {
Object value = cellElement.getValue(); Object value = cellElement.getValue();
if (value == null) { if (value == null) {
str = StringUtils.EMPTY; str = StringUtils.EMPTY;
} else if (value instanceof Formula) { } else if (value instanceof BaseFormula) {
Formula formula = (Formula) value; BaseFormula formula = (BaseFormula) value;
str = formula.getContent(); str = formula.getContent();
reserveInResult = formula.isReserveInResult(); reserveInResult = formula.isReserveInResult();
reserveOnWriteOrAnaly = formula.isReserveOnWriteOrAnaly(); reserveOnWriteOrAnaly = formula.isReserveOnWriteOrAnaly();

8
designer/src/com/fr/quickeditor/floatquick/FloatStringQuickEditor.java

@ -1,7 +1,7 @@
package com.fr.quickeditor.floatquick; package com.fr.quickeditor.floatquick;
import com.fr.base.BaseFormula;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Formula;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.TextFormat; import com.fr.base.TextFormat;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
@ -68,10 +68,10 @@ public class FloatStringQuickEditor extends FloatQuickEditor {
Object value = floatElement.getValue(); Object value = floatElement.getValue();
if (value == null) { if (value == null) {
str = StringUtils.EMPTY; str = StringUtils.EMPTY;
} else if (value instanceof Formula) { } else if (value instanceof BaseFormula) {
//MoMeak: 没拆文本框和公式所以需要这么个玩意 //MoMeak: 没拆文本框和公式所以需要这么个玩意
formulaButton.setVisible(true); formulaButton.setVisible(true);
Formula formula = (Formula) value; BaseFormula formula = (BaseFormula) value;
str = formula.getContent(); str = formula.getContent();
stringTextField.setLineWrap(false); stringTextField.setLineWrap(false);
this.setBorder(BorderFactory.createEmptyBorder(10, 75, 10, 10)); this.setBorder(BorderFactory.createEmptyBorder(10, 75, 10, 10));
@ -110,7 +110,7 @@ public class FloatStringQuickEditor extends FloatQuickEditor {
protected void changeReportPaneCell(String tmpText) { protected void changeReportPaneCell(String tmpText) {
if (tmpText != null && (tmpText.length() > 0 && tmpText.charAt(0) == '=')) { if (tmpText != null && (tmpText.length() > 0 && tmpText.charAt(0) == '=')) {
Formula textFormula = new Formula(tmpText); BaseFormula textFormula = BaseFormula.createFormulaBuilder().build(tmpText);
textFormula.setReserveInResult(reserveInResult); textFormula.setReserveInResult(reserveInResult);
textFormula.setReserveOnWriteOrAnaly(reserveOnWriteOrAnaly); textFormula.setReserveOnWriteOrAnaly(reserveOnWriteOrAnaly);
floatElement.setValue(textFormula); floatElement.setValue(textFormula);

25
designer_base/src/com/fr/design/actions/core/ActionFactory.java

@ -127,23 +127,32 @@ public class ActionFactory {
} }
private static QuickEditor createEditor(Class clazz, Map<Class, Class<? extends QuickEditor>> editorMap) { private static QuickEditor createEditor(Class clazz, Map<Class, Class<? extends QuickEditor>> editorMap) {
Class<? extends QuickEditor> c = editorMap.get(clazz); Class<? extends QuickEditor> c = findQuickEditorClass(clazz, editorMap);
if (c == null) {
return null;
}
try { try {
Constructor<? extends QuickEditor> constructor = c.getDeclaredConstructor(); Constructor<? extends QuickEditor> constructor = c.getDeclaredConstructor();
constructor.setAccessible(true); constructor.setAccessible(true);
return constructor.newInstance(); return constructor.newInstance();
} catch (NoSuchMethodException e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
} catch (IllegalAccessException e) {
FRContext.getLogger().error(e.getMessage(), e);
} catch (InstantiationException e) {
FRContext.getLogger().error(e.getMessage(), e);
} catch (InvocationTargetException e) {
FRContext.getLogger().error(e.getMessage(), e); FRContext.getLogger().error(e.getMessage(), e);
} }
return null; return null;
} }
private static Class<? extends QuickEditor> findQuickEditorClass(Class clazz, Map<Class, Class<? extends QuickEditor>> editorMap) {
Class<? extends QuickEditor> c = editorMap.get(clazz);
if (c == null) {
Class superClazz = clazz.getSuperclass();
if (superClazz == null) {
return null;
}
return findQuickEditorClass(superClazz, editorMap);
}
return c;
}
public static QuickEditor getCellEditor(Class clazz) { public static QuickEditor getCellEditor(Class clazz) {
return createEditor(clazz, cellEditor); return createEditor(clazz, cellEditor);
} }

10
designer_base/src/com/fr/design/condition/LiteConditionPane.java

@ -1,7 +1,7 @@
package com.fr.design.condition; package com.fr.design.condition;
import com.fr.base.BaseFormula;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Formula;
import com.fr.data.DataConstants; import com.fr.data.DataConstants;
import com.fr.data.condition.*; import com.fr.data.condition.*;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
@ -75,13 +75,13 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
@Override @Override
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
Formula formula; BaseFormula formula;
String text = formulaTextArea.getText(); String text = formulaTextArea.getText();
if (text == null || text.length() <= 0) { if (text == null || text.length() <= 0) {
formula = new Formula(StringUtils.EMPTY); formula = BaseFormula.createFormulaBuilder().build();
} else { } else {
formula = new Formula(text); formula = BaseFormula.createFormulaBuilder().build(text);
} }
final UIFormula formulaPane = FormulaFactory.createFormulaPane(); final UIFormula formulaPane = FormulaFactory.createFormulaPane();
@ -90,7 +90,7 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
@Override @Override
public void doOk() { public void doOk() {
Formula formula = formulaPane.update(); BaseFormula formula = formulaPane.update();
if (formula.getContent().length() <= 1) {// 如果没有填任何字符,则是空白文本 if (formula.getContent().length() <= 1) {// 如果没有填任何字符,则是空白文本
formulaTextArea.setText(StringUtils.EMPTY); formulaTextArea.setText(StringUtils.EMPTY);
} else { } else {

239
designer_base/src/com/fr/design/data/datapane/ChoosePaneSupportFormula.java

File diff suppressed because one or more lines are too long

4
designer_base/src/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java

@ -386,10 +386,10 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
return new ActionListener() { return new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
final UIFormula formulaPane = FormulaFactory.createFormulaPane(); final UIFormula formulaPane = FormulaFactory.createFormulaPane();
formulaPane.populate(new Formula(formulaContentTextField.getText())); formulaPane.populate(BaseFormula.createFormulaBuilder().build(formulaContentTextField.getText()));
formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(MultiTDTableDataPane.this), new DialogActionAdapter() { formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(MultiTDTableDataPane.this), new DialogActionAdapter() {
public void doOk() { public void doOk() {
Formula formula = formulaPane.update(); BaseFormula formula = formulaPane.update();
if (formula == null) { if (formula == null) {
formulaContentTextField.setText(""); formulaContentTextField.setText("");
} else { } else {

17
designer_base/src/com/fr/design/editor/DoubleDeckValueEditorPane.java

@ -1,9 +1,14 @@
package com.fr.design.editor; package com.fr.design.editor;
import com.fr.base.Formula; import com.fr.base.BaseFormula;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.editor.editor.*; import com.fr.design.editor.editor.ColumnIndexEditor;
import com.fr.design.editor.editor.ColumnNameEditor;
import com.fr.design.editor.editor.Editor;
import com.fr.design.editor.editor.FormulaEditor;
import com.fr.design.editor.editor.TextEditor;
import com.fr.design.editor.editor.XMLANameEditor;
import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver; import com.fr.design.event.GlobalNameObserver;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
@ -234,7 +239,7 @@ public class DoubleDeckValueEditorPane extends BasicPane implements UIObserver,
Object columnName = StringUtils.EMPTY; Object columnName = StringUtils.EMPTY;
if (ComparatorUtils.equals(name, Inter.getLocText("FR-Designer_Formula"))) { if (ComparatorUtils.equals(name, Inter.getLocText("FR-Designer_Formula"))) {
columnIndex = new Formula(columnIndex == null ? "" : columnIndex.toString()); columnIndex = BaseFormula.createFormulaBuilder().build(columnIndex == null ? "" : columnIndex.toString());
} }
if (currentEditor instanceof ColumnNameEditor) { if (currentEditor instanceof ColumnNameEditor) {
@ -250,7 +255,7 @@ public class DoubleDeckValueEditorPane extends BasicPane implements UIObserver,
Object columnName = StringUtils.EMPTY; Object columnName = StringUtils.EMPTY;
if (ComparatorUtils.equals(name, Inter.getLocText("FR-Designer_Formula"))) { if (ComparatorUtils.equals(name, Inter.getLocText("FR-Designer_Formula"))) {
columnIndex = new Formula(columnIndex == null ? "" : columnIndex.toString()); columnIndex = BaseFormula.createFormulaBuilder().build(columnIndex == null ? "" : columnIndex.toString());
} }
if (isXMLA) { if (isXMLA) {
@ -302,12 +307,12 @@ public class DoubleDeckValueEditorPane extends BasicPane implements UIObserver,
if (returnValue == JOptionPane.OK_OPTION) { if (returnValue == JOptionPane.OK_OPTION) {
setCurrentEditor(j); setCurrentEditor(j);
Formula formula = new Formula(string); BaseFormula formula = BaseFormula.createFormulaBuilder().build(string);
currentEditor.setValue(formula); currentEditor.setValue(formula);
} }
} else { } else {
setCurrentEditor(j); setCurrentEditor(j);
Formula formula = new Formula(string); BaseFormula formula = BaseFormula.createFormulaBuilder().build(string);
currentEditor.setValue(formula); currentEditor.setValue(formula);
} }
} }

17
designer_base/src/com/fr/design/editor/ValueEditorPane.java

@ -1,9 +1,13 @@
package com.fr.design.editor; package com.fr.design.editor;
import com.fr.base.Formula; import com.fr.base.BaseFormula;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.editor.editor.*; import com.fr.design.editor.editor.ColumnNameEditor;
import com.fr.design.editor.editor.Editor;
import com.fr.design.editor.editor.FormulaEditor;
import com.fr.design.editor.editor.TextEditor;
import com.fr.design.editor.editor.XMLANameEditor;
import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver; import com.fr.design.event.GlobalNameObserver;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
@ -216,7 +220,7 @@ public class ValueEditorPane extends BasicPane implements UIObserver, GlobalName
Object columnName = StringUtils.EMPTY; Object columnName = StringUtils.EMPTY;
if (ComparatorUtils.equals(name, Inter.getLocText("FR-Designer_Formula"))) { if (ComparatorUtils.equals(name, Inter.getLocText("FR-Designer_Formula"))) {
columnIndex = new Formula(columnIndex == null ? "" : columnIndex.toString()); columnIndex = BaseFormula.createFormulaBuilder().build(columnIndex == null ? "" : columnIndex.toString());
} }
if (currentEditor instanceof ColumnNameEditor) { if (currentEditor instanceof ColumnNameEditor) {
@ -232,7 +236,7 @@ public class ValueEditorPane extends BasicPane implements UIObserver, GlobalName
Object columnName = StringUtils.EMPTY; Object columnName = StringUtils.EMPTY;
if (ComparatorUtils.equals(name, Inter.getLocText("FR-Designer_Formula"))) { if (ComparatorUtils.equals(name, Inter.getLocText("FR-Designer_Formula"))) {
columnIndex = new Formula(columnIndex == null ? "" : columnIndex.toString()); columnIndex = BaseFormula.createFormulaBuilder().build(columnIndex == null ? "" : columnIndex.toString());
} }
if (isXMLA) { if (isXMLA) {
@ -284,17 +288,16 @@ public class ValueEditorPane extends BasicPane implements UIObserver, GlobalName
if (returnValue == JOptionPane.OK_OPTION) { if (returnValue == JOptionPane.OK_OPTION) {
setCurrentEditor(j); setCurrentEditor(j);
Formula formula = new Formula(string); BaseFormula formula = BaseFormula.createFormulaBuilder().build(string);
currentEditor.setValue(formula); currentEditor.setValue(formula);
} }
} else { } else {
setCurrentEditor(j); setCurrentEditor(j);
Formula formula = new Formula(string); BaseFormula formula = BaseFormula.createFormulaBuilder().build(string);
currentEditor.setValue(formula); currentEditor.setValue(formula);
} }
} }
} }
} }
private boolean isFormula(String string) { private boolean isFormula(String string) {

5
designer_base/src/com/fr/design/editor/editor/ConstantsEditor.java

@ -1,11 +1,12 @@
package com.fr.design.editor.editor; package com.fr.design.editor.editor;
import com.fr.base.BaseFormula;
import com.fr.base.Formula; import com.fr.base.Formula;
public class ConstantsEditor extends FormulaEditor { public class ConstantsEditor extends FormulaEditor {
public ConstantsEditor(String name, Formula formula) { public ConstantsEditor(String name, BaseFormula formula) {
super(name, formula); super(name, formula);
} }
@ -13,7 +14,7 @@ public class ConstantsEditor extends FormulaEditor {
// do nothing 防止修改... // do nothing 防止修改...
} }
public void setValue(Formula value) { public void setValue(BaseFormula value) {
// do nothing 防止修改... // do nothing 防止修改...
} }

28
designer_base/src/com/fr/design/editor/editor/FormulaEditor.java

@ -3,13 +3,13 @@
*/ */
package com.fr.design.editor.editor; package com.fr.design.editor.editor;
import com.fr.base.BaseFormula;
import com.fr.base.Formula; import com.fr.base.Formula;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.formula.FormulaFactory; import com.fr.design.formula.FormulaFactory;
import com.fr.design.formula.UIFormula; import com.fr.design.formula.UIFormula;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
@ -23,10 +23,10 @@ import java.awt.event.MouseEvent;
* @editor zhou * @editor zhou
* @since 2012-3-29下午6:27:27 * @since 2012-3-29下午6:27:27
*/ */
public class FormulaEditor extends Editor<Formula> { public class FormulaEditor extends Editor<BaseFormula> {
private Formula formula = new Formula(StringUtils.EMPTY); private BaseFormula formula = BaseFormula.createFormulaBuilder().build();
private UITextField currentTextField; private UITextField currentTextField;
private ShowPaneListener listerner = new ShowPaneListener(); private ShowPaneListener listener = new ShowPaneListener();
/** /**
* Constructor. * Constructor.
@ -39,7 +39,7 @@ public class FormulaEditor extends Editor<Formula> {
this(name, null); this(name, null);
} }
public FormulaEditor(String name, Formula formula) { public FormulaEditor(String name, BaseFormula formula) {
if (formula != null) { if (formula != null) {
this.formula = formula; this.formula = formula;
} }
@ -51,7 +51,7 @@ public class FormulaEditor extends Editor<Formula> {
editPane.add(currentTextField, BorderLayout.CENTER); editPane.add(currentTextField, BorderLayout.CENTER);
currentTextField.setEditable(false); currentTextField.setEditable(false);
currentTextField.addMouseListener(listerner); currentTextField.addMouseListener(listener);
this.add(editPane, BorderLayout.CENTER); this.add(editPane, BorderLayout.CENTER);
this.setName(name); this.setName(name);
} }
@ -96,7 +96,7 @@ public class FormulaEditor extends Editor<Formula> {
}).setVisible(true); }).setVisible(true);
} }
public Formula getFormula(){ public BaseFormula getFormula(){
return formula; return formula;
} }
@ -104,7 +104,7 @@ public class FormulaEditor extends Editor<Formula> {
* Return the value of the CellEditor. * Return the value of the CellEditor.
*/ */
@Override @Override
public Formula getValue() { public BaseFormula getValue() {
if (formula != null && "=".equals(formula.getContent())) { if (formula != null && "=".equals(formula.getContent())) {
return null; return null;
} }
@ -115,9 +115,9 @@ public class FormulaEditor extends Editor<Formula> {
* Set the value to the CellEditor. * Set the value to the CellEditor.
*/ */
@Override @Override
public void setValue(Formula value) { public void setValue(BaseFormula value) {
if (value == null) { if (value == null) {
value = new Formula(StringUtils.EMPTY); value = BaseFormula.createFormulaBuilder().build();
} }
this.formula = value; this.formula = value;
currentTextField.setText(value.toString()); currentTextField.setText(value.toString());
@ -151,7 +151,7 @@ public class FormulaEditor extends Editor<Formula> {
*/ */
public void reset() { public void reset() {
currentTextField.setText("="); currentTextField.setText("=");
formula = new Formula(StringUtils.EMPTY); formula = BaseFormula.createFormulaBuilder().build();
} }
/** /**
@ -170,13 +170,13 @@ public class FormulaEditor extends Editor<Formula> {
this.setEnabled(flag); this.setEnabled(flag);
this.currentTextField.setEnabled(flag); this.currentTextField.setEnabled(flag);
if (flag == false) { if (flag == false) {
this.currentTextField.removeMouseListener(listerner); this.currentTextField.removeMouseListener(listener);
} else { } else {
int listenerSize = this.currentTextField.getMouseListeners().length; int listenerSize = this.currentTextField.getMouseListeners().length;
for (int i = 0; i < listenerSize; i++) { for (int i = 0; i < listenerSize; i++) {
this.currentTextField.removeMouseListener(listerner); this.currentTextField.removeMouseListener(listener);
} }
this.currentTextField.addMouseListener(listerner); this.currentTextField.addMouseListener(listener);
} }
} }
} }

41
designer_base/src/com/fr/design/formula/FormulaPane.java

@ -1,8 +1,8 @@
package com.fr.design.formula; package com.fr.design.formula;
import com.fr.base.BaseFormula;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.Formula;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.border.UIRoundedBorder; import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
@ -32,13 +32,27 @@ import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener; import javax.swing.event.ListSelectionListener;
import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener; import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.*; import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.MutableTreeNode;
import javax.swing.tree.TreePath;
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.ActionEvent;
import java.io.*; import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StringReader;
import java.util.Locale; import java.util.Locale;
import java.util.Set;
/** /**
* 公式编辑面板 * 公式编辑面板
@ -468,11 +482,11 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
/** /**
* Populate * Populate
*/ */
public void populate(Formula formula) { public void populate(BaseFormula formula) {
this.populate(formula, VariableResolver.DEFAULT); this.populate(formula, VariableResolver.DEFAULT);
} }
public void populate(Formula formula, VariableResolver variableResolver) { public void populate(BaseFormula formula, VariableResolver variableResolver) {
this.variableTreeAndDescriptionArea.populate(variableResolver); this.variableTreeAndDescriptionArea.populate(variableResolver);
// set text // set text
@ -508,19 +522,18 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
/** /**
* update * update
*/ */
public Formula update() { public BaseFormula update() {
Formula formula; BaseFormula formula;
if (ifHasBeenWriten == 0) { if (ifHasBeenWriten == 0) {
String content = StringUtils.EMPTY; formula = BaseFormula.createFormulaBuilder().build();
formula = new Formula(content);
return formula; return formula;
} else { } else {
String content = this.formulaTextArea.getText(); String content = this.formulaTextArea.getText();
if (StringUtils.isEmpty(content) || content.trim().charAt(0) == '=') { if (StringUtils.isEmpty(content) || content.trim().charAt(0) == '=') {
formula = new Formula(content); formula = BaseFormula.createFormulaBuilder().build(content);
} else { } else {
formula = new Formula("=" + content); formula = BaseFormula.createFormulaBuilder().build("=" + content);
} }
return formula; return formula;
} }

7
designer_base/src/com/fr/design/formula/FormulaPaneWhenReserveFormula.java

@ -1,5 +1,6 @@
package com.fr.design.formula; package com.fr.design.formula;
import com.fr.base.BaseFormula;
import com.fr.base.Formula; import com.fr.base.Formula;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -46,15 +47,15 @@ public class FormulaPaneWhenReserveFormula extends FormulaPane {
} }
@Override @Override
public void populate(Formula formula, VariableResolver variableResolver) { public void populate(BaseFormula formula, VariableResolver variableResolver) {
super.populate(formula, variableResolver); super.populate(formula, variableResolver);
reserveCheckBox4Result.setSelected(formula.isReserveInResult()); reserveCheckBox4Result.setSelected(formula.isReserveInResult());
reserveCheckBox4Write.setSelected(formula.isReserveOnWriteOrAnaly()); reserveCheckBox4Write.setSelected(formula.isReserveOnWriteOrAnaly());
} }
@Override @Override
public Formula update() { public BaseFormula update() {
Formula formula = super.update(); BaseFormula formula = super.update();
if (formula != null) { if (formula != null) {
formula.setReserveInResult(this.reserveCheckBox4Result.isSelected()); formula.setReserveInResult(this.reserveCheckBox4Result.isSelected());
formula.setReserveOnWriteOrAnaly(this.reserveCheckBox4Write.isSelected()); formula.setReserveOnWriteOrAnaly(this.reserveCheckBox4Write.isSelected());

7
designer_base/src/com/fr/design/formula/SortFormulaPane.java

@ -1,7 +1,7 @@
package com.fr.design.formula; package com.fr.design.formula;
import com.fr.base.Formula; import com.fr.base.BaseFormula;
import com.fr.data.util.SortOrder; import com.fr.data.util.SortOrder;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
@ -57,12 +57,11 @@ public abstract class SortFormulaPane extends JPanel {
public void showFormulaDialog(String[] displayNames) { public void showFormulaDialog(String[] displayNames) {
String text = sortFormulaTextField.getText(); String text = sortFormulaTextField.getText();
final UIFormula formulaPane = FormulaFactory.createFormulaPaneWhenReserveFormula(); final UIFormula formulaPane = FormulaFactory.createFormulaPaneWhenReserveFormula();
formulaPane.populate(BaseFormula.createFormulaBuilder().build(text), new CustomVariableResolver(displayNames, true));
formulaPane.populate(new Formula(text), new CustomVariableResolver(displayNames, true));
formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(SortFormulaPane.this), formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(SortFormulaPane.this),
new DialogActionAdapter() { new DialogActionAdapter() {
public void doOk() { public void doOk() {
Formula fm = formulaPane.update(); BaseFormula fm = formulaPane.update();
if (fm.getContent().length() <= 1) { if (fm.getContent().length() <= 1) {
sortFormulaTextField.setText(""); sortFormulaTextField.setText("");
} else { } else {

7
designer_base/src/com/fr/design/formula/TinyFormulaPane.java

@ -1,5 +1,6 @@
package com.fr.design.formula; package com.fr.design.formula;
import com.fr.base.BaseFormula;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Formula; import com.fr.base.Formula;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
@ -51,11 +52,11 @@ public class TinyFormulaPane extends BasicBeanPane<String> implements UIObserver
String text = formulaTextField.getText(); String text = formulaTextField.getText();
final UIFormula formulaPane = FormulaFactory.createFormulaPane(); final UIFormula formulaPane = FormulaFactory.createFormulaPane();
formulaPane.populate(new Formula(text)); formulaPane.populate(BaseFormula.createFormulaBuilder().build(text));
formulaPane.showLargeWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { formulaPane.showLargeWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
Formula fm = formulaPane.update(); BaseFormula fm = formulaPane.update();
populateTextField(fm); populateTextField(fm);
okEvent(); okEvent();
} }
@ -65,7 +66,7 @@ public class TinyFormulaPane extends BasicBeanPane<String> implements UIObserver
initLayout(); initLayout();
} }
protected void populateTextField(Formula fm) { protected void populateTextField(BaseFormula fm) {
if (fm.getContent().length() <= 1) { if (fm.getContent().length() <= 1) {
formulaTextField.setText("$$$"); formulaTextField.setText("$$$");
} else { } else {

7
designer_base/src/com/fr/design/formula/UIFormula.java

@ -1,5 +1,6 @@
package com.fr.design.formula; package com.fr.design.formula;
import com.fr.base.BaseFormula;
import com.fr.base.Formula; import com.fr.base.Formula;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionListener; import com.fr.design.dialog.DialogActionListener;
@ -17,20 +18,20 @@ public interface UIFormula {
* 从已有的公式还原公式面板 * 从已有的公式还原公式面板
* @param formula 公式 * @param formula 公式
*/ */
void populate(Formula formula); void populate(BaseFormula formula);
/** /**
* 根据指定的变量处理和公式还原公式面板 * 根据指定的变量处理和公式还原公式面板
* @param formula 公式 * @param formula 公式
* @param variableResolver 变量处理器 * @param variableResolver 变量处理器
*/ */
void populate(Formula formula, VariableResolver variableResolver); void populate(BaseFormula formula, VariableResolver variableResolver);
/** /**
* 获取公式面板的参数 * 获取公式面板的参数
* @return 公式 * @return 公式
*/ */
Formula update(); BaseFormula update();
/** /**
* 显示窗口 * 显示窗口

10
designer_base/src/com/fr/design/present/dict/FormulaDictPane.java

@ -1,16 +1,14 @@
package com.fr.design.present.dict; package com.fr.design.present.dict;
import com.fr.base.BaseFormula;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Formula;
import com.fr.data.impl.FormulaDictionary; import com.fr.data.impl.FormulaDictionary;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.constants.UIConstants;
import com.fr.design.editor.editor.FormulaEditor; import com.fr.design.editor.editor.FormulaEditor;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -54,7 +52,7 @@ public class FormulaDictPane extends FurtherBasicBeanPane<FormulaDictionary> {
JPanel t = new JPanel(new BorderLayout()); JPanel t = new JPanel(new BorderLayout());
t.add(tag, BorderLayout.CENTER); t.add(tag, BorderLayout.CENTER);
Formula vf = new Formula("$$$"); BaseFormula vf = BaseFormula.createFormulaBuilder().build("$$$");
valueFormulaEditor = new FormulaEditor(StringUtils.EMPTY, vf); valueFormulaEditor = new FormulaEditor(StringUtils.EMPTY, vf);
JPanel valueFormulaContainer = new JPanel(new FlowLayout(FlowLayout.RIGHT, LEFT_BORDER, 0)); JPanel valueFormulaContainer = new JPanel(new FlowLayout(FlowLayout.RIGHT, LEFT_BORDER, 0));
@ -88,8 +86,8 @@ public class FormulaDictPane extends FurtherBasicBeanPane<FormulaDictionary> {
@Override @Override
public void populateBean(FormulaDictionary dict) { public void populateBean(FormulaDictionary dict) {
keyFormulaEditor.setValue(new Formula(dict.getProduceFormula() == null ? StringUtils.EMPTY : dict.getProduceFormula())); keyFormulaEditor.setValue(BaseFormula.createFormulaBuilder().build(dict.getProduceFormula() == null ? StringUtils.EMPTY : dict.getProduceFormula()));
valueFormulaEditor.setValue(new Formula(dict.getExcuteFormula() == null ? StringUtils.EMPTY : dict.getExcuteFormula())); valueFormulaEditor.setValue(BaseFormula.createFormulaBuilder().build(dict.getExcuteFormula() == null ? StringUtils.EMPTY : dict.getExcuteFormula()));
} }
@Override @Override

11
designer_base/src/com/fr/design/widget/component/DateValuePane.java

@ -1,12 +1,15 @@
package com.fr.design.widget.component; package com.fr.design.widget.component;
import com.fr.base.Formula; import com.fr.base.BaseFormula;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.editor.editor.*; import com.fr.design.editor.editor.DateEditor;
import com.fr.design.editor.editor.Editor;
import com.fr.design.editor.editor.FormulaEditor;
import com.fr.design.editor.editor.NoneEditor;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
@ -61,7 +64,7 @@ public class DateValuePane extends JPanel {
Editor e = editor[index]; Editor e = editor[index];
Object value = e.getValue(); Object value = e.getValue();
if(value == null && ComparatorUtils.equals(FORMULA_EDITOR_NAME, e.getName())){ if(value == null && ComparatorUtils.equals(FORMULA_EDITOR_NAME, e.getName())){
value = new Formula(StringUtils.EMPTY); value = BaseFormula.createFormulaBuilder().build();
} }
return value; return value;
} }

64
designer_base/src/com/fr/design/write/submit/DBManipulationPane.java

@ -1,46 +1,7 @@
package com.fr.design.write.submit; package com.fr.design.write.submit;
import java.awt.BorderLayout; import com.fr.base.BaseFormula;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.Date;
import java.util.EventObject;
import java.util.List;
import javax.swing.AbstractCellEditor;
import javax.swing.BorderFactory;
import javax.swing.DefaultCellEditor;
import javax.swing.DefaultComboBoxModel;
import javax.swing.Icon;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTree;
import javax.swing.ListSelectionModel;
import javax.swing.SwingUtilities;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableColumn;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Formula;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.data.DataConstants; import com.fr.data.DataConstants;
import com.fr.data.condition.JoinCondition; import com.fr.data.condition.JoinCondition;
@ -86,6 +47,27 @@ import com.fr.write.config.InsertConfig;
import com.fr.write.config.IntelliDMLConfig; import com.fr.write.config.IntelliDMLConfig;
import com.fr.write.config.UpdateConfig; import com.fr.write.config.UpdateConfig;
import javax.swing.*;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableColumn;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.Date;
import java.util.EventObject;
import java.util.List;
//august:这个东西应该分成两类,一类是有单元格的情况,一类是没有单元格的情况 //august:这个东西应该分成两类,一类是有单元格的情况,一类是没有单元格的情况
public class DBManipulationPane extends BasicBeanPane<DBManipulation> { public class DBManipulationPane extends BasicBeanPane<DBManipulation> {
private static final Image ICODS_IMAGE = BaseUtils.readImage("/com/fr/web/core/css/images/icons.png"); private static final Image ICODS_IMAGE = BaseUtils.readImage("/com/fr/web/core/css/images/icons.png");
@ -752,7 +734,7 @@ public class DBManipulationPane extends BasicBeanPane<DBManipulation> {
String columnName = column.getColumnName(); String columnName = column.getColumnName();
if (!acceptPara && column.getColumnValue() instanceof Parameter) { if (!acceptPara && column.getColumnValue() instanceof Parameter) {
// 表单中,将以前的参数转换为公式 // 表单中,将以前的参数转换为公式
column.setColumnValue(new Formula(((Parameter)column.getColumnValue()).getName())); column.setColumnValue(BaseFormula.createFormulaBuilder().build(((Parameter)column.getColumnValue()).getName()));
} }
KeyColumnNameValue newColumnNameValue = new KeyColumnNameValue(column.isKey(), new ColumnName(columnName), new ColumnValue(column.getColumnValue()), KeyColumnNameValue newColumnNameValue = new KeyColumnNameValue(column.isKey(), new ColumnName(columnName), new ColumnValue(column.getColumnValue()),

5
designer_chart/src/com/fr/design/chart/ChartSwingUtils.java

@ -1,5 +1,6 @@
package com.fr.design.chart; package com.fr.design.chart;
import com.fr.base.BaseFormula;
import com.fr.base.Formula; import com.fr.base.Formula;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
@ -58,10 +59,10 @@ public class ChartSwingUtils {
private static void showFormulaPane(final UITextField jTextField, final OKListener l) { private static void showFormulaPane(final UITextField jTextField, final OKListener l) {
final UIFormula formulaPane = FormulaFactory.createFormulaPane(); final UIFormula formulaPane = FormulaFactory.createFormulaPane();
formulaPane.populate(new Formula(jTextField.getText())); formulaPane.populate(BaseFormula.createFormulaBuilder().build(jTextField.getText()));
formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane()), new DialogActionAdapter(){ formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane()), new DialogActionAdapter(){
public void doOk() { public void doOk() {
Formula formula = formulaPane.update(); BaseFormula formula = formulaPane.update();
jTextField.setText(Utils.objectToString(formula)); jTextField.setText(Utils.objectToString(formula));
if (l != null) { if (l != null) {
l.action(); l.action();

7
designer_chart/src/com/fr/design/chart/axis/ChartAlertValuePane.java

@ -1,5 +1,6 @@
package com.fr.design.chart.axis; package com.fr.design.chart.axis;
import com.fr.base.BaseFormula;
import com.fr.base.Formula; import com.fr.base.Formula;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.chart.chartattr.ChartAlertValue; import com.fr.chart.chartattr.ChartAlertValue;
@ -162,10 +163,10 @@ public class ChartAlertValuePane extends BasicBeanPane<ChartAlertValue> {
private void showFormulaPane() { private void showFormulaPane() {
final UIFormula formulaPane = FormulaFactory.createFormulaPane(); final UIFormula formulaPane = FormulaFactory.createFormulaPane();
formulaPane.populate(new Formula(textField.getText())); formulaPane.populate(BaseFormula.createFormulaBuilder().build(textField.getText()));
formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(ChartAlertValuePane.this), new DialogActionAdapter(){ formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(ChartAlertValuePane.this), new DialogActionAdapter(){
public void doOk() { public void doOk() {
Formula formula = formulaPane.update(); BaseFormula formula = formulaPane.update();
textField.setText(Utils.objectToString(formula)); textField.setText(Utils.objectToString(formula));
} }
}).setVisible(true); }).setVisible(true);
@ -206,7 +207,7 @@ public class ChartAlertValuePane extends BasicBeanPane<ChartAlertValue> {
public void updateBean(ChartAlertValue chartAlertValue) { public void updateBean(ChartAlertValue chartAlertValue) {
chartAlertValue.setAlertValueFormula(new Formula(textField.getText())); chartAlertValue.setAlertValueFormula(BaseFormula.createFormulaBuilder().build(textField.getText()));
chartAlertValue.getLineColor().setSeriesColor(colorBox.getSelectObject()); chartAlertValue.getLineColor().setSeriesColor(colorBox.getSelectObject());
chartAlertValue.getLineStyle().setLineStyle(lineCombo.getSelectedLineStyle()); chartAlertValue.getLineStyle().setLineStyle(lineCombo.getSelectedLineStyle());
chartAlertValue.setAlertLineAlpha(alphaPane.update()); chartAlertValue.setAlertLineAlpha(alphaPane.update());

14
designer_chart/src/com/fr/design/chart/axis/MinMaxValuePane.java

@ -1,6 +1,6 @@
package com.fr.design.chart.axis; package com.fr.design.chart.axis;
import com.fr.base.Formula; import com.fr.base.BaseFormula;
import com.fr.chart.base.ChartBaseUtils; import com.fr.chart.base.ChartBaseUtils;
import com.fr.chart.chartattr.Axis; import com.fr.chart.chartattr.Axis;
import com.fr.design.chart.ChartSwingUtils; import com.fr.design.chart.ChartSwingUtils;
@ -147,13 +147,13 @@ public class MinMaxValuePane extends JPanel {
// 最大最小值 // 最大最小值
if (minCheckBox.isSelected()) { if (minCheckBox.isSelected()) {
axis.setCustomMinValue(StringUtils.isNotEmpty(minValueField.getText())); axis.setCustomMinValue(StringUtils.isNotEmpty(minValueField.getText()));
axis.setMinValue(new Formula(minValueField.getText())); axis.setMinValue(BaseFormula.createFormulaBuilder().build(minValueField.getText()));
} else { } else {
axis.setCustomMinValue(false); axis.setCustomMinValue(false);
} }
if (maxCheckBox.isSelected()) { if (maxCheckBox.isSelected()) {
axis.setCustomMaxValue(StringUtils.isNotEmpty(maxValueField.getText())); axis.setCustomMaxValue(StringUtils.isNotEmpty(maxValueField.getText()));
axis.setMaxValue(new Formula(maxValueField.getText())); axis.setMaxValue(BaseFormula.createFormulaBuilder().build(maxValueField.getText()));
} else { } else {
axis.setCustomMaxValue(false); axis.setCustomMaxValue(false);
} }
@ -170,10 +170,10 @@ public class MinMaxValuePane extends JPanel {
axis.setMainUnit(null); axis.setMainUnit(null);
} else { } else {
axis.setCustomMainUnit(true); axis.setCustomMainUnit(true);
Formula formula = new Formula(increment); BaseFormula formula = BaseFormula.createFormulaBuilder().build(increment);
Number number = ChartBaseUtils.formula2Number(formula); Number number = ChartBaseUtils.formula2Number(formula);
if(number != null && number.doubleValue() < 0) { if(number != null && number.doubleValue() < 0) {
axis.setMainUnit(new Formula("10")); axis.setMainUnit(BaseFormula.createFormulaBuilder().build("10"));
} else { } else {
axis.setMainUnit(formula); axis.setMainUnit(formula);
} }
@ -189,10 +189,10 @@ public class MinMaxValuePane extends JPanel {
axis.setSecUnit(null); axis.setSecUnit(null);
} else { } else {
axis.setCustomSecUnit(true); axis.setCustomSecUnit(true);
Formula formula = new Formula(increment); BaseFormula formula = BaseFormula.createFormulaBuilder().build(increment);
Number number = ChartBaseUtils.formula2Number(formula); Number number = ChartBaseUtils.formula2Number(formula);
if(number != null && number.doubleValue() < 0) { if(number != null && number.doubleValue() < 0) {
axis.setSecUnit(new Formula("10")); axis.setSecUnit(BaseFormula.createFormulaBuilder().build("10"));
} else { } else {
axis.setSecUnit(formula); axis.setSecUnit(formula);
} }

30
designer_chart/src/com/fr/design/chart/report/GisMapReportDataContentPane.java

@ -1,26 +1,13 @@
package com.fr.design.chart.report; package com.fr.design.chart.report;
import java.awt.*; import com.fr.base.BaseFormula;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import com.fr.base.Formula;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.chart.chartdata.BaseSeriesDefinition; import com.fr.chart.chartdata.BaseSeriesDefinition;
import com.fr.chart.chartdata.GisMapReportDefinition; import com.fr.chart.chartdata.GisMapReportDefinition;
import com.fr.chart.chartdata.SeriesDefinition; import com.fr.chart.chartdata.SeriesDefinition;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.formula.TinyFormulaPane; import com.fr.design.formula.TinyFormulaPane;
@ -35,6 +22,15 @@ import com.fr.general.Inter;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.util.ArrayList;
import java.util.List;
/** /**
* 属性表gis地图单元格数据源设置界面 * 属性表gis地图单元格数据源设置界面
* *
@ -179,7 +175,7 @@ public class GisMapReportDataContentPane extends FurtherBasicBeanPane<GisMapRepo
return null; return null;
} }
if (StableUtils.canBeFormula(address)) { if (StableUtils.canBeFormula(address)) {
reportDefinition.setCategoryName(new Formula(address)); reportDefinition.setCategoryName(BaseFormula.createFormulaBuilder().build(address));
} else { } else {
reportDefinition.setCategoryName(address); reportDefinition.setCategoryName(address);
} }
@ -200,7 +196,7 @@ public class GisMapReportDataContentPane extends FurtherBasicBeanPane<GisMapRepo
Object value = objects[1]; Object value = objects[1];
if (StableUtils.canBeFormula(value)) { if (StableUtils.canBeFormula(value)) {
value = new Formula(Utils.objectToString(value)); value = BaseFormula.createFormulaBuilder().build(value);
} }
SeriesDefinition definition = new SeriesDefinition(name, value); SeriesDefinition definition = new SeriesDefinition(name, value);
reportDefinition.addTitleValue(definition); reportDefinition.addTitleValue(definition);

26
designer_chart/src/com/fr/design/chart/report/MapMoreReportIndexPane.java

@ -1,25 +1,12 @@
package com.fr.design.chart.report; package com.fr.design.chart.report;
import java.awt.BorderLayout; import com.fr.base.BaseFormula;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JTable;
import com.fr.base.Formula;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.chart.chartdata.BaseSeriesDefinition; import com.fr.chart.chartdata.BaseSeriesDefinition;
import com.fr.chart.chartdata.MapSingleLayerReportDefinition; import com.fr.chart.chartdata.MapSingleLayerReportDefinition;
import com.fr.chart.chartdata.SeriesDefinition; import com.fr.chart.chartdata.SeriesDefinition;
import com.fr.design.constants.UIConstants;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.constants.UIConstants;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.formula.TinyFormulaPane; import com.fr.design.formula.TinyFormulaPane;
@ -31,6 +18,13 @@ import com.fr.general.Inter;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.util.ArrayList;
import java.util.List;
/** /**
* 多层地图, 单元格, 多层切换 单界面. * 多层地图, 单元格, 多层切换 单界面.
* @author kunsnat E-mail:kunsnat@gmail.com * @author kunsnat E-mail:kunsnat@gmail.com
@ -98,7 +92,7 @@ public class MapMoreReportIndexPane extends BasicBeanPane<MapSingleLayerReportDe
String areaName = areaNamePane.updateBean(); String areaName = areaNamePane.updateBean();
if(StableUtils.canBeFormula(areaName)) { if(StableUtils.canBeFormula(areaName)) {
definition.setCategoryName(new Formula(areaName)); definition.setCategoryName(BaseFormula.createFormulaBuilder().build(areaName));
} else { } else {
definition.setCategoryName(areaName); definition.setCategoryName(areaName);
} }

33
designer_chart/src/com/fr/design/chart/report/MapReportDataSinglePane.java

@ -1,28 +1,12 @@
package com.fr.design.chart.report; package com.fr.design.chart.report;
import java.awt.BorderLayout; import com.fr.base.BaseFormula;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import com.fr.base.Formula;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.chart.chartdata.BaseSeriesDefinition; import com.fr.chart.chartdata.BaseSeriesDefinition;
import com.fr.chart.chartdata.MapSingleLayerReportDefinition; import com.fr.chart.chartdata.MapSingleLayerReportDefinition;
import com.fr.chart.chartdata.SeriesDefinition; import com.fr.chart.chartdata.SeriesDefinition;
import com.fr.design.constants.UIConstants;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.constants.UIConstants;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.formula.TinyFormulaPane; import com.fr.design.formula.TinyFormulaPane;
@ -33,6 +17,15 @@ import com.fr.design.gui.itextfield.UITextField;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.util.ArrayList;
import java.util.List;
/** /**
* 地图 单元格数据 单层地图 界面 * 地图 单元格数据 单层地图 界面
* *
@ -118,7 +111,7 @@ public class MapReportDataSinglePane extends FurtherBasicBeanPane<MapSingleLayer
String areaName = areaNamePane.updateBean(); String areaName = areaNamePane.updateBean();
if(StableUtils.canBeFormula(areaName)) { if(StableUtils.canBeFormula(areaName)) {
reportDefinition.setCategoryName(new Formula(areaName)); reportDefinition.setCategoryName(BaseFormula.createFormulaBuilder().build(areaName));
} else { } else {
reportDefinition.setCategoryName(areaName); reportDefinition.setCategoryName(areaName);
} }
@ -131,7 +124,7 @@ public class MapReportDataSinglePane extends FurtherBasicBeanPane<MapSingleLayer
Object value = objects[1]; Object value = objects[1];
if (StableUtils.canBeFormula(value)) { if (StableUtils.canBeFormula(value)) {
value = new Formula(Utils.objectToString(value)); value = BaseFormula.createFormulaBuilder().build(value);
} }
SeriesDefinition definition = new SeriesDefinition(name, value); SeriesDefinition definition = new SeriesDefinition(name, value);
reportDefinition.addTitleValue(definition); reportDefinition.addTitleValue(definition);

6
designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/AbstractReportDataContentPane.java

@ -1,6 +1,6 @@
package com.fr.design.mainframe.chart.gui.data.report; package com.fr.design.mainframe.chart.gui.data.report;
import com.fr.base.Formula; import com.fr.base.BaseFormula;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartdata.NormalReportDataDefinition; import com.fr.chart.chartdata.NormalReportDataDefinition;
@ -140,7 +140,7 @@ public abstract class AbstractReportDataContentPane extends BasicBeanPane<ChartC
return null; return null;
} }
return StableUtils.canBeFormula(object) ? new Formula(object.toString()) : object.toString(); return StableUtils.canBeFormula(object) ? BaseFormula.createFormulaBuilder().build(object) : object.toString();
} }
protected class InnerTableEditor extends UITableEditor { protected class InnerTableEditor extends UITableEditor {
@ -179,7 +179,7 @@ public abstract class AbstractReportDataContentPane extends BasicBeanPane<ChartC
} }
@Override @Override
protected void populateTextField(Formula fm) { protected void populateTextField(BaseFormula fm) {
formulaTextField.setText(fm.getContent()); formulaTextField.setText(fm.getContent());
} }
}; };

3
designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotReportDataContentPane.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.chart.gui.data.report; package com.fr.design.mainframe.chart.gui.data.report;
import com.fr.base.BaseFormula;
import com.fr.base.Formula; import com.fr.base.Formula;
import com.fr.base.chart.chartdata.TopDefinitionProvider; import com.fr.base.chart.chartdata.TopDefinitionProvider;
import com.fr.chart.chartattr.Bar2DPlot; import com.fr.chart.chartattr.Bar2DPlot;
@ -60,7 +61,7 @@ public class CategoryPlotReportDataContentPane extends AbstractReportDataContent
} }
@Override @Override
protected void populateTextField(Formula fm) { protected void populateTextField(BaseFormula fm) {
formulaTextField.setText(fm.getContent()); formulaTextField.setText(fm.getContent());
} }

4
designer_chart/src/com/fr/design/mainframe/chart/gui/other/ChartDesignerInteractivePane.java

@ -4,7 +4,7 @@
package com.fr.design.mainframe.chart.gui.other; package com.fr.design.mainframe.chart.gui.other;
import com.fr.base.Formula; import com.fr.base.BaseFormula;
import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartdata.TopDefinition; import com.fr.chart.chartdata.TopDefinition;
import com.fr.design.mainframe.chart.gui.ChartOtherPane; import com.fr.design.mainframe.chart.gui.ChartOtherPane;
@ -31,7 +31,7 @@ public class ChartDesignerInteractivePane extends ChartInteractivePane {
protected List<ChartUIMenuNameableCreator> refreshList(HashMap map) { protected List<ChartUIMenuNameableCreator> refreshList(HashMap map) {
List<ChartUIMenuNameableCreator> list = new ArrayList<ChartUIMenuNameableCreator>(); List<ChartUIMenuNameableCreator> list = new ArrayList<ChartUIMenuNameableCreator>();
java.util.HashMap<String, Formula> hyperLinkEditorMap = plot.getHyperLinkEditorMap(); java.util.HashMap<String, BaseFormula> hyperLinkEditorMap = plot.getHyperLinkEditorMap();
list.add(new ChartUIMenuNameableCreator(hyperLinkEditorMap, Inter.getLocText("Hyperlink-Web_link"), list.add(new ChartUIMenuNameableCreator(hyperLinkEditorMap, Inter.getLocText("Hyperlink-Web_link"),
new WebHyperlink(), getUseMap(map, WebHyperlink.class))); new WebHyperlink(), getUseMap(map, WebHyperlink.class)));

4
designer_chart/src/com/fr/design/mainframe/chart/gui/other/ChartInteractivePane.java

@ -1,7 +1,7 @@
package com.fr.design.mainframe.chart.gui.other; package com.fr.design.mainframe.chart.gui.other;
import com.fr.base.BaseFormula;
import com.fr.base.CoreDecimalFormat; import com.fr.base.CoreDecimalFormat;
import com.fr.base.Formula;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.chart.chartdata.TopDefinitionProvider; import com.fr.base.chart.chartdata.TopDefinitionProvider;
import com.fr.chart.base.AttrContents; import com.fr.chart.base.AttrContents;
@ -854,7 +854,7 @@ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIOb
protected List<ChartUIMenuNameableCreator> refreshList(HashMap map) { protected List<ChartUIMenuNameableCreator> refreshList(HashMap map) {
List<ChartUIMenuNameableCreator> list = new ArrayList<ChartUIMenuNameableCreator>(); List<ChartUIMenuNameableCreator> list = new ArrayList<ChartUIMenuNameableCreator>();
java.util.HashMap<String, Formula> hyperLinkEditorMap = plot.getHyperLinkEditorMap(); java.util.HashMap<String, BaseFormula> hyperLinkEditorMap = plot.getHyperLinkEditorMap();
list.add(new ChartUIMenuNameableCreator(hyperLinkEditorMap, Inter.getLocText("Chart-Link_Reportlet"), list.add(new ChartUIMenuNameableCreator(hyperLinkEditorMap, Inter.getLocText("Chart-Link_Reportlet"),
new ReportletHyperlink(), getUseMap(map, ReportletHyperlink.class))); new ReportletHyperlink(), getUseMap(map, ReportletHyperlink.class)));

25
designer_chart/src/com/fr/design/mainframe/chart/gui/other/TimeSwitchPane.java

@ -1,7 +1,7 @@
package com.fr.design.mainframe.chart.gui.other; package com.fr.design.mainframe.chart.gui.other;
import com.fr.base.BaseFormula;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Formula;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.chart.base.ChartConstants; import com.fr.chart.base.ChartConstants;
import com.fr.chart.base.TimeSwitchAttr; import com.fr.chart.base.TimeSwitchAttr;
@ -22,7 +22,12 @@ import com.fr.general.Inter;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -85,10 +90,10 @@ public class TimeSwitchPane extends JPanel implements UIObserver {
private void initTablePane(){ private void initTablePane(){
tablePane = new JPanel(new TableLayout()); tablePane = new JPanel(new TableLayout());
tablePane.add(new TimeTickBox(new Formula("1"),ChartConstants.MONTH_TYPE)); tablePane.add(new TimeTickBox(BaseFormula.createFormulaBuilder().build("1"),ChartConstants.MONTH_TYPE));
tablePane.add(new TimeTickBox(new Formula("3"),ChartConstants.MONTH_TYPE)); tablePane.add(new TimeTickBox(BaseFormula.createFormulaBuilder().build("3"),ChartConstants.MONTH_TYPE));
tablePane.add(new TimeTickBox(new Formula("6"),ChartConstants.MONTH_TYPE)); tablePane.add(new TimeTickBox(BaseFormula.createFormulaBuilder().build("6"),ChartConstants.MONTH_TYPE));
tablePane.add(new TimeTickBox(new Formula("1"), ChartConstants.YEAR_TYPE)); tablePane.add(new TimeTickBox(BaseFormula.createFormulaBuilder().build("1"), ChartConstants.YEAR_TYPE));
tablePane.revalidate(); tablePane.revalidate();
} }
@ -111,7 +116,7 @@ public class TimeSwitchPane extends JPanel implements UIObserver {
return new ActionListener() { return new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
tablePane.add(new TimeTickBox(new Formula(),ChartConstants.YEAR_TYPE)); tablePane.add(new TimeTickBox(BaseFormula.createFormulaBuilder().build(),ChartConstants.YEAR_TYPE));
tablePane.revalidate(); tablePane.revalidate();
fireChange(); fireChange();
} }
@ -150,7 +155,7 @@ public class TimeSwitchPane extends JPanel implements UIObserver {
continue; continue;
} }
TimeTickBox box =(TimeTickBox) component; TimeTickBox box =(TimeTickBox) component;
timeMap.add(new TimeSwitchAttr(new Formula(box.mainUnitField.getText()),VALUES.get(box.mainType.getSelectedItem()))); timeMap.add(new TimeSwitchAttr(BaseFormula.createFormulaBuilder().build(box.mainUnitField.getText()),VALUES.get(box.mainType.getSelectedItem())));
} }
} }
@ -267,7 +272,7 @@ public class TimeSwitchPane extends JPanel implements UIObserver {
private UIComboBox mainType; private UIComboBox mainType;
private UIButton delButton; private UIButton delButton;
public TimeTickBox(Formula time,int unit){ public TimeTickBox(BaseFormula time,int unit){
this.setLayout(new FlowLayout(FlowLayout.CENTER, 4, 0)); this.setLayout(new FlowLayout(FlowLayout.CENTER, 4, 0));
mainUnitField = new UITextField(time.toString()); mainUnitField = new UITextField(time.toString());
mainUnitField.setEditable(false); mainUnitField.setEditable(false);
@ -310,7 +315,7 @@ public class TimeSwitchPane extends JPanel implements UIObserver {
private void showFormulaPane(final UITextField jTextField) { private void showFormulaPane(final UITextField jTextField) {
final UIFormula formulaPane = FormulaFactory.createFormulaPane(); final UIFormula formulaPane = FormulaFactory.createFormulaPane();
final String original = jTextField.getText(); final String original = jTextField.getText();
formulaPane.populate(new Formula(original)); formulaPane.populate(BaseFormula.createFormulaBuilder().build(original));
BasicDialog dlg = formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(TimeSwitchPane.this), new DialogActionAdapter() { BasicDialog dlg = formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(TimeSwitchPane.this), new DialogActionAdapter() {
public void doOk() { public void doOk() {
String newText = Utils.objectToString(formulaPane.update()); String newText = Utils.objectToString(formulaPane.update());

38
designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartAxisLabelPane.java

@ -1,23 +1,13 @@
package com.fr.design.mainframe.chart.gui.style; package com.fr.design.mainframe.chart.gui.style;
import java.awt.*; import com.fr.base.BaseFormula;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import javax.swing.JPanel;
import javax.swing.SpinnerNumberModel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import com.fr.base.Formula;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.chart.base.ChartBaseUtils; import com.fr.chart.base.ChartBaseUtils;
import com.fr.chart.base.TextAttr; import com.fr.chart.base.TextAttr;
import com.fr.chart.chartattr.Axis; import com.fr.chart.chartattr.Axis;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
@ -28,9 +18,17 @@ import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.gui.style.NumberDragBar; import com.fr.design.gui.style.NumberDragBar;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.dialog.BasicPane;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
public class ChartAxisLabelPane extends BasicPane implements UIObserver{ public class ChartAxisLabelPane extends BasicPane implements UIObserver{
private static final int LABEL_INTERVAL = 0; private static final int LABEL_INTERVAL = 0;
private static final int LABEL_WRAP =1; private static final int LABEL_WRAP =1;
@ -330,7 +328,7 @@ public class ChartAxisLabelPane extends BasicPane implements UIObserver{
} }
} }
private int getLabelSampleNumber(Formula formula) { private int getLabelSampleNumber(BaseFormula formula) {
Number number = ChartBaseUtils.formula2Number(formula); Number number = ChartBaseUtils.formula2Number(formula);
if (number != null) { if (number != null) {
int num = number.intValue(); int num = number.intValue();
@ -339,7 +337,7 @@ public class ChartAxisLabelPane extends BasicPane implements UIObserver{
return 0; return 0;
} }
private boolean isWrapShow(Formula formula){ private boolean isWrapShow(BaseFormula formula){
Number number = ChartBaseUtils.formula2Number(formula); Number number = ChartBaseUtils.formula2Number(formula);
return number == null; return number == null;
} }
@ -423,20 +421,20 @@ public class ChartAxisLabelPane extends BasicPane implements UIObserver{
private void update4Normal(Axis axis){ private void update4Normal(Axis axis){
if (labelSampleChoose.getSelectedIndex() == 0) { if (labelSampleChoose.getSelectedIndex() == 0) {
axis.setLabelIntervalNumber(new Formula("0")); axis.setLabelIntervalNumber(BaseFormula.createFormulaBuilder().build("0"));
} else { } else {
axis.setLabelIntervalNumber(new Formula(customLabelSamleTime.getText())); axis.setLabelIntervalNumber(BaseFormula.createFormulaBuilder().build(customLabelSamleTime.getText()));
} }
} }
private void update4Wrap(Axis axis){ private void update4Wrap(Axis axis){
if (showWay.getSelectedIndex() == LABEL_WRAP) { if (showWay.getSelectedIndex() == LABEL_WRAP) {
axis.setLabelIntervalNumber(new Formula()); axis.setLabelIntervalNumber(BaseFormula.createFormulaBuilder().build());
} else if (showWay.getSelectedIndex() == LABEL_INTERVAL) { } else if (showWay.getSelectedIndex() == LABEL_INTERVAL) {
if (auto.isSelected()) { if (auto.isSelected()) {
axis.setLabelIntervalNumber(new Formula("0")); axis.setLabelIntervalNumber(BaseFormula.createFormulaBuilder().build("0"));
} else if (custom.isSelected()) { } else if (custom.isSelected()) {
axis.setLabelIntervalNumber(new Formula(customLabelSamleTime.getText())); axis.setLabelIntervalNumber(BaseFormula.createFormulaBuilder().build(customLabelSamleTime.getText()));
} }
} }
} }

6
designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartAxisTitlePane.java

@ -1,19 +1,19 @@
package com.fr.design.mainframe.chart.gui.style; package com.fr.design.mainframe.chart.gui.style;
import com.fr.base.BaseFormula;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Formula;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.chart.chartattr.Axis; import com.fr.chart.chartattr.Axis;
import com.fr.chart.chartattr.Title; import com.fr.chart.chartattr.Title;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.formula.TinyFormulaPane; import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.dialog.BasicPane;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.Constants; import com.fr.stable.Constants;
@ -109,7 +109,7 @@ public class ChartAxisTitlePane extends BasicPane{
title.getTextAttr().setAlignText(Style.VERTICALTEXT); title.getTextAttr().setAlignText(Style.VERTICALTEXT);
} }
if(StableUtils.canBeFormula(axisTitleContentPane.updateBean())) { if(StableUtils.canBeFormula(axisTitleContentPane.updateBean())) {
title.setTextObject(new Formula(axisTitleContentPane.updateBean())); title.setTextObject(BaseFormula.createFormulaBuilder().build(axisTitleContentPane.updateBean()));
} else { } else {
title.setTextObject(axisTitleContentPane.updateBean()); title.setTextObject(axisTitleContentPane.updateBean());
} }

23
designer_chart/src/com/fr/design/mainframe/chart/gui/style/DateAxisValuePane.java

@ -1,6 +1,6 @@
package com.fr.design.mainframe.chart.gui.style; package com.fr.design.mainframe.chart.gui.style;
import com.fr.base.Formula; import com.fr.base.BaseFormula;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.chart.base.ChartConstants; import com.fr.chart.base.ChartConstants;
import com.fr.chart.chartattr.CategoryAxis; import com.fr.chart.chartattr.CategoryAxis;
@ -28,7 +28,12 @@ import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.text.ParseException; import java.text.ParseException;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
@ -194,7 +199,7 @@ public class DateAxisValuePane extends FurtherBasicBeanPane<CategoryAxis>{
private void showFormulaPane(final UITextField jTextField) { private void showFormulaPane(final UITextField jTextField) {
final UIFormula formulaPane = FormulaFactory.createFormulaPane(); final UIFormula formulaPane = FormulaFactory.createFormulaPane();
formulaPane.populate(new Formula(jTextField.getText())); formulaPane.populate(BaseFormula.createFormulaBuilder().build(jTextField.getText()));
BasicDialog dlg = formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(DateAxisValuePane.this), new DialogActionAdapter() { BasicDialog dlg = formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(DateAxisValuePane.this), new DialogActionAdapter() {
public void doOk() { public void doOk() {
jTextField.setText(Utils.objectToString(formulaPane.update())); jTextField.setText(Utils.objectToString(formulaPane.update()));
@ -214,7 +219,7 @@ public class DateAxisValuePane extends FurtherBasicBeanPane<CategoryAxis>{
private void updateMain(CategoryAxis axis) { private void updateMain(CategoryAxis axis) {
if (mainTickBox.isSelected() && StringUtils.isNotEmpty(mainUnitField.getText())) { if (mainTickBox.isSelected() && StringUtils.isNotEmpty(mainUnitField.getText())) {
axis.setCustomMainUnit(true); axis.setCustomMainUnit(true);
axis.setMainUnit(new Formula(mainUnitField.getText())); axis.setMainUnit(BaseFormula.createFormulaBuilder().build(mainUnitField.getText()));
axis.setMainType(VALUES.get(mainType.getSelectedItem())); axis.setMainType(VALUES.get(mainType.getSelectedItem()));
} else { } else {
axis.setCustomMainUnit(false); axis.setCustomMainUnit(false);
@ -305,7 +310,7 @@ public class DateAxisValuePane extends FurtherBasicBeanPane<CategoryAxis>{
//最小值 //最小值
if (minCheckBox.isSelected()) { if (minCheckBox.isSelected()) {
if(minValueField.getCurrentEditor() instanceof FormulaEditor){ if(minValueField.getCurrentEditor() instanceof FormulaEditor){
Formula min = (Formula)minValueField.update(); BaseFormula min = (BaseFormula) minValueField.update();
axis.setMinValue(min); axis.setMinValue(min);
axis.setCustomMinValue(!StringUtils.isEmpty(min.getPureContent())); axis.setCustomMinValue(!StringUtils.isEmpty(min.getPureContent()));
}else{ }else{
@ -313,7 +318,7 @@ public class DateAxisValuePane extends FurtherBasicBeanPane<CategoryAxis>{
DateEditor dateEditor = (DateEditor)minValueField.getCurrentEditor(); DateEditor dateEditor = (DateEditor)minValueField.getCurrentEditor();
String dateString = dateEditor.getUIDatePickerFormat().format(datetmp); String dateString = dateEditor.getUIDatePickerFormat().format(datetmp);
axis.setCustomMinValue(!StringUtils.isEmpty(dateString)); axis.setCustomMinValue(!StringUtils.isEmpty(dateString));
axis.setMinValue(new Formula(dateString)); axis.setMinValue(BaseFormula.createFormulaBuilder().build(dateString));
} }
} else { } else {
axis.setCustomMinValue(false); axis.setCustomMinValue(false);
@ -322,7 +327,7 @@ public class DateAxisValuePane extends FurtherBasicBeanPane<CategoryAxis>{
//最大值 //最大值
if (maxCheckBox.isSelected()) { if (maxCheckBox.isSelected()) {
if(maxValueField.getCurrentEditor() instanceof FormulaEditor){ if(maxValueField.getCurrentEditor() instanceof FormulaEditor){
Formula max = (Formula)maxValueField.update(); BaseFormula max = (BaseFormula) maxValueField.update();
axis.setMaxValue(max); axis.setMaxValue(max);
axis.setCustomMaxValue(!StringUtils.isEmpty(max.getPureContent())); axis.setCustomMaxValue(!StringUtils.isEmpty(max.getPureContent()));
}else{ }else{
@ -330,7 +335,7 @@ public class DateAxisValuePane extends FurtherBasicBeanPane<CategoryAxis>{
DateEditor dateEditor = (DateEditor)maxValueField.getCurrentEditor(); DateEditor dateEditor = (DateEditor)maxValueField.getCurrentEditor();
String dateString = dateEditor.getUIDatePickerFormat().format(datetmp); String dateString = dateEditor.getUIDatePickerFormat().format(datetmp);
axis.setCustomMaxValue(!StringUtils.isEmpty(dateString)); axis.setCustomMaxValue(!StringUtils.isEmpty(dateString));
axis.setMaxValue(new Formula(dateString)); axis.setMaxValue(BaseFormula.createFormulaBuilder().build(dateString));
} }
} else { } else {
axis.setCustomMaxValue(false); axis.setCustomMaxValue(false);
@ -345,7 +350,7 @@ public class DateAxisValuePane extends FurtherBasicBeanPane<CategoryAxis>{
} }
//将从formula读出来的内容转化为指定格式的日期 //将从formula读出来的内容转化为指定格式的日期
private static final Date getDateFromFormula(Formula dateFormula){ private static final Date getDateFromFormula(BaseFormula dateFormula){
String dateStr = dateFormula.getPureContent(); String dateStr = dateFormula.getPureContent();
dateStr = Pattern.compile("\"").matcher(dateStr).replaceAll(StringUtils.EMPTY); dateStr = Pattern.compile("\"").matcher(dateStr).replaceAll(StringUtils.EMPTY);
Date toDate = DateUtils.string2Date(dateStr, true); Date toDate = DateUtils.string2Date(dateStr, true);

5
designer_chart/src/com/fr/design/mainframe/chart/gui/style/axis/ChartValuePane.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.chart.gui.style.axis; package com.fr.design.mainframe.chart.gui.style.axis;
import com.fr.base.BaseFormula;
import com.fr.base.Formula; import com.fr.base.Formula;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.chart.base.ChartBaseUtils; import com.fr.chart.base.ChartBaseUtils;
@ -280,11 +281,11 @@ public class ChartValuePane extends ChartAxisUsePane<Axis>{
numberAxis.setLogBase(null); numberAxis.setLogBase(null);
} else { } else {
numberAxis.setLog(true); numberAxis.setLog(true);
Formula formula = new Formula(increment); BaseFormula formula = BaseFormula.createFormulaBuilder().build(increment);
Number number = ChartBaseUtils.formula2Number(formula); Number number = ChartBaseUtils.formula2Number(formula);
// 界面处理防止 遇到 对数增量为小于1的值. // 界面处理防止 遇到 对数增量为小于1的值.
if (number != null && number.doubleValue() <= 1.0) { if (number != null && number.doubleValue() <= 1.0) {
numberAxis.setLogBase(new Formula("2")); numberAxis.setLogBase(BaseFormula.createFormulaBuilder().build("2"));
} else { } else {
numberAxis.setLogBase(formula); numberAxis.setLogBase(formula);
} }

24
designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java

@ -1,6 +1,6 @@
package com.fr.design.mainframe.chart.gui.style.series; package com.fr.design.mainframe.chart.gui.style.series;
import com.fr.base.Formula; import com.fr.base.BaseFormula;
import com.fr.chart.base.AreaColor; import com.fr.chart.base.AreaColor;
import com.fr.chart.base.ChartBaseUtils; import com.fr.chart.base.ChartBaseUtils;
import com.fr.chart.chartglyph.MapHotAreaColor; import com.fr.chart.chartglyph.MapHotAreaColor;
@ -465,7 +465,7 @@ public class UIColorPickerPane extends BasicPane implements UIObserver {
private class TextFieldGroupPane extends JPanel { private class TextFieldGroupPane extends JPanel {
private static final long serialVersionUID = -8390474551829486013L; private static final long serialVersionUID = -8390474551829486013L;
public void refreshTextGroupPane(Formula[] values) { public void refreshTextGroupPane(BaseFormula[] values) {
if (values.length == textFieldList.size()) { if (values.length == textFieldList.size()) {
for (int i = 0; i < textFieldList.size(); i++) { for (int i = 0; i < textFieldList.size(); i++) {
@ -519,13 +519,13 @@ public class UIColorPickerPane extends BasicPane implements UIObserver {
if(i == size - 1) { if(i == size - 1) {
backValue = -Double.MAX_VALUE; backValue = -Double.MAX_VALUE;
} else { } else {
Number backNumber = ChartBaseUtils.formula2Number(new Formula(getValue4Index(i+1))); Number backNumber = ChartBaseUtils.formula2Number(BaseFormula.createFormulaBuilder().build(getValue4Index(i+1)));
if(backNumber != null){ if(backNumber != null){
backValue = backNumber.doubleValue(); backValue = backNumber.doubleValue();
} }
} }
Number number = ChartBaseUtils.formula2Number(new Formula(getValue4Index(i))); Number number = ChartBaseUtils.formula2Number(BaseFormula.createFormulaBuilder().build(getValue4Index(i)));
if(number != null) { if(number != null) {
double value = number.doubleValue(); double value = number.doubleValue();
@ -633,7 +633,7 @@ public class UIColorPickerPane extends BasicPane implements UIObserver {
* @param colorArray 颜色值 * @param colorArray 颜色值
* @param valueArray 值区间 * @param valueArray 值区间
*/ */
public void refreshGroupPane(Color[] colorArray, Formula[] valueArray) { public void refreshGroupPane(Color[] colorArray, BaseFormula[] valueArray) {
colorGroup.refreshColorGroupPane(colorArray); colorGroup.refreshColorGroupPane(colorArray);
textGroup.refreshTextGroupPane(valueArray); textGroup.refreshTextGroupPane(valueArray);
@ -657,7 +657,7 @@ public class UIColorPickerPane extends BasicPane implements UIObserver {
UIColorPickerPane.this.add(textGroup); UIColorPickerPane.this.add(textGroup);
UIColorPickerPane.this.add(colorGroup); UIColorPickerPane.this.add(colorGroup);
Color[] colors = hotAreaColor.initColor(); Color[] colors = hotAreaColor.initColor();
Formula[] values = hotAreaColor.initValues(); BaseFormula[] values = hotAreaColor.initValues();
refreshGroupPane(colors, values); refreshGroupPane(colors, values);
this.initContainerLister(); this.initContainerLister();
regionNumPane.populateBean(value); regionNumPane.populateBean(value);
@ -686,7 +686,7 @@ public class UIColorPickerPane extends BasicPane implements UIObserver {
} }
hotAreaColor.clearColor(); hotAreaColor.clearColor();
Color[] colors = getColors4Custom(fillStyleCombox.getSelectObject(), regionNumPane.updateBean().intValue()); Color[] colors = getColors4Custom(fillStyleCombox.getSelectObject(), regionNumPane.updateBean().intValue());
Formula[] value = getValueArray(regionNumPane.updateBean().intValue()); BaseFormula[] value = getValueArray(regionNumPane.updateBean().intValue());
for (int i = 0; i < colors.length; i++) { for (int i = 0; i < colors.length; i++) {
hotAreaColor.addAreaColor(new AreaColor(value[i], value[i + 1], colors[i])); hotAreaColor.addAreaColor(new AreaColor(value[i], value[i + 1], colors[i]));
@ -705,7 +705,7 @@ public class UIColorPickerPane extends BasicPane implements UIObserver {
if(StringUtils.isEmpty(getValue4Index(i))){ if(StringUtils.isEmpty(getValue4Index(i))){
return false; return false;
} }
Number number = ChartBaseUtils.formula2Number(new Formula(getValue4Index(i))); Number number = ChartBaseUtils.formula2Number(BaseFormula.createFormulaBuilder().build(getValue4Index(i)));
if(number != null) { if(number != null) {
double value = number.doubleValue(); double value = number.doubleValue();
if(value > maxValue) { if(value > maxValue) {
@ -739,13 +739,13 @@ public class UIColorPickerPane extends BasicPane implements UIObserver {
return ChartBaseUtils.createColorsWithHSB(color, sum); return ChartBaseUtils.createColorsWithHSB(color, sum);
} }
private Formula[] getValueArray(int count) { private BaseFormula[] getValueArray(int count) {
Formula[] valueArray = new Formula[count + 1]; BaseFormula[] valueArray = new BaseFormula[count + 1];
for (int i = 0; i < valueArray.length; i++) { for (int i = 0; i < valueArray.length; i++) {
if (i >= textFieldList.size()) { if (i >= textFieldList.size()) {
valueArray[i] = new Formula(new Double((count + 1 - i) * VALUE).toString()); valueArray[i] = BaseFormula.createFormulaBuilder().build((count + 1 - i) * VALUE);
} else { } else {
valueArray[i] = new Formula(getValue4Index(i)); valueArray[i] = BaseFormula.createFormulaBuilder().build(getValue4Index(i));
} }
} }
return valueArray; return valueArray;

24
designer_chart/src/com/fr/design/mainframe/chart/gui/style/title/ChartTitlePane.java

@ -1,22 +1,14 @@
package com.fr.design.mainframe.chart.gui.style.title; package com.fr.design.mainframe.chart.gui.style.title;
import java.awt.BorderLayout; import com.fr.base.BaseFormula;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Icon;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Formula;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.chart.base.TextAttr; import com.fr.chart.base.TextAttr;
import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Title; import com.fr.chart.chartattr.Title;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.dialog.BasicScrollPane;
import com.fr.design.formula.TinyFormulaPane; import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
@ -27,12 +19,16 @@ import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.mainframe.chart.gui.style.ChartBackgroundNoImagePane; import com.fr.design.mainframe.chart.gui.style.ChartBackgroundNoImagePane;
import com.fr.design.mainframe.chart.gui.style.ChartBorderPane; import com.fr.design.mainframe.chart.gui.style.ChartBorderPane;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.dialog.BasicScrollPane;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class ChartTitlePane extends BasicScrollPane<Chart> { public class ChartTitlePane extends BasicScrollPane<Chart> {
private static final long serialVersionUID = 5748881235830708722L; private static final long serialVersionUID = 5748881235830708722L;
private UICheckBox isTitleVisable; private UICheckBox isTitleVisable;
@ -148,8 +144,8 @@ public class ChartTitlePane extends BasicScrollPane<Chart> {
return; return;
} }
isTitleVisable.setSelected(title.isTitleVisible()); isTitleVisable.setSelected(title.isTitleVisible());
if (title.getTextObject() instanceof Formula) { if (title.getTextObject() instanceof BaseFormula) {
titleContent.populateBean(((Formula) title.getTextObject()).getContent()); titleContent.populateBean(((BaseFormula) title.getTextObject()).getContent());
} else { } else {
titleContent.populateBean(Utils.objectToString(title.getTextObject())); titleContent.populateBean(Utils.objectToString(title.getTextObject()));
} }
@ -178,7 +174,7 @@ public class ChartTitlePane extends BasicScrollPane<Chart> {
String titleString = titleContent.updateBean(); String titleString = titleContent.updateBean();
Object titleObj; Object titleObj;
if (StableUtils.maybeFormula(titleString)) { if (StableUtils.maybeFormula(titleString)) {
titleObj = new Formula(titleString); titleObj = BaseFormula.createFormulaBuilder().build(titleString);
} else { } else {
titleObj = titleString; titleObj = titleString;
} }

14
designer_chart/src/com/fr/plugin/chart/designer/other/VanChartInteractivePane.java

@ -1,6 +1,6 @@
package com.fr.plugin.chart.designer.other; package com.fr.plugin.chart.designer.other;
import com.fr.base.Formula; import com.fr.base.BaseFormula;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
@ -296,13 +296,13 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
zoomWidget.setSelectedIndex(zoom.isZoomVisible() ? 0 : 1); zoomWidget.setSelectedIndex(zoom.isZoomVisible() ? 0 : 1);
zoomGesture.setSelectedIndex(zoom.isZoomGesture() ? 0 : 1); zoomGesture.setSelectedIndex(zoom.isZoomGesture() ? 0 : 1);
zoomResize.setSelectedIndex(zoom.isZoomResize() ? 0 : 1); zoomResize.setSelectedIndex(zoom.isZoomResize() ? 0 : 1);
if (zoom.getFrom() instanceof Formula) { if (zoom.getFrom() instanceof BaseFormula) {
from.populateBean(((Formula) zoom.getFrom()).getContent()); from.populateBean(((BaseFormula) zoom.getFrom()).getContent());
} else { } else {
from.populateBean(Utils.objectToString(zoom.getFrom())); from.populateBean(Utils.objectToString(zoom.getFrom()));
} }
if (zoom.getTo() instanceof Formula) { if (zoom.getTo() instanceof BaseFormula) {
to.populateBean(((Formula) zoom.getTo()).getContent()); to.populateBean(((BaseFormula) zoom.getTo()).getContent());
} else { } else {
to.populateBean(Utils.objectToString(zoom.getTo())); to.populateBean(Utils.objectToString(zoom.getTo()));
} }
@ -381,7 +381,7 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
String fromString = from.updateBean(); String fromString = from.updateBean();
Object fromObject; Object fromObject;
if (StableUtils.maybeFormula(fromString)) { if (StableUtils.maybeFormula(fromString)) {
fromObject = new Formula(fromString); fromObject = BaseFormula.createFormulaBuilder().build(fromString);
} else { } else {
fromObject = fromString; fromObject = fromString;
} }
@ -389,7 +389,7 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
String toString = to.updateBean(); String toString = to.updateBean();
Object toObject; Object toObject;
if (StableUtils.maybeFormula(toString)) { if (StableUtils.maybeFormula(toString)) {
toObject = new Formula(toString); toObject = BaseFormula.createFormulaBuilder().build(toString);
} else { } else {
toObject = toString; toObject = toString;
} }

8
designer_chart/src/com/fr/plugin/chart/designer/style/VanChartTitlePane.java

@ -1,7 +1,7 @@
package com.fr.plugin.chart.designer.style; package com.fr.plugin.chart.designer.style;
import com.fr.base.BaseFormula;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Formula;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.chart.base.TextAttr; import com.fr.chart.base.TextAttr;
@ -272,8 +272,8 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
return; return;
} }
isTitleVisible.setSelected(title.isTitleVisible()); isTitleVisible.setSelected(title.isTitleVisible());
if (title.getTextObject() instanceof Formula) { if (title.getTextObject() instanceof BaseFormula) {
titleContent.populateBean(((Formula) title.getTextObject()).getContent()); titleContent.populateBean(((BaseFormula) title.getTextObject()).getContent());
} else { } else {
titleContent.populateBean(Utils.objectToString(title.getTextObject())); titleContent.populateBean(Utils.objectToString(title.getTextObject()));
} }
@ -313,7 +313,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
String titleString = titleContent.updateBean(); String titleString = titleContent.updateBean();
Object titleObj; Object titleObj;
if (StableUtils.maybeFormula(titleString)) { if (StableUtils.maybeFormula(titleString)) {
titleObj = new Formula(titleString); titleObj = BaseFormula.createFormulaBuilder().build(titleString);
} else { } else {
titleObj = titleString; titleObj = titleString;
} }

12
designer_chart/src/com/fr/plugin/chart/designer/style/axis/VanChartBaseAxisPane.java

@ -1,7 +1,7 @@
package com.fr.plugin.chart.designer.style.axis; package com.fr.plugin.chart.designer.style.axis;
import com.fr.base.BaseFormula;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Formula;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.chart.base.TextAttr; import com.fr.chart.base.TextAttr;
import com.fr.chart.chartattr.Title; import com.fr.chart.chartattr.Title;
@ -428,8 +428,8 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
private void populateTitle(VanChartAxis axis){ private void populateTitle(VanChartAxis axis){
Title axisTitle = axis.getTitle(); Title axisTitle = axis.getTitle();
if(axisTitle != null){ if(axisTitle != null){
if (axisTitle.getTextObject() instanceof Formula && titleContent != null) { if (axisTitle.getTextObject() instanceof BaseFormula && titleContent != null) {
titleContent.populateBean(((Formula) axisTitle.getTextObject()).getContent()); titleContent.populateBean(((BaseFormula) axisTitle.getTextObject()).getContent());
} else if(titleContent != null){ } else if(titleContent != null){
titleContent.populateBean(Utils.objectToString(axisTitle.getTextObject())); titleContent.populateBean(Utils.objectToString(axisTitle.getTextObject()));
} }
@ -547,7 +547,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
String titleString = titleContent.updateBean(); String titleString = titleContent.updateBean();
Object titleObj; Object titleObj;
if (StableUtils.maybeFormula(titleString)) { if (StableUtils.maybeFormula(titleString)) {
titleObj = new Formula(titleString); titleObj = BaseFormula.createFormulaBuilder().build(titleString);
} else { } else {
titleObj = titleString; titleObj = titleString;
} }
@ -586,9 +586,9 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
} }
if(labelGapValue != null){ if(labelGapValue != null){
if(axis.isAutoLabelGap()){ if(axis.isAutoLabelGap()){
axis.setLabelIntervalNumber(new Formula("1")); axis.setLabelIntervalNumber(BaseFormula.createFormulaBuilder().build("1"));
} else { } else {
axis.setLabelIntervalNumber(new Formula(labelGapValue.getText())); axis.setLabelIntervalNumber(BaseFormula.createFormulaBuilder().build(labelGapValue.getText()));
} }
} }
} }

16
designer_chart/src/com/fr/plugin/chart/designer/style/axis/VanChartTimeAxisPane.java

@ -1,6 +1,6 @@
package com.fr.plugin.chart.designer.style.axis; package com.fr.plugin.chart.designer.style.axis;
import com.fr.base.Formula; import com.fr.base.BaseFormula;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.design.chart.ChartSwingUtils; import com.fr.design.chart.ChartSwingUtils;
import com.fr.design.editor.ValueEditorPane; import com.fr.design.editor.ValueEditorPane;
@ -267,7 +267,7 @@ public class VanChartTimeAxisPane extends VanChartBaseAxisPane {
public void update(VanChartTimeAxis timeAxis){ public void update(VanChartTimeAxis timeAxis){
if (minCheckBox.isSelected()) {//最小值 if (minCheckBox.isSelected()) {//最小值
if(minValueField.getCurrentEditor() instanceof FormulaEditor){ if(minValueField.getCurrentEditor() instanceof FormulaEditor){
Formula min = (Formula)minValueField.update(); BaseFormula min = (BaseFormula) minValueField.update();
timeAxis.setMinValue(min); timeAxis.setMinValue(min);
timeAxis.setCustomMinValue(StringUtils.isNotEmpty(min.getPureContent())); timeAxis.setCustomMinValue(StringUtils.isNotEmpty(min.getPureContent()));
}else{ }else{
@ -275,14 +275,14 @@ public class VanChartTimeAxisPane extends VanChartBaseAxisPane {
DateEditor dateEditor = (DateEditor)minValueField.getCurrentEditor(); DateEditor dateEditor = (DateEditor)minValueField.getCurrentEditor();
String dateString = dateEditor.getUIDatePickerFormat().format(datetmp); String dateString = dateEditor.getUIDatePickerFormat().format(datetmp);
timeAxis.setCustomMinValue(StringUtils.isNotEmpty(dateString)); timeAxis.setCustomMinValue(StringUtils.isNotEmpty(dateString));
timeAxis.setMinValue(new Formula(dateString)); timeAxis.setMinValue(BaseFormula.createFormulaBuilder().build(dateString));
} }
} else { } else {
timeAxis.setCustomMinValue(false); timeAxis.setCustomMinValue(false);
} }
if (maxCheckBox.isSelected()) {//最大值 if (maxCheckBox.isSelected()) {//最大值
if(maxValueField.getCurrentEditor() instanceof FormulaEditor){ if(maxValueField.getCurrentEditor() instanceof FormulaEditor){
Formula max = (Formula)maxValueField.update(); BaseFormula max = (BaseFormula) maxValueField.update();
timeAxis.setMaxValue(max); timeAxis.setMaxValue(max);
timeAxis.setCustomMaxValue(StringUtils.isNotEmpty(max.getPureContent())); timeAxis.setCustomMaxValue(StringUtils.isNotEmpty(max.getPureContent()));
}else{ }else{
@ -290,14 +290,14 @@ public class VanChartTimeAxisPane extends VanChartBaseAxisPane {
DateEditor dateEditor = (DateEditor)maxValueField.getCurrentEditor(); DateEditor dateEditor = (DateEditor)maxValueField.getCurrentEditor();
String dateString = dateEditor.getUIDatePickerFormat().format(datetmp); String dateString = dateEditor.getUIDatePickerFormat().format(datetmp);
timeAxis.setCustomMaxValue(StringUtils.isNotEmpty(dateString)); timeAxis.setCustomMaxValue(StringUtils.isNotEmpty(dateString));
timeAxis.setMaxValue(new Formula(dateString)); timeAxis.setMaxValue(BaseFormula.createFormulaBuilder().build(dateString));
} }
} else { } else {
timeAxis.setCustomMaxValue(false); timeAxis.setCustomMaxValue(false);
} }
if (mainTickBox.isSelected() && StringUtils.isNotEmpty(mainUnitField.getText())) {//主要刻度单位 if (mainTickBox.isSelected() && StringUtils.isNotEmpty(mainUnitField.getText())) {//主要刻度单位
timeAxis.setCustomMainUnit(true); timeAxis.setCustomMainUnit(true);
timeAxis.setMainUnit(new Formula(mainUnitField.getText())); timeAxis.setMainUnit(BaseFormula.createFormulaBuilder().build(mainUnitField.getText()));
String item = mainType.getSelectedItem().toString(); String item = mainType.getSelectedItem().toString();
timeAxis.setMainType(TimeType.parseString(item)); timeAxis.setMainType(TimeType.parseString(item));
} else { } else {
@ -305,7 +305,7 @@ public class VanChartTimeAxisPane extends VanChartBaseAxisPane {
} }
if (secondTickBox.isSelected() && StringUtils.isNotEmpty(secondUnitField.getText())) { //次要刻度单位 if (secondTickBox.isSelected() && StringUtils.isNotEmpty(secondUnitField.getText())) { //次要刻度单位
timeAxis.setCustomSecUnit(true); timeAxis.setCustomSecUnit(true);
timeAxis.setSecUnit(new Formula(secondUnitField.getText())); timeAxis.setSecUnit(BaseFormula.createFormulaBuilder().build(secondUnitField.getText()));
String item = secondType.getSelectedItem().toString(); String item = secondType.getSelectedItem().toString();
timeAxis.setSecondType(TimeType.parseString(item)); timeAxis.setSecondType(TimeType.parseString(item));
} else { } else {
@ -367,7 +367,7 @@ public class VanChartTimeAxisPane extends VanChartBaseAxisPane {
} }
//将从formula读出来的内容转化为指定格式的日期 //将从formula读出来的内容转化为指定格式的日期
private Date getDateFromFormula(Formula dateFormula){ private Date getDateFromFormula(BaseFormula dateFormula){
String dateStr = dateFormula.getPureContent(); String dateStr = dateFormula.getPureContent();
dateStr = Pattern.compile("\"").matcher(dateStr).replaceAll(StringUtils.EMPTY); dateStr = Pattern.compile("\"").matcher(dateStr).replaceAll(StringUtils.EMPTY);
Date toDate = DateUtils.string2Date(dateStr, true); Date toDate = DateUtils.string2Date(dateStr, true);

5
designer_chart/src/com/fr/plugin/chart/designer/style/axis/VanChartValueAxisPane.java

@ -1,5 +1,6 @@
package com.fr.plugin.chart.designer.style.axis; package com.fr.plugin.chart.designer.style.axis;
import com.fr.base.BaseFormula;
import com.fr.base.Formula; import com.fr.base.Formula;
import com.fr.chart.base.ChartBaseUtils; import com.fr.chart.base.ChartBaseUtils;
import com.fr.design.chart.ChartSwingUtils; import com.fr.design.chart.ChartSwingUtils;
@ -162,11 +163,11 @@ public class VanChartValueAxisPane extends VanChartBaseAxisPane {
valueAxis.setLogBase(null); valueAxis.setLogBase(null);
} else { } else {
valueAxis.setLog(true); valueAxis.setLog(true);
Formula formula = new Formula(increment); BaseFormula formula = BaseFormula.createFormulaBuilder().build(increment);
Number number = ChartBaseUtils.formula2Number(formula); Number number = ChartBaseUtils.formula2Number(formula);
// 界面处理防止 遇到 对数增量为小于1的值. // 界面处理防止 遇到 对数增量为小于1的值.
if (number != null && number.doubleValue() <= 1.0) { if (number != null && number.doubleValue() <= 1.0) {
valueAxis.setLogBase(new Formula("2")); valueAxis.setLogBase(BaseFormula.createFormulaBuilder().build("2"));
} else { } else {
valueAxis.setLogBase(formula); valueAxis.setLogBase(formula);
} }

6
designer_chart/src/com/fr/plugin/chart/designer/style/axis/component/MinMaxValuePaneWithOutTick.java

@ -1,6 +1,6 @@
package com.fr.plugin.chart.designer.style.axis.component; package com.fr.plugin.chart.designer.style.axis.component;
import com.fr.base.Formula; import com.fr.base.BaseFormula;
import com.fr.plugin.chart.range.MinAndMaxValue; import com.fr.plugin.chart.range.MinAndMaxValue;
import javax.swing.*; import javax.swing.*;
@ -35,8 +35,8 @@ public class MinMaxValuePaneWithOutTick extends VanChartMinMaxValuePane {
if(minAndMaxValue == null) { if(minAndMaxValue == null) {
return; return;
} }
minAndMaxValue.setMinValue(new Formula(minValueField.getText())); minAndMaxValue.setMinValue(BaseFormula.createFormulaBuilder().build(minValueField.getText()));
minAndMaxValue.setMaxValue(new Formula(maxValueField.getText())); minAndMaxValue.setMaxValue(BaseFormula.createFormulaBuilder().build(maxValueField.getText()));
minAndMaxValue.setCustomMin(minCheckBox.isSelected()); minAndMaxValue.setCustomMin(minCheckBox.isSelected());
minAndMaxValue.setCustomMax(maxCheckBox.isSelected()); minAndMaxValue.setCustomMax(maxCheckBox.isSelected());
} }

5
designer_chart/src/com/fr/plugin/chart/designer/style/background/VanChartAlertValuePane.java

@ -1,5 +1,6 @@
package com.fr.plugin.chart.designer.style.background; package com.fr.plugin.chart.designer.style.background;
import com.fr.base.BaseFormula;
import com.fr.base.Formula; import com.fr.base.Formula;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
@ -171,14 +172,14 @@ public class VanChartAlertValuePane extends BasicBeanPane<VanChartAlertValue> {
public VanChartAlertValue updateBean(){ public VanChartAlertValue updateBean(){
chartAlertValue.setAxisName(alertAxis.getSelectedItem().toString()); chartAlertValue.setAxisName(alertAxis.getSelectedItem().toString());
chartAlertValue.setAlertValueFormula(new Formula(alertValue.updateBean())); chartAlertValue.setAlertValueFormula(BaseFormula.createFormulaBuilder().build(alertValue.updateBean()));
chartAlertValue.getLineColor().setSeriesColor(alertLineColor.getSelectObject()); chartAlertValue.getLineColor().setSeriesColor(alertLineColor.getSelectObject());
chartAlertValue.getLineStyle().setLineStyle(alertLineStyle.getSelectedLineStyle()); chartAlertValue.getLineStyle().setLineStyle(alertLineStyle.getSelectedLineStyle());
String contentString = alertText.updateBean(); String contentString = alertText.updateBean();
Object contentObj; Object contentObj;
if (StableUtils.maybeFormula(contentString)) { if (StableUtils.maybeFormula(contentString)) {
contentObj = new Formula(contentString); contentObj = BaseFormula.createFormulaBuilder().build(contentString);
} else { } else {
contentObj = contentString; contentObj = contentString;
} }

6
designer_chart/src/com/fr/plugin/chart/designer/style/background/VanChartCustomIntervalBackgroundPane.java

@ -1,6 +1,6 @@
package com.fr.plugin.chart.designer.style.background; package com.fr.plugin.chart.designer.style.background;
import com.fr.base.Formula; import com.fr.base.BaseFormula;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.formula.TinyFormulaPane; import com.fr.design.formula.TinyFormulaPane;
@ -105,8 +105,8 @@ public class VanChartCustomIntervalBackgroundPane extends BasicBeanPane<VanChart
customIntervalBackground.setAxisName(backgroundAxis.getSelectedItem().toString()); customIntervalBackground.setAxisName(backgroundAxis.getSelectedItem().toString());
customIntervalBackground.setFromFormula(new Formula(bottomValue.updateBean())); customIntervalBackground.setFromFormula(BaseFormula.createFormulaBuilder().build(bottomValue.updateBean()));
customIntervalBackground.setToFormula(new Formula(topValue.updateBean())); customIntervalBackground.setToFormula(BaseFormula.createFormulaBuilder().build(topValue.updateBean()));
customIntervalBackground.setBackgroundColor(color.getSelectObject()); customIntervalBackground.setBackgroundColor(color.getSelectObject());
customIntervalBackground.setAlpha(transparent.updateBean() / VanChartAttrHelper.PERCENT); customIntervalBackground.setAlpha(transparent.updateBean() / VanChartAttrHelper.PERCENT);
return customIntervalBackground; return customIntervalBackground;

12
designer_form/src/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java

@ -1,11 +1,6 @@
package com.fr.design.designer.creator; package com.fr.design.designer.creator;
import java.awt.Dimension; import com.fr.base.BaseFormula;
import java.awt.Insets;
import javax.swing.JComponent;
import com.fr.base.Formula;
import com.fr.design.border.UIRoundedBorder; import com.fr.design.border.UIRoundedBorder;
import com.fr.form.ui.AbstractBorderStyleWidget; import com.fr.form.ui.AbstractBorderStyleWidget;
import com.fr.form.ui.Label; import com.fr.form.ui.Label;
@ -19,6 +14,9 @@ import com.fr.general.ComparatorUtils;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
/** /**
* Created with IntelliJ IDEA. * Created with IntelliJ IDEA.
* User: zx * User: zx
@ -119,7 +117,7 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
private WidgetValue getTitleValue(WidgetTitle wTitle){ private WidgetValue getTitleValue(WidgetTitle wTitle){
String content = String.valueOf(wTitle.getTextObject()); String content = String.valueOf(wTitle.getTextObject());
Object vlaue = content.startsWith("=") ? new Formula(content) : content; Object vlaue = content.startsWith("=") ? BaseFormula.createFormulaBuilder().build(content) : content;
return new WidgetValue(vlaue); return new WidgetValue(vlaue);
} }

3
designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleFormulaEditor.java

@ -3,6 +3,7 @@
*/ */
package com.fr.design.mainframe.widget.accessibles; package com.fr.design.mainframe.widget.accessibles;
import com.fr.base.BaseFormula;
import com.fr.base.Formula; import com.fr.base.Formula;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
@ -37,7 +38,7 @@ public class AccessibleFormulaEditor extends BaseAccessibleEditor {
fireStateChanged(); fireStateChanged();
} }
}); });
formulaPane.populate((Formula) getValue()); formulaPane.populate((BaseFormula) getValue());
dlg.setVisible(true); dlg.setVisible(true);
} }
} }

3
designer_form/src/com/fr/design/mainframe/widget/wrappers/FormulaWrapper.java

@ -3,6 +3,7 @@
*/ */
package com.fr.design.mainframe.widget.wrappers; package com.fr.design.mainframe.widget.wrappers;
import com.fr.base.BaseFormula;
import com.fr.base.Formula; import com.fr.base.Formula;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -29,7 +30,7 @@ public class FormulaWrapper implements Encoder, Decoder{
@Override @Override
public Object decode(String txt) { public Object decode(String txt) {
return new Formula(txt); return BaseFormula.createFormulaBuilder().build(txt);
} }
@Override @Override

49
designer_form/src/com/fr/design/widget/ui/designer/DateEditorDefinePane.java

@ -217,55 +217,6 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
return ob; return ob;
} }
/**
* 更新日期控件的起止日期
*
* @param dateWidgetEditor 日期控件
*/
public void updateStartEnd(DateEditor dateWidgetEditor) {
Object startObject = startDv.update();
Object endObject = endDv.update();
// wei : 对公式的处理
Calculator cal = null;
if (startObject instanceof Formula) {
cal = Calculator.createCalculator();
Formula startFormula = (Formula) startObject;
try {
startFormula.setResult(cal.evalValue(startFormula.getContent()));
} catch (UtilEvalError e) {
FRContext.getLogger().error(e.getMessage(), e);
}
startObject = startFormula.getResult();
dateWidgetEditor.setStartDateFM(startFormula);
dateWidgetEditor.setStartText(null);
} else {
try {
dateWidgetEditor.setStartText(startObject == null ? "" : DateUtils.getDate2Str("MM/dd/yyyy", (Date) startObject));
} catch (ClassCastException e) {
//wei : TODO 说明应用的公式不能转化成日期格式,应该做些处理。
}
}
if (endObject instanceof Formula) {
cal = Calculator.createCalculator();
Formula endFormula = (Formula) endObject;
try {
endFormula.setResult(cal.evalValue(endFormula.getContent()));
} catch (UtilEvalError e) {
FRContext.getLogger().error(e.getMessage(), e);
}
endObject = endFormula.getResult();
dateWidgetEditor.setEndDateFM(endFormula);
dateWidgetEditor.setEndText(null);
} else {
try {
dateWidgetEditor.setEndText(endObject == null ? "" : DateUtils.getDate2Str("MM/dd/yyyy", (Date) endObject));
} catch (ClassCastException e) {
}
}
}
private SimpleDateFormat getSimpleDateFormat() { private SimpleDateFormat getSimpleDateFormat() {
String text = (String) currentFormatComboBox.getSelectedItem(); String text = (String) currentFormatComboBox.getSelectedItem();
SimpleDateFormat simpleDateFormat; SimpleDateFormat simpleDateFormat;

Loading…
Cancel
Save