Browse Source

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

master
richie 7 years ago
parent
commit
bcaeb1975c
  1. 29
      designer/src/com/fr/design/report/RichTextPane.java
  2. 2463
      designer/src/com/fr/grid/GridUI.java
  3. 10
      designer_base/src/com/fr/design/data/tabledata/tabledatapane/AutoStoreProcedureTableModel.java
  4. 352
      designer_base/src/com/fr/design/data/tabledata/tabledatapane/StoreProcedureParameterPane.java
  5. 3
      designer_base/src/com/fr/design/editor/editor/FormulaEditor.java
  6. 460
      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; package com.fr.design.report;
import java.awt.BorderLayout; import com.fr.base.BaseFormula;
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.FRContext; import com.fr.base.FRContext;
import com.fr.base.Formula;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.design.cell.editor.RichTextToolBar; import com.fr.design.cell.editor.RichTextToolBar;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
@ -34,6 +20,17 @@ 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 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 { public class RichTextPane extends BasicPane {
//12号字体有个奇怪的bug, 字体下部分渲染会截断一部分, 换其他字体没问题, 字体改大小也没问题. //12号字体有个奇怪的bug, 字体下部分渲染会截断一部分, 换其他字体没问题, 字体改大小也没问题.
@ -82,7 +79,7 @@ public class RichTextPane extends BasicPane {
if(cellValue == null){ if(cellValue == null){
return; return;
} }
if(cellValue instanceof Formula){ if(cellValue instanceof BaseFormula){
cellValue = RichTextConverter.asFormula(String.valueOf(cellValue)); cellValue = RichTextConverter.asFormula(String.valueOf(cellValue));
} }

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

File diff suppressed because it is too large Load Diff

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

@ -1,10 +1,11 @@
package com.fr.design.data.tabledata.tabledatapane; 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.base.StoreProcedureParameter;
import com.fr.design.gui.itableeditorpane.ParameterTableModel;
import com.fr.design.editor.ValueEditorPane; import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory; import com.fr.design.editor.ValueEditorPaneFactory;
import com.fr.design.editor.editor.CursorEditor; import com.fr.design.editor.editor.CursorEditor;
import com.fr.design.gui.itableeditorpane.ParameterTableModel;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -16,7 +17,8 @@ import javax.swing.event.PopupMenuListener;
import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellEditor;
import java.awt.*; 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"); type = Inter.getLocText("Date");
else if(value instanceof Boolean) else if(value instanceof Boolean)
type = Inter.getLocText("Parameter-Boolean"); type = Inter.getLocText("Parameter-Boolean");
else if(value instanceof Formula) else if(value instanceof BaseFormula)
type = Inter.getLocText("Formula"); type = Inter.getLocText("Formula");
else else
type = Inter.getLocText("Parameter-String"); type = Inter.getLocText("Parameter-String");

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

@ -1,178 +1,176 @@
package com.fr.design.data.tabledata.tabledatapane; package com.fr.design.data.tabledata.tabledatapane;
import java.awt.BorderLayout; import com.fr.base.BaseFormula;
import java.awt.Component; import com.fr.base.StoreProcedureParameter;
import java.util.Date; import com.fr.data.impl.storeproc.StoreProcedureConstants;
import java.util.HashMap; import com.fr.design.dialog.BasicPane;
import com.fr.design.editor.ValueEditorPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.editor.ValueEditorPaneFactory;
import javax.swing.JPanel; import com.fr.design.editor.editor.CursorEditor;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.base.Formula; import com.fr.design.gui.ilable.UILabel;
import com.fr.general.NameObject; import com.fr.design.gui.itextfield.UITextField;
import com.fr.base.StoreProcedureParameter; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.data.impl.storeproc.StoreProcedureConstants; import com.fr.design.layout.TableLayout;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.gui.itextfield.UITextField; import com.fr.general.Inter;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.general.NameObject;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import javax.swing.*;
import com.fr.design.dialog.BasicPane; import java.awt.*;
import com.fr.design.editor.ValueEditorPane; import java.util.Date;
import com.fr.design.editor.ValueEditorPaneFactory; import java.util.HashMap;
import com.fr.design.editor.editor.CursorEditor;
import com.fr.general.Inter;
public class StoreProcedureParameterPane extends BasicPane {
public class StoreProcedureParameterPane extends BasicPane { private static String[] schemaName = new String[]{
"IN", "OUT", "INOUT"
private static String[] schemaName = new String[]{ };
"IN", "OUT", "INOUT"
}; private static NameObject[] nameAndValue = new NameObject[]{
new NameObject(Inter.getLocText("Cursor"), StoreProcedureConstants.CURSOR),
private static NameObject[] nameAndValue = new NameObject[]{ new NameObject(Inter.getLocText("Parameter-String"), StoreProcedureConstants.VARCHAR),
new NameObject(Inter.getLocText("Cursor"), StoreProcedureConstants.CURSOR), new NameObject(Inter.getLocText("Integer"), StoreProcedureConstants.INTEGER),
new NameObject(Inter.getLocText("Parameter-String"), StoreProcedureConstants.VARCHAR), new NameObject(Inter.getLocText("Double"), StoreProcedureConstants.DECIMAL),
new NameObject(Inter.getLocText("Integer"), StoreProcedureConstants.INTEGER), new NameObject(Inter.getLocText("Date"), StoreProcedureConstants.DATE),
new NameObject(Inter.getLocText("Double"), StoreProcedureConstants.DECIMAL), new NameObject(Inter.getLocText("Parameter-Boolean"), StoreProcedureConstants.BOOLEAN),
new NameObject(Inter.getLocText("Date"), StoreProcedureConstants.DATE), new NameObject(Inter.getLocText("Formula"), StoreProcedureConstants.FORMULA),
new NameObject(Inter.getLocText("Parameter-Boolean"), StoreProcedureConstants.BOOLEAN), new NameObject("IN",StoreProcedureConstants.IN),
new NameObject(Inter.getLocText("Formula"), StoreProcedureConstants.FORMULA), new NameObject("OUT",StoreProcedureConstants.OUT),
new NameObject("IN",StoreProcedureConstants.IN), new NameObject("INOUT",StoreProcedureConstants.INOUT)
new NameObject("OUT",StoreProcedureConstants.OUT), };
new NameObject("INOUT",StoreProcedureConstants.INOUT)
}; private static HashMap<String, Integer> infoMap = new HashMap<String, Integer>();
static {
private static HashMap<String, Integer> infoMap = new HashMap<String, Integer>(); for(int i = 0; i < nameAndValue.length; i ++){
static { infoMap.put(nameAndValue[i].getName(), (Integer) nameAndValue[i].getObject());
for(int i = 0; i < nameAndValue.length; i ++){ }
infoMap.put(nameAndValue[i].getName(), (Integer) nameAndValue[i].getObject()); }
}
} private UITextField nameField;
private UIComboBox schemaCombo;
private UITextField nameField; private ValueEditorPane valueEditPane;
private UIComboBox schemaCombo; private JPanel valuePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
private ValueEditorPane valueEditPane;
private JPanel valuePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); public StoreProcedureParameterPane(){
valueEditPane = ValueEditorPaneFactory.createStoreProcedValueEditorPane();
public StoreProcedureParameterPane(){ this.initComponents();
valueEditPane = ValueEditorPaneFactory.createStoreProcedValueEditorPane(); }
this.initComponents();
} public void checkValid() throws Exception{
StoreProcedureParameter spp=this.update();
public void checkValid() throws Exception{ if(spp.getSchema()!= StoreProcedureConstants.OUT && spp.getType() == StoreProcedureConstants.CURSOR){
StoreProcedureParameter spp=this.update(); throw new Exception(Inter.getLocText("IN_and_INOUT_type_not_as_cursor"));
if(spp.getSchema()!= StoreProcedureConstants.OUT && spp.getType() == StoreProcedureConstants.CURSOR){ }
throw new Exception(Inter.getLocText("IN_and_INOUT_type_not_as_cursor")); }
}
} private void initComponents(){
this.setLayout(FRGUIPaneFactory.createBorderLayout());
private void initComponents(){
this.setLayout(FRGUIPaneFactory.createBorderLayout()); schemaCombo = new UIComboBox();
initUIComboBox(schemaCombo, schemaName);
schemaCombo = new UIComboBox(); JPanel namePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
initUIComboBox(schemaCombo, schemaName); namePane.add(new UILabel(" " + Inter.getLocText("Name") + ":"), BorderLayout.WEST);
JPanel namePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); nameField = new UITextField(10);
namePane.add(new UILabel(" " + Inter.getLocText("Name") + ":"), BorderLayout.WEST); namePane.add(nameField, BorderLayout.CENTER);
nameField = new UITextField(10); namePane.add(new UILabel(" "), BorderLayout.EAST);
namePane.add(nameField, BorderLayout.CENTER); valuePane.add(new UILabel(" " + Inter.getLocText("CellWrite-InsertRow_DEFAULT") + ":"), BorderLayout.WEST);
namePane.add(new UILabel(" "), BorderLayout.EAST); valuePane.add(valueEditPane, BorderLayout.CENTER);
valuePane.add(new UILabel(" " + Inter.getLocText("CellWrite-InsertRow_DEFAULT") + ":"), BorderLayout.WEST); valuePane.add(new UILabel(" "), BorderLayout.EAST);
valuePane.add(valueEditPane, BorderLayout.CENTER); Component[][] components = {{null},
valuePane.add(new UILabel(" "), BorderLayout.EAST); {namePane},
Component[][] components = {{null}, {addPane("Model", 1, schemaCombo)},
{namePane}, {valuePane},
{addPane("Model", 1, schemaCombo)}, {null}
{valuePane}, };
{null} double p = TableLayout.PREFERRED;
}; double[] rowSize = {p, p, p, p, p, p};
double p = TableLayout.PREFERRED; double[] columnSize = {p};
double[] rowSize = {p, p, p, p, p, p}; JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(
double[] columnSize = {p}; components, rowSize, columnSize, 20, 10);
JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane( this.add(centerPane, BorderLayout.CENTER);
components, rowSize, columnSize, 20, 10);
this.add(centerPane, BorderLayout.CENTER); }
} private JPanel addPane(String s, int i, UIComboBox combo){
JPanel pane = FRGUIPaneFactory.createBorderLayout_S_Pane();
private JPanel addPane(String s, int i, UIComboBox combo){ pane.add(new UILabel(" " + Inter.getLocText(s) + ":"), BorderLayout.WEST);
JPanel pane = FRGUIPaneFactory.createBorderLayout_S_Pane(); combo.setSelectedIndex(i);
pane.add(new UILabel(" " + Inter.getLocText(s) + ":"), BorderLayout.WEST); pane.add(combo, BorderLayout.CENTER);
combo.setSelectedIndex(i); pane.add(new UILabel(" "), BorderLayout.EAST);
pane.add(combo, BorderLayout.CENTER);
pane.add(new UILabel(" "), BorderLayout.EAST); return pane;
}
return pane;
} @Override
protected String title4PopupWindow() {
@Override return Inter.getLocText("Parameter");
protected String title4PopupWindow() { }
return Inter.getLocText("Parameter");
} public void populate(StoreProcedureParameter stpParameter) {
if(stpParameter == null)
public void populate(StoreProcedureParameter stpParameter) { return;
if(stpParameter == null) this.nameField.setText(stpParameter.getName());
return; String schema = getInfo4Name(stpParameter.getSchema());
this.nameField.setText(stpParameter.getName()); this.schemaCombo.setSelectedItem(schema);
String schema = getInfo4Name(stpParameter.getSchema()); this.valueEditPane.populate(stpParameter.getValue());
this.schemaCombo.setSelectedItem(schema);
this.valueEditPane.populate(stpParameter.getValue()); }
} public StoreProcedureParameter update(){
StoreProcedureParameter p = new StoreProcedureParameter();
public StoreProcedureParameter update(){ p.setName(nameField.getText());
StoreProcedureParameter p = new StoreProcedureParameter(); Object value = valueEditPane.update();
p.setName(nameField.getText()); String type = "";
Object value = valueEditPane.update(); if(value instanceof CursorEditor)
String type = ""; type=Inter.getLocText("Cursor");
if(value instanceof CursorEditor) else if(value instanceof String ){
type=Inter.getLocText("Cursor"); if(((String) value).length() > 0 && ((String) value).charAt(0) == '=')
else if(value instanceof String ){ type = Inter.getLocText("Formula");
if(((String) value).length() > 0 && ((String) value).charAt(0) == '=') else
type = Inter.getLocText("Formula"); type = Inter.getLocText("Parameter-String");
else }else if(value instanceof Integer)
type = Inter.getLocText("Parameter-String"); type = Inter.getLocText("Integer");
}else if(value instanceof Integer) else if(value instanceof Double)
type = Inter.getLocText("Integer"); type = Inter.getLocText("Double");
else if(value instanceof Double) else if(value instanceof Date)
type = Inter.getLocText("Double"); type = Inter.getLocText("Date");
else if(value instanceof Date) else if(value instanceof Boolean)
type = Inter.getLocText("Date"); type = Inter.getLocText("Parameter-Boolean");
else if(value instanceof Boolean) else if(value instanceof BaseFormula)
type = Inter.getLocText("Parameter-Boolean"); type = Inter.getLocText("Formula");
else if(value instanceof Formula) else
type = Inter.getLocText("Formula"); type = Inter.getLocText("Parameter-String");
else int typeVl = getInfo4Value(type);
type = Inter.getLocText("Parameter-String"); p.setType(typeVl);
int typeVl = getInfo4Value(type); String schema = (String)schemaCombo.getSelectedItem();
p.setType(typeVl); int schemaVl = getInfo4Value(schema);
String schema = (String)schemaCombo.getSelectedItem(); p.setSchema(schemaVl);
int schemaVl = getInfo4Value(schema); p.setValue(value);
p.setSchema(schemaVl);
p.setValue(value); return p;
}
return p;
} private void initUIComboBox(UIComboBox combo, String[] p){
for(int i = 0; i < p.length; i ++)
private void initUIComboBox(UIComboBox combo, String[] p){ combo.addItem(p[i]);
for(int i = 0; i < p.length; i ++) }
combo.addItem(p[i]);
} public static int getInfo4Value(String name){
return infoMap.get(name);
public static int getInfo4Value(String name){ }
return infoMap.get(name);
} public static String getInfo4Name(int value){
java.util.Set<String> set = infoMap.keySet();
public static String getInfo4Name(int value){ for(String s : set){
java.util.Set<String> set = infoMap.keySet(); if(infoMap.get(s) == value)
for(String s : set){ return s;
if(infoMap.get(s) == value) }
return s; return null;
} }
return null; /**
} *
/** */
* private static final long serialVersionUID = 1L;
*/
private static final long serialVersionUID = 1L;
} }

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

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

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

@ -1,229 +1,233 @@
package com.fr.design.gui.frpane; package com.fr.design.gui.frpane;
import com.fr.base.Formula; import com.fr.base.BaseFormula;
import com.fr.design.data.BasicTableDataTreePane; import com.fr.data.impl.NameTableData;
import com.fr.design.data.DesignTableDataManager; import com.fr.data.impl.RecursionTableData;
import com.fr.design.data.datapane.EditOrNewLabel; import com.fr.data.impl.TableDataDictionary;
import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.DesignModelAdapter;
import com.fr.design.data.datapane.TreeTableDataComboBox; import com.fr.design.data.BasicTableDataTreePane;
import com.fr.design.data.datapane.preview.PreviewLabel; import com.fr.design.data.DesignTableDataManager;
import com.fr.data.impl.NameTableData; import com.fr.design.data.datapane.EditOrNewLabel;
import com.fr.data.impl.RecursionTableData; import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.data.impl.TableDataDictionary; import com.fr.design.data.datapane.TreeTableDataComboBox;
import com.fr.design.data.tabledata.wrapper.AbstractTableDataWrapper; import com.fr.design.data.datapane.preview.PreviewLabel;
import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.data.tabledata.wrapper.AbstractTableDataWrapper;
import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper; import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.DesignModelAdapter; import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.dialog.BasicPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.editor.ValueEditorPane;
import com.fr.design.layout.TableLayout; import com.fr.design.editor.ValueEditorPaneFactory;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.editor.editor.ColumnIndexEditor;
import com.fr.design.dialog.BasicPane; import com.fr.design.editor.editor.ColumnNameEditor;
import com.fr.design.editor.ValueEditorPane; import com.fr.design.editor.editor.Editor;
import com.fr.design.editor.ValueEditorPaneFactory; import com.fr.design.editor.editor.FormulaEditor;
import com.fr.design.editor.editor.*; import com.fr.design.editor.editor.OldColumnIndexEditor;
import com.fr.general.Inter; import com.fr.design.gui.ilable.UILabel;
import com.fr.stable.StringUtils; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import javax.swing.*; import com.fr.design.layout.TableLayoutHelper;
import java.awt.*; import com.fr.general.Inter;
import java.awt.event.ItemEvent; import com.fr.stable.StringUtils;
import java.awt.event.ItemListener;
import java.util.List; import javax.swing.*;
import java.awt.*;
public class JTreeAutoBuildPane extends BasicPane implements PreviewLabel.Previewable, EditOrNewLabel.Editable { import java.awt.event.ItemEvent;
private TreeTableDataComboBox treeTableDataComboBox; import java.awt.event.ItemListener;
private ValueEditorPane valuePane; import java.util.List;
private ValueEditorPane textPane;
private JPanel centerPane; public class JTreeAutoBuildPane extends BasicPane implements PreviewLabel.Previewable, EditOrNewLabel.Editable {
private JPanel selectTreeDataPanel; private TreeTableDataComboBox treeTableDataComboBox;
private ValueEditorPane valuePane;
public JTreeAutoBuildPane() { private ValueEditorPane textPane;
this.initComponent(); private JPanel centerPane;
} private JPanel selectTreeDataPanel;
/** public JTreeAutoBuildPane() {
* 初始化 this.initComponent();
*/ }
public void initComponent() {
this.setLayout(FRGUIPaneFactory.createM_BorderLayout()); /**
UILabel selectTreeDataLabel = new UILabel(Inter.getLocText("Select_A_Tree_DataSource_To_Build") + ": "); * 初始化
treeTableDataComboBox = new TreeTableDataComboBox(DesignTableDataManager.getEditingTableDataSource()); */
treeTableDataComboBox.setPreferredSize(new Dimension(180, 20)); public void initComponent() {
selectTreeDataPanel = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(); this.setLayout(FRGUIPaneFactory.createM_BorderLayout());
selectTreeDataPanel.add(selectTreeDataLabel); UILabel selectTreeDataLabel = new UILabel(Inter.getLocText("Select_A_Tree_DataSource_To_Build") + ": ");
treeTableDataComboBox.addItemListener(new ItemListener() { treeTableDataComboBox = new TreeTableDataComboBox(DesignTableDataManager.getEditingTableDataSource());
public void itemStateChanged(ItemEvent e) { treeTableDataComboBox.setPreferredSize(new Dimension(180, 20));
tdChange(); selectTreeDataPanel = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane();
} selectTreeDataPanel.add(selectTreeDataLabel);
}); treeTableDataComboBox.addItemListener(new ItemListener() {
selectTreeDataPanel.add(treeTableDataComboBox); public void itemStateChanged(ItemEvent e) {
treeTableDataComboBox.setPreferredSize(new Dimension(200, 25)); tdChange();
treeTableDataComboBox.setSelectedIndex(-1); }
PreviewLabel pl = new PreviewLabel(this); });
pl.setPreferredSize(new Dimension(25, 25)); selectTreeDataPanel.add(treeTableDataComboBox);
EditOrNewLabel enl = new EditOrNewLabel(this, this); treeTableDataComboBox.setPreferredSize(new Dimension(200, 25));
enl.setPreferredSize(new Dimension(25, 25)); treeTableDataComboBox.setSelectedIndex(-1);
selectTreeDataPanel.add(pl); PreviewLabel pl = new PreviewLabel(this);
selectTreeDataPanel.add(enl); pl.setPreferredSize(new Dimension(25, 25));
EditOrNewLabel enl = new EditOrNewLabel(this, this);
this.add(selectTreeDataPanel, BorderLayout.NORTH); enl.setPreferredSize(new Dimension(25, 25));
selectTreeDataPanel.add(pl);
valuePane = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor()}); selectTreeDataPanel.add(enl);
FormulaEditor formulaEditor = new FormulaEditor(Inter.getLocText("Parameter-Formula"));
formulaEditor.setEnabled(true); this.add(selectTreeDataPanel, BorderLayout.NORTH);
textPane = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor(), formulaEditor});
Component[][] coms = { valuePane = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor()});
{new UILabel(Inter.getLocText("Actual_Value") + ":"), FormulaEditor formulaEditor = new FormulaEditor(Inter.getLocText("Parameter-Formula"));
valuePane}, formulaEditor.setEnabled(true);
{new UILabel(Inter.getLocText("Display_Value") + ":"), textPane = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor(), formulaEditor});
textPane}}; Component[][] coms = {
{new UILabel(Inter.getLocText("Actual_Value") + ":"),
double p = TableLayout.PREFERRED; valuePane},
{new UILabel(Inter.getLocText("Display_Value") + ":"),
double[] rowSize = {p, p, p}; textPane}};
double[] columnSize = {p, p};
centerPane = TableLayoutHelper.createTableLayoutPane(coms, rowSize, double p = TableLayout.PREFERRED;
columnSize);
double[] rowSize = {p, p, p};
this.add(centerPane, BorderLayout.CENTER); double[] columnSize = {p, p};
tdChange(); centerPane = TableLayoutHelper.createTableLayoutPane(coms, rowSize,
} columnSize);
private void tdChange() { this.add(centerPane, BorderLayout.CENTER);
TableDataWrapper tableDataWrappe = this.treeTableDataComboBox.getSelectedItem(); tdChange();
if (tableDataWrappe == null) { }
return;
} private void tdChange() {
try { TableDataWrapper tableDataWrappe = this.treeTableDataComboBox.getSelectedItem();
List<String> namelist = tableDataWrappe.calculateColumnNameList(); if (tableDataWrappe == null) {
String[] columnNames = new String[namelist.size()]; return;
namelist.toArray(columnNames); }
valuePane.setEditors(new Editor[]{new ColumnNameEditor(columnNames), new ColumnIndexEditor(columnNames.length)}, columnNames[0]); try {
FormulaEditor formulaEditor = new FormulaEditor(Inter.getLocText("Parameter-Formula")); List<String> namelist = tableDataWrappe.calculateColumnNameList();
formulaEditor.setEnabled(true); String[] columnNames = new String[namelist.size()];
textPane.setEditors(new Editor[]{new ColumnNameEditor(columnNames), new ColumnIndexEditor(columnNames.length), formulaEditor}, columnNames[0]); namelist.toArray(columnNames);
} catch (Exception e) { valuePane.setEditors(new Editor[]{new ColumnNameEditor(columnNames), new ColumnIndexEditor(columnNames.length)}, columnNames[0]);
valuePane.setEditors(new Editor[]{new OldColumnIndexEditor(100, Inter.getLocText("ColumnName"))}, 1); FormulaEditor formulaEditor = new FormulaEditor(Inter.getLocText("Parameter-Formula"));
FormulaEditor formulaEditor = new FormulaEditor(Inter.getLocText("Parameter-Formula")); formulaEditor.setEnabled(true);
formulaEditor.setEnabled(true); textPane.setEditors(new Editor[]{new ColumnNameEditor(columnNames), new ColumnIndexEditor(columnNames.length), formulaEditor}, columnNames[0]);
textPane.setEditors(new Editor[]{new OldColumnIndexEditor(100, Inter.getLocText("ColumnName")), formulaEditor}, 1); } catch (Exception e) {
} valuePane.setEditors(new Editor[]{new OldColumnIndexEditor(100, Inter.getLocText("ColumnName"))}, 1);
} FormulaEditor formulaEditor = new FormulaEditor(Inter.getLocText("Parameter-Formula"));
formulaEditor.setEnabled(true);
public void populate(TableDataDictionary tableDataDict) { textPane.setEditors(new Editor[]{new OldColumnIndexEditor(100, Inter.getLocText("ColumnName")), formulaEditor}, 1);
if (tableDataDict == null) { }
this.treeTableDataComboBox.setSelectedItem(""); }
this.textPane.populate(1);
this.valuePane.populate(1); public void populate(TableDataDictionary tableDataDict) {
return; if (tableDataDict == null) {
} else { this.treeTableDataComboBox.setSelectedItem("");
String _name = ""; this.textPane.populate(1);
if (tableDataDict.getTableData() instanceof NameTableData) { this.valuePane.populate(1);
_name = ((NameTableData) tableDataDict.getTableData()).getName(); return;
} } else {
this.treeTableDataComboBox.setSelectedTableDataByName(_name); String _name = "";
tdChange(); if (tableDataDict.getTableData() instanceof NameTableData) {
// alex:因为显示到界面上的index是以1为始的,所以要加1 _name = ((NameTableData) tableDataDict.getTableData()).getName();
if (!StringUtils.isEmpty(tableDataDict.getKeyColumnName())) { }
this.valuePane.populate(tableDataDict.getKeyColumnName()); this.treeTableDataComboBox.setSelectedTableDataByName(_name);
} else { tdChange();
this.valuePane.populate(tableDataDict.getKeyColumnIndex() + 1); // alex:因为显示到界面上的index是以1为始的,所以要加1
} if (!StringUtils.isEmpty(tableDataDict.getKeyColumnName())) {
Object value = null; this.valuePane.populate(tableDataDict.getKeyColumnName());
if ((tableDataDict).getFormula() != null) { } else {
value = (tableDataDict).getFormula(); this.valuePane.populate(tableDataDict.getKeyColumnIndex() + 1);
} else { }
if (!StringUtils.isEmpty(tableDataDict.getValueColumnName())) { Object value = null;
value = tableDataDict.getValueColumnName(); if ((tableDataDict).getFormula() != null) {
} else { value = (tableDataDict).getFormula();
value = tableDataDict.getValueColumnIndex() + 1; } else {
} if (!StringUtils.isEmpty(tableDataDict.getValueColumnName())) {
} value = tableDataDict.getValueColumnName();
} else {
this.textPane.populate(value); value = tableDataDict.getValueColumnIndex() + 1;
} }
} }
public TableDataDictionary update() { this.textPane.populate(value);
TableDataDictionary tableDataDict = new TableDataDictionary(); }
Object object = this.valuePane.update(StringUtils.EMPTY); }
// alex:因为显示到界面上的index是以1为始的,所以要减1
// carl:假如这里的序号要变,请考虑6.2的兼容 public TableDataDictionary update() {
TableDataDictionary tableDataDict = new TableDataDictionary();
if (object instanceof Object[]) { Object object = this.valuePane.update(StringUtils.EMPTY);
Object[] temp = (Object[]) object; // alex:因为显示到界面上的index是以1为始的,所以要减1
tableDataDict.setKeyColumnIndex(((Integer) temp[0]).intValue() - 1); // carl:假如这里的序号要变,请考虑6.2的兼容
tableDataDict.setKeyColumnName((String) temp[1]);
} else if (object instanceof Integer) { if (object instanceof Object[]) {
tableDataDict.setKeyColumnIndex((Integer) object - 1); Object[] temp = (Object[]) object;
} else if (object instanceof String) { tableDataDict.setKeyColumnIndex(((Integer) temp[0]).intValue() - 1);
tableDataDict.setKeyColumnName((String) object); tableDataDict.setKeyColumnName((String) temp[1]);
} } else if (object instanceof Integer) {
Object object_text = this.textPane.update(StringUtils.EMPTY); tableDataDict.setKeyColumnIndex((Integer) object - 1);
if (object_text instanceof Object[]) { } else if (object instanceof String) {
Object[] temp = (Object[]) object_text; tableDataDict.setKeyColumnName((String) object);
if (temp[0] instanceof Formula) { }
tableDataDict.setFormula((Formula) temp[0]); Object object_text = this.textPane.update(StringUtils.EMPTY);
} else { if (object_text instanceof Object[]) {
tableDataDict.setValueColumnIndex(((Integer) temp[0]).intValue() - 1); Object[] temp = (Object[]) object_text;
tableDataDict.setValueColumnName((String) temp[1]); if (temp[0] instanceof BaseFormula) {
} tableDataDict.setFormula((BaseFormula) temp[0]);
} else if (object_text instanceof Integer) { } else {
tableDataDict.setValueColumnIndex((Integer) this.textPane.update() - 1); tableDataDict.setValueColumnIndex(((Integer) temp[0]).intValue() - 1);
} else if (object_text instanceof String) { tableDataDict.setValueColumnName((String) temp[1]);
tableDataDict.setValueColumnName((String) object_text); }
} else { } else if (object_text instanceof Integer) {
tableDataDict.setFormula(((Formula) object)); tableDataDict.setValueColumnIndex((Integer) this.textPane.update() - 1);
} } else if (object_text instanceof String) {
tableDataDict.setValueColumnName((String) object_text);
TableDataWrapper tableDataWrappe = this.treeTableDataComboBox.getSelectedItem(); } else {
if (tableDataWrappe != null) { tableDataDict.setFormula(((BaseFormula) object));
tableDataDict.setTableData(new NameTableData(tableDataWrappe.getTableDataName())); }
}
TableDataWrapper tableDataWrappe = this.treeTableDataComboBox.getSelectedItem();
return tableDataDict; if (tableDataWrappe != null) {
} tableDataDict.setTableData(new NameTableData(tableDataWrappe.getTableDataName()));
}
@Override
protected String title4PopupWindow() { return tableDataDict;
return "Auto Build Tree"; }
}
@Override
/** protected String title4PopupWindow() {
* 预览 return "Auto Build Tree";
*/ }
public void preview() {
TableDataWrapper tableDataWrappe = treeTableDataComboBox.getSelectedItem(); /**
if (tableDataWrappe == null) { * 预览
return; */
} public void preview() {
tableDataWrappe.previewData(); TableDataWrapper tableDataWrappe = treeTableDataComboBox.getSelectedItem();
} if (tableDataWrappe == null) {
return;
/** }
* 编辑 tableDataWrappe.previewData();
* @param jPanel 面板 }
*/
public void edit(JPanel jPanel) { /**
RecursionTableData rtd = null; * 编辑
String name = ""; * @param jPanel 面板
BasicTableDataTreePane tdtp = TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); */
if (treeTableDataComboBox.getSelectedItem() == null) { public void edit(JPanel jPanel) {
//新建 RecursionTableData rtd = null;
rtd = new RecursionTableData(); String name = "";
name = TableDataTreePane.createUnrepeatedName(tdtp.getDataTree(), "Tree"); BasicTableDataTreePane tdtp = TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter());
} else { if (treeTableDataComboBox.getSelectedItem() == null) {
//编辑 //新建
rtd = treeTableDataComboBox.getSelcetedTableData(); rtd = new RecursionTableData();
name = treeTableDataComboBox.getSelectedItem().getTableDataName(); name = TableDataTreePane.createUnrepeatedName(tdtp.getDataTree(), "Tree");
} } else {
AbstractTableDataWrapper atdw = new TemplateTableDataWrapper(rtd, ""); //编辑
tdtp.dgEdit(atdw.creatTableDataPane(), name); rtd = treeTableDataComboBox.getSelcetedTableData();
treeTableDataComboBox.refresh(); name = treeTableDataComboBox.getSelectedItem().getTableDataName();
treeTableDataComboBox.setSelectedTableDataByName(name); }
textPane.populate(1); AbstractTableDataWrapper atdw = new TemplateTableDataWrapper(rtd, "");
valuePane.populate(1); tdtp.dgEdit(atdw.creatTableDataPane(), name);
} treeTableDataComboBox.refresh();
treeTableDataComboBox.setSelectedTableDataByName(name);
textPane.populate(1);
valuePane.populate(1);
}
} }

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

