Browse Source

REPORT-1916 做模板的过程和耗时收集=》修改获取单元格编辑信息的方式

master
plough 8 years ago
parent
commit
f2c3c76e7d
  1. 9
      designer/src/com/fr/aspectj/designer/TemplateProcessTracker.aj
  2. 9
      designer/src/com/fr/grid/Grid.java

9
designer/src/com/fr/aspectj/designer/TemplateProcessTracker.aj

@ -6,6 +6,7 @@ package com.fr.aspectj.designer;
*/ */
import com.fr.design.mainframe.templateinfo.TemplateInfoCollector; import com.fr.design.mainframe.templateinfo.TemplateInfoCollector;
import com.fr.grid.Grid;
import org.aspectj.lang.reflect.SourceLocation; import org.aspectj.lang.reflect.SourceLocation;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -24,8 +25,8 @@ public aspect TemplateProcessTracker {
execution(* actionPerformed(ActionEvent)) && args(e); execution(* actionPerformed(ActionEvent)) && args(e);
pointcut onSetValueAt(Object v, int r, int c) : pointcut onSetValueAt(Object v, int r, int c) :
execution(* setValueAt(java.lang.Object, int, int)) && args(v, r, c); execution(* setValueAt(java.lang.Object, int, int)) && args(v, r, c);
pointcut onSetValue4EditingElement(Object v) : pointcut onSetValue4EditingElement(Grid g, Object v) :
execution(* setValue4EditingElement(java.lang.Object)) && args(v); call(* setValue4EditingElement(java.lang.Object)) && target(g) && args(v);
//before表示之前的意思 //before表示之前的意思
//这整个表示在MouseAdapter的public void mouseXXX(MouseEvent)方法调用之前,你想要执行的代码 //这整个表示在MouseAdapter的public void mouseXXX(MouseEvent)方法调用之前,你想要执行的代码
@ -60,11 +61,11 @@ public aspect TemplateProcessTracker {
} }
//同上 //同上
before(Object v) : onSetValue4EditingElement(v) { before(Grid g, Object v) : onSetValue4EditingElement(g, v) {
SourceLocation sl = thisJoinPoint.getSourceLocation(); SourceLocation sl = thisJoinPoint.getSourceLocation();
// String v = "test"; // String v = "test";
String log = String.format("%s:\n%s\nset value: %s\n\n", new Date(), sl, v); String log = String.format("%s:\n%s\nset value: %s at %s\n\n", new Date(), sl, v, g.getEditingCellElement());
TemplateInfoCollector.appendProcess(log); TemplateInfoCollector.appendProcess(log);
} }

9
designer/src/com/fr/grid/Grid.java

@ -1067,6 +1067,13 @@ public class Grid extends BaseGridComponent {
} }
/**
* @return editingCellElement 的字符串表示
*/
public String getEditingCellElement() {
return editingCellElement.toString();
}
/** /**
* 将新值赋给editingCellElement * 将新值赋给editingCellElement
* *
@ -1074,8 +1081,6 @@ public class Grid extends BaseGridComponent {
* @return true if the value changed * @return true if the value changed
*/ */
private boolean setValue4EditingElement(Object newValue) { private boolean setValue4EditingElement(Object newValue) {
String log = String.format("%s:\nGrid.java\nset value: %s at %s\n\n", new Date(), newValue, editingCellElement);
TemplateInfoCollector.appendProcess(log);
if (newValue instanceof TemplateCellElement) { if (newValue instanceof TemplateCellElement) {
TemplateCellElement cellElement = (TemplateCellElement) newValue; TemplateCellElement cellElement = (TemplateCellElement) newValue;
editingCellElement.setValue(cellElement.getValue()); editingCellElement.setValue(cellElement.getValue());

Loading…
Cancel
Save