Browse Source

Merge pull request #372 in BA/design from ~NEIL/design:dev to dev

* commit 'b793303df7778641b2cc95916efd15c5f3e9dc1c':
  REPORT-465 日期控件的format和单元格样式相互独立, 不要联动设置, 造成困扰.
master
superman 8 years ago
parent
commit
5547102146
  1. 39
      designer/src/com/fr/design/present/CellWriteAttrPane.java

39
designer/src/com/fr/design/present/CellWriteAttrPane.java

@ -1,15 +1,13 @@
package com.fr.design.present;
import com.fr.base.FRContext;
import com.fr.base.Style;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.widget.WidgetPane;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.form.ui.DateEditor;
import com.fr.form.ui.NoneWidget;
import com.fr.form.ui.Widget;
import com.fr.general.FRLogger;
@ -22,8 +20,6 @@ import com.fr.report.cell.TemplateCellElement;
import com.fr.report.elementcase.TemplateElementCase;
import java.awt.*;
import java.text.Format;
import java.text.SimpleDateFormat;
public class CellWriteAttrPane extends BasicPane {
@ -78,22 +74,6 @@ public class CellWriteAttrPane extends BasicPane {
Widget cellWidget = cellElement.getWidget();
if (cellWidget != null && cellWidget instanceof DateEditor) {
// p:日期的格式需要设置到单元格子里面.
DateEditor dateCellEditorDef = (DateEditor) cellWidget;
// p:需要把下拉的编辑器,日期格式,都放到CellElement的Style里面
// 这个地方很方便用户,是alex提出的.
// p:日期的格式需要设置到单元格子里面.
Style style = cellElement.getStyle();
if (style != null) {
Format format = style.getFormat();
if (format != null && format instanceof SimpleDateFormat) {
SimpleDateFormat simpleDateFormat = (SimpleDateFormat) format;
dateCellEditorDef.setFormatText(simpleDateFormat.toPattern());
}
}
}
// 这里进行克隆的原因是为了保留原始的Widget以便和新的Widget做比较来判断是否发生了改变
if (cellWidget != null) {
try {
@ -111,19 +91,6 @@ public class CellWriteAttrPane extends BasicPane {
}
Widget cellWidget = this.cellEditorDefPane.update();
// p:需要把下拉的编辑器,日期格式,都放到CellElement的Style里面
if (cellWidget instanceof DateEditor) {
// p:日期的格式需要设置到单元格子里面.
DateEditor dateCellEditorDef = (DateEditor) cellWidget;
String formatText = dateCellEditorDef.getFormatText();
if (formatText != null) {
Style style = cellElement.getStyle();
if (style != null) {
cellElement.setStyle(style.deriveFormat(new SimpleDateFormat(formatText)));
}
}
}
// p:最后把这个cellEditorDef设置到CellGUIAttr.
if (cellWidget instanceof NoneWidget) {
cellElement.setWidget(null);

Loading…
Cancel
Save