Browse Source

REPORT-3348 数据列基本设置添加过滤条件设置,多个文件换行符和todo

master
yaoh.wu 7 years ago
parent
commit
98eec20b71
  1. 11
      designer/src/com/fr/design/dscolumn/DSColumnBasicEditorPane.java
  2. 499
      designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java
  3. 112
      designer/src/com/fr/design/mainframe/cell/QuickEditorRegion.java
  4. 124
      designer/src/com/fr/quickeditor/cellquick/CellBiasTextPainterEditor.java
  5. 13
      designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java
  6. 152
      designer/src/com/fr/quickeditor/cellquick/CellImageQuickEditor.java
  7. 98
      designer/src/com/fr/quickeditor/cellquick/CellRichTextEditor.java
  8. 308
      designer/src/com/fr/quickeditor/cellquick/CellStringQuickEditor.java
  9. 88
      designer/src/com/fr/quickeditor/cellquick/CellSubReportEditor.java

11
designer/src/com/fr/design/dscolumn/DSColumnBasicEditorPane.java

@ -23,11 +23,14 @@ public class DSColumnBasicEditorPane extends CellEditorPane {
private ResultSetGroupDockingPane groupPane; private ResultSetGroupDockingPane groupPane;
//当前编辑的单元格 //当前编辑的单元格
private TemplateCellElement cellElement; private TemplateCellElement cellElement;
//条件过滤按钮面板
private JPanel conditionPane;
public DSColumnBasicEditorPane(TemplateCellElement cellElement, SelectedDataColumnPane dataPane, ResultSetGroupDockingPane groupPane) { public DSColumnBasicEditorPane(TemplateCellElement cellElement, SelectedDataColumnPane dataPane, ResultSetGroupDockingPane groupPane, JPanel conditionPane) {
this.cellElement = cellElement; this.cellElement = cellElement;
this.dataPane = dataPane; this.dataPane = dataPane;
this.groupPane = groupPane; this.groupPane = groupPane;
this.conditionPane = conditionPane;
this.add(this.createContentPane(), BorderLayout.CENTER); this.add(this.createContentPane(), BorderLayout.CENTER);
} }
@ -66,12 +69,14 @@ public class DSColumnBasicEditorPane extends CellEditorPane {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = {p, f}; double[] columnSize = {p, f};
double[] rowSize = {p, p}; double[] rowSize = {p, p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
//数据集列选择 //数据集列选择
new Component[]{this.dataPane, null}, new Component[]{this.dataPane, null},
//数据分组设置 //数据分组设置
new Component[]{this.groupPane, null} new Component[]{this.groupPane, null},
//条件过滤
new Component[]{this.conditionPane, null}
}; };
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
} }

499
designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java

