Browse Source

Merge pull request #1046 in BA/design from ~YAOH.WU/design_0407:9.0 to 9.0

* 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
parent
commit
0aba6fe258
  1. 9
      designer/src/com/fr/design/actions/columnrow/DSColumnConditionAction.java
  2. 38
      designer/src/com/fr/design/dscolumn/DSColumnAdvancedEditorPane.java
  3. 84
      designer/src/com/fr/design/dscolumn/DSColumnBasicEditorPane.java
  4. 25
      designer/src/com/fr/design/dscolumn/DSColumnBasicPane.java
  5. 4
      designer/src/com/fr/design/dscolumn/DSColumnPane.java
  6. 56
      designer/src/com/fr/design/dscolumn/ResultSetGroupDockingPane.java
  7. 10
      designer/src/com/fr/design/dscolumn/SelectedConfirmedDataColumnPane.java
  8. 99
      designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java
  9. 4
      designer/src/com/fr/design/mainframe/cell/CellEditorPane.java
  10. 2
      designer/src/com/fr/design/module/DesignerModule.java
  11. 38
      designer/src/com/fr/quickeditor/CellQuickEditor.java
  12. 20
      designer/src/com/fr/quickeditor/cellquick/CellBiasTextPainterEditor.java
  13. 941
      designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java
  14. 152
      designer/src/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java
  15. 32
      designer/src/com/fr/quickeditor/cellquick/CellImageQuickEditor.java
  16. 36
      designer/src/com/fr/quickeditor/cellquick/CellRichTextEditor.java
  17. 16
      designer/src/com/fr/quickeditor/cellquick/CellStringQuickEditor.java
  18. 20
      designer/src/com/fr/quickeditor/cellquick/CellSubReportEditor.java
  19. 2
      designer_base/src/com/fr/design/layout/FRGUIPaneFactory.java
  20. 1
      designer_base/src/com/fr/design/locale/designer.properties
  21. 1
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  22. 1
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  23. 1
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  24. 1
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  25. 1
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties
  26. 4
      designer_base/src/com/fr/design/selection/QuickEditor.java

9
designer/src/com/fr/design/actions/columnrow/DSColumnConditionAction.java

@ -1,19 +1,16 @@
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);

38
designer/src/com/fr/design/dscolumn/DSColumnAdvancedEditorPane.java

@ -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) {
}
}

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

@ -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);
}
}

25
designer/src/com/fr/design/dscolumn/DSColumnBasicPane.java

@ -1,25 +1,23 @@
package com.fr.design.dscolumn;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import com.fr.data.TableDataSource;
import com.fr.design.dialog.BasicPane;
import com.fr.design.expand.ConditionParentPane;
import com.fr.design.expand.ExpandDirectionPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.dialog.BasicPane;
import com.fr.general.Inter;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import com.fr.report.cell.CellElement;
import com.fr.report.cell.TemplateCellElement;
import com.fr.report.cell.cellattr.CellExpandAttr;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class DSColumnBasicPane extends BasicPane {
@ -135,6 +133,7 @@ public class DSColumnBasicPane extends BasicPane {
}
resultSetGroupPane.update();
}
ActionListener summary_direction_ActionListener = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
@ -157,14 +156,16 @@ public class DSColumnBasicPane extends BasicPane {
selectDataColumnPane.update(cellElement);
}
};
public void putElementcase(ElementCasePane t) {
if (conditionParentPane != null) {
conditionParentPane.putElementcase(t);
}
}
public void putCellElement(TemplateCellElement tplEC2) {
public void putCellElement(TemplateCellElement tplCE) {
if (conditionParentPane != null) {
conditionParentPane.putCellElement(tplEC2);
conditionParentPane.putCellElement(tplCE);
}
}
}

4
designer/src/com/fr/design/dscolumn/DSColumnPane.java

@ -148,7 +148,7 @@ public class DSColumnPane extends BasicPane {
basicPane.putElementcase(t);
}
public void putCellElement(TemplateCellElement tplEC2) {
basicPane.putCellElement(tplEC2);
public void putCellElement(TemplateCellElement tplCE) {
basicPane.putCellElement(tplCE);
}
}