@ -3,28 +3,10 @@
*/ */
package com.fr.design.parameter; package com.fr.design.parameter;
import java.awt.BorderLayout; import com.fr.base.BaseFormula;
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.StoreProcedureParameter; import com.fr.base.StoreProcedureParameter;
import com.fr.base.Utils;
import com.fr.data.impl.storeproc.StoreProcedureConstants; import com.fr.data.impl.storeproc.StoreProcedureConstants;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.editor.ValueEditorPane; import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory; 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.FloatEditor;
import com.fr.design.editor.editor.IntegerEditor; import com.fr.design.editor.editor.IntegerEditor;
import com.fr.design.editor.editor.TextEditor; 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.general.Inter;
import com.fr.stable.ParameterProvider; import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils; 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. * The dialog used to input parameter.
* @editor zhou * @editor zhou
@ -130,7 +123,7 @@ public class ParameterInputPane extends BasicPane {
editors[0] = new DateEditor(true, Inter.getLocText("Date")); editors[0] = new DateEditor(true, Inter.getLocText("Date"));
} else if (pv instanceof Boolean) { } else if (pv instanceof Boolean) {
editors[0] = new BooleanEditor(); editors[0] = new BooleanEditor();
} else if (pv instanceof Formula) { } else if (pv instanceof BaseFormula) {
editors = ValueEditorPaneFactory.basicEditors(); editors = ValueEditorPaneFactory.basicEditors();
} else { } else {
editors[0] = new TextEditor(); 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; package com.fr.plugin.chart.designer.style.background;
import com.fr.base.BaseFormula; import com.fr.base.BaseFormula;
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;
import com.fr.design.formula.TinyFormulaPane; 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.style.color.ColorSelectBox;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.general.GeneralUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.plugin.chart.VanChartAttrHelper; import com.fr.plugin.chart.VanChartAttrHelper;
import com.fr.plugin.chart.attr.axis.VanChartAlertValue; 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); alertTextPosition.setSelectedIndex(chartAlertValue.getAlertPosition() == Constants.LEFT ? 0 : 1);
} }
if (chartAlertValue.getAlertContentFormula() instanceof Formula) { if (chartAlertValue.getAlertContentFormula() instanceof BaseFormula) {
alertText.populateBean(((Formula) chartAlertValue.getAlertContentFormula()).getContent()); alertText.populateBean(((BaseFormula) chartAlertValue.getAlertContentFormula()).getContent());
} else { } else {
alertText.populateBean(Utils.objectToString(chartAlertValue.getAlertContentFormula())); alertText.populateBean(GeneralUtils.objectToString(chartAlertValue.getAlertContentFormula()));
} }
fontName.setSelectedItem(chartAlertValue.getAlertFont().getName()); fontName.setSelectedItem(chartAlertValue.getAlertFont().getName());
fontSize.setSelectedItem(chartAlertValue.getAlertFont().getSize()); fontSize.setSelectedItem(chartAlertValue.getAlertFont().getSize());

Loading…
Cancel
Save