@ -1,247 +1,254 @@
package com.fr.design.dscolumn; package com.fr.design.dscolumn;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.design.data.DesignTableDataManager; import com.fr.data.SimpleDSColumn;
import com.fr.data.SimpleDSColumn; import com.fr.data.TableDataSource;
import com.fr.data.TableDataSource; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataComboBox; import com.fr.design.data.datapane.TableDataComboBox;
import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.dialog.BasicDialog;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.itableeditorpane.ParameterTableModel; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.itableeditorpane.UITableEditorPane; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.LazyComboBox; import com.fr.design.gui.icombobox.LazyComboBox;
import com.fr.design.layout.TableLayout; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.gui.itableeditorpane.ParameterTableModel;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.gui.itableeditorpane.UITableEditorPane;
import com.fr.design.dialog.BasicDialog; import com.fr.design.layout.TableLayout;
import com.fr.design.dialog.BasicPane; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.mainframe.DesignerContext;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.data.TableDataColumn; import com.fr.general.data.TableDataColumn;
import com.fr.report.cell.CellElement; import com.fr.report.cell.CellElement;
import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.TemplateCellElement;
import com.fr.report.cell.cellattr.core.group.DSColumn; import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.stable.ParameterProvider; import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.regex.Pattern; import java.util.regex.Pattern;
public class SelectedDataColumnPane extends BasicPane { /**
protected UITableEditorPane<ParameterProvider> editorPane; * 数据集列动态参数设置组件
protected Parameter[] ps; *
* @author yaoh.wu
protected TableDataComboBox tableNameComboBox; * @version 2017年7月26日
protected LazyComboBox columnNameComboBox; * todo 9.0设计器更新修改动态参数注入按钮部分,使其能在右侧边栏正常显示
private ItemListener itemListener; * @since 8.0
*/
private UIButton paramButton; public class SelectedDataColumnPane extends BasicPane {
protected UITableEditorPane<ParameterProvider> editorPane;
public SelectedDataColumnPane() { protected Parameter[] ps;
this(true);
} protected TableDataComboBox tableNameComboBox;
protected LazyComboBox columnNameComboBox;
public SelectedDataColumnPane(boolean showParameterButton) { private ItemListener itemListener;
initComponent(showParameterButton);
} private UIButton paramButton;
/** public SelectedDataColumnPane() {
* 初始化组件 this(true);
* }
* @param showParameterButton 是否显示参数按钮
* public SelectedDataColumnPane(boolean showParameterButton) {
*/ initComponent(showParameterButton);
public void initComponent(boolean showParameterButton) { }
initTableNameComboBox();
if (showParameterButton) { /**
initWithParameterButton(); * 初始化组件
} *
columnNameComboBox = new LazyComboBox() { * @param showParameterButton 是否显示参数按钮
*/
@Override public void initComponent(boolean showParameterButton) {
public Object[] load() { initTableNameComboBox();
List<String> l = calculateColumnNameList(); if (showParameterButton) {
return l.toArray(new String[l.size()]); initWithParameterButton();
} }
columnNameComboBox = new LazyComboBox() {
};
columnNameComboBox.setEditable(true); @Override
double p = TableLayout.PREFERRED; public Object[] load() {
UILabel label1 = new UILabel(Inter.getLocText("TableData") + ":"); List<String> l = calculateColumnNameList();
UILabel label2 = new UILabel(Inter.getLocText("DataColumn") + ":"); return l.toArray(new String[l.size()]);
if (showParameterButton) { }
label1.setPreferredSize(new Dimension(200, 25));
label2.setPreferredSize(new Dimension(200, 25)); };
} columnNameComboBox.setEditable(true);
if (showParameterButton) { double p = TableLayout.PREFERRED;
Component[][] comps = {{label1, null, label2}, {tableNameComboBox, paramButton, columnNameComboBox}}; UILabel label1 = new UILabel(Inter.getLocText("TableData") + ":");
this.add(TableLayoutHelper.createTableLayoutPane(comps, new double[]{p, p}, new double[]{p, p, p})); UILabel label2 = new UILabel(Inter.getLocText("DataColumn") + ":");
} else { if (showParameterButton) {
double f = TableLayout.FILL; label1.setPreferredSize(new Dimension(200, 25));
double[] columnSize = {p, f}; label2.setPreferredSize(new Dimension(200, 25));
double[] rowSize = {p, p}; }
Component[][] components = new Component[][]{ if (showParameterButton) {
new Component[]{label1, tableNameComboBox}, Component[][] comps = {{label1, null, label2}, {tableNameComboBox, paramButton, columnNameComboBox}};
new Component[]{label2, columnNameComboBox} this.add(TableLayoutHelper.createTableLayoutPane(comps, new double[]{p, p}, new double[]{p, p, p}));
}; } else {
JPanel jPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); double f = TableLayout.FILL;
this.setLayout(new BorderLayout()); double[] columnSize = {p, f};
this.add(jPanel, BorderLayout.CENTER); double[] rowSize = {p, p};
} Component[][] components = new Component[][]{
} new Component[]{label1, tableNameComboBox},
new Component[]{label2, columnNameComboBox}
protected void initTableNameComboBox() { };
tableNameComboBox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource()); JPanel jPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
tableNameComboBox.addItemListener(new ItemListener() { this.setLayout(new BorderLayout());
@Override this.add(jPanel, BorderLayout.CENTER);
public void itemStateChanged(ItemEvent e) { }
columnNameComboBox.setLoaded(false); }
// columnNameComboBox.loadList();
}
}); public void populate(TableDataSource source, TemplateCellElement cellElement) {
tableNameComboBox.setPreferredSize(new Dimension(100, 20)); if (cellElement == null) {
} return;
}
private void initWithParameterButton() {
editorPane = new UITableEditorPane<ParameterProvider>(new ParameterTableModel()); if (itemListener != null) {
paramButton = new UIButton(Inter.getLocText("TableData_Dynamic_Parameter_Setting")); removeListener(itemListener);
paramButton.addActionListener(new ActionListener() { }
public void actionPerformed(ActionEvent e) {
BasicDialog paramDialog = editorPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { Object value = cellElement.getValue();
@Override if (!(value instanceof DSColumn)) {
public void doOk() { return;
List<ParameterProvider> parameterList = editorPane.update(); }
ps = parameterList.toArray(new Parameter[parameterList.size()]);
} DSColumn dsColumn = (DSColumn) value;
}); String dsName = dsColumn.getDSName();
tableNameComboBox.setSelectedTableDataByName(dsName);
editorPane.populate(ps == null ? new Parameter[0] : ps); columnNameComboBox.setSelectedItem(TableDataColumn.getColumnName(dsColumn.getColumn()));
paramDialog.setVisible(true); ps = dsColumn.getParameters();
}
}); addListener(itemListener);
} }
@Override public void update(CellElement cellElement) {
protected String title4PopupWindow() { if (cellElement == null) {
return "DSColumn"; return;
} }
Object value = cellElement.getValue();
public void populate(TableDataSource source, TemplateCellElement cellElement) { if (this.tableNameComboBox.getSelectedItem() == null && this.columnNameComboBox.getSelectedItem() == null) {
if (cellElement == null) { return;
return; }
} DSColumn dsColumn = null;
if (value == null || !(value instanceof DSColumn)) {
if (itemListener != null) { dsColumn = new DSColumn();
removeListener(itemListener); cellElement.setValue(dsColumn);
} }
dsColumn = (DSColumn) cellElement.getValue();
Object value = cellElement.getValue();
if (!(value instanceof DSColumn)) { SimpleDSColumn simpleDSColumn = updateColumnPane();
return; dsColumn.setDSName(simpleDSColumn.getDsName());
} dsColumn.setColumn(simpleDSColumn.getColumn());
DSColumn dsColumn = (DSColumn) value; dsColumn.setParameters((ps != null && ps.length > 0) ? ps : null);
String dsName = dsColumn.getDSName(); }
tableNameComboBox.setSelectedTableDataByName(dsName);
columnNameComboBox.setSelectedItem(TableDataColumn.getColumnName(dsColumn.getColumn())); /**
ps = dsColumn.getParameters(); * 更新面板
*
addListener(itemListener); * @return 更新后的值
} */
public SimpleDSColumn updateColumnPane() {
public void update(CellElement cellElement) { SimpleDSColumn dsColumn = new SimpleDSColumn();
if (cellElement == null) { TableDataWrapper tableDataWrappe = this.tableNameComboBox.getSelectedItem();
return; if (tableDataWrappe == null) {
} return null;
Object value = cellElement.getValue(); }
if (this.tableNameComboBox.getSelectedItem() == null && this.columnNameComboBox.getSelectedItem() == null) { dsColumn.setDsName(tableDataWrappe.getTableDataName());
return; TableDataColumn column;
} String columnExp = (String) this.columnNameComboBox.getSelectedItem();
DSColumn dsColumn = null; if (isColumnName(columnExp)) {
if (value == null || !(value instanceof DSColumn)) { String number = columnExp.substring(1);
dsColumn = new DSColumn(); Pattern pattern = Pattern.compile("[^\\d]");
cellElement.setValue(dsColumn); if (pattern.matcher(number).find()) {
} column = TableDataColumn.createColumn(columnExp);
dsColumn = (DSColumn) cellElement.getValue(); } else {
int serialNumber = Integer.parseInt(columnExp.substring(1));
SimpleDSColumn simpleDSColumn = updateColumnPane(); column = TableDataColumn.createColumn(serialNumber);
dsColumn.setDSName(simpleDSColumn.getDsName()); }
dsColumn.setColumn(simpleDSColumn.getColumn()); } else {
column = TableDataColumn.createColumn(columnExp);
dsColumn.setParameters((ps != null && ps.length > 0) ? ps : null); }
} dsColumn.setColumn(column);
return dsColumn;
/** }
* 更新面板
* /**
* @return 更新后的值 * 添加监听事件
* *
*/ * @param i 监听事件
public SimpleDSColumn updateColumnPane() { */
SimpleDSColumn dsColumn = new SimpleDSColumn(); public void addListener(ItemListener i) {
TableDataWrapper tableDataWrappe = this.tableNameComboBox.getSelectedItem(); itemListener = i;
if (tableDataWrappe == null) { tableNameComboBox.addItemListener(i);
return null; columnNameComboBox.addItemListener(i);
} }
dsColumn.setDsName(tableDataWrappe.getTableDataName());
TableDataColumn column; /**
String columnExp = (String) this.columnNameComboBox.getSelectedItem(); * 移除监听事件
if (isColumnName(columnExp)) { *
String number = columnExp.substring(1); * @param i 监听事件
Pattern pattern = Pattern.compile("[^\\d]"); */
if (pattern.matcher(number).find()) { public void removeListener(ItemListener i) {
column = TableDataColumn.createColumn(columnExp); tableNameComboBox.removeItemListener(i);
} else { columnNameComboBox.removeItemListener(i);
int serialNumber = Integer.parseInt(columnExp.substring(1)); }
column = TableDataColumn.createColumn(serialNumber);
}
} else { protected void initTableNameComboBox() {
column = TableDataColumn.createColumn(columnExp); tableNameComboBox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource());
} tableNameComboBox.addItemListener(new ItemListener() {
dsColumn.setColumn(column); @Override
return dsColumn; public void itemStateChanged(ItemEvent e) {
} columnNameComboBox.setLoaded(false);
}
private boolean isColumnName(String columnExp) { });
return StringUtils.isNotBlank(columnExp) && (columnExp.length() > 0 && columnExp.charAt(0) == '#') && !columnExp.endsWith("#"); tableNameComboBox.setPreferredSize(new Dimension(100, 20));
}
}
@Override
/** protected String title4PopupWindow() {
* 添加监听事件 return "DSColumn";
* }
* @param i 监听事件
*
*/ private void initWithParameterButton() {
public void addListener(ItemListener i) { editorPane = new UITableEditorPane<ParameterProvider>(new ParameterTableModel());
itemListener = i; paramButton = new UIButton(Inter.getLocText("TableData_Dynamic_Parameter_Setting"));
tableNameComboBox.addItemListener(i); paramButton.addActionListener(new ActionListener() {
columnNameComboBox.addItemListener(i); public void actionPerformed(ActionEvent e) {
} BasicDialog paramDialog = editorPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
/** public void doOk() {
* 移除监听事件 List<ParameterProvider> parameterList = editorPane.update();
* ps = parameterList.toArray(new Parameter[parameterList.size()]);
* @param i 监听事件 }
* });
*/
public void removeListener(ItemListener i) { editorPane.populate(ps == null ? new Parameter[0] : ps);
tableNameComboBox.removeItemListener(i); paramDialog.setVisible(true);
columnNameComboBox.removeItemListener(i); }
} });
}
private List<String> calculateColumnNameList() {
if (this.tableNameComboBox.getSelectedItem() != null) {
return this.tableNameComboBox.getSelectedItem().calculateColumnNameList(); private boolean isColumnName(String columnExp) {
} return StringUtils.isNotBlank(columnExp) && (columnExp.length() > 0 && columnExp.charAt(0) == '#') && !columnExp.endsWith("#");
return new ArrayList<String>(); }
}
private List<String> calculateColumnNameList() {
if (this.tableNameComboBox.getSelectedItem() != null) {
return this.tableNameComboBox.getSelectedItem().calculateColumnNameList();
}
return new ArrayList<String>();
}
} }