56
designer/src/com/fr/design/dscolumn/ResultSetGroupDockingPane.java

@ -1,35 +1,31 @@
package com.fr.design.dscolumn;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.FunctionComboBox;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.Inter;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import com.fr.report.cell.TemplateCellElement;
import com.fr.report.cell.cellattr.CellExpandAttr;
import com.fr.report.cell.cellattr.core.group.CustomGrouper;
import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.report.cell.cellattr.core.group.FunctionGrouper;
import com.fr.report.cell.cellattr.core.group.RecordGrouper;
import com.fr.report.cell.cellattr.core.group.SummaryGrouper;
import com.fr.report.cell.cellattr.core.group.*;
import com.fr.stable.Constants;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
/**
* 这个pane是选中数据列后在上方QuickRegion处显示的pane
*
* @author zhou
* @author zhou, yaoh.wu
* @version 2017年8月2日14点55分
* @since 8.0
*/
public class ResultSetGroupDockingPane extends ResultSetGroupPane {
private static final int BIND_GROUP = 0;
@ -42,7 +38,7 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane {
private CardLayout cardLayout;
private UIComboBox goBox;
ItemListener l;
private ItemListener listener;
public ResultSetGroupDockingPane(ElementCasePane ePane) {
super();
@ -58,15 +54,14 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane {
}
private JPanel layoutPane() {
double vs = 4;
double vg = 6;
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
UILabel dataSetLabel = new UILabel(Inter.getLocText("Data_Setting"));
dataSetLabel.setPreferredSize(new Dimension(60, 20));
Component[][] components = new Component[][]
{
new Component[]{new UILabel(Inter.getLocText("Data_Setting")), goBox},
new Component[]{cardPane, null}
new Component[]{dataSetLabel, goBox},
new Component[]{null, cardPane}
};
goBox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent ee) {
@ -74,10 +69,13 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane {
int i = goBox.getSelectedIndex();
if (i == BIND_GROUP) {
cardLayout.show(cardPane, "groupPane");
cardPane.setPreferredSize(new Dimension(155, 20));
} else if (i == BIND_SELECTED) {
cardLayout.show(cardPane, "listPane");
cardPane.setPreferredSize(new Dimension(0, 0));
} else if (i == BIND_SUMMARY) {
cardLayout.show(cardPane, "summaryPane");
cardPane.setPreferredSize(new Dimension(155, 20));
CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr();
cellExpandAttr.setDirection(Constants.NONE);
}
@ -190,15 +188,15 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane {
}
}
public void addListener(ItemListener l) {
goBox.addItemListener(l);
groupComboBox.addItemListener(l);
functionComboBox.addItemListener(l);
this.l = l;
public void addListener(ItemListener listener) {
goBox.addItemListener(listener);
groupComboBox.addItemListener(listener);
functionComboBox.addItemListener(listener);
this.listener = listener;
}
void fireTargetChanged() {
l.itemStateChanged(null);
listener.itemStateChanged(null);
}
@Override

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

@ -1,16 +1,16 @@
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() {

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

@ -17,6 +17,7 @@ import com.fr.design.gui.itableeditorpane.UITableEditorPane;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.general.Inter;
import com.fr.general.data.TableDataColumn;
import com.fr.report.cell.CellElement;
@ -39,8 +40,8 @@ import java.util.regex.Pattern;
* 数据集列动态参数设置组件
*
* @author yaoh.wu
* @version 2017年7月26
* 9.0设计器更新修改动态参数注入按钮部分,使其显示动态参数按钮时能在右侧边栏正常显示
* @version 2017年8月3
* 复用对话框代码保留对话框原始布局
* @since 8.0
*/
public class SelectedDataColumnPane extends BasicPane {
@ -54,12 +55,21 @@ public class SelectedDataColumnPane extends BasicPane {
private UIButton paramButton;
public SelectedDataColumnPane() {
this(true);
this(true, false, null, null);
}
SelectedDataColumnPane(boolean showParameterButton) {
public SelectedDataColumnPane(boolean showParameterButton) {
this(showParameterButton, false, null, null);
}
public SelectedDataColumnPane(boolean showParameterButton, boolean verticalLayout, ElementCasePane casePane, TemplateCellElement cellElement) {
if (verticalLayout) {
initComponentVerticalLayout(casePane, cellElement);
} else {
initComponent(showParameterButton);
}
}
/**
* 初始化组件
@ -72,33 +82,32 @@ public class SelectedDataColumnPane extends BasicPane {
initWithParameterButton();
}
columnNameComboBox = new LazyComboBox() {
@Override
public Object[] load() {
List<String> l = calculateColumnNameList();
return l.toArray(new String[l.size()]);
}
};
columnNameComboBox.setEditable(true);
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
UILabel label1 = new UILabel(Inter.getLocText("TableData"));
UILabel label3 = new UILabel(Inter.getLocText("DataColumn"));
UILabel dsLabel = new UILabel(Inter.getLocText("TableData") + ":");
UILabel dcLabel = new UILabel(Inter.getLocText("DataColumn") + ":");
if (showParameterButton) {
//todo 国际化
UILabel label2 = new UILabel("param");
Component[][] components = {
{label1, tableNameComboBox},
{label2, paramButton},
{label3, columnNameComboBox}
};
this.setLayout(new BorderLayout());
this.add(TableLayoutHelper.createTableLayoutPane(components, new double[]{p, p, p}, new double[]{p, f}));
dsLabel.setPreferredSize(new Dimension(200, 25));
dcLabel.setPreferredSize(new Dimension(200, 25));
}
if (showParameterButton) {
Component[][] comps = {{dsLabel, null, dcLabel}, {tableNameComboBox, paramButton, columnNameComboBox}};
this.add(TableLayoutHelper.createTableLayoutPane(comps, new double[]{p, p}, new double[]{p, p, p}));
} else {
double f = TableLayout.FILL;
double[] columnSize = {p, f};
double[] rowSize = {p, p};
Component[][] components = new Component[][]{
new Component[]{label1, tableNameComboBox},
new Component[]{label3, columnNameComboBox}
new Component[]{dsLabel, tableNameComboBox},
new Component[]{dcLabel, columnNameComboBox}
};
JPanel jPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout());
@ -107,6 +116,39 @@ public class SelectedDataColumnPane extends BasicPane {
}
/**
* 初始化竖直布局的组件
*/
public void initComponentVerticalLayout(ElementCasePane casePane, TemplateCellElement cellElement) {
initTableNameComboBox();
initWithParameterButton(casePane, cellElement);
columnNameComboBox = new LazyComboBox() {
@Override
public Object[] load() {
List<String> l = calculateColumnNameList();
return l.toArray(new String[l.size()]);
}
};
columnNameComboBox.setEditable(true);
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
UILabel dsLabel = new UILabel(Inter.getLocText("TableData"));
UILabel dpLabel = new UILabel(Inter.getLocText("FR-Designer_Dynamic_Parameter"));
UILabel dcLabel = new UILabel(Inter.getLocText("DataColumn"));
dsLabel.setPreferredSize(new Dimension(60, 20));
dpLabel.setPreferredSize(new Dimension(60, 20));
dcLabel.setPreferredSize(new Dimension(60, 20));
Component[][] components = {
{dsLabel, tableNameComboBox},
{dpLabel, paramButton},
{dcLabel, columnNameComboBox}
};
this.setLayout(new BorderLayout());
this.add(TableLayoutHelper.createTableLayoutPane(components, new double[]{p, p, p}, new double[]{p, f}));
}
public void populate(TableDataSource source, TemplateCellElement cellElement) {
if (cellElement == null) {
return;
@ -237,6 +279,27 @@ public class SelectedDataColumnPane extends BasicPane {
});
}
private void initWithParameterButton(ElementCasePane casePane, TemplateCellElement cellElement) {
SelectedDataColumnPane that = this;
editorPane = new UITableEditorPane<ParameterProvider>(new ParameterTableModel());
paramButton = new UIButton(Inter.getLocText("TableData_Dynamic_Parameter_Setting"));
paramButton.addActionListener(new ActionListener() {
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()]);
that.update(cellElement);
casePane.fireTargetModified();
}
});
editorPane.populate(ps == null ? new Parameter[0] : ps);
paramDialog.setVisible(true);
}
});
}
private boolean isColumnName(String columnExp) {
return StringUtils.isNotBlank(columnExp) && (columnExp.length() > 0 && columnExp.charAt(0) == '#') && !columnExp.endsWith("#");

4
designer/src/com/fr/design/mainframe/cell/CellEditorPane.java

@ -1,7 +1,6 @@
package com.fr.design.mainframe.cell;
import com.fr.design.dialog.BasicPane;
import com.fr.report.cell.TemplateCellElement;
/**
* 右侧单元格元素面板抽象类
@ -24,7 +23,6 @@ public abstract class CellEditorPane extends BasicPane {
/**
* 更新面板数据
*
* @param cellElement 单元格
*/
public abstract void populate(TemplateCellElement cellElement);
public abstract void populate();
}

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

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

38
designer/src/com/fr/quickeditor/CellQuickEditor.java

@ -1,6 +1,5 @@
package com.fr.quickeditor;
import com.fr.base.BaseUtils;
import com.fr.design.actions.utils.DeprecatedActionManager;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
@ -11,6 +10,7 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.selection.QuickEditor;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.grid.selection.CellSelection;
import com.fr.report.cell.TemplateCellElement;
@ -24,31 +24,51 @@ import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
/**
* @author zhou
* @since 2012-7-23下午5:16:53
* @author zhou, yaoh.wu
* @version 2017年8月7日16点54分
* @since 1.0
*/
public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
protected UITextField columnRowTextField;
private UIButton cellElementEditButton;
protected TemplateCellElement cellElement;
public CellQuickEditor() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {p, f};
double[] rowSize = {p, p, p};
double[] rowSize = {p, p};
Component[][] components = new Component[][]{
new Component[]{new UILabel(" " + Inter.getLocText("Cell")), columnRowTextField = initColumnRowTextField()},
new Component[]{new UILabel(Inter.getLocText("HF-Insert_Content") + " "), cellElementEditButton = initCellElementEditButton()},
new Component[]{initTopContent(), null},
new Component[]{createCenterBody(), null}
};
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
this.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
this.add(panel, BorderLayout.CENTER);
}
private JPanel initTopContent() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {p, f};
double[] rowSize = {p, p};
UILabel cellLabel = new UILabel(Inter.getLocText("Cell"));
cellLabel.setPreferredSize(new Dimension(60, 20));
UILabel insertContentLabel = new UILabel(Inter.getLocText("HF-Insert_Content"));
insertContentLabel.setPreferredSize(new Dimension(60, 20));
UIButton cellElementEditButton = initCellElementEditButton();
Component[][] components = new Component[][]{
new Component[]{cellLabel, columnRowTextField = initColumnRowTextField()},
new Component[]{insertContentLabel, cellElementEditButton},
};
JPanel topContent = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
topContent.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15));
return topContent;
}
/**
* 初始化添加按钮
* TODO 9.0 换成下拉菜单后原来的快捷键不好处理先跳过
@ -56,7 +76,7 @@ public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
* @return UIButton
*/
private UIButton initCellElementEditButton() {
final UIButton cellElementEditButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png"));
final UIButton cellElementEditButton = new UIButton(IOUtils.readIcon("/com/fr/design/images/buttonicon/add.png"));
cellElementEditButton.addMouseListener(new MouseAdapter() {
@Override

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

@ -1,39 +1,39 @@
package com.fr.quickeditor.cellquick;
import com.fr.base.BaseUtils;
import com.fr.design.cell.editor.BiasTextPainterCellEditor.BiasTextPainterPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.DesignerContext;
import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.quickeditor.CellQuickEditor;
import com.fr.report.cell.painter.BiasTextPainter;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* 单元格元素斜线编辑器
* TODO 9.0 大体没有改动
*/
public class CellBiasTextPainterEditor extends CellQuickEditor {
@Override
public JComponent createCenterBody() {
UIButton editbutton = new UIButton(Inter.getLocText("Edit"), BaseUtils.readIcon("/com/fr/design/images/m_insert/bias.png"));
editbutton.addActionListener(new ActionListener() {
JPanel content = new JPanel(new BorderLayout());
content.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15));
UIButton editButton = new UIButton(Inter.getLocText("Edit"), IOUtils.readIcon("/com/fr/design/images/m_insert/bias.png"));
editButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
showEditingDialog();
}
});
editbutton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
editbutton.setMargin(null);
editbutton.setOpaque(false);
return editbutton;
editButton.setOpaque(false);
content.add(editButton, BorderLayout.CENTER);
return content;
}
private void showEditingDialog() {
@ -56,8 +56,6 @@ public class CellBiasTextPainterEditor extends CellQuickEditor {
@Override
protected void refreshDetails() {
// TODO Auto-generated method stub
}
}

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

File diff suppressed because it is too large Load Diff

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

@ -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);
}
}

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

