Browse Source
* commit '9fd84e024d3116a264beecfc30d874be9cd78c9b': 修改数字结尾命名的变量 找回处理冲突过程中丢失的代码 找回处理冲突过程中丢失的代码 REPORT-3348 公式组件边界对其 REPORT-3348 card layout隐藏时不再显示空白面板 回退一些可能冲突的格式化修改 REPORT-3348 国际化,table layout对齐 REPORT-3348 富文本,图片,斜线,子报表面板修改;公式,文本编辑器拆分 REPORT-3348 可扩展性触发保存 REPORT-3348 自定义值公式输入框触发保存 REPORT-3348 结果集筛选 公式输入框触发保存 REPORT-3348 动态参数注入触发保存,高级设置排列顺序触发保存,结果集筛选触发保存 回退修改 REPORT-3348 修改后触发保存 REPORT-3348 重构,不然不能保存 REPORT-3348 复用添加数据列对话框代码,保留原始对话框布局 REPORT-3348 数据列高级设置内部组件调整 REPORT-3348 单元格元素数据列高级设置master
superman
7 years ago
26 changed files with 1365 additions and 491 deletions
@ -1,36 +1,33 @@
|
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.data.DesignTableDataManager; |
||||
import com.fr.design.actions.cell.AbstractCellElementAction; |
||||
import com.fr.design.dscolumn.DSColumnConditionsPane; |
||||
import com.fr.design.data.DesignTableDataManager; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.dscolumn.DSColumnConditionsPane; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.general.Inter; |
||||
import com.fr.report.cell.TemplateCellElement; |
||||
|
||||
public class DSColumnConditionAction extends AbstractCellElementAction { |
||||
|
||||
private boolean returnValue = false; |
||||
private TemplateCellElement editCellElement; |
||||
|
||||
public DSColumnConditionAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("Filter")); |
||||
this.setMnemonic('E'); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/expand/cellAttr.gif")); |
||||
} |
||||
|
||||
@Override |
||||
protected BasicPane populateBasicPane(TemplateCellElement cellElement) { |
||||
protected BasicPane populateBasicPane(TemplateCellElement cellElement) { |
||||
DSColumnConditionsPane dSColumnConditionsPane = new DSColumnConditionsPane(); |
||||
dSColumnConditionsPane.populate(DesignTableDataManager.getEditingTableDataSource(), cellElement); |
||||
return dSColumnConditionsPane; |
||||
} |
||||
|
||||
@Override |
||||
protected void updateBasicPane(BasicPane bp, TemplateCellElement cellElement) { |
||||
protected void updateBasicPane(BasicPane bp, TemplateCellElement cellElement) { |
||||
((DSColumnConditionsPane) bp).update(cellElement); |
||||
} |
||||
} |
@ -1,38 +0,0 @@
|
||||
package com.fr.design.dscolumn; |
||||
|
||||
import com.fr.design.mainframe.cell.CellEditorPane; |
||||
import com.fr.report.cell.TemplateCellElement; |
||||
|
||||
|
||||
/** |
||||
* 单元格元素 数据列 基本设置内容面板 |
||||
* |
||||
* @author yaoh.wu |
||||
* @version 2017年7月25日 |
||||
* @since 9.0 |
||||
*/ |
||||
public class DSColumnAdvancedEditorPane extends CellEditorPane { |
||||
|
||||
|
||||
@Override |
||||
public String getIconPath() { |
||||
return "Advanced"; |
||||
} |
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return "Advanced"; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void update() { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void populate(TemplateCellElement cellElement) { |
||||
|
||||
} |
||||
|
||||
} |
@ -1,84 +0,0 @@
|
||||
package com.fr.design.dscolumn; |
||||
|
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.mainframe.cell.CellEditorPane; |
||||
import com.fr.report.cell.TemplateCellElement; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* 单元格元素 数据列 高级设置内容面板 |
||||
* |
||||
* @author yaoh.wu |
||||
* @version 2017年7月25日 |
||||
* @since 9.0 |
||||
*/ |
||||
public class DSColumnBasicEditorPane extends CellEditorPane { |
||||
|
||||
//数据集和数据列
|
||||
private SelectedDataColumnPane dataPane; |
||||
//数据分组设置
|
||||
private ResultSetGroupDockingPane groupPane; |
||||
//当前编辑的单元格
|
||||
private TemplateCellElement cellElement; |
||||
//条件过滤按钮面板
|
||||
private JPanel conditionPane; |
||||
|
||||
public DSColumnBasicEditorPane(TemplateCellElement cellElement, SelectedDataColumnPane dataPane, ResultSetGroupDockingPane groupPane, JPanel conditionPane) { |
||||
this.setLayout(new BorderLayout()); |
||||
this.cellElement = cellElement; |
||||
this.dataPane = dataPane; |
||||
this.groupPane = groupPane; |
||||
this.conditionPane = conditionPane; |
||||
this.add(this.createContentPane(), BorderLayout.CENTER); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public String getIconPath() { |
||||
return "Basic"; |
||||
} |
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return "Basic"; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void update() { |
||||
dataPane.update(this.cellElement); |
||||
groupPane.update(); |
||||
} |
||||
|
||||
@Override |
||||
public void populate(TemplateCellElement cellElement) { |
||||
this.cellElement = cellElement; |
||||
dataPane.populate(null, cellElement); |
||||
groupPane.populate(cellElement); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 创建有内容的面板显示信息 |
||||
* |
||||
* @return content JPanel |
||||
*/ |
||||
private JPanel createContentPane() { |
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
double[] columnSize = {f}; |
||||
double[] rowSize = {p, p, p}; |
||||
Component[][] components = new Component[][]{ |
||||
//数据集列选择
|
||||
new Component[]{this.dataPane}, |
||||
//数据分组设置
|
||||
new Component[]{this.groupPane}, |
||||
//条件过滤
|
||||
new Component[]{this.conditionPane} |
||||
}; |
||||
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
||||
} |
||||
} |
@ -1,45 +1,45 @@
|
||||
package com.fr.design.dscolumn; |
||||
|
||||
import java.awt.Dimension; |
||||
import java.awt.event.ItemEvent; |
||||
import java.awt.event.ItemListener; |
||||
import java.util.Iterator; |
||||
|
||||
import com.fr.data.TableDataSource; |
||||
import com.fr.design.data.datapane.TableDataComboBox; |
||||
import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper; |
||||
import com.fr.main.impl.WorkBook; |
||||
import com.fr.report.cell.TemplateCellElement; |
||||
|
||||
import java.awt.*; |
||||
import java.awt.event.ItemEvent; |
||||
import java.awt.event.ItemListener; |
||||
import java.util.Iterator; |
||||
|
||||
public class SelectedConfirmedDataColumnPane extends SelectedDataColumnPane { |
||||
|
||||
public SelectedConfirmedDataColumnPane () { |
||||
super(false); |
||||
} |
||||
|
||||
protected void initTableNameComboBox() { |
||||
tableNameComboBox = new TableDataComboBox(new WorkBook()); |
||||
tableNameComboBox.addItemListener(new ItemListener() { |
||||
@Override |
||||
public void itemStateChanged(ItemEvent e) { |
||||
columnNameComboBox.setLoaded(false); |
||||
} |
||||
}); |
||||
tableNameComboBox.setPreferredSize(new Dimension(100, 20)); |
||||
} |
||||
|
||||
public void populate(TableDataSource source, TemplateCellElement cell) { |
||||
tableNameComboBox.refresh(source); |
||||
tableNameComboBox.setEditable(false); |
||||
tableNameComboBox.setEnabled(false); |
||||
super.populate(source, cell); |
||||
try { |
||||
Iterator it = source.getTableDataNameIterator(); |
||||
String name = (String)it.next(); |
||||
TemplateTableDataWrapper wrapper = new TemplateTableDataWrapper(source.getTableData(name), name); |
||||
tableNameComboBox.setSelectedItem(wrapper); |
||||
tableNameComboBox.getModel().setSelectedItem(wrapper); |
||||
} catch (Exception e) { |
||||
} |
||||
} |
||||
public SelectedConfirmedDataColumnPane() { |
||||
super(false); |
||||
} |
||||
|
||||
protected void initTableNameComboBox() { |
||||
tableNameComboBox = new TableDataComboBox(new WorkBook()); |
||||
tableNameComboBox.addItemListener(new ItemListener() { |
||||
@Override |
||||
public void itemStateChanged(ItemEvent e) { |
||||
columnNameComboBox.setLoaded(false); |
||||
} |
||||
}); |
||||
tableNameComboBox.setPreferredSize(new Dimension(100, 20)); |
||||
} |
||||
|
||||
public void populate(TableDataSource source, TemplateCellElement cell) { |
||||
tableNameComboBox.refresh(source); |
||||
tableNameComboBox.setEditable(false); |
||||
tableNameComboBox.setEnabled(false); |
||||
super.populate(source, cell); |
||||
try { |
||||
Iterator it = source.getTableDataNameIterator(); |
||||
String name = (String) it.next(); |
||||
TemplateTableDataWrapper wrapper = new TemplateTableDataWrapper(source.getTableData(name), name); |
||||
tableNameComboBox.setSelectedItem(wrapper); |
||||
tableNameComboBox.getModel().setSelectedItem(wrapper); |
||||
} catch (Exception e) { |
||||
} |
||||
} |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,152 @@
|
||||
package com.fr.quickeditor.cellquick; |
||||
|
||||
import com.fr.base.Formula; |
||||
import com.fr.base.Style; |
||||
import com.fr.base.TextFormat; |
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.quickeditor.CellQuickEditor; |
||||
import com.fr.report.ReportHelper; |
||||
import com.fr.report.cell.DefaultTemplateCellElement; |
||||
import com.fr.stable.ColumnRow; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.event.DocumentEvent; |
||||
import javax.swing.event.DocumentListener; |
||||
import java.awt.*; |
||||
import java.awt.event.KeyAdapter; |
||||
import java.awt.event.KeyEvent; |
||||
|
||||
/** |
||||
* 公式快速编辑面板,同文本数字编辑拆分 |
||||
* |
||||
* @author yaoh.wu |
||||
* @version 2017年8月7日10点44分 |
||||
* @since 9.0 |
||||
*/ |
||||
public class CellFormulaQuickEditor extends CellQuickEditor { |
||||
//文本域
|
||||
private UITextField stringTextField; |
||||
//编辑状态
|
||||
private boolean isEditing = false; |
||||
|
||||
//编辑的是公式,要保留公式里的这些属性,不然在公式和字符串转化时,就会丢失这些属性设置。
|
||||
private boolean reserveInResult = false; |
||||
private boolean reserveOnWriteOrAnaly = true; |
||||
|
||||
private DocumentListener documentListener = new DocumentListener() { |
||||
@Override |
||||
public void insertUpdate(DocumentEvent e) { |
||||
changeReportPaneCell(stringTextField.getText().trim()); |
||||
} |
||||
|
||||
@Override |
||||
public void removeUpdate(DocumentEvent e) { |
||||
changeReportPaneCell(stringTextField.getText().trim()); |
||||
} |
||||
|
||||
@Override |
||||
public void changedUpdate(DocumentEvent e) { |
||||
changeReportPaneCell(stringTextField.getText().trim()); |
||||
} |
||||
|
||||
}; |
||||
|
||||
private CellFormulaQuickEditor() { |
||||
super(); |
||||
} |
||||
|
||||
/** |
||||
* 详细信息面板 |
||||
*/ |
||||
@Override |
||||
public JComponent createCenterBody() { |
||||
JPanel content = new JPanel(new BorderLayout()); |
||||
content.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15)); |
||||
stringTextField = new UITextField(); |
||||
stringTextField.addKeyListener(new KeyAdapter() { |
||||
@Override |
||||
public void keyReleased(KeyEvent e) { |
||||
if (tc != null) { |
||||
tc.getGrid().dispatchEvent(e); |
||||
} |
||||
} |
||||
}); |
||||
content.add(stringTextField, BorderLayout.CENTER); |
||||
return content; |
||||
} |
||||
|
||||
|
||||
private void changeReportPaneCell(String tmpText) { |
||||
isEditing = true; |
||||
//refresh一下,如果单元格内有新添加的控件,此时并不知道
|
||||
CellSelection cs1 = (CellSelection) tc.getSelection(); |
||||
ColumnRow columnRow = ColumnRow.valueOf(cs1.getColumn(), cs1.getRow()); |
||||
columnRowTextField.setText(columnRow.toString()); |
||||
cellElement = tc.getEditingElementCase().getTemplateCellElement(cs1.getColumn(), cs1.getRow()); |
||||
|
||||
if (cellElement == null) { |
||||
CellSelection cs = (CellSelection) tc.getSelection(); |
||||
cellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow()); |
||||
tc.getEditingElementCase().addCellElement(cellElement, false); |
||||
} |
||||
if (tmpText != null && (tmpText.length() > 0 && tmpText.charAt(0) == '=')) { |
||||
Formula textFormula = new Formula(tmpText); |
||||
textFormula.setReserveInResult(reserveInResult); |
||||
textFormula.setReserveOnWriteOrAnaly(reserveOnWriteOrAnaly); |
||||
cellElement.setValue(textFormula); |
||||
} else { |
||||
Style style = cellElement.getStyle(); |
||||
if (style != null && style.getFormat() != null && style.getFormat() == TextFormat.getInstance()) { |
||||
cellElement.setValue(tmpText); |
||||
} else { |
||||
cellElement.setValue(ReportHelper.convertGeneralStringAccordingToExcel(tmpText)); |
||||
} |
||||
} |
||||
fireTargetModified(); |
||||
stringTextField.requestFocus(); |
||||
isEditing = false; |
||||
} |
||||
|
||||
/** |
||||
* 刷新详细内容 |
||||
*/ |
||||
@Override |
||||
protected void refreshDetails() { |
||||
String str; |
||||
if (cellElement == null) { |
||||
str = StringUtils.EMPTY; |
||||
} else { |
||||
Object value = cellElement.getValue(); |
||||
if (value == null) { |
||||
str = StringUtils.EMPTY; |
||||
} else if (value instanceof Formula) { |
||||
Formula formula = (Formula) value; |
||||
str = formula.getContent(); |
||||
reserveInResult = formula.isReserveInResult(); |
||||
reserveOnWriteOrAnaly = formula.isReserveOnWriteOrAnaly(); |
||||
} else { |
||||
str = value.toString(); |
||||
} |
||||
} |
||||
showText(str); |
||||
stringTextField.setEditable(tc.isSelectedOneCell()); |
||||
} |
||||
|
||||
/** |
||||
* 显示文本 |
||||
* |
||||
* @param str 文本 |
||||
*/ |
||||
public void showText(String str) { |
||||
// 正在编辑时不处理
|
||||
if (isEditing) { |
||||
return; |
||||
} |
||||
stringTextField.getDocument().removeDocumentListener(documentListener); |
||||
stringTextField.setText(str); |
||||
stringTextField.getDocument().addDocumentListener(documentListener); |
||||
} |
||||
|
||||
} |
@ -1,61 +1,61 @@
|
||||
package com.fr.design.selection; |
||||
|
||||
import javax.swing.JComponent; |
||||
|
||||
import com.fr.design.designer.TargetComponent; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
/** |
||||
* 快速编辑区域 |
||||
* |
||||
* |
||||
* @author zhou |
||||
* @since 2012-7-12下午2:48:20 |
||||
*/ |
||||
@SuppressWarnings("rawtypes") |
||||
public abstract class QuickEditor<T extends TargetComponent> extends JComponent { |
||||
private static final long serialVersionUID = 5434472104640676832L; |
||||
private static final long serialVersionUID = 5434472104640676832L; |
||||
|
||||
protected T tc; |
||||
protected T tc; |
||||
|
||||
protected boolean isEditing = false; |
||||
protected boolean isEditing = false; |
||||
|
||||
public QuickEditor() { |
||||
public QuickEditor() { |
||||
|
||||
} |
||||
} |
||||
|
||||
public void populate(T tc) { |
||||
isEditing = false; |
||||
this.tc = tc; |
||||
refresh(); |
||||
isEditing = true; |
||||
} |
||||
public void populate(T tc) { |
||||
isEditing = false; |
||||
this.tc = tc; |
||||
refresh(); |
||||
isEditing = true; |
||||
} |
||||
|
||||
/** |
||||
* 触发保存一定要用这个 |
||||
*/ |
||||
protected void fireTargetModified() { |
||||
if(!isEditing) { |
||||
return; |
||||
} |
||||
tc.fireTargetModified(); |
||||
} |
||||
/** |
||||
* 触发保存一定要用这个 |
||||
*/ |
||||
protected void fireTargetModified() { |
||||
if (!isEditing) { |
||||
return; |
||||
} |
||||
tc.fireTargetModified(); |
||||
} |
||||
|
||||
protected abstract void refresh(); |
||||
protected abstract void refresh(); |
||||
|
||||
|
||||
/** |
||||
* for 关闭时候释放 |
||||
*/ |
||||
public void release () { |
||||
tc = null; |
||||
} |
||||
/** |
||||
* for 关闭时候释放 |
||||
*/ |
||||
public void release() { |
||||
tc = null; |
||||
} |
||||
|
||||
public static QuickEditor DEFAULT_EDITOR = new QuickEditor() { |
||||
public static QuickEditor DEFAULT_EDITOR = new QuickEditor() { |
||||
|
||||
@Override |
||||
protected void refresh() { |
||||
@Override |
||||
protected void refresh() { |
||||
|
||||
} |
||||
} |
||||
|
||||
}; |
||||
}; |
||||
|
||||
} |
Loading…
Reference in new issue