112
designer/src/com/fr/design/mainframe/cell/QuickEditorRegion.java

@ -1,57 +1,57 @@
package com.fr.design.mainframe.cell; package com.fr.design.mainframe.cell;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.selection.QuickEditor; import com.fr.design.selection.QuickEditor;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
/** /**
* QuickEditorRegion * QuickEditorRegion
* *
* @author zhou, yaoh.wu * @author zhou, yaoh.wu
* @version 2017年7月25日 * @version 2017年7月25日
* @since 8.0 * @since 8.0
*/ */
public class QuickEditorRegion extends JPanel { public class QuickEditorRegion extends JPanel {
private static QuickEditorRegion singleton = new QuickEditorRegion(); private static QuickEditorRegion singleton = new QuickEditorRegion();
private static JPanel EMPTY; private static JPanel EMPTY;
private QuickEditorRegion() { private QuickEditorRegion() {
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
} }
public static QuickEditorRegion getInstance() { public static QuickEditorRegion getInstance() {
return singleton; return singleton;
} }
public static JPanel getEmptyEditor() { public static JPanel getEmptyEditor() {
if (EMPTY == null) { if (EMPTY == null) {
EMPTY = new JPanel(new BorderLayout()); EMPTY = new JPanel(new BorderLayout());
UILabel content = new UILabel(Inter.getLocText(new String[]{"DataFunction-None", "HJS-Message", "Form-Widget_Property_Table"}) + "!"); UILabel content = new UILabel(Inter.getLocText(new String[]{"DataFunction-None", "HJS-Message", "Form-Widget_Property_Table"}) + "!");
content.setBorder(BorderFactory.createEmptyBorder(0, 70, 0, 0)); content.setBorder(BorderFactory.createEmptyBorder(0, 70, 0, 0));
EMPTY.add(content, BorderLayout.CENTER); EMPTY.add(content, BorderLayout.CENTER);
} }
return EMPTY; return EMPTY;
} }
/** /**
* 更新面板显示数据 * 更新面板显示数据
* *
* @param currentEditor 当前正在编辑的单元格编辑器或者默认的单元格编辑器 * @param currentEditor 当前正在编辑的单元格编辑器或者默认的单元格编辑器
*/ */
public void populate(final QuickEditor currentEditor) { public void populate(final QuickEditor currentEditor) {
this.removeAll(); this.removeAll();
if (currentEditor.getComponentCount() == 0) { if (currentEditor.getComponentCount() == 0) {
this.add(getEmptyEditor(), BorderLayout.CENTER); this.add(getEmptyEditor(), BorderLayout.CENTER);
} else { } else {
this.add(currentEditor, BorderLayout.CENTER); this.add(currentEditor, BorderLayout.CENTER);
} }
validate(); validate();
repaint(); repaint();
} }
} }