@ -1,33 +1,28 @@
package com.fr.quickeditor.cellquick;
import com.fr.base.BaseUtils;
import com.fr.base.Style;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.report.SelectImagePane;
import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.quickeditor.CellQuickEditor;
import com.fr.report.cell.cellattr.CellImage;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* 单元格元素图片编辑器
* TODO 9.0大体上没有改动
*
* @author yaoh.wu
* @version 2017年8月7日10点53分
*/
public class CellImageQuickEditor extends CellQuickEditor {
private static CellImageQuickEditor THIS;
public static final CellImageQuickEditor getInstance() {
if (THIS == null) {
THIS = new CellImageQuickEditor();
}
return THIS;
}
private CellImageQuickEditor() {
super();
@ -35,27 +30,27 @@ public class CellImageQuickEditor extends CellQuickEditor {
@Override
public JComponent createCenterBody() {
UIButton editbutton = new UIButton(Inter.getLocText("Edit"), BaseUtils.readIcon("/com/fr/design/images/m_insert/image.png"));
editbutton.addActionListener(new ActionListener() {
JPanel content = new JPanel(new BorderLayout());
content.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15));
UIButton editButton = new UIButton(Inter.getLocText("Edit"), IOUtils.readIcon("/com/fr/design/images/m_insert/image.png"));
editButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
showEditingDialog();
}
});
editbutton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
editbutton.setMargin(null);
editbutton.setOpaque(false);
return editbutton;
editButton.setOpaque(false);
content.add(editButton, BorderLayout.CENTER);
return content;
}
@SuppressWarnings("Duplicates")
private void showEditingDialog() {
final SelectImagePane imageEditorPane = new SelectImagePane();
imageEditorPane.populate(cellElement);
final Object oldValue = cellElement.getValue();
final Style oldStyle = cellElement.getStyle();
imageEditorPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
CellImage cellImage = imageEditorPane.update();
@ -65,7 +60,6 @@ public class CellImageQuickEditor extends CellQuickEditor {
fireTargetModified();
}
}
}).setVisible(true);
}

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

