Browse Source

REPORT-3348 富文本,图片,斜线,子报表面板修改;公式,文本编辑器拆分

master
yaoh.wu 7 years ago
parent
commit
35ce0a2ad0
  1. 9
      designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java
  2. 4
      designer/src/com/fr/design/module/DesignerModule.java
  3. 2
      designer/src/com/fr/quickeditor/CellQuickEditor.java
  4. 20
      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/CellFormulaQuickEditor.java
  7. 32
      designer/src/com/fr/quickeditor/cellquick/CellImageQuickEditor.java
  8. 36
      designer/src/com/fr/quickeditor/cellquick/CellRichTextEditor.java
  9. 16
      designer/src/com/fr/quickeditor/cellquick/CellStringQuickEditor.java
  10. 20
      designer/src/com/fr/quickeditor/cellquick/CellSubReportEditor.java
  11. 1
      designer_base/src/com/fr/design/locale/designer.properties
  12. 1
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  13. 1
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  14. 1
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  15. 1
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  16. 1
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties

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

@ -132,11 +132,10 @@ public class SelectedDataColumnPane extends BasicPane {
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"));
//todo 国际化
UILabel label2 = new UILabel("param");
UILabel label1 = new UILabel(Inter.getLocText("TableData") + " ");
UILabel label2 = new UILabel(Inter.getLocText("FR-Designer_Dynamic_Parameter"));
UILabel label3 = new UILabel(Inter.getLocText("DataColumn") + " ");
tableNameComboBox.setPreferredSize(new Dimension(163, 20));
Component[][] components = {
{label1, tableNameComboBox},
{label2, paramButton},

4
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);
@ -385,7 +385,7 @@ public class DesignerModule extends DesignModule {
}
public Class<?>[] actionsForInsertCellElement() {
return (Class<?>[])ArrayUtils.addAll(new Class<?>[]{
return (Class<?>[]) ArrayUtils.addAll(new Class<?>[]{
DSColumnCellAction.class,
GeneralCellAction.class,
RichTextCellAction.class,

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

@ -55,7 +55,7 @@ public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
double[] columnSize = {p, f};
double[] rowSize = {p, p};
Component[][] components = new Component[][]{
new Component[]{new UILabel(" " + Inter.getLocText("Cell")), columnRowTextField = initColumnRowTextField()},
new Component[]{new UILabel(Inter.getLocText("Cell") + " "), columnRowTextField = initColumnRowTextField()},
new Component[]{new UILabel(Inter.getLocText("HF-Insert_Content") + " "), cellElementEditButton = initCellElementEditButton()},
};
JPanel topContent = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);

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
}
}

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

@ -217,7 +217,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
groupPane.addListener(groupListener);
double[] rowSize = {P}, columnSize = {P, F};
UILabel uiLabel = new UILabel("filter");
UILabel uiLabel = new UILabel(Inter.getLocText("FR-Designer_Filter_Conditions"));
UIButton uiButton = new UIButton();
if (tc != null) {
//第一次初始化时tc为空,引发NullPointerException
@ -235,12 +235,12 @@ public class CellDSColumnEditor extends CellQuickEditor {
@Override
public String getIconPath() {
return "Basic";
return Inter.getLocText("FR-Designer_Basic");
}
@Override
public String title4PopupWindow() {
return "Basic";
return Inter.getLocText("FR-Designer_Basic");
}
@ -308,12 +308,12 @@ public class CellDSColumnEditor extends CellQuickEditor {
@Override
public String getIconPath() {
return "Advanced";
return Inter.getLocText("FR-Designer_Advanced");
}
@Override
public String title4PopupWindow() {
return "Advanced";
return Inter.getLocText("FR-Designer_Advanced");
}
@ -554,8 +554,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
tinyFormulaPane = new TinyFormulaPane();
centerPane.add(new JPanel(), "none");
centerPane.add(tinyFormulaPane, "content");
//todo 国际化
UILabel sortLabel = new UILabel("排列顺序");
UILabel sortLabel = new UILabel(Inter.getLocText("Sort-Sort_Order"));
sortTypePane.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {

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

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

@ -2105,3 +2105,4 @@ 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

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

@ -2106,3 +2106,4 @@ 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

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

@ -2109,3 +2109,4 @@ 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=\

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

@ -2109,3 +2109,4 @@ 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=\

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

@ -2112,3 +2112,4 @@ 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

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

@ -2109,3 +2109,4 @@ 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

Loading…
Cancel
Save