124
designer/src/com/fr/quickeditor/cellquick/CellBiasTextPainterEditor.java

@ -1,63 +1,63 @@
package com.fr.quickeditor.cellquick; package com.fr.quickeditor.cellquick;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.cell.editor.BiasTextPainterCellEditor.BiasTextPainterPane; import com.fr.design.cell.editor.BiasTextPainterCellEditor.BiasTextPainterPane;
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;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.quickeditor.CellQuickEditor; import com.fr.quickeditor.CellQuickEditor;
import com.fr.report.cell.painter.BiasTextPainter; import com.fr.report.cell.painter.BiasTextPainter;
import javax.swing.*; import javax.swing.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
/** /**
* 单元格元素斜线编辑器 * 单元格元素斜线编辑器
* TODO 9.0 大体没有改动 * TODO 9.0 大体没有改动
*/ */
public class CellBiasTextPainterEditor extends CellQuickEditor { public class CellBiasTextPainterEditor extends CellQuickEditor {
@Override @Override
public JComponent createCenterBody() { public JComponent createCenterBody() {
UIButton editbutton = new UIButton(Inter.getLocText("Edit"), BaseUtils.readIcon("/com/fr/design/images/m_insert/bias.png")); UIButton editbutton = new UIButton(Inter.getLocText("Edit"), BaseUtils.readIcon("/com/fr/design/images/m_insert/bias.png"));
editbutton.addActionListener(new ActionListener() { editbutton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
showEditingDialog(); showEditingDialog();
} }
}); });
editbutton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); editbutton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
editbutton.setMargin(null); editbutton.setMargin(null);
editbutton.setOpaque(false); editbutton.setOpaque(false);
return editbutton; return editbutton;
} }
private void showEditingDialog() { private void showEditingDialog() {
final BiasTextPainter oldbiasTextPainter = (BiasTextPainter) cellElement.getValue(); final BiasTextPainter oldbiasTextPainter = (BiasTextPainter) cellElement.getValue();
final BiasTextPainterPane biasTextPainterPane = new BiasTextPainterPane(); final BiasTextPainterPane biasTextPainterPane = new BiasTextPainterPane();
biasTextPainterPane.populate(oldbiasTextPainter); biasTextPainterPane.populate(oldbiasTextPainter);
biasTextPainterPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { biasTextPainterPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
BiasTextPainter newbiasTextPainter = biasTextPainterPane.update(); BiasTextPainter newbiasTextPainter = biasTextPainterPane.update();
if (!ComparatorUtils.equals(oldbiasTextPainter, newbiasTextPainter)) { if (!ComparatorUtils.equals(oldbiasTextPainter, newbiasTextPainter)) {
cellElement.setValue(newbiasTextPainter); cellElement.setValue(newbiasTextPainter);
fireTargetModified(); fireTargetModified();
} }
} }
}).setVisible(true); }).setVisible(true);
} }
@Override @Override
protected void refreshDetails() { protected void refreshDetails() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }
} }

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