@ -6,45 +6,37 @@ import com.fr.general.Inter;
import com.fr.quickeditor.CellQuickEditor;
import javax.swing.*;
import java.awt.*;
/**
* 单元格元素富文本编辑器
* TODO 9.0 大体上没有改动
*
* @author yaoh.wu
* @version 2017年8月7日10点53分
*/
public class CellRichTextEditor extends CellQuickEditor {
private UIButton subReportButton;
private static CellRichTextEditor THIS;
public static final CellRichTextEditor getInstance() {
if (THIS == null) {
THIS = new CellRichTextEditor();
}
return THIS;
}
private UIButton richTextButton;
private CellRichTextEditor() {
super();
}
/**
* 创建界面上中间的部分
*
* @return 界面元素
* @date 2014-12-7-下午9:41:52
*/
@SuppressWarnings("Duplicates")
@Override
public JComponent createCenterBody() {
subReportButton = new UIButton();
subReportButton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
subReportButton.setMargin(null);
subReportButton.setOpaque(false);
return subReportButton;
JPanel content = new JPanel(new BorderLayout());
content.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15));
richTextButton = new UIButton();
richTextButton.setOpaque(false);
content.add(richTextButton, BorderLayout.CENTER);
return content;
}
@Override
protected void refreshDetails() {
RichTextCellAction subReportCellAction = new RichTextCellAction(tc);
subReportCellAction.setName(Inter.getLocText("FR-Designer_RichTextEditor"));
subReportButton.setAction(subReportCellAction);
richTextButton.setAction(subReportCellAction);
}
}

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

