Browse Source

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

master
richie 7 years ago
parent
commit
bcaeb1975c
  1. 29
      designer/src/com/fr/design/report/RichTextPane.java
  2. 19
      designer/src/com/fr/grid/GridUI.java
  3. 10
      designer_base/src/com/fr/design/data/tabledata/tabledatapane/AutoStoreProcedureTableModel.java
  4. 28
      designer_base/src/com/fr/design/data/tabledata/tabledatapane/StoreProcedureParameterPane.java
  5. 3
      designer_base/src/com/fr/design/editor/editor/FormulaEditor.java
  6. 28
      designer_base/src/com/fr/design/gui/frpane/JTreeAutoBuildPane.java
  7. 35
      designer_base/src/com/fr/design/parameter/ParameterInputPane.java
  8. 8
      designer_chart/src/com/fr/plugin/chart/designer/style/background/VanChartAlertValuePane.java

29
designer/src/com/fr/design/report/RichTextPane.java

@ -1,21 +1,7 @@
package com.fr.design.report;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.math.BigDecimal;
import java.util.Iterator;
import javax.swing.JPanel;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.DefaultStyledDocument;
import javax.swing.text.Element;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import com.fr.base.BaseFormula;
import com.fr.base.FRContext;
import com.fr.base.Formula;
import com.fr.base.Style;
import com.fr.design.cell.editor.RichTextToolBar;
import com.fr.design.dialog.BasicPane;
@ -34,6 +20,17 @@ import com.fr.stable.Constants;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.DefaultStyledDocument;
import javax.swing.text.Element;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import java.awt.*;
import java.math.BigDecimal;
import java.util.Iterator;
public class RichTextPane extends BasicPane {
//12号字体有个奇怪的bug, 字体下部分渲染会截断一部分, 换其他字体没问题, 字体改大小也没问题.
@ -82,7 +79,7 @@ public class RichTextPane extends BasicPane {
if(cellValue == null){
return;
}
if(cellValue instanceof Formula){
if(cellValue instanceof BaseFormula){
cellValue = RichTextConverter.asFormula(String.valueOf(cellValue));
}

19
designer/src/com/fr/grid/GridUI.java

@ -1,6 +1,13 @@
package com.fr.grid;
import com.fr.base.*;
import com.fr.base.BaseFormula;
import com.fr.base.BaseUtils;
import com.fr.base.DynamicUnitList;
import com.fr.base.FRContext;
import com.fr.base.GraphHelper;
import com.fr.base.Margin;
import com.fr.base.PaperSize;
import com.fr.base.Utils;
import com.fr.base.background.ColorBackground;
import com.fr.base.background.ImageBackground;
import com.fr.design.constants.UIConstants;
@ -41,8 +48,12 @@ import com.fr.third.antlr.ANTLRException;
import javax.swing.*;
import javax.swing.plaf.ComponentUI;
import java.awt.*;
import java.awt.geom.*;
import java.awt.geom.Area;
import java.awt.geom.GeneralPath;
import java.awt.geom.Line2D;
import java.awt.geom.Line2D.Double;
import java.awt.geom.Path2D;
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@ -768,8 +779,8 @@ public class GridUI extends ComponentUI {
private void paintGridSelectionForFormula(Graphics2D g2d, ElementCase report, CellSelection cs) {
// denny: 标记公式用到的单元格
if (report.getCellValue(cs.getColumn(), cs.getRow()) instanceof Formula) {
Formula tmpFormula = (Formula) report
if (report.getCellValue(cs.getColumn(), cs.getRow()) instanceof BaseFormula) {
BaseFormula tmpFormula = (BaseFormula) report
.getCellValue(cs.getColumn(), cs.getRow());
String statement = tmpFormula.getContent();
// denny: 获得公式中包含的所有单元格

10
designer_base/src/com/fr/design/data/tabledata/tabledatapane/AutoStoreProcedureTableModel.java

@ -1,10 +1,11 @@
package com.fr.design.data.tabledata.tabledatapane;
import com.fr.base.Formula;
import com.fr.base.BaseFormula;
import com.fr.base.StoreProcedureParameter;
import com.fr.design.gui.itableeditorpane.ParameterTableModel;
import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory;
import com.fr.design.editor.editor.CursorEditor;
import com.fr.design.gui.itableeditorpane.ParameterTableModel;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
@ -16,7 +17,8 @@ import javax.swing.event.PopupMenuListener;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellEditor;
import java.awt.*;
import java.util.*;
import java.util.Date;
import java.util.TimerTask;
/**
@ -129,7 +131,7 @@ public class AutoStoreProcedureTableModel extends StoreProcedureTableModel {
type = Inter.getLocText("Date");
else if(value instanceof Boolean)
type = Inter.getLocText("Parameter-Boolean");
else if(value instanceof Formula)
else if(value instanceof BaseFormula)
type = Inter.getLocText("Formula");
else
type = Inter.getLocText("Parameter-String");

28
designer_base/src/com/fr/design/data/tabledata/tabledatapane/StoreProcedureParameterPane.java

@ -1,27 +1,25 @@
package com.fr.design.data.tabledata.tabledatapane;
import java.awt.BorderLayout;
import java.awt.Component;
import java.util.Date;
import java.util.HashMap;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
import com.fr.base.Formula;
import com.fr.general.NameObject;
import com.fr.base.BaseFormula;
import com.fr.base.StoreProcedureParameter;
import com.fr.data.impl.storeproc.StoreProcedureConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory;
import com.fr.design.editor.editor.CursorEditor;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.dialog.BasicPane;
import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory;
import com.fr.design.editor.editor.CursorEditor;
import com.fr.general.Inter;
import com.fr.general.NameObject;
import javax.swing.*;
import java.awt.*;
import java.util.Date;
import java.util.HashMap;
public class StoreProcedureParameterPane extends BasicPane {
@ -140,7 +138,7 @@ public class StoreProcedureParameterPane extends BasicPane {
type = Inter.getLocText("Date");
else if(value instanceof Boolean)
type = Inter.getLocText("Parameter-Boolean");
else if(value instanceof Formula)
else if(value instanceof BaseFormula)
type = Inter.getLocText("Formula");
else
type = Inter.getLocText("Parameter-String");

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

@ -4,7 +4,6 @@
package com.fr.design.editor.editor;
import com.fr.base.BaseFormula;
import com.fr.base.Formula;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.formula.FormulaFactory;
import com.fr.design.formula.UIFormula;
@ -143,7 +142,7 @@ public class FormulaEditor extends Editor<BaseFormula> {
* @return 是公式类型则返回true
*/
public boolean accept(Object object) {
return object instanceof Formula;
return object instanceof BaseFormula;
}
/**

28
designer_base/src/com/fr/design/gui/frpane/JTreeAutoBuildPane.java

@ -1,27 +1,31 @@
package com.fr.design.gui.frpane;
import com.fr.base.Formula;
import com.fr.base.BaseFormula;
import com.fr.data.impl.NameTableData;
import com.fr.data.impl.RecursionTableData;
import com.fr.data.impl.TableDataDictionary;
import com.fr.design.DesignModelAdapter;
import com.fr.design.data.BasicTableDataTreePane;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.EditOrNewLabel;
import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.data.datapane.TreeTableDataComboBox;
import com.fr.design.data.datapane.preview.PreviewLabel;
import com.fr.data.impl.NameTableData;
import com.fr.data.impl.RecursionTableData;
import com.fr.data.impl.TableDataDictionary;
import com.fr.design.data.tabledata.wrapper.AbstractTableDataWrapper;
import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper;
import com.fr.design.DesignModelAdapter;
import com.fr.design.dialog.BasicPane;
import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory;
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.OldColumnIndexEditor;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.dialog.BasicPane;
import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory;
import com.fr.design.editor.editor.*;
import com.fr.general.Inter;
import com.fr.stable.StringUtils;
@ -163,8 +167,8 @@ public class JTreeAutoBuildPane extends BasicPane implements PreviewLabel.Previe
Object object_text = this.textPane.update(StringUtils.EMPTY);
if (object_text instanceof Object[]) {
Object[] temp = (Object[]) object_text;
if (temp[0] instanceof Formula) {
tableDataDict.setFormula((Formula) temp[0]);
if (temp[0] instanceof BaseFormula) {
tableDataDict.setFormula((BaseFormula) temp[0]);
} else {
tableDataDict.setValueColumnIndex(((Integer) temp[0]).intValue() - 1);
tableDataDict.setValueColumnName((String) temp[1]);
@ -174,7 +178,7 @@ public class JTreeAutoBuildPane extends BasicPane implements PreviewLabel.Previe
} else if (object_text instanceof String) {
tableDataDict.setValueColumnName((String) object_text);
} else {
tableDataDict.setFormula(((Formula) object));
tableDataDict.setFormula(((BaseFormula) object));
}
TableDataWrapper tableDataWrappe = this.treeTableDataComboBox.getSelectedItem();

35
designer_base/src/com/fr/design/parameter/ParameterInputPane.java

@ -3,28 +3,10 @@
*/
package com.fr.design.parameter;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import com.fr.base.Utils;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.SwingConstants;
import com.fr.base.Formula;
import com.fr.base.BaseFormula;
import com.fr.base.StoreProcedureParameter;
import com.fr.base.Utils;
import com.fr.data.impl.storeproc.StoreProcedureConstants;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.dialog.BasicPane;
import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory;
@ -35,10 +17,21 @@ import com.fr.design.editor.editor.Editor;
import com.fr.design.editor.editor.FloatEditor;
import com.fr.design.editor.editor.IntegerEditor;
import com.fr.design.editor.editor.TextEditor;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.Inter;
import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
/**
* The dialog used to input parameter.
* @editor zhou
@ -130,7 +123,7 @@ public class ParameterInputPane extends BasicPane {
editors[0] = new DateEditor(true, Inter.getLocText("Date"));
} else if (pv instanceof Boolean) {
editors[0] = new BooleanEditor();
} else if (pv instanceof Formula) {
} else if (pv instanceof BaseFormula) {
editors = ValueEditorPaneFactory.basicEditors();
} else {
editors[0] = new TextEditor();

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

@ -1,7 +1,6 @@
package com.fr.plugin.chart.designer.style.background;
import com.fr.base.BaseFormula;
import com.fr.base.Formula;
import com.fr.base.Utils;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.formula.TinyFormulaPane;
@ -16,6 +15,7 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont;
import com.fr.general.GeneralUtils;
import com.fr.general.Inter;
import com.fr.plugin.chart.VanChartAttrHelper;
import com.fr.plugin.chart.attr.axis.VanChartAlertValue;
@ -159,10 +159,10 @@ public class VanChartAlertValuePane extends BasicBeanPane<VanChartAlertValue> {
alertTextPosition.setSelectedIndex(chartAlertValue.getAlertPosition() == Constants.LEFT ? 0 : 1);
}
if (chartAlertValue.getAlertContentFormula() instanceof Formula) {
alertText.populateBean(((Formula) chartAlertValue.getAlertContentFormula()).getContent());
if (chartAlertValue.getAlertContentFormula() instanceof BaseFormula) {
alertText.populateBean(((BaseFormula) chartAlertValue.getAlertContentFormula()).getContent());
} else {
alertText.populateBean(Utils.objectToString(chartAlertValue.getAlertContentFormula()));
alertText.populateBean(GeneralUtils.objectToString(chartAlertValue.getAlertContentFormula()));
}
fontName.setSelectedItem(chartAlertValue.getAlertFont().getName());
fontSize.setSelectedItem(chartAlertValue.getAlertFont().getSize());

Loading…
Cancel
Save