@ -1,10 +1,13 @@
package com.fr.quickeditor.cellquick; package com.fr.quickeditor.cellquick;
import com.fr.design.actions.columnrow.DSColumnConditionAction;
import com.fr.design.dscolumn.DSColumnAdvancedEditorPane; import com.fr.design.dscolumn.DSColumnAdvancedEditorPane;
import com.fr.design.dscolumn.DSColumnBasicEditorPane; import com.fr.design.dscolumn.DSColumnBasicEditorPane;
import com.fr.design.dscolumn.ResultSetGroupDockingPane; import com.fr.design.dscolumn.ResultSetGroupDockingPane;
import com.fr.design.dscolumn.SelectedDataColumnPane; import com.fr.design.dscolumn.SelectedDataColumnPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.cell.CellEditorPane; import com.fr.design.mainframe.cell.CellEditorPane;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.quickeditor.CellQuickEditor; import com.fr.quickeditor.CellQuickEditor;
@ -30,6 +33,8 @@ public class CellDSColumnEditor extends CellQuickEditor {
private SelectedDataColumnPane dataPane; private SelectedDataColumnPane dataPane;
//数据分组设置组件 //数据分组设置组件
private ResultSetGroupDockingPane groupPane; private ResultSetGroupDockingPane groupPane;
//过滤条件面板
private JPanel conditionPane;
// 基本和高级设置 // 基本和高级设置
private ArrayList<CellEditorPane> paneList; private ArrayList<CellEditorPane> paneList;
// 基本和高级设置 卡片布局 // 基本和高级设置 卡片布局
@ -171,9 +176,15 @@ public class CellDSColumnEditor extends CellQuickEditor {
/*基本设置面板*/ /*基本设置面板*/
this.dataPane = new SelectedDataColumnPane(false); this.dataPane = new SelectedDataColumnPane(false);
this.groupPane = new ResultSetGroupDockingPane(tc); this.groupPane = new ResultSetGroupDockingPane(tc);
this.conditionPane = new JPanel(new BorderLayout());
conditionPane.add(new UILabel("filter"), BorderLayout.WEST);
if (tc != null) {
//第一次初始化时tc为空,引发NullPointerException
conditionPane.add(new UIButton(new DSColumnConditionAction(tc)), BorderLayout.EAST);
}
dataPane.addListener(dataListener); dataPane.addListener(dataListener);
groupPane.addListener(groupListener); groupPane.addListener(groupListener);
paneList.add(new DSColumnBasicEditorPane(cellElement, dataPane, groupPane)); paneList.add(new DSColumnBasicEditorPane(cellElement, dataPane, groupPane, conditionPane));
/*高级设置面板*/ /*高级设置面板*/

152
designer/src/com/fr/quickeditor/cellquick/CellImageQuickEditor.java

@ -1,77 +1,77 @@
package com.fr.quickeditor.cellquick; package com.fr.quickeditor.cellquick;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Style; import com.fr.base.Style;
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;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.report.SelectImagePane; import com.fr.design.report.SelectImagePane;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.quickeditor.CellQuickEditor; import com.fr.quickeditor.CellQuickEditor;
import com.fr.report.cell.cellattr.CellImage; import com.fr.report.cell.cellattr.CellImage;
import javax.swing.*; import javax.swing.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
/** /**
* 单元格元素图片编辑器 * 单元格元素图片编辑器
* TODO 9.0大体上没有改动 * TODO 9.0大体上没有改动
*/ */
public class CellImageQuickEditor extends CellQuickEditor { public class CellImageQuickEditor extends CellQuickEditor {
private static CellImageQuickEditor THIS; private static CellImageQuickEditor THIS;
public static final CellImageQuickEditor getInstance() { public static final CellImageQuickEditor getInstance() {
if (THIS == null) { if (THIS == null) {
THIS = new CellImageQuickEditor(); THIS = new CellImageQuickEditor();
} }
return THIS; return THIS;
} }
private CellImageQuickEditor() { private CellImageQuickEditor() {
super(); super();
} }
@Override @Override
public JComponent createCenterBody() { public JComponent createCenterBody() {
UIButton editbutton = new UIButton(Inter.getLocText("Edit"), BaseUtils.readIcon("/com/fr/design/images/m_insert/image.png")); UIButton editbutton = new UIButton(Inter.getLocText("Edit"), BaseUtils.readIcon("/com/fr/design/images/m_insert/image.png"));
editbutton.addActionListener(new ActionListener() { editbutton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
showEditingDialog(); showEditingDialog();
} }
}); });
editbutton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); editbutton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
editbutton.setMargin(null); editbutton.setMargin(null);
editbutton.setOpaque(false); editbutton.setOpaque(false);
return editbutton; return editbutton;
} }
private void showEditingDialog() { private void showEditingDialog() {
final SelectImagePane imageEditorPane = new SelectImagePane(); final SelectImagePane imageEditorPane = new SelectImagePane();
imageEditorPane.populate(cellElement); imageEditorPane.populate(cellElement);
final Object oldValue = cellElement.getValue(); final Object oldValue = cellElement.getValue();
final Style oldStyle = cellElement.getStyle(); final Style oldStyle = cellElement.getStyle();
imageEditorPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { imageEditorPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
CellImage cellImage = imageEditorPane.update(); CellImage cellImage = imageEditorPane.update();
if (!ComparatorUtils.equals(cellImage.getImage(), oldValue) || !ComparatorUtils.equals(cellImage.getStyle(), oldStyle)) { if (!ComparatorUtils.equals(cellImage.getImage(), oldValue) || !ComparatorUtils.equals(cellImage.getStyle(), oldStyle)) {
cellElement.setValue(cellImage.getImage()); cellElement.setValue(cellImage.getImage());
cellElement.setStyle(cellImage.getStyle()); cellElement.setStyle(cellImage.getStyle());
fireTargetModified(); fireTargetModified();
} }
} }
}).setVisible(true); }).setVisible(true);
} }
@Override @Override
protected void refreshDetails() { protected void refreshDetails() {
} }
} }