@ -14,6 +14,7 @@ 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;
@ -21,20 +22,12 @@ import java.awt.event.KeyEvent;
*
*/
public class CellStringQuickEditor extends CellQuickEditor {
//instance
private static CellStringQuickEditor THIS;
//文本域
//TODO 9.0 文本域要根据具体文本数量自适应大小,比较难搞,先跳过。
private UITextField stringTextField;
//编辑状态
private boolean isEditing = false;
public static CellStringQuickEditor getInstance() {
if (THIS == null) {
THIS = new CellStringQuickEditor();
}
return THIS;
}
//august:如果是原来编辑的是公式,要保留公式里的这些属性,不然在公式和字符串转化时,就会丢失这些属性设置。
private boolean reserveInResult = false;
@ -64,10 +57,12 @@ public class CellStringQuickEditor extends CellQuickEditor {
/**
* 详细信息面板
* todo 文本框可自适应大小公式编辑也是在这边如果是公式那么要加一个公式编辑器的触发按钮
* todo 文本框可自适应大小公式编辑新写一个
*/
@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
@ -77,7 +72,8 @@ public class CellStringQuickEditor extends CellQuickEditor {
}
}
});
return stringTextField;
content.add(stringTextField, BorderLayout.CENTER);
return content;
}

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

@ -6,33 +6,31 @@ import com.fr.general.Inter;
import com.fr.quickeditor.CellQuickEditor;
import javax.swing.*;
import java.awt.*;
/**
* 单元格元素子报表编辑器
* TODO 9.0大体上没有改动
*
* @author yaoh.wu
* @version 2017年8月7日10点53分
*/
public class CellSubReportEditor extends CellQuickEditor {
private UIButton subReportButton;
private static CellSubReportEditor THIS;
public static final CellSubReportEditor getInstance() {
if (THIS == null) {
THIS = new CellSubReportEditor();
}
return THIS;
}
private CellSubReportEditor() {
super();
}
@SuppressWarnings("Duplicates")
@Override
public JComponent createCenterBody() {
JPanel content = new JPanel(new BorderLayout());
content.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15));
subReportButton = new UIButton();
subReportButton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
subReportButton.setMargin(null);
subReportButton.setOpaque(false);
return subReportButton;
content.add(subReportButton, BorderLayout.CENTER);
return content;
}
@Override