98
designer/src/com/fr/quickeditor/cellquick/CellRichTextEditor.java

@ -1,50 +1,50 @@
package com.fr.quickeditor.cellquick; package com.fr.quickeditor.cellquick;
import com.fr.design.actions.insert.cell.RichTextCellAction; import com.fr.design.actions.insert.cell.RichTextCellAction;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.quickeditor.CellQuickEditor; import com.fr.quickeditor.CellQuickEditor;
import javax.swing.*; import javax.swing.*;
/** /**
* 单元格元素富文本编辑器 * 单元格元素富文本编辑器
* TODO 9.0 大体上没有改动 * TODO 9.0 大体上没有改动
*/ */
public class CellRichTextEditor extends CellQuickEditor { public class CellRichTextEditor extends CellQuickEditor {
private UIButton subReportButton; private UIButton subReportButton;
private static CellRichTextEditor THIS; private static CellRichTextEditor THIS;
public static final CellRichTextEditor getInstance() { public static final CellRichTextEditor getInstance() {
if (THIS == null) { if (THIS == null) {
THIS = new CellRichTextEditor(); THIS = new CellRichTextEditor();
} }
return THIS; return THIS;
} }
private CellRichTextEditor() { private CellRichTextEditor() {
super(); super();
} }
/** /**
* 创建界面上中间的部分 * 创建界面上中间的部分
* *
* @return 界面元素 * @return 界面元素
* @date 2014-12-7-下午9:41:52 * @date 2014-12-7-下午9:41:52
*/ */
public JComponent createCenterBody() { public JComponent createCenterBody() {
subReportButton = new UIButton(); subReportButton = new UIButton();
subReportButton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); subReportButton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
subReportButton.setMargin(null); subReportButton.setMargin(null);
subReportButton.setOpaque(false); subReportButton.setOpaque(false);
return subReportButton; return subReportButton;
} }
@Override @Override
protected void refreshDetails() { protected void refreshDetails() {
RichTextCellAction subReportCellAction = new RichTextCellAction(tc); RichTextCellAction subReportCellAction = new RichTextCellAction(tc);
subReportCellAction.setName(Inter.getLocText("FR-Designer_RichTextEditor")); subReportCellAction.setName(Inter.getLocText("FR-Designer_RichTextEditor"));
subReportButton.setAction(subReportCellAction); subReportButton.setAction(subReportCellAction);
} }
} }

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

@ -1,155 +1,155 @@
package com.fr.quickeditor.cellquick; package com.fr.quickeditor.cellquick;
import com.fr.base.Formula; 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.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.quickeditor.CellQuickEditor; import com.fr.quickeditor.CellQuickEditor;
import com.fr.report.ReportHelper; import com.fr.report.ReportHelper;
import com.fr.report.cell.DefaultTemplateCellElement; import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.stable.ColumnRow; import com.fr.stable.ColumnRow;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import java.awt.event.KeyAdapter; import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
/** /**
* *
*/ */
public class CellStringQuickEditor extends CellQuickEditor { public class CellStringQuickEditor extends CellQuickEditor {
//instance //instance
private static CellStringQuickEditor THIS; private static CellStringQuickEditor THIS;
//文本域 //文本域
//TODO 9.0 文本域要根据具体文本数量自适应大小,比较难搞,先跳过。 //TODO 9.0 文本域要根据具体文本数量自适应大小,比较难搞,先跳过。
private UITextField stringTextField; private UITextField stringTextField;
//编辑状态 //编辑状态
private boolean isEditing = false; private boolean isEditing = false;
public static CellStringQuickEditor getInstance() { public static CellStringQuickEditor getInstance() {
if (THIS == null) { if (THIS == null) {
THIS = new CellStringQuickEditor(); THIS = new CellStringQuickEditor();
} }
return THIS; return THIS;
} }
//august:如果是原来编辑的是公式,要保留公式里的这些属性,不然在公式和字符串转化时,就会丢失这些属性设置。 //august:如果是原来编辑的是公式,要保留公式里的这些属性,不然在公式和字符串转化时,就会丢失这些属性设置。
private boolean reserveInResult = false; private boolean reserveInResult = false;
private boolean reserveOnWriteOrAnaly = true; private boolean reserveOnWriteOrAnaly = true;
private DocumentListener documentListener = new DocumentListener() { private DocumentListener documentListener = new DocumentListener() {
@Override @Override
public void insertUpdate(DocumentEvent e) { public void insertUpdate(DocumentEvent e) {
changeReportPaneCell(stringTextField.getText().trim()); changeReportPaneCell(stringTextField.getText().trim());
} }
@Override @Override
public void removeUpdate(DocumentEvent e) { public void removeUpdate(DocumentEvent e) {
changeReportPaneCell(stringTextField.getText().trim()); changeReportPaneCell(stringTextField.getText().trim());
} }
@Override @Override
public void changedUpdate(DocumentEvent e) { public void changedUpdate(DocumentEvent e) {
changeReportPaneCell(stringTextField.getText().trim()); changeReportPaneCell(stringTextField.getText().trim());
} }
}; };
private CellStringQuickEditor() { private CellStringQuickEditor() {
super(); super();
} }
/** /**
* 详细信息面板 * 详细信息面板
* todo 文本框可自适应大小公式编辑也是在这边如果是公式那么要加一个公式编辑器的触发按钮 * todo 文本框可自适应大小公式编辑也是在这边如果是公式那么要加一个公式编辑器的触发按钮
*/ */
@Override @Override
public JComponent createCenterBody() { public JComponent createCenterBody() {
stringTextField = new UITextField(); stringTextField = new UITextField();
stringTextField.addKeyListener(new KeyAdapter() { stringTextField.addKeyListener(new KeyAdapter() {
@Override @Override
public void keyReleased(KeyEvent e) { public void keyReleased(KeyEvent e) {
if (tc != null) { if (tc != null) {
tc.getGrid().dispatchEvent(e); tc.getGrid().dispatchEvent(e);
} }
} }
}); });
return stringTextField; return stringTextField;
} }
private void changeReportPaneCell(String tmpText) { private void changeReportPaneCell(String tmpText) {
isEditing = true; isEditing = true;
//refresh一下,如果单元格内有新添加的控件,此时并不知道 //refresh一下,如果单元格内有新添加的控件,此时并不知道
CellSelection cs1 = (CellSelection) tc.getSelection(); CellSelection cs1 = (CellSelection) tc.getSelection();
ColumnRow columnRow = ColumnRow.valueOf(cs1.getColumn(), cs1.getRow()); ColumnRow columnRow = ColumnRow.valueOf(cs1.getColumn(), cs1.getRow());
columnRowTextField.setText(columnRow.toString()); columnRowTextField.setText(columnRow.toString());
cellElement = tc.getEditingElementCase().getTemplateCellElement(cs1.getColumn(), cs1.getRow()); cellElement = tc.getEditingElementCase().getTemplateCellElement(cs1.getColumn(), cs1.getRow());
if (cellElement == null) { if (cellElement == null) {
CellSelection cs = (CellSelection) tc.getSelection(); CellSelection cs = (CellSelection) tc.getSelection();
cellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow()); cellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow());
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); Formula textFormula = new Formula(tmpText);
textFormula.setReserveInResult(reserveInResult); textFormula.setReserveInResult(reserveInResult);
textFormula.setReserveOnWriteOrAnaly(reserveOnWriteOrAnaly); textFormula.setReserveOnWriteOrAnaly(reserveOnWriteOrAnaly);
cellElement.setValue(textFormula); cellElement.setValue(textFormula);
} else { } else {
Style style = cellElement.getStyle(); Style style = cellElement.getStyle();
if (style != null && style.getFormat() != null && style.getFormat() == TextFormat.getInstance()) { if (style != null && style.getFormat() != null && style.getFormat() == TextFormat.getInstance()) {
cellElement.setValue(tmpText); cellElement.setValue(tmpText);
} else { } else {
cellElement.setValue(ReportHelper.convertGeneralStringAccordingToExcel(tmpText)); cellElement.setValue(ReportHelper.convertGeneralStringAccordingToExcel(tmpText));
} }
} }
fireTargetModified(); fireTargetModified();
stringTextField.requestFocus(); stringTextField.requestFocus();
isEditing = false; isEditing = false;
} }
/** /**
* 刷新详细内容 * 刷新详细内容
*/ */
@Override @Override
protected void refreshDetails() { protected void refreshDetails() {
String str; String str;
if (cellElement == null) { if (cellElement == null) {
str = StringUtils.EMPTY; str = StringUtils.EMPTY;
} else { } else {
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 Formula) {
Formula formula = (Formula) value; Formula formula = (Formula) value;
str = formula.getContent(); str = formula.getContent();
reserveInResult = formula.isReserveInResult(); reserveInResult = formula.isReserveInResult();
reserveOnWriteOrAnaly = formula.isReserveOnWriteOrAnaly(); reserveOnWriteOrAnaly = formula.isReserveOnWriteOrAnaly();
} else { } else {
str = value.toString(); str = value.toString();
} }
} }
showText(str); showText(str);
stringTextField.setEditable(tc.isSelectedOneCell()); stringTextField.setEditable(tc.isSelectedOneCell());
} }
/** /**
* 显示文本 * 显示文本
* *
* @param str 文本 * @param str 文本
*/ */
public void showText(String str) { public void showText(String str) {
// 正在编辑时不处理 // 正在编辑时不处理
if (isEditing) { if (isEditing) {
return; return;
} }
stringTextField.getDocument().removeDocumentListener(documentListener); stringTextField.getDocument().removeDocumentListener(documentListener);
stringTextField.setText(str); stringTextField.setText(str);
stringTextField.getDocument().addDocumentListener(documentListener); stringTextField.getDocument().addDocumentListener(documentListener);
} }
} }