2
designer_base/src/com/fr/design/layout/FRGUIPaneFactory.java

@ -7,6 +7,7 @@ import javax.swing.*;
import java.awt.*;
public class FRGUIPaneFactory {
private FRGUIPaneFactory() {
}
@ -90,7 +91,6 @@ public class FRGUIPaneFactory {
return new BorderLayout(4, 4);
}
// TODO 删掉
/**
* 创建一个1列的网格布局

1
designer_base/src/com/fr/design/locale/designer.properties

@ -2105,6 +2105,7 @@ FR-Designer_Insert_Text=Insert_Text
FR-Designer_Double=Double
FR-Designer_Add_Event=Add Event
FR-Designer_Not_Support_Authority_Edit=this element does not support authority edit
FR-Designer_Dynamic_Parameter=Dynamic Parameter
FR-Designer_Remove_Item=Remove Item
FR-Designer_Widget_Position=widget Position
FR-Designer_Widget_Field=field

1
designer_base/src/com/fr/design/locale/designer_en_US.properties

@ -2106,6 +2106,7 @@ FR-Designer_Scale_Slider=Scale_Slider
FR-Designer_Scale_Grade=Scale_Grade
FR-Designer_Add_Event=Add Event
FR-Designer_Not_Support_Authority_Edit=this element does not support authority edit
FR-Designer_Dynamic_Parameter=Dynamic Parameter
FR-Designer_Remove_Item=Remove Item
FR-Designer_Widget_No_Repeat=no repeat
FR-Designer_Widget_Error_Tip=error tip

1
designer_base/src/com/fr/design/locale/designer_ja_JP.properties

@ -2109,6 +2109,7 @@ FR-Designer_Use_Params_Template=
FR-Designer_Label_Name=
FR-Designer_Insert_Formula=
FR-Designer_Not_Support_Authority_Edit=\u3053\u306E\u8981\u7D20\u306F\u6A29\u9650\u5236\u5FA1\u3092\u30B5\u30DD\u30FC\u30C8\u3057\u3066\u3044\u307E\u305B\u3093
FR-Designer_Dynamic_Parameter=\
FR-Designer_Remove_Item=
FR-Designer_Widget_No_Repeat=
FR-Designer_Widget_Error_Tip=

1
designer_base/src/com/fr/design/locale/designer_ko_KR.properties

@ -2109,6 +2109,7 @@ FR-Designer_Use_Params_Template=
FR-Designer_Label_Name=
FR-Designer_Add_Event=
FR-Designer_Not_Support_Authority_Edit=\uD574\uB2F9\uC694\uC18C\uB294\uAD8C\uD55C\uCEE8\uD2B8\uB864\uC744\uC9C0\uC6D0\uD558\uC9C0\uC54A\uC2B5\uB2C8\uB2E4.
FR-Designer_Dynamic_Parameter=\
FR-Designer_Remove_Item=
FR-Designer_Widget_No_Repeat=
FR-Designer_Widget_Error_Tip=

1
designer_base/src/com/fr/design/locale/designer_zh_CN.properties

@ -2112,6 +2112,7 @@ FR-Designer_Scale_Up=\u653E\u5927
FR-Designer_Scale_Slider=\u7F29\u653E\u6ED1\u5757
FR-Designer_Scale_Grade=\u7F29\u653E\u7EA7\u522B\uFF0C\u5355\u51FB\u540E\u8C03\u8282\u663E\u793A\u6BD4\u4F8B\u3002
FR-Designer_Not_Support_Authority_Edit=\u8BE5\u5143\u7D20\u4E0D\u652F\u6301\u6743\u9650\u63A7\u5236
FR-Designer_Dynamic_Parameter=\u52A8\u6001\u53C2\u6570
FR-Designer_Remove_Item=\u5220\u9664\u9009\u4E2D
FR-Designer_Widget_Position=\u63A7\u4EF6\u4F4D\u7F6E
FR-Designer_Widget_Field=\u5B57\u6BB5

1
designer_base/src/com/fr/design/locale/designer_zh_TW.properties

@ -2109,6 +2109,7 @@ FR-Designer_Use_Params_Template=
FR-Designer_Label_Name=
FR-Designer_Add_Event=
FR-Designer_Not_Support_Authority_Edit=\u8A72\u5143\u7D20\u4E0D\u652F\u63F4\u8A31\u53EF\u6B0A\u63A7\u5236
FR-Designer_Dynamic_Parameter=\u52D5\u614B\u53C3\u6578
FR-Designer_Remove_Item=
FR-Designer_Widget_No_Repeat=
FR-Designer_Widget_Error_Tip=

4
designer_base/src/com/fr/design/selection/QuickEditor.java

@ -1,9 +1,9 @@
package com.fr.design.selection;
import javax.swing.JComponent;
import com.fr.design.designer.TargetComponent;
import javax.swing.*;
/**
* 快速编辑区域
*

Loading…
Cancel
Save