88
designer/src/com/fr/quickeditor/cellquick/CellSubReportEditor.java

@ -1,45 +1,45 @@
package com.fr.quickeditor.cellquick; package com.fr.quickeditor.cellquick;
import com.fr.design.actions.insert.cell.SubReportCellAction; import com.fr.design.actions.insert.cell.SubReportCellAction;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.quickeditor.CellQuickEditor; import com.fr.quickeditor.CellQuickEditor;
import javax.swing.*; import javax.swing.*;
/** /**
* 单元格元素子报表编辑器 * 单元格元素子报表编辑器
* TODO 9.0大体上没有改动 * TODO 9.0大体上没有改动
*/ */
public class CellSubReportEditor extends CellQuickEditor { public class CellSubReportEditor extends CellQuickEditor {
private UIButton subReportButton; private UIButton subReportButton;
private static CellSubReportEditor THIS; private static CellSubReportEditor THIS;
public static final CellSubReportEditor getInstance() { public static final CellSubReportEditor getInstance() {
if (THIS == null) { if (THIS == null) {
THIS = new CellSubReportEditor(); THIS = new CellSubReportEditor();
} }
return THIS; return THIS;
} }
private CellSubReportEditor() { private CellSubReportEditor() {
super(); super();
} }
@Override @Override
public JComponent createCenterBody() { public JComponent createCenterBody() {
subReportButton = new UIButton(); subReportButton = new UIButton();
subReportButton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); subReportButton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
subReportButton.setMargin(null); subReportButton.setMargin(null);
subReportButton.setOpaque(false); subReportButton.setOpaque(false);
return subReportButton; return subReportButton;
} }
@Override @Override
protected void refreshDetails() { protected void refreshDetails() {
SubReportCellAction subReportCellAction = new SubReportCellAction(tc); SubReportCellAction subReportCellAction = new SubReportCellAction(tc);
subReportCellAction.setName(Inter.getLocText(new String[]{"Edit", "Sub_Report"})); subReportCellAction.setName(Inter.getLocText(new String[]{"Edit", "Sub_Report"}));
subReportButton.setAction(subReportCellAction); subReportButton.setAction(subReportCellAction);
} }
} }
Loading…
Cancel
Save